author | herrick |
Wed, 27 Mar 2019 08:27:58 -0400 | |
branch | JDK-8200758-branch |
changeset 57288 | 0be43184f52a |
parent 51467 | 12997ebbc0d8 |
child 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
50409
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
33160 | 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 |
#include "precompiled.hpp" |
|
50409
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
25 |
#include "classfile/symbolTable.hpp" |
33160 | 26 |
#include "jvmci/jvmciJavaClasses.hpp" |
27 |
#include "memory/resourceArea.hpp" |
|
50409
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
28 |
#include "oops/oop.inline.hpp" |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
29 |
#include "runtime/jniHandles.inline.hpp" |
51467
12997ebbc0d8
8209647: constantPoolHandle::constantPoolHandle(ConstantPool*) when precompiled header is disabled
iklam
parents:
50409
diff
changeset
|
30 |
#include "runtime/fieldDescriptor.inline.hpp" |
50409
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
31 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
32 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
33 |
// This macro expands for non-inline functions, in class declarations. |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
34 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
35 |
#define START_CLASS(name) \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
36 |
void name::check(oop obj, const char* field_name, int offset) { \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
37 |
assert(obj != NULL, "NULL field access of %s.%s", #name, field_name); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
38 |
assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name()); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
39 |
assert(offset != 0, "must be valid offset"); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
40 |
} |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
41 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
42 |
#define END_CLASS |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
43 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
44 |
#define FIELD(klass, name, type, accessor, cast) \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
45 |
type klass::name(jobject obj) { check(JNIHandles::resolve(obj), #name, _##name##_offset); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
46 |
void klass::set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name, _##name##_offset); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
47 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
48 |
#define EMPTY_CAST |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
49 |
#define CHAR_FIELD(klass, name) FIELD(klass, name, jchar, char_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
50 |
#define INT_FIELD(klass, name) FIELD(klass, name, jint, int_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
51 |
#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, jboolean, bool_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
52 |
#define LONG_FIELD(klass, name) FIELD(klass, name, jlong, long_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
53 |
#define FLOAT_FIELD(klass, name) FIELD(klass, name, jfloat, float_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
54 |
#define OOP_FIELD(klass, name, signature) FIELD(klass, name, oop, obj_field, EMPTY_CAST) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
55 |
#define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(klass, name, objArrayOop, obj_field, (objArrayOop)) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
56 |
#define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(klass, name, typeArrayOop, obj_field, (typeArrayOop)) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
57 |
#define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
58 |
#define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
59 |
#define STATIC_OOPISH_FIELD(klassName, name, type, signature) \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
60 |
type klassName::name() { \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
61 |
assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
62 |
InstanceKlass* ik = klassName::klass(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
63 |
oop base = ik->static_field_base_raw(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
64 |
oop result = HeapAccess<>::oop_load_at(base, _##name##_offset); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
65 |
return type(result); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
66 |
} \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
67 |
void klassName::set_##name(type x) { \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
68 |
assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
69 |
assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
70 |
InstanceKlass* ik = klassName::klass(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
71 |
oop base = ik->static_field_base_raw(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
72 |
HeapAccess<>::oop_store_at(base, _##name##_offset, x); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
73 |
} |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
74 |
#define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename) \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
75 |
jtypename klassName::name() { \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
76 |
assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
77 |
InstanceKlass* ik = klassName::klass(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
78 |
oop base = ik->static_field_base_raw(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
79 |
return HeapAccess<>::load_at(base, _##name##_offset); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
80 |
} \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
81 |
void klassName::set_##name(jtypename x) { \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
82 |
assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
83 |
InstanceKlass* ik = klassName::klass(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
84 |
oop base = ik->static_field_base_raw(); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
85 |
HeapAccess<>::store_at(base, _##name##_offset, x); \ |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
86 |
} |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
87 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
88 |
#define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
89 |
#define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
90 |
|
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
91 |
COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, TYPEARRAYOOP_FIELD, OBJARRAYOOP_FIELD, STATIC_OOP_FIELD, STATIC_OBJARRAYOOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD) |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
92 |
#undef START_CLASS |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
93 |
#undef END_CLASS |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
94 |
#undef FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
95 |
#undef CHAR_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
96 |
#undef INT_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
97 |
#undef BOOLEAN_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
98 |
#undef LONG_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
99 |
#undef FLOAT_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
100 |
#undef OOP_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
101 |
#undef TYPEARRAYOOP_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
102 |
#undef OBJARRAYOOP_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
103 |
#undef STATIC_OOPISH_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
104 |
#undef STATIC_OOP_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
105 |
#undef STATIC_OBJARRAYOOP_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
106 |
#undef STATIC_INT_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
107 |
#undef STATIC_BOOLEAN_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
108 |
#undef STATIC_PRIMITIVE_FIELD |
76bca6678913
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
coleenp
parents:
47216
diff
changeset
|
109 |
#undef EMPTY_CAST |
33160 | 110 |
|
111 |
// This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field. |
|
112 |
// It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded. |
|
113 |
||
34192
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
114 |
void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field, TRAPS) { |
33160 | 115 |
InstanceKlass* ik = InstanceKlass::cast(klass); |
116 |
Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name)); |
|
117 |
Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature)); |
|
118 |
if (name_symbol == NULL || signature_symbol == NULL) { |
|
119 |
#ifndef PRODUCT |
|
120 |
ik->print_on(tty); |
|
121 |
#endif |
|
33198 | 122 |
fatal("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string()); |
33160 | 123 |
} |
124 |
||
125 |
fieldDescriptor fd; |
|
126 |
if (!ik->find_field(name_symbol, signature_symbol, &fd)) { |
|
127 |
ResourceMark rm; |
|
42650 | 128 |
fatal("Invalid layout of %s %s at %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), ik->external_name()); |
33160 | 129 |
} |
130 |
guarantee(fd.is_static() == static_field, "static/instance mismatch"); |
|
131 |
dest_offset = fd.offset(); |
|
132 |
assert(dest_offset != 0, "must be valid offset"); |
|
34192
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
133 |
if (static_field) { |
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
134 |
// Must ensure classes for static fields are initialized as the |
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
135 |
// accessor itself does not include a class initialization check. |
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
136 |
ik->initialize(CHECK); |
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
137 |
} |
33160 | 138 |
} |
139 |
||
140 |
// This piece of macro magic creates the contents of the jvmci_compute_offsets method that initializes the field indices of all the access classes. |
|
141 |
||
142 |
#define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name ""); |
|
143 |
||
144 |
#define END_CLASS } |
|
145 |
||
34192
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
146 |
#define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field, CHECK); |
33160 | 147 |
#define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false) |
148 |
#define INT_FIELD(klass, name) FIELD(klass, name, "I", false) |
|
149 |
#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false) |
|
150 |
#define LONG_FIELD(klass, name) FIELD(klass, name, "J", false) |
|
151 |
#define FLOAT_FIELD(klass, name) FIELD(klass, name, "F", false) |
|
152 |
#define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false) |
|
153 |
#define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true) |
|
154 |
#define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true) |
|
155 |
#define STATIC_BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", true) |
|
156 |
||
157 |
||
34192
6da4892d7cd5
8142511: [JVMCI] must eagerly initialize classes with static fields accessed by JVMCI native code
twisti
parents:
33632
diff
changeset
|
158 |
void JVMCIJavaClasses::compute_offsets(TRAPS) { |
33160 | 159 |
COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD) |
160 |
} |
|
161 |
||
162 |
#define EMPTY0 |
|
163 |
#define EMPTY1(x) |
|
164 |
#define EMPTY2(x,y) |
|
165 |
#define FIELD2(klass, name) int klass::_##name##_offset = 0; |
|
166 |
#define FIELD3(klass, name, sig) FIELD2(klass, name) |
|
167 |
||
168 |
COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2) |
|
169 |