Commit acbfa86c authored by Yi Lin's avatar Yi Lin

fix. run MUTATOR TIME exp on this revision. added instrumentation to count yp (disabled now)

parent b6f52210
...@@ -65,6 +65,7 @@ import org.jikesrvm.runtime.MagicNames; ...@@ -65,6 +65,7 @@ import org.jikesrvm.runtime.MagicNames;
import org.jikesrvm.runtime.RuntimeEntrypoints; import org.jikesrvm.runtime.RuntimeEntrypoints;
import org.jikesrvm.runtime.Statics; import org.jikesrvm.runtime.Statics;
import org.jikesrvm.scheduler.RVMThread; import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.YieldpointStatistics;
import org.vmmagic.pragma.Inline; import org.vmmagic.pragma.Inline;
import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.pragma.Uninterruptible;
import org.vmmagic.unboxed.Offset; import org.vmmagic.unboxed.Offset;
...@@ -3960,6 +3961,10 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B ...@@ -3960,6 +3961,10 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
compiledMethod.addYPOffset(asmOffset); compiledMethod.addYPOffset(asmOffset);
asm.emitNOP(1); asm.emitNOP(1);
} }
// count yieldpoint time
if (YieldpointStatistics.ENABLE_YP_COUNT)
asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.yieldpointExecutedMethod.getOffset()));
if (VM.BuildForAdaptiveSystem && options.INVOCATION_COUNTERS) { if (VM.BuildForAdaptiveSystem && options.INVOCATION_COUNTERS) {
int id = compiledMethod.getId(); int id = compiledMethod.getId();
......
...@@ -101,6 +101,7 @@ import org.jikesrvm.runtime.ArchEntrypoints; ...@@ -101,6 +101,7 @@ import org.jikesrvm.runtime.ArchEntrypoints;
import org.jikesrvm.runtime.Entrypoints; import org.jikesrvm.runtime.Entrypoints;
import org.jikesrvm.runtime.Magic; import org.jikesrvm.runtime.Magic;
import org.jikesrvm.scheduler.RVMThread; import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.YieldpointStatistics;
import org.vmmagic.unboxed.Offset; import org.vmmagic.unboxed.Offset;
/** /**
...@@ -451,16 +452,33 @@ public class FinalMIRExpansion extends IRTools { ...@@ -451,16 +452,33 @@ public class FinalMIRExpansion extends IRTools {
private static void expandPageProtectionReadYieldpoint(Instruction p, IR ir) { private static void expandPageProtectionReadYieldpoint(Instruction p, IR ir) {
Operand mem = MemoryOperand.BD(ir.regpool.makeTROp(), Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_OPT), (byte) 4, null, null); Operand mem = MemoryOperand.BD(ir.regpool.makeTROp(), Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_OPT), (byte) 4, null, null);
MIR_Test.mutate(p, IA32_TEST, mem, IC(0)); MIR_Test.mutate(p, IA32_TEST, mem, IC(0));
}
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(p, ir);
}
}
private static void expandPageProtectionWriteYieldpoint(Instruction p, IR ir) { private static void expandPageProtectionWriteYieldpoint(Instruction p, IR ir) {
Operand mem = MemoryOperand.BD(ir.regpool.makeTROp(), Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_OPT), (byte) 4, null, null); Operand mem = MemoryOperand.BD(ir.regpool.makeTROp(), Offset.fromIntSignExtend(RVMThread.PROTECT_PAGE_OFFSET_OPT), (byte) 4, null, null);
MIR_Move.mutate(p, IA32_MOV, mem, IC(0)); MIR_Move.mutate(p, IA32_MOV, mem, IC(0));
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(p, ir);
}
} }
private static void removeYieldpoint(Instruction s, IR ir) { private static void removeYieldpoint(Instruction s, IR ir) {
s.remove(); s.remove();
ir.MIRInfo.gcIRMap.delete(s); ir.MIRInfo.gcIRMap.delete(s);
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(s, ir);
}
}
private static void genYieldpointCounter(Instruction p, IR ir) {
Instruction count = MIR_Call.create0(IA32_CALL, null, null, MethodOperand.STATIC(Entrypoints.yieldpointExecutedMethod));
p.insertBefore(count);
} }
/** /**
...@@ -574,8 +592,11 @@ public class FinalMIRExpansion extends IRTools { ...@@ -574,8 +592,11 @@ public class FinalMIRExpansion extends IRTools {
LocationOperand loc = new LocationOperand(offset); LocationOperand loc = new LocationOperand(offset);
Operand guard = TG(); Operand guard = TG();
Operand target = MemoryOperand.D(Magic.getTocPointer().plus(offset), (byte) 4, loc, guard); Operand target = MemoryOperand.D(Magic.getTocPointer().plus(offset), (byte) 4, loc, guard);
MIR_Call.mutate0(s, CALL_SAVE_VOLATILE, null, null, target, MethodOperand.STATIC(meth)); MIR_Call.mutate0(s, CALL_SAVE_VOLATILE, null, null, target, MethodOperand.STATIC(meth));
yieldpoint.appendInstruction(s); yieldpoint.appendInstruction(s);
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(s, ir);
}
ir.MIRInfo.gcIRMap.moveToEnd(s); ir.MIRInfo.gcIRMap.moveToEnd(s);
yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget())); yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget()));
...@@ -614,6 +635,9 @@ public class FinalMIRExpansion extends IRTools { ...@@ -614,6 +635,9 @@ public class FinalMIRExpansion extends IRTools {
Operand target = MemoryOperand.D(Magic.getTocPointer().plus(offset), (byte) 4, loc, guard); Operand target = MemoryOperand.D(Magic.getTocPointer().plus(offset), (byte) 4, loc, guard);
MIR_Call.mutate0(s, CALL_SAVE_VOLATILE, null, null, target, MethodOperand.STATIC(meth)); MIR_Call.mutate0(s, CALL_SAVE_VOLATILE, null, null, target, MethodOperand.STATIC(meth));
yieldpoint.appendInstruction(s); yieldpoint.appendInstruction(s);
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(s, ir);
}
ir.MIRInfo.gcIRMap.moveToEnd(s); ir.MIRInfo.gcIRMap.moveToEnd(s);
yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget())); yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget()));
......
...@@ -31,6 +31,9 @@ public class Entrypoints { ...@@ -31,6 +31,9 @@ public class Entrypoints {
// //
public static final NormalMethod bootMethod = EntrypointHelper.getMethod(org.jikesrvm.VM.class, "boot", "()V"); public static final NormalMethod bootMethod = EntrypointHelper.getMethod(org.jikesrvm.VM.class, "boot", "()V");
public static final RVMMethod yieldpointExecutedMethod =
getMethod(org.jikesrvm.scheduler.YieldpointStatistics.class, "yieldpointExecuted", "()V");
public static final RVMMethod java_lang_reflect_Method_invokeMethod = public static final RVMMethod java_lang_reflect_Method_invokeMethod =
getMethod(java.lang.reflect.Method.class, "invoke", getMethod(java.lang.reflect.Method.class, "invoke",
......
...@@ -5,21 +5,28 @@ import org.jikesrvm.mm.mmtk.SynchronizedCounter; ...@@ -5,21 +5,28 @@ import org.jikesrvm.mm.mmtk.SynchronizedCounter;
import org.jikesrvm.runtime.SysCall; import org.jikesrvm.runtime.SysCall;
import org.mmtk.utility.statistics.LongCounter; import org.mmtk.utility.statistics.LongCounter;
import org.mmtk.utility.statistics.Timer; import org.mmtk.utility.statistics.Timer;
import org.vmmagic.pragma.Entrypoint;
import org.vmmagic.pragma.Inline; import org.vmmagic.pragma.Inline;
import org.vmmagic.pragma.Interruptible; import org.vmmagic.pragma.Interruptible;
import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.pragma.Uninterruptible;
@Uninterruptible @Uninterruptible
public class YieldpointStatistics { public class YieldpointStatistics {
public static final boolean ENABLE_YP_COUNT = false;
// how many yieldpoints taken in total // how many yieldpoints taken in total
public static SynchronizedCounter yieldpointTaken = new SynchronizedCounter(); public static SynchronizedCounter yieldpointTaken = new SynchronizedCounter();
// how many yieldpoints execute in total (including taken ones)
public static SynchronizedCounter yieldpointExecuted = new SynchronizedCounter();
public static long gcRequestBlockTime; public static long gcRequestBlockTime;
public static long mutatorStartTimeMillis;
public static long yieldpointTurnedOnLatency = 0; public static long yieldpointTurnedOnLatency = 0;
public static long allThreadBlockedLatency = 0; public static long allThreadBlockedLatency = 0;
// these two work together to get a mutator time (starts when all mutators resume or probe starts, ends when all mutators end or probe ends)
public static long mutatorStartTimeMillis;
public static long mutatorTimeWithoutBlockingCost = 0; public static long mutatorTimeWithoutBlockingCost = 0;
@Interruptible @Interruptible
...@@ -32,6 +39,19 @@ public class YieldpointStatistics { ...@@ -32,6 +39,19 @@ public class YieldpointStatistics {
mutatorTimeWithoutBlockingCost = 0; mutatorTimeWithoutBlockingCost = 0;
mutatorStartTimeMillis = SysCall.sysCall.sysCurrentTimeMillis(); mutatorStartTimeMillis = SysCall.sysCall.sysCurrentTimeMillis();
yieldpointExecuted.reset();
}
@Interruptible
public static void stopData() {
mutatorTimeWithoutBlockingCost += SysCall.sysCall.sysCurrentTimeMillis() - mutatorStartTimeMillis;
}
@Inline
@Entrypoint
public static void yieldpointExecuted() {
yieldpointExecuted.increment();
} }
@Inline @Inline
...@@ -46,6 +66,7 @@ public class YieldpointStatistics { ...@@ -46,6 +66,7 @@ public class YieldpointStatistics {
@Interruptible @Interruptible
public static void probeEnd() { public static void probeEnd() {
stopData();
printStatistics(); printStatistics();
} }
......
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