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;
import org.jikesrvm.runtime.RuntimeEntrypoints;
import org.jikesrvm.runtime.Statics;
import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.YieldpointStatistics;
import org.vmmagic.pragma.Inline;
import org.vmmagic.pragma.Uninterruptible;
import org.vmmagic.unboxed.Offset;
......@@ -3961,6 +3962,10 @@ public abstract class BaselineCompilerImpl extends BaselineCompiler implements B
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) {
int id = compiledMethod.getId();
InvocationCounts.allocateCounter(id);
......
......@@ -101,6 +101,7 @@ import org.jikesrvm.runtime.ArchEntrypoints;
import org.jikesrvm.runtime.Entrypoints;
import org.jikesrvm.runtime.Magic;
import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.YieldpointStatistics;
import org.vmmagic.unboxed.Offset;
/**
......@@ -451,16 +452,33 @@ public class FinalMIRExpansion extends IRTools {
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);
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) {
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));
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(p, ir);
}
}
private static void removeYieldpoint(Instruction s, IR ir) {
s.remove();
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);
}
/**
......@@ -576,6 +594,9 @@ public class FinalMIRExpansion extends IRTools {
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));
yieldpoint.appendInstruction(s);
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(s, ir);
}
ir.MIRInfo.gcIRMap.moveToEnd(s);
yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget()));
......@@ -614,6 +635,9 @@ public class FinalMIRExpansion extends IRTools {
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));
yieldpoint.appendInstruction(s);
if (YieldpointStatistics.ENABLE_YP_COUNT) {
genYieldpointCounter(s, ir);
}
ir.MIRInfo.gcIRMap.moveToEnd(s);
yieldpoint.appendInstruction(MIR_Branch.create(IA32_JMP, nextBlock.makeJumpTarget()));
......
......@@ -32,6 +32,9 @@ public class Entrypoints {
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 =
getMethod(java.lang.reflect.Method.class, "invoke",
"(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
......
......@@ -5,21 +5,28 @@ import org.jikesrvm.mm.mmtk.SynchronizedCounter;
import org.jikesrvm.runtime.SysCall;
import org.mmtk.utility.statistics.LongCounter;
import org.mmtk.utility.statistics.Timer;
import org.vmmagic.pragma.Entrypoint;
import org.vmmagic.pragma.Inline;
import org.vmmagic.pragma.Interruptible;
import org.vmmagic.pragma.Uninterruptible;
@Uninterruptible
public class YieldpointStatistics {
public static final boolean ENABLE_YP_COUNT = false;
// how many yieldpoints taken in total
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 mutatorStartTimeMillis;
public static long yieldpointTurnedOnLatency = 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;
@Interruptible
......@@ -32,6 +39,19 @@ public class YieldpointStatistics {
mutatorTimeWithoutBlockingCost = 0;
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
......@@ -46,6 +66,7 @@ public class YieldpointStatistics {
@Interruptible
public static void probeEnd() {
stopData();
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