test/compiler/jvmci/code/SimpleDebugInfoTest.java

Print this page




 200         return SimpleDebugInfoTest.class;
 201     }
 202 
 203     private void testObjectOnStack(DebugInfoCompiler compiler) {
 204         test(compiler, getMethod("objectOnStack"), 2, JavaKind.Object);
 205     }
 206 
 207     public static Class<?> objectInLocal() {
 208         Class<?> local = SimpleDebugInfoTest.class;
 209         return local;
 210     }
 211 
 212     private void testObjectInLocal(DebugInfoCompiler compiler) {
 213         test(compiler, getMethod("objectInLocal"), 3, JavaKind.Object);
 214     }
 215 
 216     @Test
 217     public void testConstObject() {
 218         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 219         DebugInfoCompiler compiler = (asm, values) -> {
 220             values[0] = type.getJavaClass();
 221             return null;
 222         };
 223         testObjectOnStack(compiler);
 224         testObjectInLocal(compiler);
 225     }
 226 
 227     @Test
 228     public void testRegObject() {
 229         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 230         DebugInfoCompiler compiler = (asm, values) -> {
 231             Register reg = asm.emitLoadPointer((HotSpotConstant) type.getJavaClass());
 232             values[0] = reg.asValue(target.getLIRKind(JavaKind.Object));
 233             return null;
 234         };
 235         testObjectOnStack(compiler);
 236         testObjectInLocal(compiler);
 237     }
 238 
 239     @Test
 240     public void testStackObject() {
 241         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 242         DebugInfoCompiler compiler = (asm, values) -> {
 243             Register reg = asm.emitLoadPointer((HotSpotConstant) type.getJavaClass());
 244             values[0] = asm.emitPointerToStack(reg);
 245             return null;
 246         };
 247         testObjectOnStack(compiler);
 248         testObjectInLocal(compiler);
 249     }
 250 
 251     @Test
 252     public void testRegNarrowObject() {
 253         Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
 254         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 255         DebugInfoCompiler compiler = (asm, values) -> {
 256             HotSpotConstant wide = (HotSpotConstant) type.getJavaClass();
 257             Register reg = asm.emitLoadPointer((HotSpotConstant) wide.compress());
 258             values[0] = reg.asValue(asm.narrowOopKind);
 259             return null;
 260         };
 261         testObjectOnStack(compiler);
 262         testObjectInLocal(compiler);
 263     }
 264 
 265     @Test
 266     public void testStackNarrowObject() {
 267         Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
 268         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 269         DebugInfoCompiler compiler = (asm, values) -> {
 270             HotSpotConstant wide = (HotSpotConstant) type.getJavaClass();
 271             Register reg = asm.emitLoadPointer((HotSpotConstant) wide.compress());
 272             values[0] = asm.emitNarrowPointerToStack(reg);
 273             return null;
 274         };
 275         testObjectOnStack(compiler);
 276         testObjectInLocal(compiler);
 277     }
 278 }


 200         return SimpleDebugInfoTest.class;
 201     }
 202 
 203     private void testObjectOnStack(DebugInfoCompiler compiler) {
 204         test(compiler, getMethod("objectOnStack"), 2, JavaKind.Object);
 205     }
 206 
 207     public static Class<?> objectInLocal() {
 208         Class<?> local = SimpleDebugInfoTest.class;
 209         return local;
 210     }
 211 
 212     private void testObjectInLocal(DebugInfoCompiler compiler) {
 213         test(compiler, getMethod("objectInLocal"), 3, JavaKind.Object);
 214     }
 215 
 216     @Test
 217     public void testConstObject() {
 218         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 219         DebugInfoCompiler compiler = (asm, values) -> {
 220             values[0] = constantReflection.asJavaClass(type);
 221             return null;
 222         };
 223         testObjectOnStack(compiler);
 224         testObjectInLocal(compiler);
 225     }
 226 
 227     @Test
 228     public void testRegObject() {
 229         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 230         DebugInfoCompiler compiler = (asm, values) -> {
 231             Register reg = asm.emitLoadPointer((HotSpotConstant) constantReflection.asJavaClass(type));
 232             values[0] = reg.asValue(target.getLIRKind(JavaKind.Object));
 233             return null;
 234         };
 235         testObjectOnStack(compiler);
 236         testObjectInLocal(compiler);
 237     }
 238 
 239     @Test
 240     public void testStackObject() {
 241         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 242         DebugInfoCompiler compiler = (asm, values) -> {
 243             Register reg = asm.emitLoadPointer((HotSpotConstant) constantReflection.asJavaClass(type));
 244             values[0] = asm.emitPointerToStack(reg);
 245             return null;
 246         };
 247         testObjectOnStack(compiler);
 248         testObjectInLocal(compiler);
 249     }
 250 
 251     @Test
 252     public void testRegNarrowObject() {
 253         Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
 254         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 255         DebugInfoCompiler compiler = (asm, values) -> {
 256             HotSpotConstant wide = (HotSpotConstant) constantReflection.asJavaClass(type);
 257             Register reg = asm.emitLoadPointer((HotSpotConstant) wide.compress());
 258             values[0] = reg.asValue(asm.narrowOopKind);
 259             return null;
 260         };
 261         testObjectOnStack(compiler);
 262         testObjectInLocal(compiler);
 263     }
 264 
 265     @Test
 266     public void testStackNarrowObject() {
 267         Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
 268         ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
 269         DebugInfoCompiler compiler = (asm, values) -> {
 270             HotSpotConstant wide = (HotSpotConstant) constantReflection.asJavaClass(type);
 271             Register reg = asm.emitLoadPointer((HotSpotConstant) wide.compress());
 272             values[0] = asm.emitNarrowPointerToStack(reg);
 273             return null;
 274         };
 275         testObjectOnStack(compiler);
 276         testObjectInLocal(compiler);
 277     }
 278 }