1 /* 2 * Copyright (c) 2011, 2013, 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 package com.oracle.graal.hotspot; 24 25 /** 26 * Used to communicate configuration details, runtime offsets, etc. to Graal upon compileMethod. 27 */ 28 public final class HotSpotVMConfig extends CompilerObject { 29 30 private static final long serialVersionUID = -4744897993263044184L; 31 32 HotSpotVMConfig() { 33 } 34 35 // os information, register layout, code generation, ... 36 public boolean windowsOs; 37 public int codeEntryAlignment; 38 public boolean verifyOops; 39 public boolean ciTime; 40 public boolean compileTheWorld; 41 public int compileTheWorldStartAt; 42 public int compileTheWorldStopAt; 43 public boolean printCompilation; 44 public boolean printInlining; 45 public boolean useFastLocking; 46 public boolean useTLAB; 47 public boolean useBiasedLocking; 48 public boolean usePopCountInstruction; 49 public boolean useAESIntrinsics; 50 public boolean useG1GC; 51 52 // offsets, ... 53 public int stackShadowPages; 54 55 /** 56 * The offset of the mark word in an object's header. 57 */ 58 public int markOffset; 59 60 /** 61 * The offset of the hub (i.e. Klass*) in an object's header. 62 */ 63 public int hubOffset; 64 65 /** 66 * The offset of the _prototype_header field in a Klass. 67 */ 68 public int prototypeMarkWordOffset; 69 70 /** 71 * The offset of the _subklass field in a Klass. 72 */ 73 public int subklassOffset; 74 75 /** 76 * The offset of the _next_sibling field in a Klass. 77 */ 78 public int nextSiblingOffset; 79 80 /** 81 * The offset of the array length word in an array object's header. 82 */ 83 public int arrayLengthOffset; 84 85 /** 86 * The offset of the _length field in an Array metaspace object (see array.hpp). 87 */ 88 public int metaspaceArrayLengthOffset; 89 90 /** 91 * The offset of the _data field in an Array metaspace object (see array.hpp). 92 */ 93 public int metaspaceArrayBaseOffset; 94 95 /** 96 * The offset of the _super_check_offset field in a Klass. 97 */ 98 public int superCheckOffsetOffset; 99 100 /** 101 * The offset of the _secondary_super_cache field in a Klass. 102 */ 103 public int secondarySuperCacheOffset; 104 105 /** 106 * The offset of the _secondary_supers field in a Klass. 107 */ 108 public int secondarySupersOffset; 109 110 /** 111 * The offset of the _init_state field in an instanceKlass. 112 */ 113 public int klassStateOffset; 114 115 /** 116 * The value of instanceKlass::fully_initialized. 117 */ 118 public int klassStateFullyInitialized; 119 120 /** 121 * The value of objArrayKlass::element_klass_offset(). 122 */ 123 public int arrayClassElementOffset; 124 125 /** 126 * The value of JavaThread::tlab_top_offset(). 127 */ 128 public int threadTlabTopOffset; 129 130 /** 131 * The value of JavaThread::tlab_end_offset(). 132 */ 133 public int threadTlabEndOffset; 134 135 public int threadObjectOffset; 136 137 /** 138 * The value of JavaThread::osthread_offset(). 139 */ 140 public int osThreadOffset; 141 142 /** 143 * The value of OSThread::interrupted_offset(). 144 */ 145 public int osThreadInterruptedOffset; 146 147 /** 148 * The value of markOopDesc::unlocked_value. 149 */ 150 public int unlockedMask; 151 152 /** 153 * The value of markOopDesc::biased_lock_mask_in_place. 154 */ 155 public int biasedLockMaskInPlace; 156 157 /** 158 * The value of markOopDesc::age_mask_in_place. 159 */ 160 public int ageMaskInPlace; 161 162 /** 163 * The value of markOopDesc::epoch_mask_in_place. 164 */ 165 public int epochMaskInPlace; 166 167 /** 168 * The value of markOopDesc::biased_lock_pattern. 169 */ 170 public int biasedLockPattern; 171 172 /** 173 * Identity hash code value when uninitialized. 174 */ 175 public int uninitializedIdentityHashCodeValue; 176 177 /** 178 * Offset of the pending deoptimization field. 179 */ 180 public int pendingDeoptimizationOffset; 181 182 /** 183 * Mark word right shift to get identity hash code. 184 */ 185 public int identityHashCodeShift; 186 187 /** 188 * Offset of _access_flags in a metaspace Method object. 189 */ 190 public int methodAccessFlagsOffset; 191 192 /** 193 * Offset of _intrinsic_id in a metaspace Method object. 194 */ 195 public int methodIntrinsicIdOffset; 196 197 /** 198 * Offset of _max_locals in a metaspace Method object. 199 */ 200 public int methodMaxLocalsOffset; 201 202 /** 203 * Offset of _constMethod in a metaspace Method object. 204 */ 205 public int methodConstMethodOffset; 206 207 /** 208 * Offset of _max_stack in a metaspace ConstMethod object. 209 */ 210 public int constMethodMaxStackOffset; 211 212 /** 213 * Value of extra_stack_entries() in method.hpp. 214 */ 215 public int extraStackEntries; 216 217 /** 218 * Value of JVM_ACC_HAS_FINALIZER in accessFlags.hpp. 219 */ 220 public int klassHasFinalizerFlag; 221 222 public int threadExceptionOopOffset; 223 public int threadExceptionPcOffset; 224 public long cardtableStartAddress; 225 public int cardtableShift; 226 public long safepointPollingAddress; 227 public boolean isPollingPageFar; 228 229 /** 230 * G1 Collector Related Values. 231 */ 232 public int g1CardQueueIndexOffset; 233 public int g1CardQueueBufferOffset; 234 public int logOfHRGrainBytes; 235 public int g1SATBQueueMarkingOffset; 236 public int g1SATBQueueIndexOffset; 237 public int g1SATBQueueBufferOffset; 238 239 /** 240 * The offset of the _java_mirror field (of type {@link Class}) in a Klass. 241 */ 242 public int classMirrorOffset; 243 244 public int runtimeCallStackSize; 245 246 /** 247 * The offset of the _modifier_flags field in a Klass. 248 */ 249 public int klassModifierFlagsOffset; 250 251 /** 252 * The offset of the _access_flags field in a Klass. 253 */ 254 public int klassAccessFlagsOffset; 255 256 /** 257 * The offset of the _layout_helper field in a Klass. 258 */ 259 public int klassLayoutHelperOffset; 260 261 /** 262 * Bit pattern in the klass layout helper that can be used to identify arrays. 263 */ 264 public int arrayKlassLayoutHelperIdentifier; 265 266 /** 267 * The offset of the _componentMirror field in an ArrayKlass. 268 */ 269 public int arrayKlassComponentMirrorOffset; 270 271 /** 272 * The offset of the _super field in a Klass. 273 */ 274 public int klassSuperKlassOffset; 275 276 /** 277 * The offset of the injected klass field in a {@link Class}. 278 */ 279 public int klassOffset; 280 281 /** 282 * The offset of the injected graal_mirror field in a {@link Class}. 283 */ 284 public int graalMirrorInClassOffset; 285 286 /** 287 * The offset of the _method_data field in a metaspace Method. 288 */ 289 public int methodDataOffset; 290 291 public int nmethodEntryOffset; 292 public int methodCompiledEntryOffset; 293 public int basicLockSize; 294 public int basicLockDisplacedHeaderOffset; 295 public long tlabIntArrayMarkWord; 296 public long heapEndAddress; 297 public long heapTopAddress; 298 public int threadTlabStartOffset; 299 public int threadTlabSizeOffset; 300 public int threadAllocatedBytesOffset; 301 public int tlabRefillWasteLimitOffset; 302 public int tlabRefillWasteIncrement; 303 public int tlabAlignmentReserve; 304 public int tlabSlowAllocationsOffset; 305 public int tlabFastRefillWasteOffset; 306 public int tlabNumberOfRefillsOffset; 307 public boolean tlabStats; 308 public int klassInstanceSizeOffset; 309 public boolean inlineContiguousAllocationSupported; 310 public long arrayPrototypeMarkWord; 311 public int layoutHelperLog2ElementSizeShift; 312 public int layoutHelperLog2ElementSizeMask; 313 public int layoutHelperElementTypeShift; 314 public int layoutHelperElementTypeMask; 315 public int layoutHelperElementTypePrimitiveInPlace; 316 public int layoutHelperHeaderSizeShift; 317 public int layoutHelperHeaderSizeMask; 318 public int layoutHelperOffset; 319 320 // methodData information 321 public int methodDataOopDataOffset; 322 public int methodDataOopTrapHistoryOffset; 323 public int dataLayoutHeaderSize; 324 public int dataLayoutTagOffset; 325 public int dataLayoutFlagsOffset; 326 public int dataLayoutBCIOffset; 327 public int dataLayoutCellsOffset; 328 public int dataLayoutCellSize; 329 public int bciProfileWidth; 330 public int typeProfileWidth; 331 332 // runtime stubs 333 public long newInstanceStub; 334 public long newArrayStub; 335 public long newMultiArrayStub; 336 public long inlineCacheMissStub; 337 public long handleExceptionStub; 338 public long handleDeoptStub; 339 public long monitorEnterStub; 340 public long monitorExitStub; 341 public long wbPreCallStub; 342 public long wbPostCallStub; 343 344 public long verifyOopStub; 345 public long vmErrorStub; 346 public long deoptimizeStub; 347 public long unwindExceptionStub; 348 public long osrMigrationEndStub; 349 public long registerFinalizerStub; 350 public long createNullPointerExceptionStub; 351 public long createOutOfBoundsExceptionStub; 352 public long javaTimeMillisStub; 353 public long javaTimeNanosStub; 354 public long arithmeticFremStub; 355 public long arithmeticDremStub; 356 public long arithmeticSinStub; 357 public long arithmeticCosStub; 358 public long arithmeticTanStub; 359 public long logPrimitiveStub; 360 public long logObjectStub; 361 public long logPrintfStub; 362 public int deoptReasonNone; 363 public long threadIsInterruptedStub; 364 public long identityHashCodeStub; 365 public long aescryptEncryptBlockStub; 366 public long aescryptDecryptBlockStub; 367 public long cipherBlockChainingEncryptAESCryptStub; 368 public long cipherBlockChainingDecryptAESCryptStub; 369 370 public int deoptReasonNullCheck; 371 public int deoptReasonRangeCheck; 372 public int deoptReasonClassCheck; 373 public int deoptReasonArrayCheck; 374 public int deoptReasonUnreached0; 375 public int deoptReasonTypeCheckInlining; 376 public int deoptReasonOptimizedTypeCheck; 377 public int deoptReasonNotCompiledExceptionHandler; 378 public int deoptReasonUnresolved; 379 public int deoptReasonJsrMismatch; 380 public int deoptReasonDiv0Check; 381 public int deoptReasonConstraint; 382 383 public int deoptActionNone; 384 public int deoptActionMaybeRecompile; 385 public int deoptActionReinterpret; 386 public int deoptActionMakeNotEntrant; 387 public int deoptActionMakeNotCompilable; 388 389 public int vmIntrinsicInvokeBasic; 390 public int vmIntrinsicLinkToVirtual; 391 public int vmIntrinsicLinkToStatic; 392 public int vmIntrinsicLinkToSpecial; 393 public int vmIntrinsicLinkToInterface; 394 395 public void check() { 396 assert codeEntryAlignment > 0; 397 assert stackShadowPages > 0; 398 } 399 }