Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] April CPU sync #715

Merged
merged 97 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
3e1d105
use safe abs in loop opts
davleopo Jan 18, 2024
4e6249a
fix comment
davleopo Jan 23, 2024
212002d
loop ex: allow overflow in math.abs for stride !=1 checks, it does not
davleopo Jan 23, 2024
917983d
reuse loopex.absStrideIsOne
davleopo Jan 26, 2024
2252a16
Report error if building static executable without musl libc
pejovica Feb 5, 2024
c809f5b
Fix a deadlock in IsolateAwareTruffleCompiler.tearDownIsolateOnShutdown.
christianhaeubl Feb 7, 2024
d463a8f
Backport: Register the virtual thread group unconditionally.
jovanstevanovic Feb 26, 2024
4dc78b3
Deprecate ZeroExtendNode.inputAlwaysPositive.
mur47x111 Dec 22, 2023
9ea43a6
Update -g to include all information for profiling. Fix the problem w…
jovanstevanovic Mar 8, 2024
62c2046
[GR-52324] Add InsertGuardFencesPhase into runtime compilation phases.
tzezula Feb 26, 2024
28e94b8
[GR-52616] Limit Log.exception() output.
christianhaeubl Feb 29, 2024
c61f5d9
[GR-52616] Prevent register writes from floating.
christianhaeubl Feb 29, 2024
de0832d
[GR-52434] ExitOnOutOfMemoryError must wait until HeapDumpOnOutOfMemo…
christianhaeubl Feb 29, 2024
baa88a8
[GR-52613] Improve a code installation error message.
christianhaeubl Feb 29, 2024
bdb47df
loop fragment: ensure we are not killing control flow when we have
davleopo Feb 19, 2024
f23f2cb
GR-50768 : new dev cycle GraalVM 24.0.1
marwan-hallaoui Mar 13, 2024
d653ec9
fix no module named _sqlite3 : update graalpython revision
marwan-hallaoui Mar 13, 2024
97d950f
update LockingMode constants
marwan-hallaoui Jan 29, 2024
219c699
tmp test jdk-22.0.1+2
marwan-hallaoui Jan 29, 2024
d845200
update labsjdk to jdk-22.0.1+8
marwan-hallaoui Mar 14, 2024
9566c61
re-enable JVMCI check
marwan-hallaoui Mar 14, 2024
4563097
update labsjdk 22 CE to 22.0.1+8
marwan-hallaoui Mar 14, 2024
65eba9e
add conditional elimination 17 test: contributed by Andreas Woess
davleopo Feb 23, 2024
2ec5d14
cfg: add logging decorator for cfg traversal
davleopo Feb 23, 2024
44ca3f8
simplify test further
davleopo Feb 23, 2024
7ac1e3f
MoveGuardsUpwards: fix conceptual problem with not respecting the dom
davleopo Feb 23, 2024
c347916
checkstyle fixes
davleopo Feb 23, 2024
9dff843
address review comments
davleopo Mar 4, 2024
2e311a9
[GR-52312] Backport to 24.0: Register the virtual thread group uncond…
jovanstevanovic Mar 14, 2024
5643ab6
don't try to resolve method parameter types from debugger, parse the …
javeleon Mar 1, 2024
2d82b9d
remove unsued imports
javeleon Mar 1, 2024
4ef9b60
remove unused methods
javeleon Mar 4, 2024
03c8608
deploy snapshots
marwan-hallaoui Mar 15, 2024
4024741
new API method on RootNode that allows language root node implementat…
javeleon Feb 20, 2024
4f50bc2
pickup new API method to find a leaf (call node) node from a root nod…
javeleon Feb 20, 2024
3f1a5c7
implement new RootNode API in EspressoRootNode. Disable stepping when…
javeleon Feb 20, 2024
6f4e1d4
make sure all native and substitution methods return the root node as…
javeleon Feb 21, 2024
58d2d0e
simplify BciProvider hierarchy by providing default implementations
javeleon Feb 21, 2024
ad33867
remove redundant class init checks since those will be done when crea…
javeleon Feb 21, 2024
ab7434c
Skip bci check, we end up returning null from the default implementat…
javeleon Feb 21, 2024
1e7a662
only attempt to get next bci when 0 or above. Takes out the -2 defaul…
javeleon Feb 22, 2024
0388815
remove disable stepping from verifier.
javeleon Feb 22, 2024
c68480c
go back to workaround for finding caller in DebuggerSession
javeleon Feb 27, 2024
84067d2
more precise disabling of stepping when resolving constants from with…
javeleon Feb 27, 2024
073a26b
make sure to search for the instrumentable espresso root node when lo…
javeleon Feb 27, 2024
291b9a4
unused import
javeleon Feb 27, 2024
3507a72
reformat code
javeleon Feb 27, 2024
8fa723c
minor review fixes
javeleon Feb 27, 2024
0948c93
only do class init for invoke static opcodes
javeleon Feb 27, 2024
b1ae61e
unused import
javeleon Feb 27, 2024
1d9afbe
minor code formatting fix
javeleon Feb 27, 2024
a497548
don't apply the workaround to use the root node if there was a call n…
javeleon Feb 28, 2024
93fa7be
simplify method
javeleon Mar 1, 2024
717634d
remove suppressed warning
javeleon Mar 1, 2024
8ed087a
refactor boundary call and use transfer to interpreter when disabling…
javeleon Mar 4, 2024
b660840
suppress warning
javeleon Mar 4, 2024
dfe0563
Fix an incorrect option.
fniephaus Feb 19, 2024
900e7ab
Fix printed values in `-march` user errors.
fniephaus Feb 19, 2024
7270b53
Document `-O` and `-march` options.
fniephaus Feb 19, 2024
d5c625e
Document list of build artifacts.
fniephaus Feb 20, 2024
d1f07af
[GR-52602] Backport to 24.0 : Update -g to include all information fo…
jovanstevanovic Mar 15, 2024
8075879
[GR-52502] Backport to 24.0: MoveGuardsUpwards: respect dom tree.
hamzaGhaissi Mar 15, 2024
8c2dec8
[GR-52468] Backport to 24.0: Fix NPE in JDWP when debugger asks for l…
OracleLabsAutomation Mar 15, 2024
84b5a74
ci: reenable labsjdk-ee-latest vs oraclejdk-latest assert
zapster Mar 15, 2024
b4a1c41
ci: update oraclejdk-latest to jdk-22.0.1+8
zapster Mar 15, 2024
1b91711
do not use release artifacts
marwan-hallaoui Mar 15, 2024
99d81ab
[GR-52696] Update labsjdk to 22.0.1+8-jvmci-b01.
marwan-hallaoui Mar 15, 2024
8add253
[GR-52277] Fix a deadlock in IsolateAwareTruffleCompiler.tearDownIsol…
christianhaeubl Mar 18, 2024
23452e9
[GR-52224] Backport to 24.0: loop fragment: ensure we are not killing…
selhagani Mar 18, 2024
66eef37
[GR-52457] Backport to 24.0: Fix single stepping in Espresso JDWP whe…
OracleLabsAutomation Mar 18, 2024
06f31df
[GR-52466] Backport to 24.0: Upgrading the underlying Node.js to vers…
iamstolis Mar 18, 2024
289bf3d
[GR-52750] Backport to 24.0: Report error if building static executab…
pejovica Mar 18, 2024
dd4b214
[GR-51529] FileSystemsTest#testSetAttribute() fails on JDK-23-linux.
tzezula Jan 22, 2024
4c2a30b
[GR-52657] Fix simplification of always-deopt FixedGuard.
rmosaner Mar 13, 2024
0040203
[GR-52246] Backport to 24.0: Document `-O`, `-march`, and build artif…
OracleLabsAutomation Mar 19, 2024
9ddfa50
[GR-51529] FileSystemsTest#testSetAttribute() fails on JDK-23-linux.
tzezula Mar 21, 2024
5af1a18
[GR-52623] Backport to 24.0: Add InsertGuardFencesPhase into runtime …
tzezula Mar 21, 2024
2485645
pi node: guard against deletion in recursion
davleopo Mar 13, 2024
6831b6b
[GR-52735] Backport to 24.0: Fix simplification of always-deopt Fixed…
OracleLabsAutomation Mar 21, 2024
558d1ed
[GR-52840] Backport to 24.0: Instanceof operator should check whether…
iamstolis Mar 22, 2024
d1d77f3
[GR-52708] Backport to 24.0: pi node: guard against deletion in recur…
aelmassa Mar 22, 2024
607caec
[GR-52532] Backport to 24.0: Deprecate ZeroExtendNode.inputAlwaysPosi…
mur47x111 Mar 25, 2024
bf0bb9b
Backport [GR-18163] Fix rb_global_variable() for Float and bignum val…
andrykonchin Mar 26, 2024
7e9d49f
[GR-52921] Remove DumpTopDeoptimizedFrame.
christianhaeubl Mar 26, 2024
1a19902
[GR-52921] Mark installDeoptimizedFrame() as @Uninterruptible.
christianhaeubl Mar 26, 2024
5e5eb61
Move checkstyle file.
ansalond Feb 15, 2024
97f9971
Remove the GraalVM Component Updater (gu).
ansalond Feb 6, 2024
0ded87c
Remove references to the removed `gu` component.
ansalond Feb 20, 2024
af65204
[GR-52434] [GR-52613] [GR-52616] [GR-52921] Backport to 24.0: Small f…
christianhaeubl Mar 27, 2024
738a5e0
[GR-52910] Backport to 24.0: Fix caching of Regexps.
andrykonchin Mar 27, 2024
812049f
[GR-51666] Backport to 24.0: Use safe abs in loop opts.
elkorchi Mar 27, 2024
e9edc20
basic array copy: less virtualization for illegal values
davleopo Mar 27, 2024
83f9932
[GR-51274] Backport removal of the GraalVM Component Updater (gu) and…
ansalond Mar 28, 2024
fa07fff
[GR-52946] Backport to 24.0 : GH-8638: Correctness problem when Syste…
davleopo Mar 29, 2024
3a9a3fe
GR-53257 : release GraalVM 24.0.1
marwan-hallaoui Apr 5, 2024
d3ba9c4
follow up fix: graalpython import
marwan-hallaoui Apr 5, 2024
c5c3818
April 2024 CPU sync: Merge tag 'vm-ce-24.0.1' into mandrel/24.0
zakkak Apr 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions ci/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ local common_json = import "../common.json";
assert
local _labsjdk = common_json.jdks["labsjdk-ee-latest"];
local _oraclejdk = common_json.jdks["oraclejdk-latest"];
local _ov = "ee-%s+%s" % [_oraclejdk.version, _oraclejdk.build_id];
local _lv = _labsjdk.version;
local _ov = _oraclejdk.build_id;
local _lv = std.strReplace(_labsjdk.version, "ee-", "jdk-");
# Skip the check if we are not using a labsjdk. This can happen on JDK integration branches.
local no_labsjdk = _labsjdk.name != "labsjdk";
assert no_labsjdk || std.startsWith(_lv, _ov) : "update oraclejdk-latest to match labsjdk-ee-latest: %s+%s vs %s" % [_oraclejdk.version, _oraclejdk.build_id, _labsjdk.version];
Expand Down
14 changes: 7 additions & 7 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-sulong", "platformspecific": true },

