8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp
authorcoleenp
Tue, 05 Jun 2018 11:11:33 -0400
changeset 50409 76bca6678913
parent 50408 a5fc0fb1d31d
child 50410 01e4ddc3c23f
8204237: Clean up incorrectly included .inline.hpp files from jvmciJavaClasses.hpp Summary: Reexpand macro to provide non-inline functions. Reviewed-by: kvn, dnsimon
src/hotspot/share/jvmci/jvmciJavaClasses.cpp
src/hotspot/share/jvmci/jvmciJavaClasses.hpp
src/hotspot/share/jvmci/vmStructs_jvmci.cpp
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp	Tue Jun 05 15:56:23 2018 +0200
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp	Tue Jun 05 11:11:33 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +22,90 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/symbolTable.hpp"
 #include "jvmci/jvmciJavaClasses.hpp"
-#include "runtime/jniHandles.hpp"
-#include "classfile/symbolTable.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/oop.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
+
+
+// This macro expands for non-inline functions, in class declarations.
+
+#define START_CLASS(name)                                                                                                                                \
+    void name::check(oop obj, const char* field_name, int offset) {                                                                                          \
+      assert(obj != NULL, "NULL field access of %s.%s", #name, field_name);                                                                                  \
+      assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name());                       \
+      assert(offset != 0, "must be valid offset");                                                                                                           \
+    }
+
+#define END_CLASS
+
+#define FIELD(klass, name, type, accessor, cast)                                                                                                                                \
+    type klass::name(jobject obj)               { check(JNIHandles::resolve(obj), #name, _##name##_offset); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
+    void klass::set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name, _##name##_offset); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
+
+#define EMPTY_CAST
+#define CHAR_FIELD(klass, name) FIELD(klass, name, jchar, char_field, EMPTY_CAST)
+#define INT_FIELD(klass, name) FIELD(klass, name, jint, int_field, EMPTY_CAST)
+#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, jboolean, bool_field, EMPTY_CAST)
+#define LONG_FIELD(klass, name) FIELD(klass, name, jlong, long_field, EMPTY_CAST)
+#define FLOAT_FIELD(klass, name) FIELD(klass, name, jfloat, float_field, EMPTY_CAST)
+#define OOP_FIELD(klass, name, signature) FIELD(klass, name, oop, obj_field, EMPTY_CAST)
+#define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(klass, name, objArrayOop, obj_field, (objArrayOop))
+#define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(klass, name, typeArrayOop, obj_field, (typeArrayOop))
+#define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature)
+#define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature)
+#define STATIC_OOPISH_FIELD(klassName, name, type, signature)                                                  \
+    type klassName::name() {                                                                                   \
+      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
+      InstanceKlass* ik = klassName::klass();                                                                  \
+      oop base = ik->static_field_base_raw();                                                                  \
+      oop result = HeapAccess<>::oop_load_at(base, _##name##_offset);                                          \
+      return type(result);                                                                                     \
+    }                                                                                                          \
+    void klassName::set_##name(type x) {                                                                       \
+      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
+      assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName);                                 \
+      InstanceKlass* ik = klassName::klass();                                                                  \
+      oop base = ik->static_field_base_raw();                                                                  \
+      HeapAccess<>::oop_store_at(base, _##name##_offset, x);                                                   \
+    }
+#define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename)                                                     \
+    jtypename klassName::name() {                                                                              \
+      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
+      InstanceKlass* ik = klassName::klass();                                                                  \
+      oop base = ik->static_field_base_raw();                                                                  \
+      return HeapAccess<>::load_at(base, _##name##_offset);                                                    \
+    }                                                                                                          \
+    void klassName::set_##name(jtypename x) {                                                                  \
+      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
+      InstanceKlass* ik = klassName::klass();                                                                  \
+      oop base = ik->static_field_base_raw();                                                                  \
+      HeapAccess<>::store_at(base, _##name##_offset, x);                                                       \
+    }
+
+#define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint)
+#define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean)
+
+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)
+#undef START_CLASS
+#undef END_CLASS
+#undef FIELD
+#undef CHAR_FIELD
+#undef INT_FIELD
+#undef BOOLEAN_FIELD
+#undef LONG_FIELD
+#undef FLOAT_FIELD
+#undef OOP_FIELD
+#undef TYPEARRAYOOP_FIELD
+#undef OBJARRAYOOP_FIELD
+#undef STATIC_OOPISH_FIELD
+#undef STATIC_OOP_FIELD
+#undef STATIC_OBJARRAYOOP_FIELD
+#undef STATIC_INT_FIELD
+#undef STATIC_BOOLEAN_FIELD
+#undef STATIC_PRIMITIVE_FIELD
+#undef EMPTY_CAST
 
 // This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field.
 // It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded.
@@ -86,7 +166,3 @@
 
 COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2)
 
-
-
-
-
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Tue Jun 05 15:56:23 2018 +0200
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Tue Jun 05 11:11:33 2018 -0400
@@ -25,10 +25,9 @@
 #define SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
 
 #include "classfile/systemDictionary.hpp"
-#include "oops/access.inline.hpp"
+#include "oops/access.hpp"
 #include "oops/instanceMirrorKlass.hpp"
-#include "oops/oop.inline.hpp"
-#include "runtime/jniHandles.inline.hpp"
+#include "oops/oop.hpp"
 
 class JVMCIJavaClasses : AllStatic {
  public:
@@ -243,19 +242,19 @@
   end_class                                                                                                                                                    \
   start_class(JavaKind)                                                                                                                                        \
     char_field(JavaKind, typeChar)                                                                                                                             \
-    static_oop_field(JavaKind, Boolean, "Ljdk/vm/ci/meta/JavaKind;");                                                                                          \
-    static_oop_field(JavaKind, Byte, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
-    static_oop_field(JavaKind, Char, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
-    static_oop_field(JavaKind, Short, "Ljdk/vm/ci/meta/JavaKind;");                                                                                            \
-    static_oop_field(JavaKind, Int, "Ljdk/vm/ci/meta/JavaKind;");                                                                                              \
-    static_oop_field(JavaKind, Long, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
+    static_oop_field(JavaKind, Boolean, "Ljdk/vm/ci/meta/JavaKind;")                                                                                           \
+    static_oop_field(JavaKind, Byte, "Ljdk/vm/ci/meta/JavaKind;")                                                                                              \
+    static_oop_field(JavaKind, Char, "Ljdk/vm/ci/meta/JavaKind;")                                                                                              \
+    static_oop_field(JavaKind, Short, "Ljdk/vm/ci/meta/JavaKind;")                                                                                             \
+    static_oop_field(JavaKind, Int, "Ljdk/vm/ci/meta/JavaKind;")                                                                                               \
+    static_oop_field(JavaKind, Long, "Ljdk/vm/ci/meta/JavaKind;")                                                                                              \
   end_class                                                                                                                                                    \
   start_class(ValueKind)                                                                                                                                       \
     oop_field(ValueKind, platformKind, "Ljdk/vm/ci/meta/PlatformKind;")                                                                                        \
   end_class                                                                                                                                                    \
   start_class(Value)                                                                                                                                           \
     oop_field(Value, valueKind, "Ljdk/vm/ci/meta/ValueKind;")                                                                                                  \
-    static_oop_field(Value, ILLEGAL, "Ljdk/vm/ci/meta/AllocatableValue;");                                                                                     \
+    static_oop_field(Value, ILLEGAL, "Ljdk/vm/ci/meta/AllocatableValue;")                                                                                      \
   end_class                                                                                                                                                    \
   start_class(RegisterValue)                                                                                                                                   \
     oop_field(RegisterValue, reg, "Ljdk/vm/ci/code/Register;")                                                                                                 \
@@ -317,11 +316,7 @@
 class name : AllStatic {                                                                                                                                       \
   private:                                                                                                                                                     \
     friend class JVMCICompiler;                                                                                                                                \
-    static void check(oop obj, const char* field_name, int offset) {                                                                                           \
-        assert(obj != NULL, "NULL field access of %s.%s", #name, field_name);                                                                                  \
-        assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name());                       \
-        assert(offset != 0, "must be valid offset");                                                                                                           \
-    }                                                                                                                                                          \
+    static void check(oop obj, const char* field_name, int offset);                                                                                            \
     static void compute_offsets(TRAPS);                                                                                                                        \
   public:                                                                                                                                                      \
     static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
@@ -330,12 +325,12 @@
 
 #define FIELD(name, type, accessor, cast)                                                                                                                         \
     static int _##name##_offset;                                                                                                                                  \
-    static type name(oop obj)                   { check(obj, #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                                               \
-    static type name(Handle obj)                { check(obj(), #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                                             \
-    static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name, _##name##_offset); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
-    static void set_##name(oop obj, type x)     { check(obj, #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                                                  \
-    static void set_##name(Handle obj, type x)  { check(obj(), #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                                                \
-    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name, _##name##_offset); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
+    static type name(oop obj)                   { check(obj, #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                             \
+    static type name(Handle obj)                { check(obj(), #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                           \
+    static type name(jobject obj);                                                                                                                                \
+    static void set_##name(oop obj, type x)     { check(obj, #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                                \
+    static void set_##name(Handle obj, type x)  { check(obj(), #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                              \
+    static void set_##name(jobject obj, type x);                                                                                                                  \
 
 #define EMPTY_CAST
 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)
@@ -350,34 +345,12 @@
 #define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature)
 #define STATIC_OOPISH_FIELD(klassName, name, type, signature)                                                  \
     static int _##name##_offset;                                                                               \
-    static type name() {                                                                                       \
-      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
-      InstanceKlass* ik = klassName::klass();                                                                  \
-      oop base = ik->static_field_base_raw();                                                                  \
-      oop result = HeapAccess<>::oop_load_at(base, _##name##_offset);                                          \
-      return type(result);                                                                                     \
-    }                                                                                                          \
-    static void set_##name(type x) {                                                                           \
-      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
-      assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName);                                 \
-      InstanceKlass* ik = klassName::klass();                                                                  \
-      oop base = ik->static_field_base_raw();                                                                  \
-      HeapAccess<>::oop_store_at(base, _##name##_offset, x);                                                   \
-    }
+    static type name();                                                                                        \
+    static void set_##name(type x);
 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename)                                                     \
     static int _##name##_offset;                                                                               \
-    static jtypename name() {                                                                                  \
-      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
-      InstanceKlass* ik = klassName::klass();                                                                  \
-      oop base = ik->static_field_base_raw();                                                                  \
-      return HeapAccess<>::load_at(base, _##name##_offset);                                                    \
-    }                                                                                                          \
-    static void set_##name(jtypename x) {                                                                      \
-      assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
-      InstanceKlass* ik = klassName::klass();                                                                  \
-      oop base = ik->static_field_base_raw();                                                                  \
-      HeapAccess<>::store_at(base, _##name##_offset, x);                                                       \
-    }
+    static jtypename name();                                                                                   \
+    static void set_##name(jtypename x);
 
 #define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint)
 #define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean)
@@ -399,6 +372,7 @@
 #undef STATIC_OBJARRAYOOP_FIELD
 #undef STATIC_INT_FIELD
 #undef STATIC_BOOLEAN_FIELD
+#undef STATIC_PRIMITIVE_FIELD
 #undef EMPTY_CAST
 
 void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field, TRAPS);
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Tue Jun 05 15:56:23 2018 +0200
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Tue Jun 05 11:11:33 2018 -0400
@@ -26,6 +26,7 @@
 #include "code/codeBlob.hpp"
 #include "compiler/abstractCompiler.hpp"
 #include "compiler/compileBroker.hpp"
+#include "gc/shared/collectedHeap.hpp"
 #include "jvmci/jvmciCodeInstaller.hpp"
 #include "jvmci/jvmciCompilerToVM.hpp"
 #include "jvmci/jvmciEnv.hpp"