use of org.jikesrvm.classloader.MethodReference in project JikesRVM by JikesRVM.
the class PartialCallGraph method getCallTargets.
/**
* @param caller caller method
* @param bcIndex bytecode index in caller method
* @return the WeightedCallTargets currently associated with the
* given caller bytecodeIndex pair.
*/
public WeightedCallTargets getCallTargets(RVMMethod caller, int bcIndex) {
MethodReference callerRef = caller.getMemberRef().asMethodReference();
UnResolvedWeightedCallTargets unresolvedTargets = unresolvedCallGraph.get(new UnResolvedCallSite(callerRef, bcIndex));
if (unresolvedTargets != null) {
final RVMMethod fCaller = caller;
final int fBcIndex = bcIndex;
final PartialCallGraph pg = this;
unresolvedTargets.visitTargets(new UnResolvedWeightedCallTargets.Visitor() {
@Override
public void visit(MethodReference calleeRef, double weight) {
RVMMethod callee = calleeRef.getResolvedMember();
if (callee != null) {
pg.incrementEdge(fCaller, fBcIndex, callee, (float) weight);
}
}
});
}
return getCallTargets(new CallSite(caller, bcIndex));
}
use of org.jikesrvm.classloader.MethodReference in project JikesRVM by JikesRVM.
the class Class method getEnclosingConstructor.
public Constructor<?> getEnclosingConstructor() {
if (!(isAnonymousClass() || isLocalClass())) {
return null;
}
MethodReference enclosingMethodRef = type.asClass().getEnclosingMethod();
if (enclosingMethodRef == null) {
return null;
}
RVMMethod method = enclosingMethodRef.resolve();
if (!method.isObjectInitializer()) {
return null;
}
return JikesRVMSupport.createConstructor(method);
}
use of org.jikesrvm.classloader.MethodReference in project JikesRVM by JikesRVM.
the class Barriers method arrayStoreBarrierHelper.
/**
* Helper function for primitive array stores
*
* @param asm the assembler to generate the code in
* @param compiler the compiler instance to ensure correct parameter passing
* @param barrier the designated barrier
*/
private static void arrayStoreBarrierHelper(Assembler asm, BaselineCompilerImpl compiler, NormalMethod barrier) {
// on entry java stack contains ...|target_array_ref|array_index|value_to_store|
// Use the correct calling convention to pass parameters by register and the stack
// (size of value_to_store varies by type of array store)
MethodReference method = barrier.getMemberRef().asMethodReference();
compiler.genParameterRegisterLoad(method, false);
// call the actual write barrier
asm.generateJTOCcall(barrier.getOffset());
}
use of org.jikesrvm.classloader.MethodReference in project JikesRVM by JikesRVM.
the class Barriers method putfieldStoreBarrierHelper.
/**
* Private helper method for primitive putfields
*
* @param asm the assembler to generate the code in
* @param compiler the compiler instance to ensure correct parameter passing
* @param fieldOffset offset of the field
* @param locationMetadata meta-data about the location
* @param barrier the barrier method to call
*/
@Inline
private static void putfieldStoreBarrierHelper(Assembler asm, BaselineCompilerImpl compiler, Offset fieldOffset, int locationMetadata, NormalMethod barrier) {
// on entry the java stack contains... |object|value|
asm.emitPUSH_Imm(fieldOffset.toInt());
asm.emitPUSH_Imm(locationMetadata);
// Use the correct calling convention to pass parameters by register and the stack
// (size of value varies by type of putfield)
MethodReference method = barrier.getMemberRef().asMethodReference();
compiler.genParameterRegisterLoad(method, false);
genNullCheck(asm, T0);
asm.generateJTOCcall(barrier.getOffset());
}
use of org.jikesrvm.classloader.MethodReference in project JikesRVM by JikesRVM.
the class JNIGenericHelpers method callMethodJValuePtr.
/**
* Dispatch method call, arguments in jvalue*
* @param env the JNI environemnt for the thread
* @param objJREF a JREF index for the object
* @param methodID id of a MethodReference
* @param argAddress address of an array of jvalues (jvalue*)
* @param expectedReturnType a type reference for the expected return type
* @param nonVirtual should invocation be of the given method or should we use virtual dispatch on the object?
* @return return value of the method (boxed if primitive)
* @throws InvocationTargetException when reflective invocation fails
*/
protected static Object callMethodJValuePtr(JNIEnvironment env, int objJREF, int methodID, Address argAddress, TypeReference expectedReturnType, boolean nonVirtual) throws InvocationTargetException {
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
MethodReference mr = MemberReference.getMethodRef(methodID);
Object[] args = packageParametersFromJValuePtr(mr, argAddress);
return callMethod(obj, mr, args, expectedReturnType, nonVirtual);
} catch (Throwable unexpected) {
if (JNIFunctions.traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0;
}
}
Aggregations