use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method defaultCompilerForMethodsIsBaselineWhenVMIsBuildWithoutOptCompiler.
@Test
@Category(RequiresLackOfOptCompiler.class)
public void defaultCompilerForMethodsIsBaselineWhenVMIsBuildWithoutOptCompiler() throws Exception {
String[] compileClass = { "-method", ABSTRACT_CLASS_WITH_EMPTY_METHOD, "emptyMethod", "-" };
executeOptTestHarness(compileClass);
assertThatNumberOfBaselineCompiledMethodsIs(1);
assertThatNumberOfOptCompiledMethodsIs(0);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> testClass2 = Class.forName(ABSTRACT_CLASS_WITH_EMPTY_METHOD);
NormalMethod emptyMethod = TestingTools.getNormalMethod(testClass2, "emptyMethod");
assertThatOutputContainsMessageForCompiledMethod(emptyMethod);
removeCompiledMethodMessageFromStandardOutput(emptyMethod);
assertThatRemainingOutputIsEmptyWhenTrimmed();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method methodsWillOptCompiledIfRequested.
@Test
@Category(RequiresOptCompiler.class)
public void methodsWillOptCompiledIfRequested() throws Exception {
String[] compileClass = { "+baseline", "-methodOpt", ABSTRACT_CLASS_WITH_EMPTY_METHOD, "emptyMethod", "-" };
executeOptTestHarness(compileClass);
assertThatNumberOfBaselineCompiledMethodsIs(0);
assertThatNumberOfOptCompiledMethodsIs(1);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> testClass2 = Class.forName(ABSTRACT_CLASS_WITH_EMPTY_METHOD);
NormalMethod emptyMethod = TestingTools.getNormalMethod(testClass2, "emptyMethod");
assertThatOutputContainsMessageForCompiledMethod(emptyMethod);
removeCompiledMethodMessageFromStandardOutput(emptyMethod);
assertThatRemainingOutputIsEmptyWhenTrimmed();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method methodOptionsCanDistinguishMethodsBasedOnDescriptors.
@Test
public void methodOptionsCanDistinguishMethodsBasedOnDescriptors() throws Exception {
String[] compilePrintIntMethod = { "-methodBase", CLASS_OVERLOADED_METHODS, "print", "(I)V" };
executeOptTestHarness(compilePrintIntMethod);
assertThatNoAdditionalErrorsHaveOccurred();
assertThatNumberOfBaselineCompiledMethodsIs(1);
assertThatNumberOfOptCompiledMethodsIs(0);
assertThatNoAdditionalErrorsHaveOccurred();
Class<?> classWithOverloadedMethods = Class.forName(CLASS_OVERLOADED_METHODS);
NormalMethod printMethod = TestingTools.getNormalMethod(classWithOverloadedMethods, "print", int.class);
assertThatOutputContainsMessageForCompiledMethod(printMethod);
removeCompiledMethodMessageFromStandardOutput(printMethod);
assertThatRemainingOutputIsEmptyWhenTrimmed();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class InvocationCounts method counterTripped.
/**
* Called from baseline compiled code when a method's invocation counter
* becomes negative and thus must be handled
*
* @param id the compiled method id
*/
@Entrypoint
static synchronized void counterTripped(int id) {
// set counter to max int to avoid lots of redundant calls.
counts[id] = 0x7fffffff;
if (processed[id])
return;
processed[id] = true;
CompiledMethod cm = CompiledMethods.getCompiledMethod(id);
if (cm == null)
return;
if (VM.VerifyAssertions)
VM._assert(cm.getCompilerType() == CompiledMethod.BASELINE);
NormalMethod m = (NormalMethod) cm.getMethod();
CompilationPlan compPlan = new CompilationPlan(m, _optPlan, null, _options);
ControllerPlan cp = // 2.0 is a bogus number....
new ControllerPlan(compPlan, Controller.controllerClock, id, 2.0, 2.0, 2.0);
cp.execute();
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptCompiledMethod method isWithinUninterruptibleCode.
@Override
@Interruptible
public boolean isWithinUninterruptibleCode(Offset instructionOffset) {
NormalMethod realMethod = _mcMap.getMethodForMCOffset(instructionOffset);
// error message when no method is found.
if (realMethod == null) {
VM.sysWrite("Failing instruction offset: ");
VM.sysWrite(instructionOffset);
VM.sysWrite(" in method ");
RVMMethod thisMethod = this.getMethod();
VM.sysWrite(thisMethod.getName());
VM.sysWrite(" with descriptor ");
VM.sysWrite(thisMethod.getDescriptor());
VM.sysWrite(" declared by class with descriptor ");
VM.sysWriteln(thisMethod.getDeclaringClass().getDescriptor());
String msg = "Couldn't find a method for given instruction offset";
if (VM.VerifyAssertions) {
VM._assert(NOT_REACHED, msg);
} else {
VM.sysFail(msg);
}
}
return realMethod.isUninterruptible();
}
Aggregations