8153439: do not install an empty SpeculationLog in an nmethod

Reviewed-by: iveresov, twisti
This commit is contained in:
Doug Simon 2016-04-07 08:57:26 -10:00
parent d9c49d2be5
commit 1131e05b66
14 changed files with 104 additions and 70 deletions

View File

@ -83,6 +83,21 @@ suite = {
"workingSets" : "API,JVMCI", "workingSets" : "API,JVMCI",
}, },
"jdk.vm.ci.code.test" : {
"subDir" : "test/compiler/jvmci",
"sourceDirs" : ["src"],
"dependencies" : [
"mx:JUNIT",
"jdk.vm.ci.amd64",
"jdk.vm.ci.sparc",
"jdk.vm.ci.code",
"jdk.vm.ci.hotspot",
],
"checkstyle" : "jdk.vm.ci.services",
"javaCompliance" : "1.8",
"workingSets" : "API,JVMCI",
},
"jdk.vm.ci.runtime" : { "jdk.vm.ci.runtime" : {
"subDir" : "src/jdk.vm.ci/share/classes", "subDir" : "src/jdk.vm.ci/share/classes",
"sourceDirs" : ["src"], "sourceDirs" : ["src"],

View File

@ -120,7 +120,9 @@ public class HotSpotCodeCacheProvider implements CodeCacheProvider {
resultInstalledCode = installedCode; resultInstalledCode = installedCode;
} }
int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log); HotSpotSpeculationLog speculationLog = (log != null && log.hasSpeculations()) ? (HotSpotSpeculationLog) log : null;
int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, speculationLog);
if (result != config.codeInstallResultOk) { if (result != config.codeInstallResultOk) {
String resultDesc = config.getCodeInstallResultDescription(result); String resultDesc = config.getCodeInstallResultDescription(result);
if (compiledCode instanceof HotSpotCompiledNmethod) { if (compiledCode instanceof HotSpotCompiledNmethod) {

View File

@ -38,7 +38,7 @@ public class HotSpotSpeculationLog implements SpeculationLog {
/** All speculations that have been a deoptimization reason. */ /** All speculations that have been a deoptimization reason. */
private Set<SpeculationReason> failedSpeculations; private Set<SpeculationReason> failedSpeculations;
/** Strong references to all reasons embededded in the current nmethod. */ /** Strong references to all reasons embedded in the current nmethod. */
private volatile Collection<SpeculationReason> speculations; private volatile Collection<SpeculationReason> speculations;
@Override @Override
@ -81,4 +81,9 @@ public class HotSpotSpeculationLog implements SpeculationLog {
return HotSpotObjectConstantImpl.forObject(reason); return HotSpotObjectConstantImpl.forObject(reason);
} }
@Override
public synchronized boolean hasSpeculations() {
return speculations != null && !speculations.isEmpty();
}
} }

View File

@ -56,4 +56,11 @@ public interface SpeculationLog {
* argument to the deoptimization function. * argument to the deoptimization function.
*/ */
JavaConstant speculate(SpeculationReason reason); JavaConstant speculate(SpeculationReason reason);
/**
* Returns if this log has speculations.
*
* @return true if there are speculations, false otherwise
*/
boolean hasSpeculations();
} }

View File

@ -20,15 +20,19 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.junit.Assert;
import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64;
import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.code.test.amd64.AMD64TestAssembler;
import jdk.vm.ci.code.test.sparc.SPARCTestAssembler;
import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.ConstantReflectionProvider;
@ -37,11 +41,6 @@ import jdk.vm.ci.runtime.JVMCI;
import jdk.vm.ci.runtime.JVMCIBackend; import jdk.vm.ci.runtime.JVMCIBackend;
import jdk.vm.ci.sparc.SPARC; import jdk.vm.ci.sparc.SPARC;
import org.junit.Assert;
import compiler.jvmci.code.amd64.AMD64TestAssembler;
import compiler.jvmci.code.sparc.SPARCTestAssembler;
/** /**
* Base class for code installation tests. * Base class for code installation tests.
*/ */

View File

@ -32,10 +32,11 @@
* jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc * jdk.vm.ci/jdk.vm.ci.sparc
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.DataPatchTest * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.DataPatchTest
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import jdk.vm.ci.code.Register; import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.code.site.DataSectionReference;
@ -158,7 +159,6 @@ public class DataPatchTest extends CodeInstallationTest {
}); });
} }
public static long getConstSymbol(HotSpotMetaAccessProvider meta) { public static long getConstSymbol(HotSpotMetaAccessProvider meta) {
HotSpotSymbol symbol = meta.lookupSymbol("java/lang/Object"); HotSpotSymbol symbol = meta.lookupSymbol("java/lang/Object");
return symbol.getMetaspacePointer(); return symbol.getMetaspacePointer();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -20,7 +20,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import java.lang.reflect.Method; import java.lang.reflect.Method;

View File

@ -33,23 +33,20 @@
* jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc * jdk.vm.ci/jdk.vm.ci.sparc
* @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.InterpreterFrameSizeTest * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.InterpreterFrameSizeTest
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import java.lang.reflect.Method;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaValue;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaValue;
import jdk.vm.ci.meta.ResolvedJavaMethod;
public class InterpreterFrameSizeTest extends CodeInstallationTest { public class InterpreterFrameSizeTest extends CodeInstallationTest {
HotSpotCodeCacheProvider hotspotCodeCache() { HotSpotCodeCacheProvider hotspotCodeCache() {
@ -61,7 +58,7 @@ public class InterpreterFrameSizeTest extends CodeInstallationTest {
try { try {
hotspotCodeCache().interpreterFrameSize(null); hotspotCodeCache().interpreterFrameSize(null);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
System.out.println("threw NPE as expected"); // Threw NPE as expected.
return; return;
} }
Assert.fail("expected NullPointerException"); Assert.fail("expected NullPointerException");
@ -78,7 +75,6 @@ public class InterpreterFrameSizeTest extends CodeInstallationTest {
JavaKind[] slotKinds = new JavaKind[numLocals]; JavaKind[] slotKinds = new JavaKind[numLocals];
BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0); BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
int size = hotspotCodeCache().interpreterFrameSize(frame); int size = hotspotCodeCache().interpreterFrameSize(frame);
System.out.println("Frame size is " + size + " bytes");
if (size <= 0) { if (size <= 0) {
Assert.fail("expected non-zero result"); Assert.fail("expected non-zero result");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,15 +32,16 @@
* jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc * jdk.vm.ci/jdk.vm.ci.sparc
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.SimpleCodeInstallationTest * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleCodeInstallationTest
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import jdk.vm.ci.code.Register;
import org.junit.Test; import org.junit.Test;
import jdk.vm.ci.code.Register;
/** /**
* Test simple code installation. * Test simple code installation.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,10 +32,14 @@
* jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc * jdk.vm.ci/jdk.vm.ci.sparc
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.SimpleDebugInfoTest * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleDebugInfoTest
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import org.junit.Assume;
import org.junit.Test;
import jdk.vm.ci.code.Register; import jdk.vm.ci.code.Register;
import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotConstant;
@ -45,9 +49,6 @@ import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.vm.ci.meta.Value; import jdk.vm.ci.meta.Value;
import org.junit.Assume;
import org.junit.Test;
public class SimpleDebugInfoTest extends DebugInfoTest { public class SimpleDebugInfoTest extends DebugInfoTest {
public static int intOnStack() { public static int intOnStack() {
@ -99,7 +100,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest {
testIntInLocal(compiler); testIntInLocal(compiler);
} }
public static float floatOnStack() { public static float floatOnStack() {
return 42.0f; return 42.0f;
} }
@ -149,7 +149,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest {
testFloatInLocal(compiler); testFloatInLocal(compiler);
} }
public static long longOnStack() { public static long longOnStack() {
return 42; return 42;
} }
@ -202,7 +201,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest {
testLongInLocal(compiler); testLongInLocal(compiler);
} }
public static Class<?> objectOnStack() { public static Class<?> objectOnStack() {
return SimpleDebugInfoTest.class; return SimpleDebugInfoTest.class;
} }

View File

@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,14 +32,18 @@
* jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc * jdk.vm.ci/jdk.vm.ci.sparc
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.VirtualObjectDebugInfoTest * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.VirtualObjectDebugInfoTest
*/ */
package compiler.jvmci.code; package jdk.vm.ci.code.test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import org.junit.Assert;
import org.junit.Test;
import jdk.vm.ci.code.Register; import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.VirtualObject; import jdk.vm.ci.code.VirtualObject;
import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotConstant;
@ -49,9 +53,6 @@ import jdk.vm.ci.meta.JavaValue;
import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaField;
import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.ResolvedJavaType;
import org.junit.Assert;
import org.junit.Test;
public class VirtualObjectDebugInfoTest extends DebugInfoTest { public class VirtualObjectDebugInfoTest extends DebugInfoTest {
private static class TestClass { private static class TestClass {
@ -61,11 +62,11 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest {
private float floatField; private float floatField;
private Object[] arrayField; private Object[] arrayField;
public TestClass() { TestClass() {
this.longField = 8472; this.longField = 8472;
this.intField = 42; this.intField = 42;
this.floatField = 3.14f; this.floatField = 3.14f;
this.arrayField = new Object[] { Integer.valueOf(58), this, null, Integer.valueOf(17), "Hello, World!" }; this.arrayField = new Object[]{Integer.valueOf(58), this, null, Integer.valueOf(17), "Hello, World!"};
} }
@Override @Override
@ -75,10 +76,7 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest {
} }
TestClass other = (TestClass) o; TestClass other = (TestClass) o;
if (this.longField != other.longField if (this.longField != other.longField || this.intField != other.intField || this.floatField != other.floatField || this.arrayField.length != other.arrayField.length) {
|| this.intField != other.intField
|| this.floatField != other.floatField
|| this.arrayField.length != other.arrayField.length) {
return false; return false;
} }
@ -95,6 +93,11 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest {
return true; return true;
} }
@Override
public int hashCode() {
return super.hashCode();
}
} }
public static TestClass buildObject() { public static TestClass buildObject() {

View File

@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package compiler.jvmci.code.amd64; package jdk.vm.ci.code.test.amd64;
import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64;
import jdk.vm.ci.amd64.AMD64Kind; import jdk.vm.ci.amd64.AMD64Kind;
@ -31,6 +31,7 @@ import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.test.TestAssembler;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotConstant;
import jdk.vm.ci.hotspot.HotSpotForeignCallTarget; import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
@ -39,8 +40,6 @@ import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.LIRKind; import jdk.vm.ci.meta.LIRKind;
import jdk.vm.ci.meta.VMConstant; import jdk.vm.ci.meta.VMConstant;
import compiler.jvmci.code.TestAssembler;
public class AMD64TestAssembler extends TestAssembler { public class AMD64TestAssembler extends TestAssembler {
public AMD64TestAssembler(CodeCacheProvider codeCache) { public AMD64TestAssembler(CodeCacheProvider codeCache) {
@ -161,7 +160,7 @@ public class AMD64TestAssembler extends TestAssembler {
code.emitInt(0xDEADDEAD); code.emitInt(0xDEADDEAD);
return ret; return ret;
} else { } else {
return emitLoadLong(0xDEADDEADDEADDEADl); return emitLoadLong(0xDEADDEADDEADDEADL);
} }
} }
@ -195,14 +194,16 @@ public class AMD64TestAssembler extends TestAssembler {
@Override @Override
public StackSlot emitIntToStack(Register a) { public StackSlot emitIntToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.DWORD)); StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.DWORD));
emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m32,r32 // MOV r/m32,r32
emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
return ret; return ret;
} }
@Override @Override
public StackSlot emitLongToStack(Register a) { public StackSlot emitLongToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.QWORD)); StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.QWORD));
emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m64,r64 // MOV r/m64,r64
emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
return ret; return ret;
} }
@ -221,14 +222,16 @@ public class AMD64TestAssembler extends TestAssembler {
@Override @Override
public StackSlot emitPointerToStack(Register a) { public StackSlot emitPointerToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.QWORD)); StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.QWORD));
emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m64,r64 // MOV r/m64,r64
emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
return ret; return ret;
} }
@Override @Override
public StackSlot emitNarrowPointerToStack(Register a) { public StackSlot emitNarrowPointerToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.DWORD)); StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.DWORD));
emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m32,r32 // MOV r/m32,r32
emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16);
return ret; return ret;
} }

