use of jdk.vm.ci.meta.JavaField in project graal by oracle.
the class BytecodeParser method genGetStatic.
protected void genGetStatic(int cpi, int opcode) {
JavaField field = lookupField(cpi, opcode);
genGetStatic(field);
}
use of jdk.vm.ci.meta.JavaField in project graal by oracle.
the class BytecodeParser method genPutStatic.
protected void genPutStatic(int cpi, int opcode) {
JavaField field = lookupField(cpi, opcode);
genPutStatic(field);
}
use of jdk.vm.ci.meta.JavaField in project graal by oracle.
the class BytecodeParser method lookupField.
protected JavaField lookupField(int cpi, int opcode) {
maybeEagerlyResolve(cpi, opcode);
JavaField result = constantPool.lookupField(cpi, method, opcode);
assert !graphBuilderConfig.unresolvedIsError() || result instanceof ResolvedJavaField : "Not resolved: " + result;
if (parsingIntrinsic() || eagerInitializing) {
if (result instanceof ResolvedJavaField) {
ResolvedJavaType declaringClass = ((ResolvedJavaField) result).getDeclaringClass();
if (!declaringClass.isInitialized()) {
// See StaticInterfaceFieldTest
assert !eagerInitializing || declaringClass.isInterface() : "Declaring class not initialized but not an interface? " + declaringClass;
initialize(declaringClass);
}
}
}
assert !uninitializedIsError || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).getDeclaringClass().isInitialized()) : result;
return result;
}
use of jdk.vm.ci.meta.JavaField in project graal by oracle.
the class BytecodeParser method tryFastInlineAccessor.
/**
* Tries to inline {@code targetMethod} if it is an instance field accessor. This avoids the
* overhead of creating and using a nested {@link BytecodeParser} object.
*/
@SuppressWarnings("try")
private boolean tryFastInlineAccessor(ValueNode[] args, ResolvedJavaMethod targetMethod) {
byte[] bytecode = targetMethod.getCode();
if (bytecode != null && bytecode.length == ACCESSOR_BYTECODE_LENGTH && Bytes.beU1(bytecode, 0) == ALOAD_0 && Bytes.beU1(bytecode, 1) == GETFIELD) {
int b4 = Bytes.beU1(bytecode, 4);
if (b4 >= IRETURN && b4 <= ARETURN) {
int cpi = Bytes.beU2(bytecode, 2);
JavaField field = targetMethod.getConstantPool().lookupField(cpi, targetMethod, GETFIELD);
if (field instanceof ResolvedJavaField) {
ValueNode receiver = invocationPluginReceiver.init(targetMethod, args).get();
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
try (DebugCloseable context = openNodeContext(targetMethod, 1)) {
genGetField(resolvedField, receiver);
notifyBeforeInline(targetMethod);
printInlining(targetMethod, targetMethod, true, "inline accessor method (bytecode parsing)");
notifyAfterInline(targetMethod);
}
return true;
}
}
}
return false;
}
use of jdk.vm.ci.meta.JavaField in project graal by oracle.
the class BytecodeParser method genPutField.
protected void genPutField(int cpi, int opcode) {
JavaField field = lookupField(cpi, opcode);
genPutField(field);
}
Aggregations