use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptCompiledMethod method getDynamicLink.
/**
* Fetch symbolic reference to a method that's called
* by one of this method's instructions.
* @param dynamicLink place to put return information
* @param instructionOffset offset of machine instruction that issued
* the call
*/
@Override
public void getDynamicLink(DynamicLink dynamicLink, Offset instructionOffset) {
int bci = _mcMap.getBytecodeIndexForMCOffset(instructionOffset);
NormalMethod realMethod = _mcMap.getMethodForMCOffset(instructionOffset);
if (bci == -1 || realMethod == null) {
VM.sysFail("Mapping to source code location not available at Dynamic Linking point\n");
}
realMethod.getDynamicLink(dynamicLink, bci);
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptCompiledMethod method printStackTrace.
@Override
@Interruptible
public void printStackTrace(Offset instructionOffset, PrintLN out) {
OptMachineCodeMap map = getMCMap();
int iei = map.getInlineEncodingForMCOffset(instructionOffset);
if (iei >= 0) {
int[] inlineEncoding = map.inlineEncoding;
int bci = map.getBytecodeIndexForMCOffset(instructionOffset);
for (int j = iei; j >= 0; j = OptEncodedCallSiteTree.getParent(j, inlineEncoding)) {
int mid = OptEncodedCallSiteTree.getMethodID(j, inlineEncoding);
NormalMethod m = (NormalMethod) MemberReference.getMethodRef(mid).peekResolvedMethod();
// might be 0 if unavailable.
int lineNumber = m.getLineNumberForBCIndex(bci);
out.print("\tat ");
out.print(m.getDeclaringClass());
out.print('.');
out.print(m.getName());
out.print('(');
out.print(m.getDeclaringClass().getSourceName());
out.print(':');
out.print(lineNumber);
out.print(')');
out.println();
if (j > 0) {
bci = OptEncodedCallSiteTree.getByteCodeOffset(j, inlineEncoding);
}
}
} else {
out.print("\tat ");
out.print(method.getDeclaringClass());
out.print('.');
out.print(method.getName());
out.print('(');
out.print(method.getDeclaringClass().getSourceName());
out.print("; machine code offset: ");
out.printHex(instructionOffset.toInt());
out.print(')');
out.println();
}
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptLinker method resolveDynamicLink.
/**
* Given an opt compiler info and a machine code offset in that method's
* instruction array, performs the dynamic linking required by that
* instruction.
* <p>
* We do this by mapping back to the source RVMMethod and bytecode offset,
* then examining the bytecodes to see what field/method was being
* referenced, then calling TableBasedDynamicLinker to do the real work.
*
* @param cm the opt compiled method
* @param offset machine code offset
*/
public static void resolveDynamicLink(OptCompiledMethod cm, Offset offset) throws NoClassDefFoundError {
OptMachineCodeMap map = cm.getMCMap();
int bci = map.getBytecodeIndexForMCOffset(offset);
NormalMethod realMethod = map.getMethodForMCOffset(offset);
if (bci == -1 || realMethod == null) {
VM.sysFail("Mapping to source code location not available at Dynamic Linking point\n");
}
BytecodeStream bcodes = realMethod.getBytecodes();
bcodes.reset(bci);
int opcode = bcodes.nextInstruction();
switch(opcode) {
case JBC_getfield:
case JBC_putfield:
case JBC_getstatic:
case JBC_putstatic:
TableBasedDynamicLinker.resolveMember(bcodes.getFieldReference());
break;
case JBC_invokevirtual:
case JBC_invokestatic:
case JBC_invokespecial:
TableBasedDynamicLinker.resolveMember(bcodes.getMethodReference());
break;
case JBC_invokeinterface:
default:
if (VM.VerifyAssertions) {
VM._assert(VM.NOT_REACHED, "Unexpected case in OptLinker.resolveDynamicLink");
}
break;
}
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class BaselineCompilerImplTest method emptyStaticMethodInClassWithDynamicBridgeRequiresThirteenWordsForSSE2_FULLAndX64.
@Test
public void emptyStaticMethodInClassWithDynamicBridgeRequiresThirteenWordsForSSE2_FULLAndX64() throws Exception {
assumeThat(VM.BuildForSSE2Full, is(true));
assumeThat(VM.BuildFor64Addr, is(true));
Class<?>[] noArgs = {};
NormalMethod emptyStaticMethod = TestingTools.getNormalMethod(DynamicBridgeMethodsForTests.class, "emptyStaticMethodInClassWithDynamicBridge", noArgs);
int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(emptyStaticMethod);
assertThat(size, is(9 * WORDSIZE));
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class BaselineCompilerImplTest method emptyStaticMethodRequiresThreeWords.
@Test
public void emptyStaticMethodRequiresThreeWords() throws Exception {
Class<?>[] noArgs = {};
NormalMethod emptyStaticMethod = TestingTools.getNormalMethod(MethodsForTests.class, "emptyStaticMethodWithoutAnnotations", noArgs);
int size = BaselineCompilerImpl.calculateRequiredSpaceForFrame(emptyStaticMethod);
assertThat(size, is(3 * WORDSIZE));
}
Aggregations