author | coleenp |
Thu, 27 Jun 2019 11:40:18 -0400 | |
changeset 55513 | be05771cdfdf |
parent 54120 | 677cede5608e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49621
diff
changeset
|
2 |
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49621
diff
changeset
|
25 |
#ifndef SHARE_CI_CIOBJECT_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49621
diff
changeset
|
26 |
#define SHARE_CI_CIOBJECT_HPP |
7397 | 27 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
28 |
#include "ci/ciBaseObject.hpp" |
7397 | 29 |
#include "ci/ciClassList.hpp" |
30 |
#include "runtime/handles.hpp" |
|
31 |
#include "runtime/jniHandles.hpp" |
|
32 |
||
1 | 33 |
// ciObject |
34 |
// |
|
35 |
// This class represents an oop in the HotSpot virtual machine. |
|
36 |
// Its subclasses are structured in a hierarchy which mirrors |
|
37 |
// an aggregate of the VM's oop and klass hierarchies (see |
|
38 |
// oopHierarchy.hpp). Each instance of ciObject holds a handle |
|
39 |
// to a corresponding oop on the VM side and provides routines |
|
40 |
// for accessing the information in its oop. By using the ciObject |
|
41 |
// hierarchy for accessing oops in the VM, the compiler ensures |
|
42 |
// that it is safe with respect to garbage collection; that is, |
|
43 |
// GC and compilation can proceed independently without |
|
44 |
// interference. |
|
45 |
// |
|
46 |
// Within the VM, the oop and klass hierarchies are separate. |
|
47 |
// The compiler interface does not preserve this separation -- |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
48 |
// the distinction between `Klass*' and `Klass' are not |
1 | 49 |
// reflected in the interface and instead the Klass hierarchy |
50 |
// is directly modeled as the subclasses of ciKlass. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
51 |
class ciObject : public ciBaseObject { |
1 | 52 |
CI_PACKAGE_ACCESS |
53 |
friend class ciEnv; |
|
54 |
||
55 |
private: |
|
56 |
// A JNI handle referring to an oop in the VM. This |
|
57 |
// handle may, in a small set of cases, correctly be NULL. |
|
58 |
jobject _handle; |
|
59 |
ciKlass* _klass; |
|
60 |
||
61 |
protected: |
|
62 |
ciObject(); |
|
63 |
ciObject(oop o); |
|
64 |
ciObject(Handle h); |
|
65 |
ciObject(ciKlass* klass); |
|
66 |
||
67 |
jobject handle() const { return _handle; } |
|
68 |
// Get the VM oop that this object holds. |
|
49192
6734eeef4283
8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
kbarrett
parents:
47216
diff
changeset
|
69 |
oop get_oop() const; |
1 | 70 |
|
71 |
// Virtual behavior of the print() method. |
|
72 |
virtual void print_impl(outputStream* st) {} |
|
73 |
||
74 |
virtual const char* type_string() { return "ciObject"; } |
|
75 |
||
76 |
public: |
|
77 |
// The klass of this ciObject. |
|
78 |
ciKlass* klass(); |
|
79 |
||
80 |
// Are two ciObjects equal? |
|
81 |
bool equals(ciObject* obj); |
|
82 |
||
83 |
// A hash value for the convenience of compilers. |
|
84 |
int hash(); |
|
85 |
||
3908 | 86 |
// Tells if this oop should be made a constant. |
87 |
bool should_be_constant(); |
|
1 | 88 |
|
89 |
// The address which the compiler should embed into the |
|
90 |
// generated code to represent this oop. This address |
|
91 |
// is not the true address of the oop -- it will get patched |
|
92 |
// during nmethod creation. |
|
93 |
// |
|
94 |
// Usage note: no address arithmetic allowed. Oop must |
|
95 |
// be registered with the oopRecorder. |
|
3908 | 96 |
jobject constant_encoding(); |
1 | 97 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
98 |
virtual bool is_object() const { return true; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
99 |
|
1 | 100 |
// What kind of ciObject is this? |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
101 |
virtual bool is_null_object() const { return false; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
102 |
virtual bool is_call_site() const { return false; } |
1 | 103 |
virtual bool is_instance() { return false; } |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
104 |
virtual bool is_member_name() const { return false; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
105 |
virtual bool is_method_handle() const { return false; } |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
106 |
virtual bool is_method_type() const { return false; } |
1 | 107 |
virtual bool is_array() { return false; } |
108 |
virtual bool is_obj_array() { return false; } |
|
109 |
virtual bool is_type_array() { return false; } |
|
110 |
||
111 |
// Is this a type or value which has no associated class? |
|
112 |
// It is true of primitive types and null objects. |
|
113 |
virtual bool is_classless() const { return false; } |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13929
diff
changeset
|
114 |
virtual void dump_replay_data(outputStream* st) { /* do nothing */ } |
1 | 115 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
116 |
// Note: some ciObjects refer to oops which have yet to be created. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
117 |
// We refer to these as "unloaded". Specifically, there are |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
118 |
// unloaded instances of java.lang.Class, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
119 |
// java.lang.invoke.MethodHandle, and java.lang.invoke.MethodType. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
120 |
// By convention the ciNullObject is considered loaded, and |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
121 |
// primitive types are considered loaded. |
1 | 122 |
bool is_loaded() const { |
123 |
return handle() != NULL || is_classless(); |
|
124 |
} |
|
125 |
||
126 |
// Subclass casting with assertions. |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
127 |
ciNullObject* as_null_object() { |
1 | 128 |
assert(is_null_object(), "bad cast"); |
129 |
return (ciNullObject*)this; |
|
130 |
} |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
131 |
ciCallSite* as_call_site() { |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
132 |
assert(is_call_site(), "bad cast"); |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
133 |
return (ciCallSite*)this; |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
134 |
} |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
135 |
ciInstance* as_instance() { |
1 | 136 |
assert(is_instance(), "bad cast"); |
137 |
return (ciInstance*)this; |
|
138 |
} |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
139 |
ciMemberName* as_member_name() { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
140 |
assert(is_member_name(), "bad cast"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
141 |
return (ciMemberName*)this; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
142 |
} |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
143 |
ciMethodHandle* as_method_handle() { |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
144 |
assert(is_method_handle(), "bad cast"); |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
145 |
return (ciMethodHandle*)this; |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
146 |
} |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
147 |
ciMethodType* as_method_type() { |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
148 |
assert(is_method_type(), "bad cast"); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
149 |
return (ciMethodType*)this; |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
150 |
} |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
151 |
ciArray* as_array() { |
1 | 152 |
assert(is_array(), "bad cast"); |
153 |
return (ciArray*)this; |
|
154 |
} |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
155 |
ciObjArray* as_obj_array() { |
1 | 156 |
assert(is_obj_array(), "bad cast"); |
157 |
return (ciObjArray*)this; |
|
158 |
} |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
159 |
ciTypeArray* as_type_array() { |
1 | 160 |
assert(is_type_array(), "bad cast"); |
161 |
return (ciTypeArray*)this; |
|
162 |
} |
|
163 |
||
164 |
// Print debugging output about this ciObject. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
165 |
void print(outputStream* st); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
9959
diff
changeset
|
166 |
void print() { print(tty); } // GDB cannot handle default arguments |
1 | 167 |
|
168 |
// Print debugging output about the oop this ciObject represents. |
|
169 |
void print_oop(outputStream* st = tty); |
|
170 |
}; |
|
7397 | 171 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49621
diff
changeset
|
172 |
#endif // SHARE_CI_CIOBJECT_HPP |