< prev index next >

test/compiler/jvmci/errors/TestInvalidOopMap.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.TestInvalidOopMap
  29  */
  30 
  31 package compiler.jvmci.errors;
  32 
  33 import static jdk.vm.ci.code.CompilationResult.Infopoint;
  34 
  35 import jdk.vm.ci.code.BytecodePosition;
  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.ReferenceMap;
  41 import jdk.vm.ci.code.Register;
  42 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
  43 import jdk.vm.ci.hotspot.HotSpotVMConfig;
  44 import jdk.vm.ci.meta.JavaKind;
  45 import jdk.vm.ci.meta.LIRKind;
  46 import jdk.vm.ci.meta.PlatformKind;
  47 import jdk.vm.ci.common.JVMCIError;
  48 
  49 import org.junit.Test;
  50 
  51 /**
  52  * Tests for errors in oop maps.
  53  */
  54 public class TestInvalidOopMap extends CodeInstallerTest {
  55 
  56     private static class InvalidReferenceMap extends ReferenceMap {
  57     }
  58 
  59     private void test(ReferenceMap refMap) {
  60         BytecodePosition pos = new BytecodePosition(null, dummyMethod, 0);
  61         DebugInfo info = new DebugInfo(pos);
  62         info.setReferenceMap(refMap);
  63 
  64         CompilationResult result = new CompilationResult();
  65         result.addInfopoint(new Infopoint(0, info, InfopointReason.SAFEPOINT));
  66         installCode(result);
  67     }
  68 
  69     @Test(expected = NullPointerException.class)
  70     public void testMissingReferenceMap() {
  71         test(null);
  72     }
  73 
  74     @Test(expected = JVMCIError.class)
  75     public void testInvalidReferenceMap() {
  76         test(new InvalidReferenceMap());
  77     }
  78 
  79     @Test(expected = NullPointerException.class)
  80     public void testNullOops() {
  81         test(new HotSpotReferenceMap(null, new Location[0], new int[0], 8));
  82     }
  83 
  84     @Test(expected = NullPointerException.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.TestInvalidOopMap
  29  */
  30 
  31 package compiler.jvmci.errors;
  32 
  33 import static jdk.vm.ci.code.CompilationResult.Infopoint;
  34 
  35 import jdk.vm.ci.code.BytecodePosition;
  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.ReferenceMap;
  41 import jdk.vm.ci.code.Register;
  42 import jdk.vm.ci.hotspot.HotSpotReferenceMap;
  43 import jdk.vm.ci.hotspot.HotSpotVMConfig;
  44 import jdk.vm.ci.meta.JavaKind;
  45 import jdk.vm.ci.meta.LIRKind;
  46 import jdk.vm.ci.meta.PlatformKind;
  47 import jdk.vm.ci.common.JVMCIError;
  48 
  49 import org.junit.Test;
  50 
  51 /**
  52  * Tests for errors in oop maps.
  53  */
  54 public class TestInvalidOopMap extends CodeInstallerTest {
  55 
  56     private static class InvalidReferenceMap extends ReferenceMap {
  57     }
  58 
  59     private void test(ReferenceMap refMap) {
  60         BytecodePosition pos = new BytecodePosition(null, dummyMethod, 0);
  61         DebugInfo info = new DebugInfo(pos);
  62         info.setReferenceMap(refMap);
  63 
  64         CompilationResult result = createEmptyCompilationResult();
  65         result.addInfopoint(new Infopoint(0, info, InfopointReason.SAFEPOINT));
  66         installCode(result);
  67     }
  68 
  69     @Test(expected = NullPointerException.class)
  70     public void testMissingReferenceMap() {
  71         test(null);
  72     }
  73 
  74     @Test(expected = JVMCIError.class)
  75     public void testInvalidReferenceMap() {
  76         test(new InvalidReferenceMap());
  77     }
  78 
  79     @Test(expected = NullPointerException.class)
  80     public void testNullOops() {
  81         test(new HotSpotReferenceMap(null, new Location[0], new int[0], 8));
  82     }
  83 
  84     @Test(expected = NullPointerException.class)


< prev index next >