src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigVersioned.java
author iveresov
Wed, 20 Jun 2018 17:30:43 -0700
changeset 50689 070b5313b2fe
parent 50609 bf414874c28f
child 50858 2d3e99a72541
permissions -rw-r--r--
8205105: VM crashes with "assert(Universe::heap()->is_in_reserved(start + words - 1)) failed: not in heap" Summary: Disable fast TLAB refill in Graal. Reviewed-by: dnsimon, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     1
/*
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     2
 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     4
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     7
 * published by the Free Software Foundation.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     8
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    13
 * accompanied this code).
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    14
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    18
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    21
 * questions.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    22
 */
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    23
package org.graalvm.compiler.hotspot;
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    24
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    25
import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    26
import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    27
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    28
/**
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    29
 * This is a source with different versions for various JDKs. When modifying/adding a field in this
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    30
 * class accessed from outside this class, be sure to update the field appropriately in all source
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    31
 * files named {@code GraalHotSpotVMConfigVersioned.java}.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    32
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    33
 * Fields are grouped according to the most recent JBS issue showing why they are versioned.
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    34
 *
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    35
 * JDK Version: 11+
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    36
 */
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    37
final class GraalHotSpotVMConfigVersioned extends HotSpotVMConfigAccess {
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    38
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    39
    GraalHotSpotVMConfigVersioned(HotSpotVMConfigStore store) {
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    40
        super(store);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    41
    }
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    42
50609
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    43
    private boolean initInlineNotify() {
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    44
        String syncKnobs = getFlag("SyncKnobs", String.class, "");
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    45
        return syncKnobs == null || !syncKnobs.contains("InlineNotify=0");
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    46
    }
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    47
50330
2cbc42a5764b 8202670: Update Graal
dlong
parents: 50083
diff changeset
    48
    // JSK-8132287
50609
bf414874c28f 8204231: Update Graal
dlong
parents: 50330
diff changeset
    49
    final boolean inlineNotify = initInlineNotify();
50330
2cbc42a5764b 8202670: Update Graal
dlong
parents: 50083
diff changeset
    50
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    51
    // JDK-8073583
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    52
    final boolean useCRC32CIntrinsics = getFlag("UseCRC32CIntrinsics", Boolean.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    53
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    54
    // JDK-8046936
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    55
    final int javaThreadReservedStackActivationOffset = getFieldOffset("JavaThread::_reserved_stack_activation", Integer.class, "address");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    56
    final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    57
    final long throwDelayedStackOverflowErrorEntry = getFieldValue("StubRoutines::_throw_delayed_StackOverflowError_entry", Long.class, "address");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    58
    final long enableStackReservedZoneAddress = getAddress("SharedRuntime::enable_stack_reserved_zone");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    59
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    60
    // JDK-8135085
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    61
    final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    62
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    63
    // JDK-8151956
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    64
    final int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    65
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    66
    // JDK-8059606
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    67
    final int invocationCounterIncrement = getConstant("InvocationCounter::count_increment", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    68
    final int invocationCounterShift = getConstant("InvocationCounter::count_shift", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    69
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    70
    // JDK-8195142
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    71
    final byte dirtyCardValue = getConstant("CardTable::dirty_card", Byte.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    72
    final byte g1YoungCardValue = getConstant("G1CardTable::g1_young_gen", Byte.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    73
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    74
    // JDK-8201318
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    75
    final int g1SATBQueueMarkingOffset = getConstant("G1ThreadLocalData::satb_mark_queue_active_offset", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    76
    final int g1SATBQueueIndexOffset = getConstant("G1ThreadLocalData::satb_mark_queue_index_offset", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    77
    final int g1SATBQueueBufferOffset = getConstant("G1ThreadLocalData::satb_mark_queue_buffer_offset", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    78
    final int g1CardQueueIndexOffset = getConstant("G1ThreadLocalData::dirty_card_queue_index_offset", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    79
    final int g1CardQueueBufferOffset = getConstant("G1ThreadLocalData::dirty_card_queue_buffer_offset", Integer.class);
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    80
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    81
    // JDK-8033552
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    82
    final long heapTopAddress = getFieldValue("CompilerToVM::Data::_heap_top_addr", Long.class, "HeapWord* volatile*");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    83
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    84
    // JDK-8015774
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    85
    final long codeCacheLowBound = getFieldValue("CodeCache::_low_bound", Long.class, "address");
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    86
    final long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class, "address");
50689
070b5313b2fe 8205105: VM crashes with "assert(Universe::heap()->is_in_reserved(start + words - 1)) failed: not in heap"
iveresov
parents: 50609
diff changeset
    87
070b5313b2fe 8205105: VM crashes with "assert(Universe::heap()->is_in_reserved(start + words - 1)) failed: not in heap"
iveresov
parents: 50609
diff changeset
    88
    // JDK-8205105
070b5313b2fe 8205105: VM crashes with "assert(Universe::heap()->is_in_reserved(start + words - 1)) failed: not in heap"
iveresov
parents: 50609
diff changeset
    89
    boolean useFastTLABRefill = false;
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents:
diff changeset
    90
}