Commit a48564f1 authored by Yi Lin's avatar Yi Lin

renaming code patching yp

parent 95c4bb38
......@@ -27,8 +27,8 @@ public class Config {
public static final int USE_CHECKING_YP = 0;
public static final int USE_PAGE_PROTECTION_READ_YP = 1;
public static final int USE_PAGE_PROTECTION_WRITE_YP = 2;
public static final int USE_CODE_PATCHING_YP = 3;
public static final int USE_CODE_PATCHING_LOCAL_YP = 4;
public static final int USE_CODE_PATCHING_INT3_YP = 3;
public static final int USE_CODE_PATCHING_CALL_YP = 4;
public static final int USE_GLOBAL_CHECKING_YP = 10;
public static final int USE_GLOBAL_PAGE_PROTECTION_READ_YP = 11;
......@@ -52,10 +52,10 @@ public class Config {
YIELDPOINT_IMPL = USE_PAGE_PROTECTION_READ_YP;
} else if (config.getBooleanProperty("mmtk.use_page_protection_write_yp", false)) {
YIELDPOINT_IMPL = USE_PAGE_PROTECTION_WRITE_YP;
} else if (config.getBooleanProperty("mmtk.use_code_patching_yp", false)) {
YIELDPOINT_IMPL = USE_CODE_PATCHING_YP;
} else if (config.getBooleanProperty("mmtk.use_code_patching_local_yp", false)) {
YIELDPOINT_IMPL = USE_CODE_PATCHING_LOCAL_YP;
} else if (config.getBooleanProperty("mmtk.use_code_patching_int3_yp", false)) {
YIELDPOINT_IMPL = USE_CODE_PATCHING_INT3_YP;
} else if (config.getBooleanProperty("mmtk.use_code_patching_call_yp", false)) {
YIELDPOINT_IMPL = USE_CODE_PATCHING_CALL_YP;
}
else if (config.getBooleanProperty("mmtk.use_no_yp", false)) {
YIELDPOINT_IMPL = USE_NO_YP;
......
......@@ -11,4 +11,4 @@
# regarding copyright ownership.
#
# Default MMTk properties file.
mmtk.use_code_patching_yp = true
mmtk.use_code_patching_call_yp = true
......@@ -11,4 +11,4 @@
# regarding copyright ownership.
#
# Default MMTk properties file.
mmtk.use_code_patching_local_yp = true
mmtk.use_code_patching_int3_yp = true
......@@ -1323,7 +1323,7 @@ public class GenerateAssembler {
emitTab(3);
emit("case FORCENOP_opcode:\n");
emitTab(4);
emit("if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP)\n");
emit("if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP)\n");
emitTab(5);
emit("ir.compiledMethod.addYPOffset(mi);\n");
emitTab(4);
......@@ -1341,7 +1341,7 @@ public class GenerateAssembler {
emitTab(3);
emit("case FORCE6NOP_opcode:\n");
emitTab(4);
emit("if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP)\n");
emit("if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP)\n");
emitTab(5);
emit("ir.compiledMethod.addYPOffset(mi);\n");
emitTab(4);
......
......@@ -174,10 +174,10 @@ public class VM extends Properties {
CompiledMethod.CALL[0] = (byte) 0xff;
CompiledMethod.CALL[1] = (byte) 0x15;
CompiledMethod.CALL[2] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()).toWord().and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[3] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()).toWord().rsha(8).and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[4] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()).toWord().rsha(16).and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[5] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()).toWord().rsha(24).and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[2] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()).toWord().and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[3] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()).toWord().rsha(8).and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[4] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()).toWord().rsha(16).and(Word.fromIntZeroExtend(0xff)).toInt();
CompiledMethod.CALL[5] = (byte) Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()).toWord().rsha(24).and(Word.fromIntZeroExtend(0xff)).toInt();
// nop5
CompiledMethod.NOP6[0] = (byte) 0x66;
......@@ -189,9 +189,9 @@ public class VM extends Properties {
VM.sysWriteln("JTOC:", Magic.getJTOC());
VM.sysWrite("Check Method Offset:");
VM.sysWriteln(Entrypoints.optThreadSwitchCheckMethod.getOffset());
VM.sysWriteln("Call address:", Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()));
VM.sysWriteln("Call address (word):", Magic.getJTOC().plus(Entrypoints.optThreadSwitchCheckMethod.getOffset()).toWord());
VM.sysWriteln(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset());
VM.sysWriteln("Call address:", Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()));
VM.sysWriteln("Call address (word):", Magic.getJTOC().plus(Entrypoints.optThreadSwitchFromPrologueMethod.getOffset()).toWord());
VM.sysWrite("bytes[0]=");
VM.sysWriteHex(CompiledMethod.CALL[0]);
VM.sysWriteln();
......
......@@ -3935,8 +3935,8 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
// thread switch requested ??
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP
|| org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP
|| org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
|| org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP
|| org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
ThreadLocalState.emitCompareFieldWithImm(asm, Entrypoints.takeYieldpointField.getOffset(), 0);
ForwardReference fr1;
if (whereFrom == RVMThread.PROLOGUE) {
......
......@@ -442,10 +442,10 @@ public class FinalMIRExpansion extends IRTools {
expandNopYieldpoint(p, ir, 0);
}
// code patching
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP) {
expandCodePatchingYieldpoint(p, ir);
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
expandCodePatchingYieldpointNOP6(p, ir);
}
break;
......@@ -479,10 +479,10 @@ public class FinalMIRExpansion extends IRTools {
expandNopYieldpoint(p, ir, 0);
}
// code patching
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP) {
expandCodePatchingYieldpoint(p, ir);
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
expandCodePatchingYieldpointNOP6(p, ir);
}
break;
......@@ -516,10 +516,10 @@ public class FinalMIRExpansion extends IRTools {
expandNopYieldpoint(p, ir, 0);
}
// code patching
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP) {
expandCodePatchingYieldpoint(p, ir);
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
expandCodePatchingYieldpointNOP6(p, ir);
}
break;
......
......@@ -5677,11 +5677,11 @@ public final class RVMThread extends ThreadContext {
org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_WRITE_YP) {
Memory.mprotect(PROTECT_GLOBAL_PAGE_BL, PROTECT_PAGE_SIZE, Memory.PROT_NONE);
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP) {
CompiledMethods.setNOP2INT();
// CompiledMethods.setINT2NOP();
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
for (int i = 0; i < RVMThread.numThreads; i++) {
RVMThread t = RVMThread.threads[i];
if (!t.isCollectorThread() && !t.ignoreHandshakesAndGC()) {
......@@ -5699,10 +5699,10 @@ public final class RVMThread extends ThreadContext {
org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_WRITE_YP) {
Memory.mprotect(PROTECT_GLOBAL_PAGE_BL, PROTECT_PAGE_SIZE, Memory.PROT_EXEC | Memory.PROT_READ | Memory.PROT_WRITE);
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_INT3_YP) {
CompiledMethods.setINT2NOP();
}
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_LOCAL_YP) {
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_CALL_YP) {
for (int i = 0; i < RVMThread.numThreads; i++) {
RVMThread t = RVMThread.threads[i];
if (!t.isCollectorThread() && !t.ignoreHandshakesAndGC()) {
......
......@@ -656,7 +656,7 @@ hardwareTrapHandler(int signo, siginfo_t *si, void *context)
if (YIELDPOINT_IMPL == 4 && signo == 5) {
// we are patching code
// a temporary INT3 is triggered, we simply return
printf("reaching a temporary INT3\n");
// printf("reaching a temporary INT3\n");
/* Insert artifical stackframe at the stack top */
Address * sp = (Address *)(IA32_ESP(context) - 4);
......@@ -666,7 +666,7 @@ hardwareTrapHandler(int signo, siginfo_t *si, void *context)
*sp = instructionFollowing;
unsigned int yieldPointHandlerAddress =
*(unsigned int *) (localJTOC + bootRecord->yieldpointCheckOffset);
*(unsigned int *) (localJTOC + bootRecord->yieldpointFromPrologueOptOffset);
IA32_EIP(context) = yieldPointHandlerAddress;
return;
}
......
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