Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/ci/ciBaseObject.hpp
40930 views
1
/*
2
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_CI_CIBASEOBJECT_HPP
26
#define SHARE_CI_CIBASEOBJECT_HPP
27
28
#include "ci/ciClassList.hpp"
29
#include "memory/allocation.hpp"
30
31
// ciBaseObject
32
//
33
// This class represents an oop in the HotSpot virtual machine.
34
// Its subclasses are structured in a hierarchy which mirrors
35
// an aggregate of the VM's oop and klass hierarchies (see
36
// oopHierarchy.hpp). Each instance of ciBaseObject holds a handle
37
// to a corresponding oop on the VM side and provides routines
38
// for accessing the information in its oop. By using the ciBaseObject
39
// hierarchy for accessing oops in the VM, the compiler ensures
40
// that it is safe with respect to garbage collection; that is,
41
// GC and compilation can proceed independently without
42
// interference.
43
//
44
// Within the VM, the oop and klass hierarchies are separate.
45
// The compiler interface does not preserve this separation --
46
// the distinction between `Klass*' and `Klass' are not
47
// reflected in the interface and instead the Klass hierarchy
48
// is directly modeled as the subclasses of ciKlass.
49
class ciBaseObject : public ResourceObj {
50
CI_PACKAGE_ACCESS
51
friend class ciEnv;
52
53
protected:
54
uint _ident;
55
56
protected:
57
ciBaseObject(): _ident(0) {}
58
59
virtual const char* type_string() { return "ciBaseObject"; }
60
61
void set_ident(uint id);
62
63
public:
64
// A number unique to this object.
65
uint ident();
66
67
// What kind of ciBaseObject is this?
68
virtual bool is_symbol() const { return false; }
69
virtual bool is_object() const { return false; }
70
virtual bool is_metadata() const { return false; }
71
72
ciSymbol* as_symbol() {
73
assert(is_symbol(), "must be");
74
return (ciSymbol*)this;
75
}
76
ciObject* as_object() {
77
assert(is_object(), "must be");
78
return (ciObject*)this;
79
}
80
ciMetadata* as_metadata() {
81
assert(is_metadata(), "must be");
82
return (ciMetadata*)this;
83
}
84
};
85
#endif // SHARE_CI_CIBASEOBJECT_HPP
86
87