use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class GenerationContextTest method packagePrivateMakeLocalReturnsRegWithInheritedFlagsAndGuard.
@Test
public void packagePrivateMakeLocalReturnsRegWithInheritedFlagsAndGuard() throws Exception {
NormalMethod nm = TestingTools.getNormalMethod(MethodsForTests.class, "emptyInstanceMethodWithoutAnnotations");
OptOptions opts = new OptOptions();
GenerationContext gc = new GenerationContext(nm, null, null, opts, null);
int localNumber = 0;
TypeReference localType = nm.getDeclaringClass().getTypeRef();
RegisterOperand regOp = gc.makeLocal(localNumber, localType);
TrueGuardOperand guard = new TrueGuardOperand();
regOp.setGuard(guard);
regOp.setParameter();
regOp.setNonVolatile();
regOp.setExtant();
regOp.setDeclaredType();
regOp.setPreciseType();
regOp.setPositiveInt();
RegisterOperand newRegOpWithInheritance = gc.makeLocal(localNumber, regOp);
Operand scratchObject = newRegOpWithInheritance.getGuard();
assertTrue(scratchObject.isTrueGuard());
assertTrue(newRegOpWithInheritance.isParameter());
assertTrue(newRegOpWithInheritance.isNonVolatile());
assertTrue(newRegOpWithInheritance.isExtant());
assertTrue(newRegOpWithInheritance.isDeclaredType());
assertTrue(newRegOpWithInheritance.isPreciseType());
assertTrue(newRegOpWithInheritance.isPositiveInt());
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class GenerationContextTest method resyncDoesNotDeleteNullCheckGuardsThatMapToUsedRegisters.
@Test
public void resyncDoesNotDeleteNullCheckGuardsThatMapToUsedRegisters() throws Exception {
NormalMethod nm = TestingTools.getNormalMethod(MethodsForTests.class, "emptyInstanceMethodWithoutAnnotations");
OptOptions opts = new OptOptions();
GenerationContext gc = new GenerationContext(nm, null, null, opts, null);
RegisterOperand thisLocal = gc.makeLocal(0, nm.getDeclaringClass().getTypeRef());
Register thisReg = thisLocal.getRegister();
RegisterOperand thisNullCheckGuard = gc.makeNullCheckGuard(thisReg);
assertNotNull(thisNullCheckGuard);
gc.resync();
RegisterOperand newNullCheckGuard = gc.makeNullCheckGuard(thisReg);
assertTrue(newNullCheckGuard.sameRegisterPropertiesAs(thisNullCheckGuard));
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptTestHarness method compileMethodsInVector.
private void compileMethodsInVector() {
// Compile all baseline methods first
int size = baselineMethodVector.size();
output.sysOutPrintln("Compiling " + size + " methods baseline");
// Compile all methods in baseline vector
for (int i = 0; i < size; i++) {
NormalMethod method = (NormalMethod) baselineMethodVector.get(i);
CompiledMethod cm = null;
cm = BaselineCompiler.compile(method);
method.replaceCompiledMethod(cm);
if (printCodeAddress) {
output.sysOutPrintln(compiledMethodMessage(method));
}
}
// Now compile all methods in opt vector
size = optMethodVector.size();
output.sysOutPrintln("Compiling " + size + " methods opt");
for (int i = 0; i < size; i++) {
NormalMethod method = (NormalMethod) optMethodVector.get(i);
OptOptions opts = optOptionsVector.get(i);
try {
CompiledMethod cm = null;
CompilationPlan cp = new CompilationPlan(method, OptimizationPlanner.createOptimizationPlan(opts), null, opts);
cm = OptimizingCompiler.compile(cp);
method.replaceCompiledMethod(cm);
if (printCodeAddress) {
output.sysOutPrintln(compiledMethodMessage(method));
}
} catch (OptimizingCompilerException e) {
if (e.isFatal && VM.ErrorsFatal) {
e.printStackTrace();
VM.sysFail("Internal vm error: " + e);
} else {
output.sysErrPrintln("SKIPPING opt-compilation of " + method + ":\n " + e.getMessage());
if (opts.PRINT_METHOD) {
e.printStackTrace();
}
}
}
}
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class OptimizingCompiler method compile.
// //////////////////////////////////////////
// Public interface for compiling a method
// //////////////////////////////////////////
/**
* Invoke the opt compiler to execute a compilation plan.
*
* @param cp the compilation plan to be executed
* @return the CompiledMethod object that is the result of compilation
*/
public static CompiledMethod compile(CompilationPlan cp) {
NormalMethod method = cp.method;
OptOptions options = cp.options;
checkSupported(method, options);
try {
printMethodMessage(method, options);
IR ir = cp.execute();
// if doing analysis only, don't try to return an object
if (cp.analyzeOnly || cp.irGeneration) {
return null;
}
// now that we're done compiling, give the specialization
// system a chance to eagerly compile any specialized version
// that are pending. TODO: use lazy compilation with specialization.
SpecializationDatabase.doDeferredSpecializations();
ir.compiledMethod.compileComplete(ir.MIRInfo.machinecode);
return ir.compiledMethod;
} catch (OptimizingCompilerException e) {
throw e;
} catch (Throwable e) {
fail(e, method);
return null;
}
}
use of org.jikesrvm.classloader.NormalMethod in project JikesRVM by JikesRVM.
the class UnsyncReplacer method transform.
/**
* Perform the transformation for a given register appearance
*
* @param rop The def or use to check
*/
private void transform(RegisterOperand rop) {
final boolean DEBUG = false;
Instruction inst = rop.instruction;
switch(inst.getOpcode()) {
case SYSCALL_opcode:
case CALL_opcode:
RegisterOperand invokee = Call.getParam(inst, 0).asRegister();
if (invokee == rop) {
// replace with equivalent call on the synthetic
// unsynchronized type
MethodOperand mop = Call.getMethod(inst);
if (mop.getTarget().isSynchronized()) {
mop.spMethod = context.findOrCreateSpecializedVersion((NormalMethod) mop.getTarget());
if (DEBUG) {
VM.sysWriteln("Identified call " + inst + " for unsynchronization");
}
}
}
break;
case MONITORENTER_opcode:
if (DEBUG) {
VM.sysWrite("Removing " + inst);
}
inst.insertBefore(Empty.create(READ_CEILING));
DefUse.removeInstructionAndUpdateDU(inst);
break;
case MONITOREXIT_opcode:
if (DEBUG) {
VM.sysWrite("Removing " + inst);
}
inst.insertAfter(Empty.create(WRITE_FLOOR));
DefUse.removeInstructionAndUpdateDU(inst);
break;
default:
// no action necessary
break;
}
}
Aggregations