View File

@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package compiler.jvmci.code.sparc; package jdk.vm.ci.code.test.sparc;
import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.DebugInfo;
@ -29,6 +29,7 @@ import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.test.TestAssembler;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotConstant;
@ -41,8 +42,6 @@ import jdk.vm.ci.meta.VMConstant;
import jdk.vm.ci.sparc.SPARC; import jdk.vm.ci.sparc.SPARC;
import jdk.vm.ci.sparc.SPARCKind; import jdk.vm.ci.sparc.SPARCKind;
import compiler.jvmci.code.TestAssembler;
public class SPARCTestAssembler extends TestAssembler { public class SPARCTestAssembler extends TestAssembler {
private static final int MASK13 = (1 << 13) - 1; private static final int MASK13 = (1 << 13) - 1;
@ -69,7 +68,8 @@ public class SPARCTestAssembler extends TestAssembler {
@Override @Override
public void emitPrologue() { public void emitPrologue() {
emitOp3(0b10, SPARC.sp, 0b111100, SPARC.sp, -SPARC.REGISTER_SAFE_AREA_SIZE); // SAVE sp, -128, sp // SAVE sp, -128, sp
emitOp3(0b10, SPARC.sp, 0b111100, SPARC.sp, -SPARC.REGISTER_SAFE_AREA_SIZE);
setDeoptRescueSlot(newStackSlot(LIRKind.value(SPARCKind.XWORD))); setDeoptRescueSlot(newStackSlot(LIRKind.value(SPARCKind.XWORD)));
} }
@ -195,35 +195,40 @@ public class SPARCTestAssembler extends TestAssembler {
@Override @Override
public StackSlot emitIntToStack(Register a) { public StackSlot emitIntToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.WORD)); StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.WORD));
emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STW a, [fp+offset] // STW a, [fp+offset]
emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
return ret; return ret;
} }
@Override @Override
public StackSlot emitLongToStack(Register a) { public StackSlot emitLongToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.XWORD)); StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.XWORD));
emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STX a, [fp+offset] // STX a, [fp+offset]
emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
return ret; return ret;
} }
@Override @Override
public StackSlot emitFloatToStack(Register a) { public StackSlot emitFloatToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.SINGLE)); StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.SINGLE));
emitOp3(0b11, a, 0b100100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STF a, [fp+offset] // STF a, [fp+offset]
emitOp3(0b11, a, 0b100100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
return ret; return ret;
} }
@Override @Override
public StackSlot emitPointerToStack(Register a) { public StackSlot emitPointerToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.XWORD)); StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.XWORD));
emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STX a, [fp+offset] // STX a, [fp+offset]
emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
return ret; return ret;
} }
@Override @Override
public StackSlot emitNarrowPointerToStack(Register a) { public StackSlot emitNarrowPointerToStack(Register a) {
StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.WORD)); StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.WORD));
emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STW a, [fp+offset] // STW a, [fp+offset]
emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
return ret; return ret;
} }