1 /* 2 * Copyright (c) 2011, 2020, 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_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 "runtime/jniHandles.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, \ 51 object_field, \ 52 primarray_field, \ 53 objectarray_field, \ 54 static_object_field, \ 55 static_objectarray_field, \ 56 static_int_field, \ 57 static_boolean_field, \ 58 jvmci_method, \ 59 jvmci_constructor) \ 60 start_class(Services, jdk_vm_ci_services_Services) \ 61 jvmci_method(CallStaticVoidMethod, GetStaticMethodID, call_static, void, Services, initializeSavedProperties, byte_array_void_signature, (JVMCIObject serializedProperties)) \ 62 end_class \ 63 start_class(Architecture, jdk_vm_ci_code_Architecture) \ 64 object_field(Architecture, wordKind, "Ljdk/vm/ci/meta/PlatformKind;") \ 65 end_class \ 66 start_class(TargetDescription, jdk_vm_ci_code_TargetDescription) \ 67 object_field(TargetDescription, arch, "Ljdk/vm/ci/code/Architecture;") \ 68 end_class \ 69 start_class(HotSpotResolvedObjectTypeImpl, jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl) \ 70 long_field(HotSpotResolvedObjectTypeImpl, metadataPointer) \ 71 end_class \ 72 start_class(HotSpotResolvedPrimitiveType, jdk_vm_ci_hotspot_HotSpotResolvedPrimitiveType) \ 73 object_field(HotSpotResolvedPrimitiveType, mirror, "Ljdk/vm/ci/hotspot/HotSpotObjectConstantImpl;") \ 74 object_field(HotSpotResolvedPrimitiveType, kind, "Ljdk/vm/ci/meta/JavaKind;") \ 75 static_objectarray_field(HotSpotResolvedPrimitiveType, primitives, "[Ljdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType;") \ 76 end_class \ 77 start_class(HotSpotResolvedJavaFieldImpl, jdk_vm_ci_hotspot_HotSpotResolvedJavaFieldImpl) \ 78 object_field(HotSpotResolvedJavaFieldImpl, type, "Ljdk/vm/ci/meta/JavaType;") \ 79 object_field(HotSpotResolvedJavaFieldImpl, holder, "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;") \ 80 int_field(HotSpotResolvedJavaFieldImpl, offset) \ 81 int_field(HotSpotResolvedJavaFieldImpl, modifiers) \ 82 end_class \ 83 start_class(HotSpotResolvedJavaMethodImpl, jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl) \ 84 long_field(HotSpotResolvedJavaMethodImpl, metadataHandle) \ 85 end_class \ 86 start_class(InstalledCode, jdk_vm_ci_code_InstalledCode) \ 87 long_field(InstalledCode, address) \ 88 long_field(InstalledCode, entryPoint) \ 89 long_field(InstalledCode, version) \ 90 object_field(InstalledCode, name, "Ljava/lang/String;") \ 91 end_class \ 92 start_class(HotSpotInstalledCode, jdk_vm_ci_hotspot_HotSpotInstalledCode) \ 93 int_field(HotSpotInstalledCode, size) \ 94 long_field(HotSpotInstalledCode, codeStart) \ 95 int_field(HotSpotInstalledCode, codeSize) \ 96 end_class \ 97 start_class(HotSpotNmethod, jdk_vm_ci_hotspot_HotSpotNmethod) \ 98 boolean_field(HotSpotNmethod, isDefault) \ 99 long_field(HotSpotNmethod, compileIdSnapshot) \ 100 object_field(HotSpotNmethod, method, "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;") \ 101 jvmci_constructor(HotSpotNmethod, "(Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;Ljava/lang/String;ZJ)V") \ 102 end_class \ 103 start_class(HotSpotCompiledCode, jdk_vm_ci_hotspot_HotSpotCompiledCode) \ 104 object_field(HotSpotCompiledCode, name, "Ljava/lang/String;") \ 105 primarray_field(HotSpotCompiledCode, targetCode, "[B") \ 106 int_field(HotSpotCompiledCode, targetCodeSize) \ 107 objectarray_field(HotSpotCompiledCode, sites, "[Ljdk/vm/ci/code/site/Site;") \ 108 objectarray_field(HotSpotCompiledCode, assumptions, "[Ljdk/vm/ci/meta/Assumptions$Assumption;") \ 109 objectarray_field(HotSpotCompiledCode, methods, "[Ljdk/vm/ci/meta/ResolvedJavaMethod;") \ 110 objectarray_field(HotSpotCompiledCode, comments, "[Ljdk/vm/ci/hotspot/HotSpotCompiledCode$Comment;") \ 111 primarray_field(HotSpotCompiledCode, dataSection, "[B") \ 112 int_field(HotSpotCompiledCode, dataSectionAlignment) \ 113 objectarray_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/vm/ci/code/site/DataPatch;") \ 114 boolean_field(HotSpotCompiledCode, isImmutablePIC) \ 115 int_field(HotSpotCompiledCode, totalFrameSize) \ 116 object_field(HotSpotCompiledCode, deoptRescueSlot, "Ljdk/vm/ci/code/StackSlot;") \ 117 end_class \ 118 start_class(HotSpotCompiledCode_Comment, jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment) \ 119 object_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;") \ 120 int_field(HotSpotCompiledCode_Comment, pcOffset) \ 121 end_class \ 122 start_class(HotSpotCompiledNmethod, jdk_vm_ci_hotspot_HotSpotCompiledNmethod) \ 123 object_field(HotSpotCompiledNmethod, method, "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;") \ 124 object_field(HotSpotCompiledNmethod, installationFailureMessage, "Ljava/lang/String;") \ 125 int_field(HotSpotCompiledNmethod, entryBCI) \ 126 int_field(HotSpotCompiledNmethod, id) \ 127 long_field(HotSpotCompiledNmethod, compileState) \ 128 boolean_field(HotSpotCompiledNmethod, hasUnsafeAccess) \ 129 end_class \ 130 start_class(HotSpotForeignCallTarget, jdk_vm_ci_hotspot_HotSpotForeignCallTarget) \ 131 long_field(HotSpotForeignCallTarget, address) \ 132 end_class \ 133 start_class(VMField, jdk_vm_ci_hotspot_VMField) \ 134 object_field(VMField, name, "Ljava/lang/String;") \ 135 object_field(VMField, type, "Ljava/lang/String;") \ 136 long_field(VMField, offset) \ 137 long_field(VMField, address) \ 138 object_field(VMField, value, "Ljava/lang/Object;") \ 139 jvmci_constructor(VMField, "(Ljava/lang/String;Ljava/lang/String;JJLjava/lang/Object;)V") \ 140 end_class \ 141 start_class(VMFlag, jdk_vm_ci_hotspot_VMFlag) \ 142 object_field(VMFlag, name, "Ljava/lang/String;") \ 143 object_field(VMFlag, type, "Ljava/lang/String;") \ 144 object_field(VMFlag, value, "Ljava/lang/Object;") \ 145 jvmci_constructor(VMFlag, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V") \ 146 end_class \ 147 start_class(VMIntrinsicMethod, jdk_vm_ci_hotspot_VMIntrinsicMethod) \ 148 object_field(VMIntrinsicMethod, declaringClass, "Ljava/lang/String;") \ 149 object_field(VMIntrinsicMethod, name, "Ljava/lang/String;") \ 150 object_field(VMIntrinsicMethod, descriptor, "Ljava/lang/String;") \ 151 int_field(VMIntrinsicMethod, id) \ 152 jvmci_constructor(VMIntrinsicMethod, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V") \ 153 end_class \ 154 start_class(Assumptions_NoFinalizableSubclass, jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass) \ 155 object_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 156 end_class \ 157 start_class(Assumptions_ConcreteSubtype, jdk_vm_ci_meta_Assumptions_ConcreteSubtype) \ 158 object_field(Assumptions_ConcreteSubtype, context, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 159 object_field(Assumptions_ConcreteSubtype, subtype, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 160 end_class \ 161 start_class(Assumptions_LeafType, jdk_vm_ci_meta_Assumptions_LeafType) \ 162 object_field(Assumptions_LeafType, context, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 163 end_class \ 164 start_class(Assumptions_ConcreteMethod, jdk_vm_ci_meta_Assumptions_ConcreteMethod) \ 165 object_field(Assumptions_ConcreteMethod, method, "Ljdk/vm/ci/meta/ResolvedJavaMethod;") \ 166 object_field(Assumptions_ConcreteMethod, context, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 167 object_field(Assumptions_ConcreteMethod, impl, "Ljdk/vm/ci/meta/ResolvedJavaMethod;") \ 168 end_class \ 169 start_class(Assumptions_CallSiteTargetValue, jdk_vm_ci_meta_Assumptions_CallSiteTargetValue) \ 170 object_field(Assumptions_CallSiteTargetValue, callSite, "Ljdk/vm/ci/meta/JavaConstant;") \ 171 object_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljdk/vm/ci/meta/JavaConstant;") \ 172 end_class \ 173 start_class(site_Site, jdk_vm_ci_code_site_Site) \ 174 int_field(site_Site, pcOffset) \ 175 end_class \ 176 start_class(site_Call, jdk_vm_ci_code_site_Call) \ 177 object_field(site_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;") \ 178 boolean_field(site_Call, direct) \ 179 end_class \ 180 start_class(site_ImplicitExceptionDispatch, jdk_vm_ci_code_site_ImplicitExceptionDispatch) \ 181 int_field(site_ImplicitExceptionDispatch, dispatchOffset) \ 182 end_class \ 183 start_class(site_DataPatch, jdk_vm_ci_code_site_DataPatch) \ 184 object_field(site_DataPatch, reference, "Ljdk/vm/ci/code/site/Reference;") \ 185 end_class \ 186 start_class(site_ConstantReference, jdk_vm_ci_code_site_ConstantReference) \ 187 object_field(site_ConstantReference, constant, "Ljdk/vm/ci/meta/VMConstant;") \ 188 end_class \ 189 start_class(site_DataSectionReference, jdk_vm_ci_code_site_DataSectionReference) \ 190 int_field(site_DataSectionReference, offset) \ 191 end_class \ 192 start_class(site_InfopointReason, jdk_vm_ci_code_site_InfopointReason) \ 193 static_object_field(site_InfopointReason, SAFEPOINT, "Ljdk/vm/ci/code/site/InfopointReason;") \ 194 static_object_field(site_InfopointReason, CALL, "Ljdk/vm/ci/code/site/InfopointReason;") \ 195 static_object_field(site_InfopointReason, IMPLICIT_EXCEPTION, "Ljdk/vm/ci/code/site/InfopointReason;") \ 196 end_class \ 197 start_class(site_Infopoint, jdk_vm_ci_code_site_Infopoint) \ 198 object_field(site_Infopoint, debugInfo, "Ljdk/vm/ci/code/DebugInfo;") \ 199 object_field(site_Infopoint, reason, "Ljdk/vm/ci/code/site/InfopointReason;") \ 200 end_class \ 201 start_class(site_ExceptionHandler, jdk_vm_ci_code_site_ExceptionHandler) \ 202 int_field(site_ExceptionHandler, handlerPos) \ 203 end_class \ 204 start_class(site_Mark, jdk_vm_ci_code_site_Mark) \ 205 object_field(site_Mark, id, "Ljava/lang/Object;") \ 206 end_class \ 207 start_class(HotSpotCompilationRequestResult, jdk_vm_ci_hotspot_HotSpotCompilationRequestResult) \ 208 object_field(HotSpotCompilationRequestResult, failureMessage, "Ljava/lang/String;") \ 209 boolean_field(HotSpotCompilationRequestResult, retry) \ 210 int_field(HotSpotCompilationRequestResult, inlinedBytecodes) \ 211 end_class \ 212 start_class(DebugInfo, jdk_vm_ci_code_DebugInfo) \ 213 object_field(DebugInfo, bytecodePosition, "Ljdk/vm/ci/code/BytecodePosition;") \ 214 object_field(DebugInfo, referenceMap, "Ljdk/vm/ci/code/ReferenceMap;") \ 215 object_field(DebugInfo, calleeSaveInfo, "Ljdk/vm/ci/code/RegisterSaveLayout;") \ 216 objectarray_field(DebugInfo, virtualObjectMapping, "[Ljdk/vm/ci/code/VirtualObject;") \ 217 end_class \ 218 start_class(HotSpotReferenceMap, jdk_vm_ci_hotspot_HotSpotReferenceMap) \ 219 objectarray_field(HotSpotReferenceMap, objects, "[Ljdk/vm/ci/code/Location;") \ 220 objectarray_field(HotSpotReferenceMap, derivedBase, "[Ljdk/vm/ci/code/Location;") \ 221 primarray_field(HotSpotReferenceMap, sizeInBytes, "[I") \ 222 int_field(HotSpotReferenceMap, maxRegisterSize) \ 223 end_class \ 224 start_class(RegisterSaveLayout, jdk_vm_ci_code_RegisterSaveLayout) \ 225 objectarray_field(RegisterSaveLayout, registers, "[Ljdk/vm/ci/code/Register;") \ 226 primarray_field(RegisterSaveLayout, slots, "[I") \ 227 end_class \ 228 start_class(BytecodeFrame, jdk_vm_ci_code_BytecodeFrame) \ 229 objectarray_field(BytecodeFrame, values, "[Ljdk/vm/ci/meta/JavaValue;") \ 230 objectarray_field(BytecodeFrame, slotKinds, "[Ljdk/vm/ci/meta/JavaKind;") \ 231 int_field(BytecodeFrame, numLocals) \ 232 int_field(BytecodeFrame, numStack) \ 233 int_field(BytecodeFrame, numLocks) \ 234 boolean_field(BytecodeFrame, rethrowException) \ 235 boolean_field(BytecodeFrame, duringCall) \ 236 static_int_field(BytecodeFrame, UNKNOWN_BCI) \ 237 static_int_field(BytecodeFrame, UNWIND_BCI) \ 238 static_int_field(BytecodeFrame, BEFORE_BCI) \ 239 static_int_field(BytecodeFrame, AFTER_BCI) \ 240 static_int_field(BytecodeFrame, AFTER_EXCEPTION_BCI) \ 241 static_int_field(BytecodeFrame, INVALID_FRAMESTATE_BCI) \ 242 end_class \ 243 start_class(BytecodePosition, jdk_vm_ci_code_BytecodePosition) \ 244 object_field(BytecodePosition, caller, "Ljdk/vm/ci/code/BytecodePosition;") \ 245 object_field(BytecodePosition, method, "Ljdk/vm/ci/meta/ResolvedJavaMethod;") \ 246 int_field(BytecodePosition, bci) \ 247 end_class \ 248 start_class(JavaConstant, jdk_vm_ci_meta_JavaConstant) \ 249 static_object_field(JavaConstant, NULL_POINTER, "Ljdk/vm/ci/meta/JavaConstant;") \ 250 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, JavaConstant, forFloat, forFloat_signature, (JVMCIObject kind, jlong value, JVMCI_TRAPS)) \ 251 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, JavaConstant, forDouble, forDouble_signature, (JVMCIObject kind, jlong value, JVMCI_TRAPS)) \ 252 end_class \ 253 start_class(ResolvedJavaMethod, jdk_vm_ci_meta_ResolvedJavaMethod) \ 254 end_class \ 255 start_class(PrimitiveConstant, jdk_vm_ci_meta_PrimitiveConstant) \ 256 object_field(PrimitiveConstant, kind, "Ljdk/vm/ci/meta/JavaKind;") \ 257 long_field(PrimitiveConstant, primitive) \ 258 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, PrimitiveConstant, forTypeChar, forTypeChar_signature, (JVMCIObject kind, jlong value, JVMCI_TRAPS)) \ 259 end_class \ 260 start_class(RawConstant, jdk_vm_ci_meta_RawConstant) \ 261 end_class \ 262 start_class(NullConstant, jdk_vm_ci_meta_NullConstant) \ 263 end_class \ 264 start_class(HotSpotCompressedNullConstant, jdk_vm_ci_hotspot_HotSpotCompressedNullConstant) \ 265 end_class \ 266 start_class(HotSpotObjectConstantImpl, jdk_vm_ci_hotspot_HotSpotObjectConstantImpl) \ 267 boolean_field(HotSpotObjectConstantImpl, compressed) \ 268 end_class \ 269 start_class(DirectHotSpotObjectConstantImpl, jdk_vm_ci_hotspot_DirectHotSpotObjectConstantImpl) \ 270 object_field(DirectHotSpotObjectConstantImpl, object, "Ljava/lang/Object;") \ 271 jvmci_constructor(DirectHotSpotObjectConstantImpl, "(Ljava/lang/Object;Z)V") \ 272 end_class \ 273 start_class(IndirectHotSpotObjectConstantImpl, jdk_vm_ci_hotspot_IndirectHotSpotObjectConstantImpl) \ 274 long_field(IndirectHotSpotObjectConstantImpl, objectHandle) \ 275 jvmci_constructor(IndirectHotSpotObjectConstantImpl, "(JZZ)V") \ 276 end_class \ 277 start_class(HotSpotMetaspaceConstantImpl, jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl) \ 278 object_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljdk/vm/ci/hotspot/MetaspaceObject;") \ 279 boolean_field(HotSpotMetaspaceConstantImpl, compressed) \ 280 end_class \ 281 start_class(HotSpotSentinelConstant, jdk_vm_ci_hotspot_HotSpotSentinelConstant) \ 282 end_class \ 283 start_class(JavaKind, jdk_vm_ci_meta_JavaKind) \ 284 char_field(JavaKind, typeChar) \ 285 static_object_field(JavaKind, Boolean, "Ljdk/vm/ci/meta/JavaKind;") \ 286 static_object_field(JavaKind, Byte, "Ljdk/vm/ci/meta/JavaKind;") \ 287 static_object_field(JavaKind, Char, "Ljdk/vm/ci/meta/JavaKind;") \ 288 static_object_field(JavaKind, Short, "Ljdk/vm/ci/meta/JavaKind;") \ 289 static_object_field(JavaKind, Int, "Ljdk/vm/ci/meta/JavaKind;") \ 290 static_object_field(JavaKind, Long, "Ljdk/vm/ci/meta/JavaKind;") \ 291 end_class \ 292 start_class(ValueKind, jdk_vm_ci_meta_ValueKind) \ 293 object_field(ValueKind, platformKind, "Ljdk/vm/ci/meta/PlatformKind;") \ 294 end_class \ 295 start_class(Value, jdk_vm_ci_meta_Value) \ 296 object_field(Value, valueKind, "Ljdk/vm/ci/meta/ValueKind;") \ 297 static_object_field(Value, ILLEGAL, "Ljdk/vm/ci/meta/AllocatableValue;") \ 298 end_class \ 299 start_class(RegisterValue, jdk_vm_ci_code_RegisterValue) \ 300 object_field(RegisterValue, reg, "Ljdk/vm/ci/code/Register;") \ 301 end_class \ 302 start_class(code_Location, jdk_vm_ci_code_Location) \ 303 object_field(code_Location, reg, "Ljdk/vm/ci/code/Register;") \ 304 int_field(code_Location, offset) \ 305 end_class \ 306 start_class(code_Register, jdk_vm_ci_code_Register) \ 307 int_field(code_Register, number) \ 308 int_field(code_Register, encoding) \ 309 end_class \ 310 start_class(StackSlot, jdk_vm_ci_code_StackSlot) \ 311 int_field(StackSlot, offset) \ 312 boolean_field(StackSlot, addFrameSize) \ 313 end_class \ 314 start_class(VirtualObject, jdk_vm_ci_code_VirtualObject) \ 315 int_field(VirtualObject, id) \ 316 boolean_field(VirtualObject, isAutoBox) \ 317 object_field(VirtualObject, type, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ 318 objectarray_field(VirtualObject, values, "[Ljdk/vm/ci/meta/JavaValue;") \ 319 objectarray_field(VirtualObject, slotKinds, "[Ljdk/vm/ci/meta/JavaKind;") \ 320 end_class \ 321 start_class(StackLockValue, jdk_vm_ci_code_StackLockValue) \ 322 object_field(StackLockValue, owner, "Ljdk/vm/ci/meta/JavaValue;") \ 323 object_field(StackLockValue, slot, "Ljdk/vm/ci/meta/AllocatableValue;") \ 324 boolean_field(StackLockValue, eliminated) \ 325 end_class \ 326 start_class(HotSpotStackFrameReference, jdk_vm_ci_hotspot_HotSpotStackFrameReference) \ 327 object_field(HotSpotStackFrameReference, compilerToVM, "Ljdk/vm/ci/hotspot/CompilerToVM;") \ 328 boolean_field(HotSpotStackFrameReference, objectsMaterialized) \ 329 long_field(HotSpotStackFrameReference, stackPointer) \ 330 int_field(HotSpotStackFrameReference, frameNumber) \ 331 int_field(HotSpotStackFrameReference, bci) \ 332 object_field(HotSpotStackFrameReference, method, "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;") \ 333 objectarray_field(HotSpotStackFrameReference, locals, "[Ljava/lang/Object;") \ 334 primarray_field(HotSpotStackFrameReference, localIsVirtual, "[Z") \ 335 end_class \ 336 start_class(HotSpotMetaData, jdk_vm_ci_hotspot_HotSpotMetaData) \ 337 primarray_field(HotSpotMetaData, pcDescBytes, "[B") \ 338 primarray_field(HotSpotMetaData, scopesDescBytes, "[B") \ 339 primarray_field(HotSpotMetaData, relocBytes, "[B") \ 340 primarray_field(HotSpotMetaData, exceptionBytes, "[B") \ 341 primarray_field(HotSpotMetaData, implicitExceptionBytes, "[B") \ 342 primarray_field(HotSpotMetaData, oopMaps, "[B") \ 343 object_field(HotSpotMetaData, metadata, "[Ljava/lang/Object;") \ 344 end_class \ 345 start_class(HotSpotConstantPool, jdk_vm_ci_hotspot_HotSpotConstantPool) \ 346 long_field(HotSpotConstantPool, metadataHandle) \ 347 end_class \ 348 start_class(HotSpotJVMCIRuntime, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime) \ 349 objectarray_field(HotSpotJVMCIRuntime, excludeFromJVMCICompilation, "[Ljava/lang/Module;") \ 350 jvmci_method(CallNonvirtualObjectMethod, GetMethodID, call_special, JVMCIObject, HotSpotJVMCIRuntime, compileMethod, compileMethod_signature, (JVMCIObject runtime, JVMCIObject method, int entry_bci, jlong env, int id)) \ 351 jvmci_method(CallNonvirtualObjectMethod, GetMethodID, call_special, JVMCIObject, HotSpotJVMCIRuntime, isGCSupported, int_bool_signature, (JVMCIObject runtime, int gcIdentifier)) \ 352 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, encodeThrowable, encodeThrowable_signature, (JVMCIObject throwable)) \ 353 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, decodeThrowable, decodeThrowable_signature, (JVMCIObject encodedThrowable)) \ 354 jvmci_method(CallNonvirtualVoidMethod, GetMethodID, call_special, void, HotSpotJVMCIRuntime, bootstrapFinished, void_method_signature, (JVMCIObject runtime, JVMCI_TRAPS)) \ 355 jvmci_method(CallNonvirtualVoidMethod, GetMethodID, call_special, void, HotSpotJVMCIRuntime, shutdown, void_method_signature, (JVMCIObject runtime)) \ 356 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, runtime, runtime_signature, (JVMCI_TRAPS)) \ 357 jvmci_method(CallObjectMethod, GetMethodID, call_virtual, JVMCIObject, HotSpotJVMCIRuntime, getCompiler, getCompiler_signature, (JVMCIObject runtime, JVMCI_TRAPS)) \ 358 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, callToString, callToString_signature, (JVMCIObject object, JVMCI_TRAPS)) \ 359 end_class \ 360 start_class(JVMCIError, jdk_vm_ci_common_JVMCIError) \ 361 jvmci_constructor(JVMCIError, "(Ljava/lang/String;)V") \ 362 end_class \ 363 start_class(InspectedFrameVisitor, jdk_vm_ci_code_stack_InspectedFrameVisitor) \ 364 end_class \ 365 start_class(JVMCI, jdk_vm_ci_runtime_JVMCI) \ 366 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, JVMCI, getRuntime, getRuntime_signature, (JVMCI_TRAPS)) \ 367 jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, JVMCI, initializeRuntime, initializeRuntime_signature, (JVMCI_TRAPS)) \ 368 end_class \ 369 start_class(Object, java_lang_Object) \ 370 end_class \ 371 start_class(String, java_lang_String) \ 372 end_class \ 373 start_class(Class, java_lang_Class) \ 374 jvmci_method(CallObjectMethod, GetMethodID, call_virtual, JVMCIObject, Class, getName, void_string_signature, (JVMCI_TRAPS)) \ 375 end_class \ 376 start_class(ArrayIndexOutOfBoundsException, java_lang_ArrayIndexOutOfBoundsException) \ 377 jvmci_constructor(ArrayIndexOutOfBoundsException, "(Ljava/lang/String;)V") \ 378 end_class \ 379 start_class(IllegalStateException, java_lang_IllegalStateException) \ 380 jvmci_constructor(IllegalStateException, "(Ljava/lang/String;)V") \ 381 end_class \ 382 start_class(NullPointerException, java_lang_NullPointerException) \ 383 jvmci_constructor(NullPointerException, "(Ljava/lang/String;)V") \ 384 end_class \ 385 start_class(IllegalArgumentException, java_lang_IllegalArgumentException) \ 386 jvmci_constructor(IllegalArgumentException, "(Ljava/lang/String;)V") \ 387 end_class \ 388 start_class(InternalError, java_lang_InternalError) \ 389 jvmci_constructor(InternalError, "(Ljava/lang/String;)V") \ 390 end_class \ 391 start_class(ClassNotFoundException, java_lang_ClassNotFoundException) \ 392 jvmci_constructor(ClassNotFoundException, "(Ljava/lang/String;)V") \ 393 end_class \ 394 start_class(InvalidInstalledCodeException, jdk_vm_ci_code_InvalidInstalledCodeException) \ 395 jvmci_constructor(InvalidInstalledCodeException, "(Ljava/lang/String;)V") \ 396 end_class \ 397 start_class(UnsatisfiedLinkError, java_lang_UnsatisfiedLinkError) \ 398 jvmci_constructor(UnsatisfiedLinkError, "(Ljava/lang/String;)V") \ 399 end_class \ 400 start_class(UnsupportedOperationException, java_lang_UnsupportedOperationException) \ 401 jvmci_constructor(UnsupportedOperationException, "(Ljava/lang/String;)V") \ 402 end_class \ 403 start_class(StackTraceElement, java_lang_StackTraceElement) \ 404 object_field(StackTraceElement, declaringClass, "Ljava/lang/String;") \ 405 object_field(StackTraceElement, methodName, "Ljava/lang/String;") \ 406 object_field(StackTraceElement, fileName, "Ljava/lang/String;") \ 407 int_field(StackTraceElement, lineNumber) \ 408 jvmci_constructor(StackTraceElement, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V") \ 409 end_class \ 410 start_class(Throwable, java_lang_Throwable) \ 411 object_field(Throwable, detailMessage, "Ljava/lang/String;") \ 412 end_class \ 413 /* end*/ 414 415 class JVMCICompiler; 416 class JVMCIEnv; 417 418 #define START_CLASS(simpleClassName, fullClassName) \ 419 class simpleClassName { \ 420 friend class JVMCIEnv; \ 421 static void initialize(JVMCI_TRAPS); \ 422 static bool is_instance(JVMCIEnv* jvmciEnv, JVMCIObject object); \ 423 424 #define END_CLASS }; 425 426 #define EMPTY_CAST 427 #define CHAR_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jchar) 428 #define INT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jint) 429 #define BOOLEAN_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jboolean) 430 #define LONG_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jlong) 431 #define FLOAT_FIELD(simpleClassName, name) FIELD(simpleClassName, name, jfloat) 432 433 #define OBJECT_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop) 434 #define OBJECTARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, objArrayOop) 435 #define PRIMARRAY_FIELD(simpleClassName, name, signature) OOPISH_FIELD(simpleClassName, name, JVMCIPrimitiveArray, typeArrayOop) 436 437 #define STATIC_INT_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jint) 438 #define STATIC_BOOLEAN_FIELD(simpleClassName, name) STATIC_FIELD(simpleClassName, name, jboolean) 439 #define STATIC_OBJECT_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObject, oop) 440 #define STATIC_OBJECTARRAY_FIELD(simpleClassName, name, signature) STATIC_OOPISH_FIELD(simpleClassName, name, JVMCIObjectArray, objArrayOop) 441 442 #define HS_START_CLASS(simpleClassName, fullClassName) \ 443 START_CLASS(simpleClassName, fullClassName) \ 444 friend class HotSpotJVMCI; \ 445 private: \ 446 static void check(oop obj, const char* field_name, int offset); \ 447 static InstanceKlass* _klass; \ 448 public: \ 449 static InstanceKlass* klass() { assert(_klass != NULL, "uninit"); return _klass; } \ 450 static Symbol* symbol() { return vmSymbols::fullClassName(); } 451 452 #define FIELD(simpleClassName, name, type) \ 453 private: \ 454 static int _##name##_offset; \ 455 public: \ 456 static type get_ ## name(JVMCIEnv* env, JVMCIObject obj) { return name(env, resolve(obj)); } \ 457 static void set_ ## name(JVMCIEnv* env, JVMCIObject obj, type x) { set_ ## name(env, resolve(obj), x); } \ 458 static type name(JVMCIEnv* env, oop obj); \ 459 static void set_ ## name(JVMCIEnv* env, oop obj, type x); 460 461 #define OOPISH_FIELD(simpleClassName, name, type, hstype) \ 462 private: \ 463 static int _##name##_offset; \ 464 public: \ 465 static type get_ ## name(JVMCIEnv* env, JVMCIObject obj) { return (type) wrap(name(env, resolve(obj))); } \ 466 static void set_ ## name(JVMCIEnv* env, JVMCIObject obj, type x) { set_ ## name(env, resolve(obj), (hstype) resolve(x)); } \ 467 static hstype name(JVMCIEnv* env, oop obj); \ 468 static void set_ ## name(JVMCIEnv* env, oop obj, hstype x); 469 470 #define STATIC_FIELD(simpleClassName, name, type) \ 471 private: \ 472 static int _##name##_offset; \ 473 public: \ 474 static type get_ ## name(JVMCIEnv* env); \ 475 static void set_ ## name(JVMCIEnv* env, type x); 476 477 #define STATIC_OOPISH_FIELD(simpleClassName, name, type, hstype) \ 478 private: \ 479 static int _##name##_offset; \ 480 public: \ 481 static type get_ ## name(JVMCIEnv* env) { return (type) wrap(name(env)); } \ 482 static void set_ ## name(JVMCIEnv* env, type x) { set_ ## name(env, (hstype) resolve(x)); } \ 483 static hstype name(JVMCIEnv* env); \ 484 static void set_ ## name(JVMCIEnv* env, hstype hstype); 485 486 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, simpleClassName, methodName, signatureSymbolName, args) 487 #define CONSTRUCTOR(className, signature) 488 489 /** 490 * VM internal interface to Java classes, methods and objects. For example: 491 * 492 * class HotSpotJVMCI { 493 * ... 494 * class Architecture { 495 * static void initialize(JVMCIEnv* env); 496 * static bool is_instance(JVMCIEnv* env, JVMCIObject object); 497 * private: 498 * static void check(oop obj, const char *field_name, int offset); 499 * public: 500 * static InstanceKlass *klass() { ... } 501 * static Symbol *symbol() { return vmSymbols::jdk_vm_ci_code_Architecture(); } 502 * private: 503 * static int _wordKind_offset; 504 * public: 505 * static JVMCIObject get_wordKind(JVMCIEnv *env, JVMCIObject obj) { ... } 506 * static void set_wordKind(JVMCIEnv *env, JVMCIObject obj, JVMCIObject x) { ... } 507 * static oop wordKind(JVMCIEnv *env, oop obj); 508 * static void set_wordKind(JVMCIEnv *env, oop obj, oop x); 509 * } 510 * ... 511 * }; 512 */ 513 class HotSpotJVMCI { 514 friend class JVMCIEnv; 515 516 public: 517 518 static oop resolve(JVMCIObject obj); 519 520 static arrayOop resolve(JVMCIArray obj); 521 static objArrayOop resolve(JVMCIObjectArray obj); 522 static typeArrayOop resolve(JVMCIPrimitiveArray obj); 523 wrap(jobject obj)524 static JVMCIObject wrap(jobject obj) { return JVMCIObject(obj, true); } 525 static JVMCIObject wrap(oop obj); 526 asMethod(JVMCIEnv * env,oop jvmci_method)527 static inline Method* asMethod(JVMCIEnv* env, oop jvmci_method) { 528 return *(Method**) HotSpotResolvedJavaMethodImpl::metadataHandle(env, jvmci_method); 529 } asConstantPool(JVMCIEnv * env,oop jvmci_constant_pool)530 static inline ConstantPool* asConstantPool(JVMCIEnv* env, oop jvmci_constant_pool) { 531 return *(ConstantPool**) HotSpotConstantPool::metadataHandle(env, jvmci_constant_pool); 532 } asKlass(JVMCIEnv * env,oop jvmci_type)533 static inline Klass* asKlass(JVMCIEnv* env, oop jvmci_type) { 534 return (Klass*) HotSpotResolvedObjectTypeImpl::metadataPointer(env, jvmci_type); 535 } 536 537 static void compute_offsets(TRAPS); 538 static void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field, TRAPS); 539 540 JVMCI_CLASSES_DO(HS_START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OBJECT_FIELD, PRIMARRAY_FIELD, OBJECTARRAY_FIELD, STATIC_OBJECT_FIELD, STATIC_OBJECTARRAY_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD, METHOD, CONSTRUCTOR) 541 }; 542 543 #undef HS_START_CLASS 544 545 #define JNI_START_CLASS(simpleClassName, fullClassName) \ 546 START_CLASS(simpleClassName, fullClassName) \ 547 friend class JNIJVMCI; \ 548 private: \ 549 static void check(JVMCIEnv* jvmciEnv, JVMCIObject obj, const char* field_name, jfieldID offset); \ 550 static jclass _class; \ 551 public: \ 552 static jclass clazz() { assert(_class != NULL, #fullClassName " uninitialized"); return _class; } \ 553 static jclass fullClassName ##_class() { assert(_class != NULL, "uninit"); return _class; } 554 555 #undef METHOD 556 #undef CONSTRUCTOR 557 #undef FIELD 558 #undef OOPISH_FIELD 559 #undef STATIC_FIELD 560 #undef STATIC_OOPISH_FIELD 561 562 #define FIELD(simpleClassName, name, type) \ 563 private: \ 564 static jfieldID _##name##_field_id; \ 565 public: \ 566 static type get_ ## name(JVMCIEnv* jvmciEnv, JVMCIObject obj); \ 567 static void set_ ## name(JVMCIEnv* jvmciEnv, JVMCIObject obj, type x); 568 569 #define OOPISH_FIELD(simpleClassName, name, type, hstype) \ 570 FIELD(simpleClassName, name, type) 571 572 #define STATIC_FIELD(simpleClassName, name, type) \ 573 private: \ 574 static jfieldID _##name##_field_id; \ 575 public: \ 576 static type get_ ## name(JVMCIEnv* jvmciEnv); \ 577 static void set_ ## name(JVMCIEnv* jvmciEnv, type x); 578 579 #define STATIC_OOPISH_FIELD(simpleClassName, name, type, hstype) \ 580 STATIC_FIELD(simpleClassName, name, type) 581 582 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) \ 583 public: \ 584 static jmethodID methodName##_method() { return _##methodName##_method; } \ 585 private: \ 586 static jmethodID _##methodName##_method; 587 588 #define CONSTRUCTOR(className, signature) \ 589 public: \ 590 static jmethodID constructor() { return _constructor; } \ 591 private: \ 592 static jmethodID _constructor; 593 594 /** 595 * JNI based interface to Java classes, methods and objects. For example: 596 * 597 * class JNIJVMCI { 598 * ... 599 * class Architecture { 600 * static void initialize(JVMCIEnv* env); 601 * static bool is_instance(JVMCIEnv* env, JVMCIObject object); 602 * private: 603 * static void check(oop obj, const char *field_name, int offset); 604 * static jclass _class; 605 * public: 606 * static jclass clazz() { return _class; } 607 * static jclass jdk_vm_ci_code_Architecture_class() { return _class; } 608 * private: 609 * static jfieldID _wordKind_field_id; 610 * public: 611 * static JVMCIObject get_wordKind(JVMCIEnv *env, JVMCIObject obj) { ... } 612 * static void set_wordKind(JVMCIEnv *env, JVMCIObject obj, JVMCIObject x) { ... } 613 * } 614 * ... 615 * }; 616 */ 617 class JNIJVMCI { 618 friend class JVMCIEnv; 619 620 static jclass _byte_array; 621 static jclass _box_classes[T_CONFLICT+1]; 622 static jfieldID _box_fields[T_CONFLICT+1]; 623 static jmethodID _box_constructors[T_CONFLICT+1]; 624 static jmethodID _Class_getName_method; 625 626 static jmethodID _HotSpotResolvedJavaMethodImpl_fromMetaspace_method; 627 static jmethodID _HotSpotConstantPool_fromMetaspace_method; 628 static jmethodID _HotSpotResolvedObjectTypeImpl_fromMetaspace_method; 629 static jmethodID _HotSpotResolvedPrimitiveType_fromMetaspace_method; 630 631 public: Class_getName_method()632 static jmethodID Class_getName_method() { return _Class_getName_method; } 633 byte_array()634 static jclass byte_array() { assert(_byte_array != NULL, "uninit"); return _byte_array; } 635 box_class(BasicType type)636 static jclass box_class(BasicType type) { assert(_box_classes[type]!= NULL, "uninit"); return _box_classes[type]; } box_field(BasicType type)637 static jfieldID box_field(BasicType type) { assert(_box_fields[type]!= NULL, "uninit"); return _box_fields[type]; } box_constructor(BasicType type)638 static jmethodID box_constructor(BasicType type) { assert(_box_constructors[type]!= NULL, "uninit"); return _box_constructors[type]; } 639 HotSpotResolvedJavaMethodImpl_fromMetaspace_method()640 static jmethodID HotSpotResolvedJavaMethodImpl_fromMetaspace_method() { assert(_HotSpotResolvedJavaMethodImpl_fromMetaspace_method != NULL, "uninit"); return _HotSpotResolvedJavaMethodImpl_fromMetaspace_method; } HotSpotConstantPool_fromMetaspace_method()641 static jmethodID HotSpotConstantPool_fromMetaspace_method() { assert(_HotSpotConstantPool_fromMetaspace_method != NULL, "uninit"); return _HotSpotConstantPool_fromMetaspace_method; } HotSpotResolvedObjectTypeImpl_fromMetaspace_method()642 static jmethodID HotSpotResolvedObjectTypeImpl_fromMetaspace_method() { assert(_HotSpotResolvedObjectTypeImpl_fromMetaspace_method != NULL, "uninit"); return _HotSpotResolvedObjectTypeImpl_fromMetaspace_method; } HotSpotResolvedPrimitiveType_fromMetaspace_method()643 static jmethodID HotSpotResolvedPrimitiveType_fromMetaspace_method() { assert(_HotSpotResolvedPrimitiveType_fromMetaspace_method != NULL, "uninit"); return _HotSpotResolvedPrimitiveType_fromMetaspace_method; } 644 645 static void initialize_ids(JNIEnv* env); 646 static void initialize_field_id(JNIEnv* env, jfieldID &dest_offset, jclass klass, const char* klass_name, const char* name, const char* signature, bool static_field); 647 static void register_natives(JNIEnv* env); 648 resolve_handle(JVMCIObject obj)649 static jobject resolve_handle(JVMCIObject obj) { return obj.as_jobject(); } wrap(jobject obj)650 static JVMCIObject wrap(jobject obj) { return JVMCIObject(obj, false); } 651 652 JVMCI_CLASSES_DO(JNI_START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OBJECT_FIELD, PRIMARRAY_FIELD, OBJECTARRAY_FIELD, STATIC_OBJECT_FIELD, STATIC_OBJECTARRAY_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD, METHOD, CONSTRUCTOR) 653 }; 654 655 #undef JNI_START_CLASS 656 #undef START_CLASS 657 #undef END_CLASS 658 #undef METHOD 659 #undef CONSTRUCTOR 660 #undef FIELD 661 #undef CHAR_FIELD 662 #undef INT_FIELD 663 #undef BOOLEAN_FIELD 664 #undef LONG_FIELD 665 #undef FLOAT_FIELD 666 #undef OBJECT_FIELD 667 #undef PRIMARRAY_FIELD 668 #undef OBJECTARRAY_FIELD 669 #undef FIELD 670 #undef OOPISH_FIELD 671 #undef STATIC_FIELD 672 #undef STATIC_OOPISH_FIELD 673 #undef STATIC_FIELD 674 #undef STATIC_OBJECT_FIELD 675 #undef STATIC_OBJECTARRAY_FIELD 676 #undef STATIC_INT_FIELD 677 #undef STATIC_BOOLEAN_FIELD 678 #undef STATIC_PRIMITIVE_FIELD 679 #undef EMPTY_CAST 680 681 #endif // SHARE_JVMCI_JVMCIJAVACLASSES_HPP 682