Commit b5d2a436 authored by Yi Lin's avatar Yi Lin

nop1 and nop6 yp done

parent 5034667f
......@@ -34,7 +34,8 @@ public class Config {
public static final int USE_GLOBAL_PAGE_PROTECTION_WRITE_YP = 12;
public static final int USE_NO_YP = 20;
public static final int USE_NOP_YP = 21;
public static final int USE_NOP1_YP = 21;
public static final int USE_NOP6_YP = 26;
public final boolean ENABLE_YP_STAT;
......@@ -58,6 +59,10 @@ public class Config {
YIELDPOINT_IMPL = USE_GLOBAL_PAGE_PROTECTION_READ_YP;
} else if (config.getBooleanProperty("mmtk.use_global_page_protection_write_yp", false)) {
YIELDPOINT_IMPL = USE_GLOBAL_PAGE_PROTECTION_WRITE_YP;
} else if (config.getBooleanProperty("mmtk.use_nop1_yp", false)) {
YIELDPOINT_IMPL = USE_NOP1_YP;
} else if (config.getBooleanProperty("mmtk.use_nop6_yp", false)) {
YIELDPOINT_IMPL = USE_NOP6_YP;
}
else {
......
#
# This file is part of the Jikes RVM project (http://jikesrvm.org).
#
# This file is licensed to You under the Eclipse Public License (EPL);
# You may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.opensource.org/licenses/eclipse-1.0.php
#
# See the COPYRIGHT.txt file distributed with this work for information
# regarding copyright ownership.
#
# Default MMTk properties file.
mmtk.use_nop1_yp = true
#
# This file is part of the Jikes RVM project (http://jikesrvm.org).
#
# This file is licensed to You under the Eclipse Public License (EPL);
# You may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.opensource.org/licenses/eclipse-1.0.php
#
# See the COPYRIGHT.txt file distributed with this work for information
# regarding copyright ownership.
#
# Default MMTk properties file.
mmtk.use_nop6_yp = true
......@@ -1320,6 +1320,13 @@ public class GenerateAssembler {
emitTab(4);
emit("break;\n");
emitTab(3);
emit("case FORCENOP_opcode:\n");
emitTab(4);
emit("emitNOP(1);\n");
emitTab(4);
emit("break;\n");
Set<String> errorOpcodes = getErrorOpcodes(emittedOpcodes);
if (!errorOpcodes.isEmpty()) {
i = errorOpcodes.iterator();
......
......@@ -386,6 +386,14 @@ stm: NOP
NOFLAGS
// drop on floor
#############
#
###########
stm: FORCENOP
10
EMIT_INSTRUCTION
EMIT(P(p));
#####
# GUARD_MOVE
#####
......
......@@ -518,6 +518,13 @@ none
# force NOP
FORCENOP
Empty
none
# Move an integer value from one (register/constant) operand
# to a register operand. Value is unchanged.
INT_MOVE
......
......@@ -3960,7 +3960,14 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
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);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP6_YP) {
asm.emitNOP(6);
}
// global yieldpoint
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_CHECKING_YP) {
asm.emitCMP_Abs_Imm(Magic.getTocPointer().plus(Entrypoints.takeYieldpointGlobalField.getOffset()), 0);
......
......@@ -18,6 +18,7 @@ import org.jikesrvm.VM;
import org.jikesrvm.classloader.NormalMethod;
import org.jikesrvm.classloader.RVMMethod;
import org.jikesrvm.compilers.opt.ir.BBend;
import org.jikesrvm.compilers.opt.ir.Empty;
import org.jikesrvm.compilers.opt.ir.Label;
import org.jikesrvm.compilers.opt.ir.MIR_BinaryAcc;
import org.jikesrvm.compilers.opt.ir.MIR_Branch;
......@@ -48,6 +49,8 @@ import static org.jikesrvm.compilers.opt.ir.Operators.CALL_SAVE_VOLATILE;
import static org.jikesrvm.compilers.opt.ir.Operators.CALL_SAVE_VOLATILE_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.DUMMY_DEF_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.DUMMY_USE_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.NOP;
import static org.jikesrvm.compilers.opt.ir.Operators.FORCENOP;
import static org.jikesrvm.compilers.opt.ir.Operators.IA32_ADD;
import static org.jikesrvm.compilers.opt.ir.Operators.IA32_CALL;
import static org.jikesrvm.compilers.opt.ir.Operators.IA32_CMP;
......@@ -404,15 +407,19 @@ public class FinalMIRExpansion extends IRTools {
break;
case YIELDPOINT_PROLOGUE_opcode:
// checking
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_GLOBAL_CHECKING_YP) {
expandYieldpointGlobal(p, ir, Entrypoints.optThreadSwitchFromPrologueMethod, IA32ConditionOperand.NE());
}
// no yp
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NO_YP) {
// do nothing
removeYieldpoint(p, ir);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP) {
}
// page protection
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP) {
expandPageProtectionReadYieldpoint(p, ir);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
expandPageProtectionWriteYieldpoint(p, ir);
......@@ -421,6 +428,12 @@ public class FinalMIRExpansion extends IRTools {
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_WRITE_YP) {
expandPageProtectionWriteYieldpointGlobal(p, ir);
}
// nop1
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP1_YP) {
expandNopYieldpoint(p, ir, 1);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP6_YP) {
expandNopYieldpoint(p, ir, 6);
}
break;
case YIELDPOINT_EPILOGUE_opcode:
......@@ -441,6 +454,12 @@ public class FinalMIRExpansion extends IRTools {
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_WRITE_YP) {
expandPageProtectionWriteYieldpointGlobal(p, ir);
}
// nop1
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP1_YP) {
expandNopYieldpoint(p, ir, 1);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP6_YP) {
expandNopYieldpoint(p, ir, 6);
}
break;
case YIELDPOINT_BACKEDGE_opcode:
......@@ -461,6 +480,12 @@ public class FinalMIRExpansion extends IRTools {
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_WRITE_YP) {
expandPageProtectionWriteYieldpointGlobal(p, ir);
}
// nop1
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP1_YP) {
expandNopYieldpoint(p, ir, 1);
} else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_NOP6_YP) {
expandNopYieldpoint(p, ir, 6);
}
break;
case YIELDPOINT_OSR_opcode:
......@@ -473,6 +498,15 @@ public class FinalMIRExpansion extends IRTools {
return 0;
}
private static void expandNopYieldpoint(Instruction p, IR ir, int n) {
for (int i = 0; i < n; i++) {
Instruction nop = Empty.create(FORCENOP);
p.insertBefore(nop);
}
removeYieldpoint(p, ir);
}
private static void expandPageProtectionReadYieldpointGlobal(Instruction p,
IR ir) {
Operand mem = MemoryOperand.D(RVMThread.PROTECT_GLOBAL_PAGE_OPT, (byte) 4, null, null);
......
......@@ -5639,15 +5639,15 @@ public final class RVMThread extends ThreadContext {
}
public void turnOffLocalYieldpoints() {
takeYieldpoint = 0;
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP ||
org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
Address pageAddr = Magic.objectAsAddress(this).plus(PROTECT_PAGE_OFFSET_BL).toWord().and(Word.fromIntZeroExtend(0xfffff000)).toAddress();
Memory.mprotect(pageAddr, 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) {
CompiledMethods.setINT2NOP();
}
// takeYieldpoint = 0;
//
// if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_READ_YP ||
// org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_PAGE_PROTECTION_WRITE_YP) {
// Address pageAddr = Magic.objectAsAddress(this).plus(PROTECT_PAGE_OFFSET_BL).toWord().and(Word.fromIntZeroExtend(0xfffff000)).toAddress();
// Memory.mprotect(pageAddr, 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) {
// CompiledMethods.setINT2NOP();
// }
}
public static int takeYieldpointGlobal = 0;
......@@ -5664,11 +5664,11 @@ public final class RVMThread extends ThreadContext {
}
public static void turnOffGlobalYieldpoints() {
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_CHECKING_YP)
takeYieldpointGlobal = 0;
else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_READ_YP ||
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);
}
// if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_CHECKING_YP)
// takeYieldpointGlobal = 0;
// else if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_GLOBAL_PAGE_PROTECTION_READ_YP ||
// 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);
// }
}
}
......@@ -670,7 +670,7 @@ hardwareTrapHandler(int signo, siginfo_t *si, void *context)
if (YIELDPOINT_IMPL == 11 || YIELDPOINT_IMPL == 12) {
unsigned int faultAddress = (unsigned int ) si->si_addr;
Addres* sp = (Address*) (IA32_ESP(context) - 4);
Address* sp = (Address*) (IA32_ESP(context) - 4);
IA32_ESP(context) = IA32_ESP(context) - 4;
instructionFollowing = getInstructionFollowing(localInstructionAddress);
*sp = instructionFollowing;
......
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