"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "36", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+36-jvmci-b02", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+36-jvmci-b02-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+36-jvmci-b02-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+36-jvmci-b02", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+36-jvmci-b02-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+36-jvmci-b02-sulong", "platformspecific": true }
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "jdk-22.0.1+8", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22.0.1+8-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22.0.1+8-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22.0.1+8-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22.0.1+8-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22.0.1+8-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22.0.1+8-jvmci-b01-sulong", "platformspecific": true }
},

"eclipse": {
Expand Down
2 changes: 1 addition & 1 deletion compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"sourceinprojectwhitelist" : [],

"groupId" : "org.graalvm.compiler",
"version" : "24.0.0.1",
"version" : "24.0.1.0",
"release" : False,
"url" : "http://www.graalvm.org/",
"developer" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.graal.compiler.core.test;

import java.util.EnumSet;

import org.junit.Test;

import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.core.common.GraalOptions;
import jdk.graal.compiler.options.OptionValues;
import jdk.vm.ci.meta.DeoptimizationReason;

public class ConditionalEliminationTest17 extends ConditionalEliminationTestBase {

static final class A {
}

static final class B {
int value = 1337;

int value() {
return value;
}
}

private static boolean equals(byte[] a, byte[] b) {
if (a == b) {
return true;
} else if (a.length != b.length) {
return false;
} else {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
}
}

private static final Object X = new Object();
private static final Object Y = new Object();

public static int test1Snippet(byte[][] haystack, byte[] needle, Object[] otherValues) {
Object someValue = otherValues[0];
Object anotherValue1 = otherValues[1];
Object anotherValue2 = otherValues[2];
if (haystack.length != 0) {
for (int i = 0; i < haystack.length; i++) {
byte[] hay = haystack[i];
if (equals(hay, needle)) {
int result = 42;
if (anotherValue1 == X) {
if (anotherValue2 == Y) {
result++;
GraalDirectives.controlFlowAnchor();
}
GraalDirectives.controlFlowAnchor();
}
if (someValue.getClass() != A.class) {
GraalDirectives.deoptimizeAndInvalidate();
}
GraalDirectives.controlFlowAnchor();
return result;
}
}
}
return ((B) someValue).value();
}

@Test
public void test1() {
Object[] args = {new byte[][]{"foo".getBytes(), "bar".getBytes()}, "neither".getBytes(), new Object[]{new B(), X, Y}};
test(getInitialOptions(), EnumSet.allOf(DeoptimizationReason.class), "test1Snippet", args);
}

public static int test2Snippet(byte[][] haystack, byte[] needle, Object[] otherValues) {
Object someValue = otherValues[0];
Object anotherValue1 = otherValues[1];
Object anotherValue2 = otherValues[2];
if (haystack.length != 0) {
for (int i = 0; i < haystack.length; i++) {
byte[] hay = haystack[i];
if (equals(hay, needle)) {
int result = 42;
if (anotherValue1 == X) {
if (anotherValue2 == Y) {
result++;
GraalDirectives.controlFlowAnchor();
}
GraalDirectives.controlFlowAnchor();
}
if (someValue == null || someValue.getClass() != A.class) {
GraalDirectives.deoptimizeAndInvalidate();
}
GraalDirectives.controlFlowAnchor();
return result;
}
}
}
return ((B) someValue).value();
}

@Test
public void test2() {
Object[] args = {new byte[][]{"foo".getBytes(), "bar".getBytes()}, "bad".getBytes(), new Object[]{new B(), X, Y}};
test(getInitialOptions(), EnumSet.allOf(DeoptimizationReason.class), "test2Snippet", args);
}

// simplified and reduced version of equals (semantics of this method is not relevant, only IR
// shape)
private static boolean simpleEquals(byte[][] a) {
for (int i = 0; i < a.length; i++) {
if (GraalDirectives.sideEffect(i) == 123) {
return true;
}
}
return false;

}

// simplified and reduced version of test1Snippet (semantics of this method is not relevant,
// only IR shape)
@SuppressWarnings("unused")
public static int test3Snippet(byte[][] haystack, byte[] needle, Object someValue, Object anotherValue1) {
for (int i = 0; i < haystack.length; i++) {
if (simpleEquals(haystack)) {
int result = 42;
if (anotherValue1 == X) {
GraalDirectives.controlFlowAnchor();
}
if (someValue.getClass() != A.class) {
GraalDirectives.deoptimizeAndInvalidate();
}
return result;
}
}
return 0;
}

@Test
public void test3() {
Object[] args = {new byte[][]{"foo".getBytes(), "bar".getBytes()}, "neither".getBytes(), X, Y};
OptionValues opt = new OptionValues(getInitialOptions(), GraalOptions.OptFloatingReads, false);
test(opt, EnumSet.allOf(DeoptimizationReason.class), "test3Snippet", args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.graal.compiler.core.test;

import org.junit.Test;

import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.core.common.type.StampFactory;
import jdk.graal.compiler.nodes.FixedGuardNode;
import jdk.graal.compiler.nodes.GraphState;
import jdk.graal.compiler.nodes.PiNode;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.graal.compiler.nodes.java.LoadFieldNode;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.phases.BasePhase;
import jdk.graal.compiler.phases.tiers.HighTierContext;
import jdk.graal.compiler.phases.tiers.Suites;
import jdk.graal.compiler.virtual.phases.ea.FinalPartialEscapePhase;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;

/**
* Tests that correct removal of always deoptimizing {@link FixedGuardNode}s in the presence of
* floating reads. This test modifies the graph after PEA to introduce a {@link FixedGuardNode} in a
* branch which is dominated by another {@link FixedGuardNode} with the inverted condition.
* Replacing the always-deopt guard must ensure a proper cleanup of all attached floating reads.
* This is tested by a floating read for which the removed guard ensures non-nullness of the read
* object. If this read would survive the removal of the guard, a segfault would be triggered. The
* guard branch is deleted in midtier after conditional elimination.
*/
public class FixedGuardSimplificationTest extends GraalCompilerTest {

public static class A {
B b;

public A(B b) {
this.b = b;
}
}

public static class B {
A a;
}

public static void snippet(A a, A a2, int x) {
guardingNull(a);
if (x == 0) {
// a2 is replaced by a1 after FinalPEA
guardingNonNull(a2);
B b = a.b;
A ba = b.a;
GraalDirectives.blackhole(ba);
}
}

@Override
protected Suites createSuites(OptionValues opts) {
Suites s = super.createSuites(opts);
s.getHighTier().findPhase(FinalPartialEscapePhase.class).add(new BasePhase<HighTierContext>() {

@Override
protected void run(StructuredGraph graph, HighTierContext context) {
FixedGuardNode guard = graph.getNodes().filter(FixedGuardNode.class).first();
FixedGuardNode placeholderGuard = graph.getNodes().filter(FixedGuardNode.class).snapshot().get(1);

/*
* Makes the inner guard use the inverted condition of the dominating, outer guard
* and adds the corresponding Pi. This can happen during PartialEscapeAnalysis.
*/
placeholderGuard.setCondition(guard.getCondition(), true);
ValueNode nullProven = (ValueNode) guard.getCondition().asNode().inputs().first();
PiNode pi = (PiNode) graph.addWithoutUnique(PiNode.create(nullProven, StampFactory.objectNonNull(), placeholderGuard));
LoadFieldNode lf = graph.getNodes().filter(LoadFieldNode.class).first();
lf.setObject(pi);
}

@Override
public java.util.Optional<NotApplicable> notApplicableTo(GraphState graphState) {
return ALWAYS_APPLICABLE;
}
});
return s;
}

private static <T> T guardingNull(T value) {
if (value != null) {
GraalDirectives.deoptimize(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode, true);
}
return value;
}

private static <T> T guardingNonNull(T value) {
if (value == null) {
GraalDirectives.deoptimize(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode, true);
}
return value;
}

@Test
public void test() throws InvalidInstalledCodeException {
InstalledCode code = getCode(getResolvedJavaMethod("snippet"));
boolean exceptionSeen = false;
try {
code.executeVarargs(null, new A(new B()), 0);
} catch (NullPointerException npe) {
exceptionSeen = true;
}
assert exceptionSeen : "Test expects a NPE to be thrown!";
assert !code.isValid() : "Test expects the code to have deopted!";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ private HotSpotGraalRuntime.HotSpotGC getSelectedGC() throws GraalError {
// of the mark word.
public final int lockingMode = getFlag("LockingMode", Integer.class);

public final int lockingModeMonitor = getConstant("LockingMode::LM_MONITOR", Integer.class, 0, JDK >= 22 && JDK_BUILD >= 18);
public final int lockingModeStack = getConstant("LockingMode::LM_LEGACY", Integer.class, 1, JDK >= 22 && JDK_BUILD >= 18);
public final int lockingModeLightweight = getConstant("LockingMode::LM_LIGHTWEIGHT", Integer.class, 2, JDK >= 22 && JDK_BUILD >= 18);
public final int lockingModeMonitor = getConstant("LockingMode::LM_MONITOR", Integer.class, 0, JDK >= 22);
public final int lockingModeStack = getConstant("LockingMode::LM_LEGACY", Integer.class, 1, JDK >= 22);
public final int lockingModeLightweight = getConstant("LockingMode::LM_LIGHTWEIGHT", Integer.class, 2, JDK >= 22);

public final boolean foldStableValues = getFlag("FoldStableValues", Boolean.class);
public final int maxVectorSize = getFlag("MaxVectorSize", Integer.class);
Expand Down Expand Up @@ -270,7 +270,7 @@ public final int arrayOopDescLengthOffset() {

public final int threadIsInVTMSTransitionOffset = getFieldOffset("JavaThread::_is_in_VTMS_transition", Integer.class, "bool");
public final int threadIsInTmpVTMSTransitionOffset = getFieldOffset("JavaThread::_is_in_tmp_VTMS_transition", Integer.class, "bool");
public final int threadIsDisableSuspendOffset = getFieldOffset("JavaThread::_is_disable_suspend", Integer.class, "bool", -1, JDK >= 22 && JDK_BUILD >= 31);
public final int threadIsDisableSuspendOffset = getFieldOffset("JavaThread::_is_disable_suspend", Integer.class, "bool", -1, JDK >= 22);

public final int javaLangThreadJFREpochOffset = getFieldValue("java_lang_Thread::_jfr_epoch_offset", Integer.class, "int");
public final int javaLangThreadTIDOffset = getFieldValue("java_lang_Thread::_tid_offset", Integer.class, "int");
Expand Down Expand Up @@ -351,7 +351,7 @@ public int threadLastJavaFpOffset() {
public final int objectMonitorEntryList = getFieldOffset("ObjectMonitor::_EntryList", Integer.class, "ObjectWaiter*");
public final int objectMonitorSucc = getFieldOffset("ObjectMonitor::_succ", Integer.class, "JavaThread*");

public final long objectMonitorAnonymousOwner = getConstant("ObjectMonitor::ANONYMOUS_OWNER", Long.class, 1L, JDK >= 22 && JDK_BUILD >= 18);
public final long objectMonitorAnonymousOwner = getConstant("ObjectMonitor::ANONYMOUS_OWNER", Long.class, 1L, JDK >= 22);

public final int markWordNoHashInPlace = getConstant("markWord::no_hash_in_place", Integer.class);
public final int markWordNoLockInPlace = getConstant("markWord::no_lock_in_place", Integer.class);
Expand Down Expand Up @@ -599,9 +599,9 @@ private long getZGCAddressField(String name) {
// Tracking of the number of monitors held by the current thread. This is used by loom but in
// JDK 20 was enabled by default to ensure it was correctly implemented.
public final int threadHeldMonitorCountOffset = getFieldOffset("JavaThread::_held_monitor_count", Integer.class, JDK >= 22 ? "intx" : "int64_t");
public final int threadLockStackOffset = getFieldOffset("JavaThread::_lock_stack", Integer.class, "LockStack", -1, JDK >= 22 && JDK_BUILD >= 18);
public final int lockStackTopOffset = getFieldOffset("LockStack::_top", Integer.class, "uint32_t", -1, JDK >= 22 && JDK_BUILD >= 18);
public final int lockStackEndOffset = getConstant("LockStack::_end_offset", Integer.class, -1, JDK >= 22 && JDK_BUILD >= 18);
public final int threadLockStackOffset = getFieldOffset("JavaThread::_lock_stack", Integer.class, "LockStack", -1, JDK >= 22);
public final int lockStackTopOffset = getFieldOffset("LockStack::_top", Integer.class, "uint32_t", -1, JDK >= 22);
public final int lockStackEndOffset = getConstant("LockStack::_end_offset", Integer.class, -1, JDK >= 22);

public final long throwAndPostJvmtiExceptionAddress = getAddress("JVMCIRuntime::throw_and_post_jvmti_exception");
public final long throwKlassExternalNameExceptionAddress = getAddress("JVMCIRuntime::throw_klass_external_name_exception");
Expand Down
Loading
Loading