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 #ifndef SHARE_JVMCI_JVMCIJAVACLASSES_HPP
25 #define SHARE_JVMCI_JVMCIJAVACLASSES_HPP
26
27 #include "classfile/vmSymbols.hpp"
28 #include "jvmci/jvmciExceptions.hpp"
29 #include "jvmci/jvmciObject.hpp"
30
31 /*
32 * This macro defines the structure of the JVMCI classes accessed from VM code. It is used to
33 * generate accessors similar to javaClasses.hpp, but with specializations for HotSpot and JNI based
34 * access.
35 *
36 * HotSpotJVMCI: This class contains accessors based on the VM internal
37 * interface to Java. It is used for JVMCI Java code executing on the HotSpot heap.
38 *
39 * JNIJVMCI: This class contains JNI based accessors and is used for JVMCI
40 * Java code executing in the JVMCI shared library.
41 */
42
43 #define JVMCI_CLASSES_DO(start_class, \
44 end_class, \
45 char_field, \
46 int_field, \
47 boolean_field, \
48 long_field, \
49 float_field, \
278
279 class JVMCICompiler;
280 class JVMCIEnv;
281
282 #define START_CLASS(simpleClassName, fullClassName) \
283 class simpleClassName { \
284 friend class JVMCIEnv; \
285 static void initialize(JVMCI_TRAPS); \
286 static bool is_instance(JVMCIEnv* jvmciEnv, JVMCIObject object); \
287
288 #define END_CLASS };
289
290 #define EMPTY_CAST
291 #define CHAR_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jchar)
292 #define INT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jint)
293 #define BOOLEAN_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jboolean)
294 #define LONG_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jlong)
295 #define FLOAT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jfloat)
296
297 #define OBJECT_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop)
298 #define OBJECTARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, objArrayOop)
299 #define PRIMARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIPrimitiveArray, typeArrayOop)
300
301 #define STATIC_INT_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jint)
302 #define STATIC_BOOLEAN_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jboolean)
303 #define STATIC_OBJECT_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop)
304 #define STATIC_OBJECTARRAY_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, objArrayOop)
305
306 #define HS_START_CLASS(simpleClassName, fullClassName) \
307 START_CLASS(simpleClassName, fullClassName) \
308 friend class HotSpotJVMCI; \
309 private: \
310 static void check(oop obj, const char* field_name, int offset); \
311 static InstanceKlass* _klass; \
312 public: \
313 static InstanceKlass* klass() { assert(_klass != nullptr, "uninit"); return _klass; } \
314 static Symbol* symbol() { return vmSymbols::fullClassName(); }
315
316 #define FIELD(simpleClassName, name, type) \
317 private: \
318 static int _##name##_offset; \
319 public: \
320 static type get_ ## name(JVMCIEnv* env, JVMCIObject obj) { return name(env, resolve(obj)); } \
321 static void set_ ## name(JVMCIEnv* env, JVMCIObject obj, type x) { set_ ## name(env, resolve(obj), x); } \
322 static type name(JVMCIEnv* env, oop obj); \
323 static void set_ ## name(JVMCIEnv* env, oop obj, type x);
324
|
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 #ifndef SHARE_JVMCI_JVMCIJAVACLASSES_HPP
25 #define SHARE_JVMCI_JVMCIJAVACLASSES_HPP
26
27 #include "classfile/vmSymbols.hpp"
28 #include "jvmci/jvmciExceptions.hpp"
29 #include "jvmci/jvmciObject.hpp"
30 #include "oops/refArrayOop.hpp"
31
32 /*
33 * This macro defines the structure of the JVMCI classes accessed from VM code. It is used to
34 * generate accessors similar to javaClasses.hpp, but with specializations for HotSpot and JNI based
35 * access.
36 *
37 * HotSpotJVMCI: This class contains accessors based on the VM internal
38 * interface to Java. It is used for JVMCI Java code executing on the HotSpot heap.
39 *
40 * JNIJVMCI: This class contains JNI based accessors and is used for JVMCI
41 * Java code executing in the JVMCI shared library.
42 */
43
44 #define JVMCI_CLASSES_DO(start_class, \
45 end_class, \
46 char_field, \
47 int_field, \
48 boolean_field, \
49 long_field, \
50 float_field, \
279
280 class JVMCICompiler;
281 class JVMCIEnv;
282
283 #define START_CLASS(simpleClassName, fullClassName) \
284 class simpleClassName { \
285 friend class JVMCIEnv; \
286 static void initialize(JVMCI_TRAPS); \
287 static bool is_instance(JVMCIEnv* jvmciEnv, JVMCIObject object); \
288
289 #define END_CLASS };
290
291 #define EMPTY_CAST
292 #define CHAR_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jchar)
293 #define INT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jint)
294 #define BOOLEAN_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jboolean)
295 #define LONG_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jlong)
296 #define FLOAT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jfloat)
297
298 #define OBJECT_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop)
299 #define OBJECTARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, refArrayOop)
300 #define PRIMARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIPrimitiveArray, typeArrayOop)
301
302 #define STATIC_INT_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jint)
303 #define STATIC_BOOLEAN_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jboolean)
304 #define STATIC_OBJECT_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop)
305 #define STATIC_OBJECTARRAY_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, refArrayOop)
306
307 #define HS_START_CLASS(simpleClassName, fullClassName) \
308 START_CLASS(simpleClassName, fullClassName) \
309 friend class HotSpotJVMCI; \
310 private: \
311 static void check(oop obj, const char* field_name, int offset); \
312 static InstanceKlass* _klass; \
313 public: \
314 static InstanceKlass* klass() { assert(_klass != nullptr, "uninit"); return _klass; } \
315 static Symbol* symbol() { return vmSymbols::fullClassName(); }
316
317 #define FIELD(simpleClassName, name, type) \
318 private: \
319 static int _##name##_offset; \
320 public: \
321 static type get_ ## name(JVMCIEnv* env, JVMCIObject obj) { return name(env, resolve(obj)); } \
322 static void set_ ## name(JVMCIEnv* env, JVMCIObject obj, type x) { set_ ## name(env, resolve(obj), x); } \
323 static type name(JVMCIEnv* env, oop obj); \
324 static void set_ ## name(JVMCIEnv* env, oop obj, type x);
325
|