Commit db6cb4e0 authored by Yi Lin's avatar Yi Lin

only patching opt-compiled methods, improves performance a lot

parent 3da68c85
......@@ -3934,7 +3934,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) {
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) {
ThreadLocalState.emitCompareFieldWithImm(asm, Entrypoints.takeYieldpointField.getOffset(), 0);
ForwardReference fr1;
if (whereFrom == RVMThread.PROLOGUE) {
......@@ -3957,14 +3958,12 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
ThreadLocalState.emitCompareFieldWithImm(asm, Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_BL), 0);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
ThreadLocalState.emitMoveImmToField(asm, Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_BL), 0);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
int asmOffset = asm.getMachineCodeIndex();
compiledMethod.addYPOffset(asmOffset);
asm.emitNOP(1);
if (CompiledMethods.methodWeCare == -1)
CompiledMethods.methodWeCare = compiledMethod.getId();
}
// else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CODE_PATCHING_YP) {
// int asmOffset = asm.getMachineCodeIndex();
// compiledMethod.addYPOffset(asmOffset);
// asm.emitNOP(1);
// }
// nop yp
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP1_YP) {
asm.emitNOP(1);
......
......@@ -331,9 +331,7 @@ public class CompiledMethods {
}
}
}
public static int methodWeCare = 0;
@Uninterruptible
public static void setNOP2INT() {
VM.sysWriteln("-----Start patching code-----");
......@@ -345,10 +343,9 @@ public class CompiledMethods {
CompiledMethod cm = getCompiledMethodUnchecked(i);
if (cm == null || !cm.isCompiled())
continue;
if (cm.getCompilerType() != CompiledMethod.OPT)
continue;
// if (cm.getId() == methodWeCare)
// cm.nop2intDebug();
// else cm.nop2int();
cm.nop2int();
patched ++;
}
......@@ -369,6 +366,8 @@ public class CompiledMethods {
CompiledMethod cm = getCompiledMethodUnchecked(i);
if (cm == null || !cm.isCompiled())
continue;
if (cm.getCompilerType() != CompiledMethod.OPT)
continue;
cm.int2nop();
patched ++;
......
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