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 25 package org.graalvm.compiler.hotspot; 26 27 import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; 28 import jdk.vm.ci.hotspot.HotSpotVMConfigStore; 29 30 /** 31 * This is a source with different versions for various JDKs. When modifying/adding a field in this 32 * class accessed from outside this class, be sure to update the field appropriately in all source 33 * files named {@code GraalHotSpotVMConfigVersioned.java}. 34 * 35 * Fields are grouped according to the most recent JBS issue showing why they are versioned. 36 * 37 * JDK Version: 11+ 38 */ 39 final class GraalHotSpotVMConfigVersioned extends HotSpotVMConfigAccess { 40 41 GraalHotSpotVMConfigVersioned(HotSpotVMConfigStore store) { 42 super(store); 43 } 44 45 private boolean initInlineNotify() { 46 String syncKnobs = getFlag("SyncKnobs", String.class, ""); 47 return syncKnobs == null || !syncKnobs.contains("InlineNotify=0"); 48 } 49 50 // JSK-8132287 51 boolean inlineNotify = initInlineNotify(); 52 53 // JDK-8073583 54 boolean useCRC32CIntrinsics = getFlag("UseCRC32CIntrinsics", Boolean.class); 55 56 // JDK-8046936 57 int javaThreadReservedStackActivationOffset = getFieldOffset("JavaThread::_reserved_stack_activation", Integer.class, "address"); 58 int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2"); 59 long throwDelayedStackOverflowErrorEntry = getFieldValue("StubRoutines::_throw_delayed_StackOverflowError_entry", Long.class, "address"); 60 long enableStackReservedZoneAddress = getAddress("SharedRuntime::enable_stack_reserved_zone"); 61 62 // JDK-8135085 63 int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2"); 64 65 // JDK-8151956 66 int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*"); 67 68 // JDK-8059606 69 int invocationCounterIncrement = getConstant("InvocationCounter::count_increment", Integer.class); 70 int invocationCounterShift = getConstant("InvocationCounter::count_shift", Integer.class); 71 72 // JDK-8195142 73 byte dirtyCardValue = getConstant("CardTable::dirty_card", Byte.class); 74 byte g1YoungCardValue = getConstant("G1CardTable::g1_young_gen", Byte.class); 75 76 // JDK-8201318 77 int g1SATBQueueMarkingOffset = getConstant("G1ThreadLocalData::satb_mark_queue_active_offset", Integer.class); 78 int g1SATBQueueIndexOffset = getConstant("G1ThreadLocalData::satb_mark_queue_index_offset", Integer.class); 79 int g1SATBQueueBufferOffset = getConstant("G1ThreadLocalData::satb_mark_queue_buffer_offset", Integer.class); 80 int g1CardQueueIndexOffset = getConstant("G1ThreadLocalData::dirty_card_queue_index_offset", Integer.class); 81 int g1CardQueueBufferOffset = getConstant("G1ThreadLocalData::dirty_card_queue_buffer_offset", Integer.class); 82 83 // JDK-8033552 84 long heapTopAddress = getFieldValue("CompilerToVM::Data::_heap_top_addr", Long.class, "HeapWord* volatile*"); 85 86 // JDK-8015774 87 long codeCacheLowBound = getFieldValue("CodeCache::_low_bound", Long.class, "address"); 88 long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class, "address"); 89 }