< prev index next >

test/compiler/jvmci/errors/TestInvalidDebugInfo.java

Print this page
rev 9327 : 8142387: Various JVMCI tests fail on unexpected exception
rev 9280 : 8139589: [JVMCI] throw exceptions in faulty code installation operations
Reviewed-by: twisti
Contributed-by: Roland Schatz <roland.schatz@oracle.com>


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
  27  * @compile CodeInstallerTest.java
  28  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo
  29  */
  30 
  31 package compiler.jvmci.errors;
  32 
  33 import static jdk.vm.ci.code.CompilationResult.Infopoint;
  34 
  35 import jdk.vm.ci.code.BytecodeFrame;
  36 import jdk.vm.ci.code.CompilationResult;
  37 import jdk.vm.ci.code.DebugInfo;
  38 import jdk.vm.ci.code.InfopointReason;
  39 import jdk.vm.ci.code.Location;
  40 import jdk.vm.ci.code.Register;
  41 import jdk.vm.ci.code.StackSlot;
  42 import jdk.vm.ci.code.VirtualObject;
  43 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
  44 import jdk.vm.ci.meta.JavaConstant;
  45 import jdk.vm.ci.meta.JavaKind;
  46 import jdk.vm.ci.meta.JavaValue;
  47 import jdk.vm.ci.meta.LIRKind;
  48 import jdk.vm.ci.meta.ResolvedJavaType;


  51 
  52 import org.junit.Test;
  53 
  54 /**
  55  * Tests for errors in debug info.
  56  */
  57 public class TestInvalidDebugInfo extends CodeInstallerTest {
  58 
  59     private static class UnknownJavaValue implements JavaValue {
  60     }
  61 
  62     private void test(JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
  63         test(null, values, slotKinds, locals, stack, locks);
  64     }
  65 
  66     private void test(VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
  67         BytecodeFrame frame = new BytecodeFrame(null, dummyMethod, 0, false, false, values, slotKinds, locals, stack, locks);
  68         DebugInfo info = new DebugInfo(frame, vobj);
  69         info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
  70 
  71         CompilationResult result = new CompilationResult();
  72         result.addInfopoint(new Infopoint(0, info, InfopointReason.SAFEPOINT));
  73         installCode(result);
  74     }
  75 
  76     @Test(expected = NullPointerException.class)
  77     public void testNullValues() {
  78         test(null, new JavaKind[0], 0, 0, 0);
  79     }
  80 
  81     @Test(expected = NullPointerException.class)
  82     public void testNullSlotKinds() {
  83         test(new JavaValue[0], null, 0, 0, 0);
  84     }
  85 
  86     @Test(expected = JVMCIError.class)
  87     public void testUnexpectedScopeValuesLength() {
  88         test(new JavaValue[]{JavaConstant.FALSE}, new JavaKind[0], 0, 0, 0);
  89     }
  90 
  91     @Test(expected = JVMCIError.class)




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
  27  * @compile CodeInstallerTest.java
  28  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo
  29  */
  30 
  31 package compiler.jvmci.errors;
  32 
  33 import static jdk.vm.ci.code.CompilationResult.Infopoint;
  34 
  35 import jdk.vm.ci.code.BytecodeFrame;
  36 import jdk.vm.ci.code.CompilationResult;
  37 import jdk.vm.ci.code.DebugInfo;
  38 import jdk.vm.ci.code.InfopointReason;
  39 import jdk.vm.ci.code.Location;
  40 import jdk.vm.ci.code.Register;
  41 import jdk.vm.ci.code.StackSlot;
  42 import jdk.vm.ci.code.VirtualObject;
  43 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
  44 import jdk.vm.ci.meta.JavaConstant;
  45 import jdk.vm.ci.meta.JavaKind;
  46 import jdk.vm.ci.meta.JavaValue;
  47 import jdk.vm.ci.meta.LIRKind;
  48 import jdk.vm.ci.meta.ResolvedJavaType;


  51 
  52 import org.junit.Test;
  53 
  54 /**
  55  * Tests for errors in debug info.
  56  */
  57 public class TestInvalidDebugInfo extends CodeInstallerTest {
  58 
  59     private static class UnknownJavaValue implements JavaValue {
  60     }
  61 
  62     private void test(JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
  63         test(null, values, slotKinds, locals, stack, locks);
  64     }
  65 
  66     private void test(VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
  67         BytecodeFrame frame = new BytecodeFrame(null, dummyMethod, 0, false, false, values, slotKinds, locals, stack, locks);
  68         DebugInfo info = new DebugInfo(frame, vobj);
  69         info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
  70 
  71         CompilationResult result = createEmptyCompilationResult();
  72         result.addInfopoint(new Infopoint(0, info, InfopointReason.SAFEPOINT));
  73         installCode(result);
  74     }
  75 
  76     @Test(expected = NullPointerException.class)
  77     public void testNullValues() {
  78         test(null, new JavaKind[0], 0, 0, 0);
  79     }
  80 
  81     @Test(expected = NullPointerException.class)
  82     public void testNullSlotKinds() {
  83         test(new JavaValue[0], null, 0, 0, 0);
  84     }
  85 
  86     @Test(expected = JVMCIError.class)
  87     public void testUnexpectedScopeValuesLength() {
  88         test(new JavaValue[]{JavaConstant.FALSE}, new JavaKind[0], 0, 0, 0);
  89     }
  90 
  91     @Test(expected = JVMCIError.class)


< prev index next >