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: 12+
  38  */
  39 final class GraalHotSpotVMConfigVersioned extends HotSpotVMConfigAccess {
  40 
  41     GraalHotSpotVMConfigVersioned(HotSpotVMConfigStore store) {
  42         super(store);
  43     }
  44 
  45     // JDK-8210848
  46     boolean inlineNotify = true;
  47 
  48     // JDK-8073583
  49     boolean useCRC32CIntrinsics = getFlag("UseCRC32CIntrinsics", Boolean.class);
  50 
  51     // JDK-8046936
  52     int javaThreadReservedStackActivationOffset = getFieldOffset("JavaThread::_reserved_stack_activation", Integer.class, "address");
  53     int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
  54     long throwDelayedStackOverflowErrorEntry = getFieldValue("StubRoutines::_throw_delayed_StackOverflowError_entry", Long.class, "address");
  55     long enableStackReservedZoneAddress = getAddress("SharedRuntime::enable_stack_reserved_zone");
  56 
  57     // JDK-8135085
  58     int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
  59 
  60     // JDK-8151956
  61     int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*");
  62 
  63     // JDK-8059606
  64     int invocationCounterIncrement = getConstant("InvocationCounter::count_increment", Integer.class);
  65     int invocationCounterShift = getConstant("InvocationCounter::count_shift", Integer.class);
  66 
  67     // JDK-8195142
  68     byte dirtyCardValue = getConstant("CardTable::dirty_card", Byte.class);
  69     byte g1YoungCardValue = getConstant("G1CardTable::g1_young_gen", Byte.class);
  70 
  71     // JDK-8201318
  72     int g1SATBQueueMarkingOffset = getConstant("G1ThreadLocalData::satb_mark_queue_active_offset", Integer.class);
  73     int g1SATBQueueIndexOffset = getConstant("G1ThreadLocalData::satb_mark_queue_index_offset", Integer.class);
  74     int g1SATBQueueBufferOffset = getConstant("G1ThreadLocalData::satb_mark_queue_buffer_offset", Integer.class);
  75     int g1CardQueueIndexOffset = getConstant("G1ThreadLocalData::dirty_card_queue_index_offset", Integer.class);
  76     int g1CardQueueBufferOffset = getConstant("G1ThreadLocalData::dirty_card_queue_buffer_offset", Integer.class);
  77 
  78     // JDK-8033552
  79     long heapTopAddress = getFieldValue("CompilerToVM::Data::_heap_top_addr", Long.class, "HeapWord* volatile*");
  80 
  81     // JDK-8015774
  82     long codeCacheLowBound = getFieldValue("CodeCache::_low_bound", Long.class, "address");
  83     long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class, "address");
  84 
  85     long continuationThaw = getFieldValue("StubRoutines::_cont_thaw", Long.class, "address");
  86     long continuationGetSP = getFieldValue("StubRoutines::_cont_getSP", Long.class, "address");
  87     long continuationDoYield = getFieldValue("StubRoutines::_cont_doYield", Long.class, "address");
  88 }