61 } 62 63 public ResolvedJavaType lookupJavaType(Class<?> clazz) { 64 if (clazz == null) { 65 throw new IllegalArgumentException("Class parameter was null"); 66 } 67 return runtime.fromClass(clazz); 68 } 69 70 public HotSpotResolvedObjectType lookupJavaType(JavaConstant constant) { 71 if (constant.isNull() || !(constant instanceof HotSpotObjectConstant)) { 72 return null; 73 } 74 return ((HotSpotObjectConstant) constant).getType(); 75 } 76 77 public Signature parseMethodDescriptor(String signature) { 78 return new HotSpotSignature(runtime, signature); 79 } 80 81 public HotSpotSymbol lookupSymbol(String symbol) { 82 long pointer = runtime.getCompilerToVM().lookupSymbol(symbol); 83 if (pointer == 0) { 84 return null; 85 } else { 86 return new HotSpotSymbol(symbol, pointer); 87 } 88 } 89 90 /** 91 * {@link Field} object of {@link Method#slot}. 92 */ 93 private Field reflectionMethodSlot = getReflectionSlotField(Method.class); 94 95 /** 96 * {@link Field} object of {@link Constructor#slot}. 97 */ 98 private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class); 99 100 private static Field getReflectionSlotField(Class<?> reflectionClass) { 101 try { 102 Field field = reflectionClass.getDeclaredField("slot"); 103 field.setAccessible(true); 104 return field; 105 } catch (NoSuchFieldException | SecurityException e) { 106 throw new JVMCIError(e); 107 } 108 } 109 | 61 } 62 63 public ResolvedJavaType lookupJavaType(Class<?> clazz) { 64 if (clazz == null) { 65 throw new IllegalArgumentException("Class parameter was null"); 66 } 67 return runtime.fromClass(clazz); 68 } 69 70 public HotSpotResolvedObjectType lookupJavaType(JavaConstant constant) { 71 if (constant.isNull() || !(constant instanceof HotSpotObjectConstant)) { 72 return null; 73 } 74 return ((HotSpotObjectConstant) constant).getType(); 75 } 76 77 public Signature parseMethodDescriptor(String signature) { 78 return new HotSpotSignature(runtime, signature); 79 } 80 81 /** 82 * {@link Field} object of {@link Method#slot}. 83 */ 84 private Field reflectionMethodSlot = getReflectionSlotField(Method.class); 85 86 /** 87 * {@link Field} object of {@link Constructor#slot}. 88 */ 89 private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class); 90 91 private static Field getReflectionSlotField(Class<?> reflectionClass) { 92 try { 93 Field field = reflectionClass.getDeclaredField("slot"); 94 field.setAccessible(true); 95 return field; 96 } catch (NoSuchFieldException | SecurityException e) { 97 throw new JVMCIError(e); 98 } 99 } 100 |