Commit 3a544853 authored by Yi Lin's avatar Yi Lin

checking vs no yieldpoint

parent ad356253
......@@ -38,6 +38,8 @@ public class Config {
YIELDPOINT_IMPL = USE_PAGE_PROTECTION_YP;
} else if (config.getBooleanProperty("mmtk.use_code_patching_yp", false)) {
YIELDPOINT_IMPL = USE_CODE_PATCHING_YP;
} else if (config.getBooleanProperty("mmtk.use_no_yp", false)) {
YIELDPOINT_IMPL = USE_NO_YP;
} else {
YIELDPOINT_IMPL = USE_CHECKING_YP;
}
......
......@@ -138,6 +138,8 @@ public class VM extends Properties {
sysWriteLockOffset = Entrypoints.sysWriteLockField.getOffset();
if (verboseBoot >= 1) VM.sysWriteln("Booting");
VM.sysWriteln("Using yieldpoint implementation: ", org.mmtk.vm.VM.config.YIELDPOINT_IMPL);
// Set up the current RVMThread object. The bootstrap program
// has placed a pointer to the current RVMThread in a special
......
......@@ -3906,22 +3906,26 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
}
// thread switch requested ??
ThreadLocalState.emitCompareFieldWithImm(asm, Entrypoints.takeYieldpointField.getOffset(), 0);
ForwardReference fr1;
if (whereFrom == RVMThread.PROLOGUE) {
// Take yieldpoint if yieldpoint flag is non-zero (either 1 or -1)
fr1 = asm.forwardJcc(EQ);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromPrologueMethod.getOffset()));
} else if (whereFrom == RVMThread.BACKEDGE) {
// Take yieldpoint if yieldpoint flag is >0
fr1 = asm.forwardJcc(LE);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromBackedgeMethod.getOffset()));
} else { // EPILOGUE
// Take yieldpoint if yieldpoint flag is non-zero (either 1 or -1)
fr1 = asm.forwardJcc(EQ);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromEpilogueMethod.getOffset()));
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP) {
ThreadLocalState.emitCompareFieldWithImm(asm, Entrypoints.takeYieldpointField.getOffset(), 0);
ForwardReference fr1;
if (whereFrom == RVMThread.PROLOGUE) {
// Take yieldpoint if yieldpoint flag is non-zero (either 1 or -1)
fr1 = asm.forwardJcc(EQ);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromPrologueMethod.getOffset()));
} else if (whereFrom == RVMThread.BACKEDGE) {
// Take yieldpoint if yieldpoint flag is >0
fr1 = asm.forwardJcc(LE);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromBackedgeMethod.getOffset()));
} else { // EPILOGUE
// Take yieldpoint if yieldpoint flag is non-zero (either 1 or -1)
fr1 = asm.forwardJcc(EQ);
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointFromEpilogueMethod.getOffset()));
}
fr1.resolve(asm);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NO_YP) {
// dont do anything
}
fr1.resolve(asm);
if (VM.BuildForAdaptiveSystem && options.INVOCATION_COUNTERS) {
int id = compiledMethod.getId();
......
......@@ -398,15 +398,30 @@ public class FinalMIRExpansion extends IRTools {
break;
case YIELDPOINT_PROLOGUE_opcode:
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromPrologueMethod, IA32ConditionOperand.NE());
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromPrologueMethod, IA32ConditionOperand.NE());
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NO_YP) {
// do nothing
removeYieldpoint(p, ir);
}
break;
case YIELDPOINT_EPILOGUE_opcode:
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromEpilogueMethod, IA32ConditionOperand.NE());
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromEpilogueMethod, IA32ConditionOperand.NE());
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NO_YP) {
// do nothing
removeYieldpoint(p, ir);
}
break;
case YIELDPOINT_BACKEDGE_opcode:
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromBackedgeMethod, IA32ConditionOperand.GT());
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromBackedgeMethod, IA32ConditionOperand.GT());
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NO_YP) {
// do nothing
removeYieldpoint(p, ir);
}
break;
case YIELDPOINT_OSR_opcode:
......@@ -418,6 +433,11 @@ public class FinalMIRExpansion extends IRTools {
}
return 0;
}
private static void removeYieldpoint(Instruction s, IR ir) {
s.remove();
ir.MIRInfo.gcIRMap.delete(s);
}
/**
* expand an FCLEAR pseudo-insruction using FFREEs.
......
......@@ -3773,6 +3773,8 @@ public final class RVMThread extends ThreadContext {
@NoCheckStore
@Unpreemptible
public static void blockAllMutatorsForGC() {
turnOnYieldpoints();
RVMThread.handshakeLock.lockNoHandshake();
while (true) {
// (1) Find all the threads that need to be blocked for GC
......@@ -5589,4 +5591,12 @@ public final class RVMThread extends ThreadContext {
sloppyExecStatusHistogram[oldState]++;
sloppyExecStatusHistogram[newState]++;
}
public static void turnOnYieldpoints() {
}
public static void turnOffYieldpoints() {
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment