hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java
changeset 35582 c32a0cc19877
parent 35148 5cfafc99d791
child 35823 59a847ec6ee3
equal deleted inserted replaced
35581:dd47cf4734f2 35582:c32a0cc19877
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo
    28  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo
    29  */
    29  */
    30 
    30 
    31 package compiler.jvmci.errors;
    31 package compiler.jvmci.errors;
    32 
    32 
    33 import static jdk.vm.ci.code.CompilationResult.Infopoint;
       
    34 
       
    35 import jdk.vm.ci.code.BytecodeFrame;
    33 import jdk.vm.ci.code.BytecodeFrame;
    36 import jdk.vm.ci.code.CompilationResult;
       
    37 import jdk.vm.ci.code.DebugInfo;
    34 import jdk.vm.ci.code.DebugInfo;
    38 import jdk.vm.ci.code.InfopointReason;
       
    39 import jdk.vm.ci.code.Location;
    35 import jdk.vm.ci.code.Location;
    40 import jdk.vm.ci.code.Register;
    36 import jdk.vm.ci.code.Register;
    41 import jdk.vm.ci.code.StackSlot;
    37 import jdk.vm.ci.code.StackSlot;
    42 import jdk.vm.ci.code.VirtualObject;
    38 import jdk.vm.ci.code.VirtualObject;
       
    39 import jdk.vm.ci.code.site.DataPatch;
       
    40 import jdk.vm.ci.code.site.Infopoint;
       
    41 import jdk.vm.ci.code.site.InfopointReason;
       
    42 import jdk.vm.ci.code.site.Site;
       
    43 import jdk.vm.ci.common.JVMCIError;
       
    44 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
    43 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
    45 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
       
    46 import jdk.vm.ci.meta.Assumptions.Assumption;
    44 import jdk.vm.ci.meta.JavaConstant;
    47 import jdk.vm.ci.meta.JavaConstant;
    45 import jdk.vm.ci.meta.JavaKind;
    48 import jdk.vm.ci.meta.JavaKind;
    46 import jdk.vm.ci.meta.JavaValue;
    49 import jdk.vm.ci.meta.JavaValue;
    47 import jdk.vm.ci.meta.LIRKind;
    50 import jdk.vm.ci.meta.LIRKind;
    48 import jdk.vm.ci.meta.ResolvedJavaType;
    51 import jdk.vm.ci.meta.ResolvedJavaType;
    49 import jdk.vm.ci.meta.Value;
    52 import jdk.vm.ci.meta.Value;
    50 import jdk.vm.ci.common.JVMCIError;
       
    51 
    53 
    52 import org.junit.Test;
    54 import org.junit.Test;
    53 
    55 
    54 /**
    56 /**
    55  * Tests for errors in debug info.
    57  * Tests for errors in debug info.
    65 
    67 
    66     private void test(VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
    68     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);
    69         BytecodeFrame frame = new BytecodeFrame(null, dummyMethod, 0, false, false, values, slotKinds, locals, stack, locks);
    68         DebugInfo info = new DebugInfo(frame, vobj);
    70         DebugInfo info = new DebugInfo(frame, vobj);
    69         info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
    71         info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
    70 
    72         installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
    71         CompilationResult result = createEmptyCompilationResult();
       
    72         result.addInfopoint(new Infopoint(0, info, InfopointReason.SAFEPOINT));
       
    73         installCode(result);
       
    74     }
    73     }
    75 
    74 
    76     @Test(expected = NullPointerException.class)
    75     @Test(expected = NullPointerException.class)
    77     public void testNullValues() {
    76     public void testNullValues() {
    78         test(null, new JavaKind[0], 0, 0, 0);
    77         test(null, new JavaKind[0], 0, 0, 0);