8148741: compiler/jvmci/code/SimpleDebugInfoTest.java fails in 'frame::sender_for_compiled_frame'
authorrschatz
Mon, 08 Feb 2016 18:52:03 +0100
changeset 35844 8a1952516600
parent 35843 67b6050f5ce8
child 35845 30025047885d
8148741: compiler/jvmci/code/SimpleDebugInfoTest.java fails in 'frame::sender_for_compiled_frame' Reviewed-by: twisti
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java
hotspot/test/compiler/jvmci/code/CodeInstallationTest.java
hotspot/test/compiler/jvmci/code/TestAssembler.java
hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java
hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java	Fri Feb 05 03:55:51 2016 -0800
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java	Mon Feb 08 18:52:03 2016 +0100
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,9 @@
  */
 package jdk.vm.ci.hotspot;
 
-public class HotSpotForeignCallTarget {
+import jdk.vm.ci.meta.InvokeTarget;
+
+public class HotSpotForeignCallTarget implements InvokeTarget {
 
     /**
      * The entry point address of this call's target.
--- a/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java	Fri Feb 05 03:55:51 2016 -0800
+++ b/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java	Mon Feb 08 18:52:03 2016 +0100
@@ -92,6 +92,7 @@
 
         asm.emitPrologue();
         compiler.compile(asm);
+        asm.emitEpilogue();
 
         HotSpotCompiledCode code = asm.finish(resolvedMethod);
         InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
--- a/hotspot/test/compiler/jvmci/code/TestAssembler.java	Fri Feb 05 03:55:51 2016 -0800
+++ b/hotspot/test/compiler/jvmci/code/TestAssembler.java	Mon Feb 08 18:52:03 2016 +0100
@@ -32,11 +32,13 @@
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.site.Call;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.DataSectionReference;
 import jdk.vm.ci.code.site.Infopoint;
 import jdk.vm.ci.code.site.InfopointReason;
+import jdk.vm.ci.code.site.Mark;
 import jdk.vm.ci.code.site.Reference;
 import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@@ -45,6 +47,7 @@
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.InvokeTarget;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.PlatformKind;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -61,6 +64,11 @@
     public abstract void emitPrologue();
 
     /**
+     * Emit the method epilogue code (e.g. the deopt handler).
+     */
+    public abstract void emitEpilogue();
+
+    /**
      * Emit code to grow the stack frame.
      *
      * @param size the size in bytes that the stack should grow
@@ -222,6 +230,14 @@
         this.deoptRescue = deoptRescue;
     }
 
+    protected void recordCall(InvokeTarget target, int size, boolean direct, DebugInfo debugInfo) {
+        sites.add(new Call(target, code.position(), size, direct, debugInfo));
+    }
+
+    protected void recordMark(Object id) {
+        sites.add(new Mark(code.position(), id));
+    }
+
     protected void recordImplicitException(DebugInfo info) {
         sites.add(new Infopoint(code.position(), info, InfopointReason.IMPLICIT_EXCEPTION));
     }
--- a/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java	Fri Feb 05 03:55:51 2016 -0800
+++ b/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java	Mon Feb 08 18:52:03 2016 +0100
@@ -33,6 +33,8 @@
 import jdk.vm.ci.code.site.DataSectionReference;
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotConstant;
+import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.VMConstant;
@@ -67,6 +69,15 @@
     }
 
     @Override
+    public void emitEpilogue() {
+        HotSpotVMConfig config = HotSpotVMConfig.config();
+        recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
+        recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 5, true, null);
+        code.emitByte(0xE8); // CALL rel32
+        code.emitInt(0xDEADDEAD);
+    }
+
+    @Override
     public void emitGrowStack(int size) {
         // SUB rsp, size
         code.emitByte(0x48);
--- a/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java	Fri Feb 05 03:55:51 2016 -0800
+++ b/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java	Mon Feb 08 18:52:03 2016 +0100
@@ -32,7 +32,9 @@
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
 import jdk.vm.ci.hotspot.HotSpotConstant;
+import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.VMConstant;
@@ -72,6 +74,14 @@
     }
 
     @Override
+    public void emitEpilogue() {
+        HotSpotVMConfig config = HotSpotVMConfig.config();
+        recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
+        recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 4, true, null);
+        code.emitInt(1 << 30); // CALL
+    }
+
+    @Override
     public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
         frameSize += SPARC.REGISTER_SAFE_AREA_SIZE;
         return super.finish(method);