< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/WriteBarrierAdditionTest.java
Print this page
rev 56282 : [mq]: graal
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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.
@@ -26,22 +26,20 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.referentOffset;
import java.lang.ref.WeakReference;
-import org.graalvm.compiler.api.replacements.Fold;
+import org.graalvm.compiler.api.test.Graal;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
-import org.graalvm.compiler.hotspot.GraalHotSpotVMConfigBase;
+import org.graalvm.compiler.hotspot.HotSpotBackend;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
import org.graalvm.compiler.nodes.gc.G1PostWriteBarrier;
import org.graalvm.compiler.nodes.gc.G1PreWriteBarrier;
import org.graalvm.compiler.nodes.gc.G1ReferentFieldReadBarrier;
import org.graalvm.compiler.nodes.gc.SerialWriteBarrier;
-import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
-import org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType;
import org.graalvm.compiler.nodes.memory.ReadNode;
import org.graalvm.compiler.nodes.memory.WriteNode;
import org.graalvm.compiler.nodes.memory.address.OffsetAddressNode;
import org.graalvm.compiler.nodes.spi.LoweringTool;
@@ -52,11 +50,11 @@
import org.graalvm.compiler.phases.common.WriteBarrierAdditionPhase;
import org.graalvm.compiler.phases.common.inlining.InliningPhase;
import org.graalvm.compiler.phases.common.inlining.policy.InlineEverythingPolicy;
import org.graalvm.compiler.phases.tiers.HighTierContext;
import org.graalvm.compiler.phases.tiers.MidTierContext;
-import org.graalvm.compiler.replacements.NodeIntrinsificationProvider;
+import org.graalvm.compiler.runtime.RuntimeProvider;
import org.junit.Assert;
import org.junit.Test;
import jdk.vm.ci.hotspot.HotSpotInstalledCode;
import jdk.vm.ci.meta.JavaConstant;
@@ -159,33 +157,22 @@
static WeakReference<Object> wr = new WeakReference<>(new Object());
static Container con = new Container();
/**
- * Expected 4 barriers for the Serial GC and 9 for G1 (1 ref + 4 pre + 4 post). In this test, we
- * load the correct offset of the WeakReference object so naturally we assert the presence of
- * the pre barrier.
+ * Expected 0 barrier for the Serial GC and 1 for G1. In this test, we load the correct offset
+ * of the WeakReference object so naturally we assert the presence of the pre barrier.
*/
@Test
public void test5() throws Exception {
testHelper("test5Snippet", config.useG1GC ? 1 : 0);
}
- @Override
- protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
- NodeIntrinsicPluginFactory.InjectionProvider injection = new NodeIntrinsificationProvider(getMetaAccess(), getSnippetReflection(), getProviders().getForeignCalls(), null);
- new PluginFactory_WriteBarrierAdditionTest().registerPlugins(invocationPlugins, injection);
- super.registerInvocationPlugins(invocationPlugins);
- }
-
- @Fold
- public static boolean useCompressedOops(@Fold.InjectedParameter GraalHotSpotVMConfig config) {
- return config.useCompressedOops;
- }
+ private static final boolean useCompressedOops = ((HotSpotBackend) Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend()).getRuntime().getVMConfig().useCompressedOops;
- public static Object test5Snippet() throws Exception {
- return UNSAFE.getObject(wr, useCompressedOops(GraalHotSpotVMConfigBase.INJECTED_VMCONFIG) ? 12L : 16L);
+ public Object test5Snippet() {
+ return UNSAFE.getObject(wr, useCompressedOops ? 12L : 16L);
}
/**
* The following test concerns the runtime checks of the unsafe loads. In this test, we unsafely
* load the java.lang.ref.Reference.referent field so the pre barier has to be executed.
< prev index next >