< prev index next >

src/share/vm/jvmci/jvmciJavaClasses.hpp

Print this page




  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_VM_JVMCI_JVMCIJAVACLASSES_HPP
  25 #define SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
  26 
  27 #include "classfile/systemDictionary.hpp"
  28 #include "oops/instanceMirrorKlass.hpp"
  29 #include "oops/oop.inline.hpp"
  30 
  31 class JVMCIJavaClasses : AllStatic {
  32  public:
  33   static void compute_offsets(TRAPS);
  34 };
  35 
  36 /* This macro defines the structure of the CompilationResult - classes.
  37  * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles.
  38  *
  39  * The public interface of these classes will look like this:
  40 
  41  * class StackSlot : AllStatic {
  42  * public:
  43  *   static Klass* klass();
  44  *   static jint  index(oop obj);
  45  *   static jint  index(Handle obj);
  46  *   static jint  index(jobject obj);
  47  *   static void set_index(oop obj, jint x);
  48  *   static void set_index(Handle obj, jint x);
  49  *   static void set_index(jobject obj, jint x);
  50  * };
  51  *
  52  */
  53 
  54 #define 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) \
  55   start_class(Architecture)                                                                                                                                    \
  56     oop_field(Architecture, wordKind, "Ljdk/vm/ci/meta/PlatformKind;")                                                                                         \


 280     typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z")                                                                                       \
 281   end_class                                                                                                                                                    \
 282   start_class(HotSpotMetaData) \
 283     typeArrayOop_field(HotSpotMetaData, pcDescBytes, "[B") \
 284     typeArrayOop_field(HotSpotMetaData, scopesDescBytes, "[B") \
 285     typeArrayOop_field(HotSpotMetaData, relocBytes, "[B") \
 286     typeArrayOop_field(HotSpotMetaData, exceptionBytes, "[B") \
 287     typeArrayOop_field(HotSpotMetaData, oopMaps, "[B") \
 288     objArrayOop_field(HotSpotMetaData, metadata, "[Ljava/lang/String;") \
 289   end_class \
 290   start_class(HotSpotOopMap) \
 291     int_field(HotSpotOopMap, offset) \
 292     int_field(HotSpotOopMap, count) \
 293     typeArrayOop_field(HotSpotOopMap, data, "[B") \
 294   end_class                                                                                                                                                    \
 295   start_class(HotSpotConstantPool)                                                                                                                             \
 296     long_field(HotSpotConstantPool, metaspaceConstantPool)                                                                                                     \
 297   end_class                                                                                                                                                    \
 298   start_class(HotSpotJVMCIRuntime)                                                                                                                             \
 299     objArrayOop_field(HotSpotJVMCIRuntime, trivialPrefixes, "[Ljava/lang/String;")                                                                             \

 300   end_class                                                                                                                                                    \
 301   /* end*/
 302 
 303 #define START_CLASS(name)                                                                                                                                      \
 304 class name : AllStatic {                                                                                                                                       \
 305   private:                                                                                                                                                     \
 306     friend class JVMCICompiler;                                                                                                                                \
 307     static void check(oop obj, const char* field_name, int offset) {                                                                                           \
 308         assert(obj != NULL, "NULL field access of %s.%s", #name, field_name);                                                                                  \
 309         assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name());                       \
 310         assert(offset != 0, "must be valid offset");                                                                                                           \
 311     }                                                                                                                                                          \
 312     static void compute_offsets(TRAPS);                                                                                                                             \
 313   public:                                                                                                                                                      \
 314     static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
 315 
 316 #define END_CLASS };
 317 
 318 #define FIELD(name, type, accessor, cast)                                                                                                                         \
 319     static int _##name##_offset;                                                                                                                                  \




  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_VM_JVMCI_JVMCIJAVACLASSES_HPP
  25 #define SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
  26 
  27 #include "classfile/systemDictionary.hpp"
  28 #include "oops/instanceMirrorKlass.hpp"
  29 #include "oops/oop.inline.hpp"
  30 
  31 class JVMCIJavaClasses : AllStatic {
  32  public:
  33   static void compute_offsets(TRAPS);
  34 };
  35 
  36 /* This macro defines the structure of the JVMCI classes accessed from VM code.
  37  * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles.
  38  *
  39  * The public interface of these classes will look like this:
  40 
  41  * class StackSlot : AllStatic {
  42  * public:
  43  *   static Klass* klass();
  44  *   static jint  index(oop obj);
  45  *   static jint  index(Handle obj);
  46  *   static jint  index(jobject obj);
  47  *   static void set_index(oop obj, jint x);
  48  *   static void set_index(Handle obj, jint x);
  49  *   static void set_index(jobject obj, jint x);
  50  * };
  51  *
  52  */
  53 
  54 #define 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) \
  55   start_class(Architecture)                                                                                                                                    \
  56     oop_field(Architecture, wordKind, "Ljdk/vm/ci/meta/PlatformKind;")                                                                                         \


 280     typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z")                                                                                       \
 281   end_class                                                                                                                                                    \
 282   start_class(HotSpotMetaData)                                                                                                                                 \
 283     typeArrayOop_field(HotSpotMetaData, pcDescBytes, "[B")                                                                                                     \
 284     typeArrayOop_field(HotSpotMetaData, scopesDescBytes, "[B")                                                                                                 \
 285     typeArrayOop_field(HotSpotMetaData, relocBytes, "[B")                                                                                                      \
 286     typeArrayOop_field(HotSpotMetaData, exceptionBytes, "[B")                                                                                                  \
 287     typeArrayOop_field(HotSpotMetaData, oopMaps, "[B")                                                                                                         \
 288     objArrayOop_field(HotSpotMetaData, metadata, "[Ljava/lang/String;")                                                                                        \
 289   end_class                                                                                                                                                    \
 290   start_class(HotSpotOopMap)                                                                                                                                   \
 291     int_field(HotSpotOopMap, offset)                                                                                                                           \
 292     int_field(HotSpotOopMap, count)                                                                                                                            \
 293     typeArrayOop_field(HotSpotOopMap, data, "[B")                                                                                                              \
 294   end_class                                                                                                                                                    \
 295   start_class(HotSpotConstantPool)                                                                                                                             \
 296     long_field(HotSpotConstantPool, metaspaceConstantPool)                                                                                                     \
 297   end_class                                                                                                                                                    \
 298   start_class(HotSpotJVMCIRuntime)                                                                                                                             \
 299     objArrayOop_field(HotSpotJVMCIRuntime, trivialPrefixes, "[Ljava/lang/String;")                                                                             \
 300           int_field(HotSpotJVMCIRuntime, compilationLevelAdjustment)                                                                                                 \
 301   end_class                                                                                                                                                    \
 302   /* end*/
 303 
 304 #define START_CLASS(name)                                                                                                                                      \
 305 class name : AllStatic {                                                                                                                                       \
 306   private:                                                                                                                                                     \
 307     friend class JVMCICompiler;                                                                                                                                \
 308     static void check(oop obj, const char* field_name, int offset) {                                                                                           \
 309         assert(obj != NULL, "NULL field access of %s.%s", #name, field_name);                                                                                  \
 310         assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name());                       \
 311         assert(offset != 0, "must be valid offset");                                                                                                           \
 312     }                                                                                                                                                          \
 313     static void compute_offsets(TRAPS);                                                                                                                        \
 314   public:                                                                                                                                                      \
 315     static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
 316 
 317 #define END_CLASS };
 318 
 319 #define FIELD(name, type, accessor, cast)                                                                                                                         \
 320     static int _##name##_offset;                                                                                                                                  \


< prev index next >