rev 49250 : [mq]: JDK-8199739.patch

   1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   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 #ifndef SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
  25 #define SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
  26 
  27 #include "classfile/systemDictionary.hpp"
  28 #include "oops/access.inline.hpp"
  29 #include "oops/instanceMirrorKlass.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "runtime/jniHandles.inline.hpp"
  32 
  33 class JVMCIJavaClasses : AllStatic {
  34  public:
  35   static void compute_offsets(TRAPS);
  36 };
  37 
  38 /* This macro defines the structure of the JVMCI classes accessed from VM code.
  39  * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles.
  40  *
  41  * The public interface of these classes will look like this:
  42 
  43  * class StackSlot : AllStatic {
  44  * public:
  45  *   static Klass* klass();
  46  *   static jint  index(oop obj);
  47  *   static jint  index(Handle obj);
  48  *   static jint  index(jobject obj);
  49  *   static void set_index(oop obj, jint x);
  50  *   static void set_index(Handle obj, jint x);
  51  *   static void set_index(jobject obj, jint x);
  52  * };
  53  *
  54  */
  55 
  56 #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) \
  57   start_class(Architecture)                                                                                                                                    \
  58     oop_field(Architecture, wordKind, "Ljdk/vm/ci/meta/PlatformKind;")                                                                                         \
  59   end_class                                                                                                                                                    \
  60   start_class(TargetDescription)                                                                                                                               \
  61     oop_field(TargetDescription, arch, "Ljdk/vm/ci/code/Architecture;")                                                                                        \
  62   end_class                                                                                                                                                    \
  63   start_class(HotSpotResolvedObjectTypeImpl)                                                                                                                   \
  64     oop_field(HotSpotResolvedObjectTypeImpl, javaClass, "Ljava/lang/Class;")                                                                                   \
  65   end_class                                                                                                                                                    \
  66   start_class(HotSpotResolvedJavaMethodImpl)                                                                                                                   \
  67     long_field(HotSpotResolvedJavaMethodImpl, metaspaceMethod)                                                                                                 \
  68   end_class                                                                                                                                                    \
  69   start_class(InstalledCode)                                                                                                                                   \
  70     long_field(InstalledCode, address)                                                                                                                         \
  71     long_field(InstalledCode, entryPoint)                                                                                                                      \
  72     long_field(InstalledCode, version)                                                                                                                         \
  73     oop_field(InstalledCode, name, "Ljava/lang/String;")                                                                                                       \
  74   end_class                                                                                                                                                    \
  75   start_class(HotSpotInstalledCode)                                                                                                                            \
  76     int_field(HotSpotInstalledCode, size)                                                                                                                      \
  77     long_field(HotSpotInstalledCode, codeStart)                                                                                                                \
  78     int_field(HotSpotInstalledCode, codeSize)                                                                                                                  \
  79   end_class                                                                                                                                                    \
  80   start_class(HotSpotNmethod)                                                                                                                                  \
  81     boolean_field(HotSpotNmethod, isDefault)                                                                                                                   \
  82   end_class                                                                                                                                                    \
  83   start_class(HotSpotCompiledCode)                                                                                                                             \
  84     oop_field(HotSpotCompiledCode, name, "Ljava/lang/String;")                                                                                                 \
  85     typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B")                                                                                                  \
  86     int_field(HotSpotCompiledCode, targetCodeSize)                                                                                                             \
  87     objArrayOop_field(HotSpotCompiledCode, sites, "[Ljdk/vm/ci/code/site/Site;")                                                                               \
  88     objArrayOop_field(HotSpotCompiledCode, assumptions, "[Ljdk/vm/ci/meta/Assumptions$Assumption;")                                                            \
  89     objArrayOop_field(HotSpotCompiledCode, methods, "[Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                    \
  90     objArrayOop_field(HotSpotCompiledCode, comments, "[Ljdk/vm/ci/hotspot/HotSpotCompiledCode$Comment;")                                                       \
  91     typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B")                                                                                                 \
  92     int_field(HotSpotCompiledCode, dataSectionAlignment)                                                                                                       \
  93     objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/vm/ci/code/site/DataPatch;")                                                             \
  94     boolean_field(HotSpotCompiledCode, isImmutablePIC)                                                                                                         \
  95     int_field(HotSpotCompiledCode, totalFrameSize)                                                                                                             \
  96     oop_field(HotSpotCompiledCode, deoptRescueSlot, "Ljdk/vm/ci/code/StackSlot;")                                                                              \
  97   end_class                                                                                                                                                    \
  98   start_class(HotSpotCompiledCode_Comment)                                                                                                                     \
  99     oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;")                                                                                         \
 100     int_field(HotSpotCompiledCode_Comment, pcOffset)                                                                                                           \
 101   end_class                                                                                                                                                    \
 102   start_class(HotSpotCompiledNmethod)                                                                                                                          \
 103     oop_field(HotSpotCompiledNmethod, method, "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;")                                                                 \
 104     oop_field(HotSpotCompiledNmethod, installationFailureMessage, "Ljava/lang/String;")                                                                        \
 105     int_field(HotSpotCompiledNmethod, entryBCI)                                                                                                                \
 106     int_field(HotSpotCompiledNmethod, id)                                                                                                                      \
 107     long_field(HotSpotCompiledNmethod, jvmciEnv)                                                                                                               \
 108     boolean_field(HotSpotCompiledNmethod, hasUnsafeAccess)                                                                                                     \
 109   end_class                                                                                                                                                    \
 110   start_class(HotSpotJVMCIMetaAccessContext)                                                                                                                   \
 111     static_objArrayOop_field(HotSpotJVMCIMetaAccessContext, allContexts, "[Ljava/lang/ref/WeakReference;")                                                     \
 112     objArrayOop_field(HotSpotJVMCIMetaAccessContext, metadataRoots, "[Ljava/lang/Object;")                                                                     \
 113   end_class                                                                                                                                                    \
 114   start_class(HotSpotForeignCallTarget)                                                                                                                        \
 115     long_field(HotSpotForeignCallTarget, address)                                                                                                              \
 116   end_class                                                                                                                                                    \
 117   start_class(VMField)                                                                                                                                         \
 118     oop_field(VMField, name, "Ljava/lang/String;")                                                                                                             \
 119     oop_field(VMField, type, "Ljava/lang/String;")                                                                                                             \
 120     long_field(VMField, offset)                                                                                                                                \
 121     long_field(VMField, address)                                                                                                                               \
 122     oop_field(VMField, value, "Ljava/lang/Object;")                                                                                                            \
 123   end_class                                                                                                                                                    \
 124   start_class(VMFlag)                                                                                                                                          \
 125     oop_field(VMFlag, name, "Ljava/lang/String;")                                                                                                              \
 126     oop_field(VMFlag, type, "Ljava/lang/String;")                                                                                                              \
 127     oop_field(VMFlag, value, "Ljava/lang/Object;")                                                                                                             \
 128   end_class                                                                                                                                                    \
 129   start_class(VMIntrinsicMethod)                                                                                                                               \
 130     oop_field(VMIntrinsicMethod, declaringClass, "Ljava/lang/String;")                                                                                         \
 131     oop_field(VMIntrinsicMethod, name, "Ljava/lang/String;")                                                                                                   \
 132     oop_field(VMIntrinsicMethod, descriptor, "Ljava/lang/String;")                                                                                             \
 133     int_field(VMIntrinsicMethod, id)                                                                                                                           \
 134   end_class                                                                                                                                                    \
 135   start_class(Assumptions_NoFinalizableSubclass)                                                                                                               \
 136     oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                            \
 137   end_class                                                                                                                                                    \
 138   start_class(Assumptions_ConcreteSubtype)                                                                                                                     \
 139     oop_field(Assumptions_ConcreteSubtype, context, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                                       \
 140     oop_field(Assumptions_ConcreteSubtype, subtype, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                                       \
 141   end_class                                                                                                                                                    \
 142   start_class(Assumptions_LeafType)                                                                                                                            \
 143     oop_field(Assumptions_LeafType, context, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                                              \
 144   end_class                                                                                                                                                    \
 145   start_class(Assumptions_ConcreteMethod)                                                                                                                      \
 146     oop_field(Assumptions_ConcreteMethod, method, "Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                       \
 147     oop_field(Assumptions_ConcreteMethod, context, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                                        \
 148     oop_field(Assumptions_ConcreteMethod, impl, "Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                         \
 149   end_class                                                                                                                                                    \
 150   start_class(Assumptions_CallSiteTargetValue)                                                                                                                 \
 151     oop_field(Assumptions_CallSiteTargetValue, callSite, "Ljava/lang/invoke/CallSite;")                                                                        \
 152     oop_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljava/lang/invoke/MethodHandle;")                                                                \
 153   end_class                                                                                                                                                    \
 154   start_class(site_Site)                                                                                                                                       \
 155     int_field(site_Site, pcOffset)                                                                                                                             \
 156   end_class                                                                                                                                                    \
 157   start_class(site_Call)                                                                                                                                       \
 158     oop_field(site_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;")                                                                                              \
 159     oop_field(site_Call, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                                              \
 160   end_class                                                                                                                                                    \
 161   start_class(site_DataPatch)                                                                                                                                  \
 162     oop_field(site_DataPatch, reference, "Ljdk/vm/ci/code/site/Reference;")                                                                                    \
 163   end_class                                                                                                                                                    \
 164   start_class(site_ConstantReference)                                                                                                                          \
 165     oop_field(site_ConstantReference, constant, "Ljdk/vm/ci/meta/VMConstant;")                                                                                 \
 166   end_class                                                                                                                                                    \
 167   start_class(site_DataSectionReference)                                                                                                                       \
 168     int_field(site_DataSectionReference, offset)                                                                                                               \
 169   end_class                                                                                                                                                    \
 170   start_class(site_InfopointReason)                                                                                                                            \
 171     static_oop_field(site_InfopointReason, SAFEPOINT, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                 \
 172     static_oop_field(site_InfopointReason, CALL, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                      \
 173     static_oop_field(site_InfopointReason, IMPLICIT_EXCEPTION, "Ljdk/vm/ci/code/site/InfopointReason;")                                                        \
 174   end_class                                                                                                                                                    \
 175   start_class(site_Infopoint)                                                                                                                                  \
 176     oop_field(site_Infopoint, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                                         \
 177     oop_field(site_Infopoint, reason, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                                 \
 178   end_class                                                                                                                                                    \
 179   start_class(site_ExceptionHandler)                                                                                                                           \
 180     int_field(site_ExceptionHandler, handlerPos)                                                                                                               \
 181   end_class                                                                                                                                                    \
 182   start_class(site_Mark)                                                                                                                                       \
 183     oop_field(site_Mark, id, "Ljava/lang/Object;")                                                                                                             \
 184   end_class                                                                                                                                                    \
 185   start_class(HotSpotCompilationRequestResult)                                                                                                                 \
 186     oop_field(HotSpotCompilationRequestResult, failureMessage, "Ljava/lang/String;")                                                                           \
 187     boolean_field(HotSpotCompilationRequestResult, retry)                                                                                                      \
 188     int_field(HotSpotCompilationRequestResult, inlinedBytecodes)                                                                                               \
 189   end_class                                                                                                                                                    \
 190   start_class(DebugInfo)                                                                                                                                       \
 191     oop_field(DebugInfo, bytecodePosition, "Ljdk/vm/ci/code/BytecodePosition;")                                                                                \
 192     oop_field(DebugInfo, referenceMap, "Ljdk/vm/ci/code/ReferenceMap;")                                                                                        \
 193     oop_field(DebugInfo, calleeSaveInfo, "Ljdk/vm/ci/code/RegisterSaveLayout;")                                                                                \
 194     objArrayOop_field(DebugInfo, virtualObjectMapping, "[Ljdk/vm/ci/code/VirtualObject;")                                                                      \
 195   end_class                                                                                                                                                    \
 196   start_class(HotSpotReferenceMap)                                                                                                                             \
 197     objArrayOop_field(HotSpotReferenceMap, objects, "[Ljdk/vm/ci/code/Location;")                                                                              \
 198     objArrayOop_field(HotSpotReferenceMap, derivedBase, "[Ljdk/vm/ci/code/Location;")                                                                          \
 199     typeArrayOop_field(HotSpotReferenceMap, sizeInBytes, "[I")                                                                                                 \
 200     int_field(HotSpotReferenceMap, maxRegisterSize)                                                                                                            \
 201   end_class                                                                                                                                                    \
 202   start_class(RegisterSaveLayout)                                                                                                                              \
 203     objArrayOop_field(RegisterSaveLayout, registers, "[Ljdk/vm/ci/code/Register;")                                                                             \
 204     typeArrayOop_field(RegisterSaveLayout, slots, "[I")                                                                                                        \
 205   end_class                                                                                                                                                    \
 206   start_class(BytecodeFrame)                                                                                                                                   \
 207     objArrayOop_field(BytecodeFrame, values, "[Ljdk/vm/ci/meta/JavaValue;")                                                                                    \
 208     objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/vm/ci/meta/JavaKind;")                                                                                  \
 209     int_field(BytecodeFrame, numLocals)                                                                                                                        \
 210     int_field(BytecodeFrame, numStack)                                                                                                                         \
 211     int_field(BytecodeFrame, numLocks)                                                                                                                         \
 212     boolean_field(BytecodeFrame, rethrowException)                                                                                                             \
 213     boolean_field(BytecodeFrame, duringCall)                                                                                                                   \
 214     static_int_field(BytecodeFrame, BEFORE_BCI)                                                                                                                \
 215   end_class                                                                                                                                                    \
 216   start_class(BytecodePosition)                                                                                                                                \
 217     oop_field(BytecodePosition, caller, "Ljdk/vm/ci/code/BytecodePosition;")                                                                                   \
 218     oop_field(BytecodePosition, method, "Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                                 \
 219     int_field(BytecodePosition, bci)                                                                                                                           \
 220   end_class                                                                                                                                                    \
 221   start_class(JavaConstant)                                                                                                                                    \
 222   end_class                                                                                                                                                    \
 223   start_class(PrimitiveConstant)                                                                                                                               \
 224     oop_field(PrimitiveConstant, kind, "Ljdk/vm/ci/meta/JavaKind;")                                                                                            \
 225     long_field(PrimitiveConstant, primitive)                                                                                                                   \
 226   end_class                                                                                                                                                    \
 227   start_class(RawConstant)                                                                                                                                     \
 228     long_field(RawConstant, primitive)                                                                                                                         \
 229   end_class                                                                                                                                                    \
 230   start_class(NullConstant)                                                                                                                                    \
 231   end_class                                                                                                                                                    \
 232   start_class(HotSpotCompressedNullConstant)                                                                                                                   \
 233   end_class                                                                                                                                                    \
 234   start_class(HotSpotObjectConstantImpl)                                                                                                                       \
 235     oop_field(HotSpotObjectConstantImpl, object, "Ljava/lang/Object;")                                                                                         \
 236     boolean_field(HotSpotObjectConstantImpl, compressed)                                                                                                       \
 237   end_class                                                                                                                                                    \
 238   start_class(HotSpotMetaspaceConstantImpl)                                                                                                                    \
 239     oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljdk/vm/ci/hotspot/MetaspaceWrapperObject;")                                                     \
 240     boolean_field(HotSpotMetaspaceConstantImpl, compressed)                                                                                                    \
 241   end_class                                                                                                                                                    \
 242   start_class(HotSpotSentinelConstant)                                                                                                                         \
 243   end_class                                                                                                                                                    \
 244   start_class(JavaKind)                                                                                                                                        \
 245     char_field(JavaKind, typeChar)                                                                                                                             \
 246     static_oop_field(JavaKind, Boolean, "Ljdk/vm/ci/meta/JavaKind;");                                                                                          \
 247     static_oop_field(JavaKind, Byte, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
 248     static_oop_field(JavaKind, Char, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
 249     static_oop_field(JavaKind, Short, "Ljdk/vm/ci/meta/JavaKind;");                                                                                            \
 250     static_oop_field(JavaKind, Int, "Ljdk/vm/ci/meta/JavaKind;");                                                                                              \
 251     static_oop_field(JavaKind, Long, "Ljdk/vm/ci/meta/JavaKind;");                                                                                             \
 252   end_class                                                                                                                                                    \
 253   start_class(ValueKind)                                                                                                                                       \
 254     oop_field(ValueKind, platformKind, "Ljdk/vm/ci/meta/PlatformKind;")                                                                                        \
 255   end_class                                                                                                                                                    \
 256   start_class(Value)                                                                                                                                           \
 257     oop_field(Value, valueKind, "Ljdk/vm/ci/meta/ValueKind;")                                                                                                  \
 258     static_oop_field(Value, ILLEGAL, "Ljdk/vm/ci/meta/AllocatableValue;");                                                                                     \
 259   end_class                                                                                                                                                    \
 260   start_class(RegisterValue)                                                                                                                                   \
 261     oop_field(RegisterValue, reg, "Ljdk/vm/ci/code/Register;")                                                                                                 \
 262   end_class                                                                                                                                                    \
 263   start_class(code_Location)                                                                                                                                   \
 264     oop_field(code_Location, reg, "Ljdk/vm/ci/code/Register;")                                                                                                 \
 265     int_field(code_Location, offset)                                                                                                                           \
 266   end_class                                                                                                                                                    \
 267   start_class(code_Register)                                                                                                                                   \
 268     int_field(code_Register, number)                                                                                                                           \
 269     int_field(code_Register, encoding)                                                                                                                         \
 270   end_class                                                                                                                                                    \
 271   start_class(StackSlot)                                                                                                                                       \
 272     int_field(StackSlot, offset)                                                                                                                               \
 273     boolean_field(StackSlot, addFrameSize)                                                                                                                     \
 274   end_class                                                                                                                                                    \
 275   start_class(VirtualObject)                                                                                                                                   \
 276     int_field(VirtualObject, id)                                                                                                                               \
 277     oop_field(VirtualObject, type, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                                                        \
 278     objArrayOop_field(VirtualObject, values, "[Ljdk/vm/ci/meta/JavaValue;")                                                                                    \
 279     objArrayOop_field(VirtualObject, slotKinds, "[Ljdk/vm/ci/meta/JavaKind;")                                                                                  \
 280   end_class                                                                                                                                                    \
 281   start_class(StackLockValue)                                                                                                                                  \
 282     oop_field(StackLockValue, owner, "Ljdk/vm/ci/meta/JavaValue;")                                                                                             \
 283     oop_field(StackLockValue, slot, "Ljdk/vm/ci/meta/AllocatableValue;")                                                                                       \
 284     boolean_field(StackLockValue, eliminated)                                                                                                                  \
 285   end_class                                                                                                                                                    \
 286   start_class(HotSpotSpeculationLog)                                                                                                                           \
 287     oop_field(HotSpotSpeculationLog, lastFailed, "Ljava/lang/Object;")                                                                                         \
 288   end_class                                                                                                                                                    \
 289   start_class(HotSpotStackFrameReference)                                                                                                                      \
 290     oop_field(HotSpotStackFrameReference, compilerToVM, "Ljdk/vm/ci/hotspot/CompilerToVM;")                                                                    \
 291     boolean_field(HotSpotStackFrameReference, objectsMaterialized)                                                                                             \
 292     long_field(HotSpotStackFrameReference, stackPointer)                                                                                                       \
 293     int_field(HotSpotStackFrameReference, frameNumber)                                                                                                         \
 294     int_field(HotSpotStackFrameReference, bci)                                                                                                                 \
 295     oop_field(HotSpotStackFrameReference, method, "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;")                                                             \
 296     objArrayOop_field(HotSpotStackFrameReference, locals, "[Ljava/lang/Object;")                                                                               \
 297     typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z")                                                                                       \
 298   end_class                                                                                                                                                    \
 299   start_class(HotSpotMetaData)                                                                                                                                 \
 300     typeArrayOop_field(HotSpotMetaData, pcDescBytes, "[B")                                                                                                     \
 301     typeArrayOop_field(HotSpotMetaData, scopesDescBytes, "[B")                                                                                                 \
 302     typeArrayOop_field(HotSpotMetaData, relocBytes, "[B")                                                                                                      \
 303     typeArrayOop_field(HotSpotMetaData, exceptionBytes, "[B")                                                                                                  \
 304     typeArrayOop_field(HotSpotMetaData, oopMaps, "[B")                                                                                                         \
 305     objArrayOop_field(HotSpotMetaData, metadata, "[Ljava/lang/Object;")                                                                                        \
 306   end_class                                                                                                                                                    \
 307   start_class(HotSpotConstantPool)                                                                                                                             \
 308     long_field(HotSpotConstantPool, metaspaceConstantPool)                                                                                                     \
 309   end_class                                                                                                                                                    \
 310   start_class(HotSpotJVMCIRuntime)                                                                                                                             \
 311     objArrayOop_field(HotSpotJVMCIRuntime, trivialPrefixes, "[Ljava/lang/String;")                                                                             \
 312     int_field(HotSpotJVMCIRuntime, compilationLevelAdjustment)                                                                                                 \
 313   end_class                                                                                                                                                    \
 314   /* end*/
 315 
 316 #define START_CLASS(name)                                                                                                                                      \
 317 class name : AllStatic {                                                                                                                                       \
 318   private:                                                                                                                                                     \
 319     friend class JVMCICompiler;                                                                                                                                \
 320     static void check(oop obj, const char* field_name, int offset) {                                                                                           \
 321         assert(obj != NULL, "NULL field access of %s.%s", #name, field_name);                                                                                  \
 322         assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected, found %s", obj->klass()->external_name());                       \
 323         assert(offset != 0, "must be valid offset");                                                                                                           \
 324     }                                                                                                                                                          \
 325     static void compute_offsets(TRAPS);                                                                                                                        \
 326   public:                                                                                                                                                      \
 327     static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
 328 
 329 #define END_CLASS };
 330 
 331 #define FIELD(name, type, accessor, cast)                                                                                                                         \
 332     static int _##name##_offset;                                                                                                                                  \
 333     static type name(oop obj)                   { check(obj, #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                                               \
 334     static type name(Handle obj)                { check(obj(), #name, _##name##_offset); return cast obj->accessor(_##name##_offset); }                                             \
 335     static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name, _##name##_offset); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
 336     static void set_##name(oop obj, type x)     { check(obj, #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                                                  \
 337     static void set_##name(Handle obj, type x)  { check(obj(), #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); }                                                \
 338     static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name, _##name##_offset); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
 339 
 340 #define EMPTY_CAST
 341 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)
 342 #define INT_FIELD(klass, name) FIELD(name, jint, int_field, EMPTY_CAST)
 343 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field, EMPTY_CAST)
 344 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field, EMPTY_CAST)
 345 #define FLOAT_FIELD(klass, name) FIELD(name, jfloat, float_field, EMPTY_CAST)
 346 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field, EMPTY_CAST)
 347 #define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(name, objArrayOop, obj_field, (objArrayOop))
 348 #define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(name, typeArrayOop, obj_field, (typeArrayOop))
 349 #define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature)
 350 #define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature)
 351 #define STATIC_OOPISH_FIELD(klassName, name, type, signature)                                                  \
 352     static int _##name##_offset;                                                                               \
 353     static type name() {                                                                                       \
 354       assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
 355       InstanceKlass* ik = klassName::klass();                                                                  \
 356       oop base = ik->static_field_base();                                                                      \
 357       oop result = HeapAccess<>::oop_load_at(base, _##name##_offset);                                          \
 358       return type(result);                                                                                     \
 359     }                                                                                                          \
 360     static void set_##name(type x) {                                                                           \
 361       assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
 362       assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName);                                 \
 363       InstanceKlass* ik = klassName::klass();                                                                  \
 364       oop base = ik->static_field_base();                                                                      \
 365       HeapAccess<>::oop_store_at(base, _##name##_offset, x);                                                      \
 366     }
 367 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename)                                                     \
 368     static int _##name##_offset;                                                                               \
 369     static jtypename name() {                                                                                  \
 370       assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
 371       InstanceKlass* ik = klassName::klass();                                                                  \
 372       oop base = ik->static_field_base();                                                                      \
 373       return HeapAccess<>::load_at(base, _##name##_offset);                                                       \
 374     }                                                                                                          \
 375     static void set_##name(jtypename x) {                                                                      \
 376       assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \
 377       InstanceKlass* ik = klassName::klass();                                                                  \
 378       oop base = ik->static_field_base();                                                                      \
 379       HeapAccess<>::store_at(base, _##name##_offset, x);                                                          \
 380     }
 381 
 382 #define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint)
 383 #define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean)
 384 
 385 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)
 386 #undef START_CLASS
 387 #undef END_CLASS
 388 #undef FIELD
 389 #undef CHAR_FIELD
 390 #undef INT_FIELD
 391 #undef BOOLEAN_FIELD
 392 #undef LONG_FIELD
 393 #undef FLOAT_FIELD
 394 #undef OOP_FIELD
 395 #undef TYPEARRAYOOP_FIELD
 396 #undef OBJARRAYOOP_FIELD
 397 #undef STATIC_OOPISH_FIELD
 398 #undef STATIC_OOP_FIELD
 399 #undef STATIC_OBJARRAYOOP_FIELD
 400 #undef STATIC_INT_FIELD
 401 #undef STATIC_BOOLEAN_FIELD
 402 #undef EMPTY_CAST
 403 
 404 void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field, TRAPS);
 405 
 406 #endif // SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP
--- EOF ---