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