Commit 55edbddc authored by Yi Lin's avatar Yi Lin

a few other counts

parent 5db2e080
......@@ -119,7 +119,7 @@ public final class Instrumentation {
* in currently compiled methods from executing.
*/
public static void disableInstrumentation() {
VM.sysWriteln("disabled instrumentation");
// VM.sysWriteln("disabled instrumentation");
instrumentationEnabled = false;
}
......@@ -128,7 +128,7 @@ public final class Instrumentation {
* perform any instrumentation.
*/
public static void enableInstrumentation() {
VM.sysWriteln("enabled instrumentation");
// VM.sysWriteln("enabled instrumentation");
instrumentationEnabled = true;
}
......
......@@ -793,5 +793,6 @@ public final class NormalMethod extends RVMMethod {
*/
public LocalVariableTable getLocalVariableTable() {
return localVariableTables.get(this);
}
}
}
......@@ -32,7 +32,7 @@ public abstract class RVMMember extends AnnotatedElement {
* The class that declared this member, available by calling
* getDeclaringClass once the class is loaded.
*/
private final TypeReference declaringClass;
protected final TypeReference declaringClass;
/**
* The canonical MemberReference for this member
......
......@@ -15,6 +15,7 @@ package org.jikesrvm.classloader;
import java.io.DataInputStream;
import java.io.IOException;
import java.lang.annotation.Annotation;
import org.jikesrvm.ArchitectureSpecific.CodeArray;
import org.jikesrvm.ArchitectureSpecific.LazyCompilationTrampoline;
import org.jikesrvm.VM;
......@@ -31,6 +32,7 @@ import org.vmmagic.pragma.RuntimePure;
import org.vmmagic.pragma.Uninterruptible;
import org.vmmagic.pragma.Unpreemptible;
import org.vmmagic.unboxed.Offset;
import static org.jikesrvm.SizeConstants.BITS_IN_SHORT;
import static org.jikesrvm.classloader.TypeReference.baseReflectionClass;
import static org.jikesrvm.classloader.BytecodeConstants.*;
......@@ -1027,4 +1029,26 @@ public abstract class RVMMethod extends RVMMember {
null,
null);
}
public boolean isInVM() {
Atom className = declaringClass.name;
byte[] byteClassName = className.getBytes();
// for (int i = 0; i < byteClassName.length; i++)
// VM.write((char) byteClassName[i]);
//
// VM.writeln();
if (byteClassName.length >= 13 && byteClassName[1] == 'o' && byteClassName[2] == 'r' && byteClassName[3] == 'g'
&& byteClassName[5] == 'j' && byteClassName[6] == 'i' && byteClassName[7] == 'k' && byteClassName[8] == 'e' && byteClassName[9] == 's'
&& byteClassName[10] == 'r' && byteClassName[11] == 'v' && byteClassName[12] == 'm')
return true;
if (byteClassName.length >= 9 && byteClassName[1] == 'o' && byteClassName[2] == 'r' && byteClassName[3] == 'g'
&& byteClassName[5] == 'm' && byteClassName[6] == 'm' && byteClassName[7] == 't' && byteClassName[8] == 'k')
return true;
return false;
}
}
......@@ -410,8 +410,10 @@ public class FinalMIRExpansion extends IRTools {
break;
case YIELDPOINT_PROLOGUE_opcode:
if (YieldpointStatistics.ENABLE_YP_COUNT)
YieldpointStatistics.yieldpointOptInsertedForPrologue++;
if (YieldpointStatistics.ENABLE_YP_COUNT) {
YieldpointStatistics.yieldpointInserted(RVMThread.PROLOGUE, ir.method);
// YieldpointStatistics.yieldpointOptInsertedForPrologue++;
}
// checking
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
......@@ -459,7 +461,7 @@ public class FinalMIRExpansion extends IRTools {
case YIELDPOINT_EPILOGUE_opcode:
if (YieldpointStatistics.ENABLE_YP_COUNT)
YieldpointStatistics.yieldpointOptInsertedForEpilogue++;
YieldpointStatistics.yieldpointInserted(RVMThread.EPILOGUE, ir.method);
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromEpilogueMethod, IA32ConditionOperand.NE());
......@@ -503,7 +505,7 @@ public class FinalMIRExpansion extends IRTools {
case YIELDPOINT_BACKEDGE_opcode:
if (YieldpointStatistics.ENABLE_YP_COUNT)
YieldpointStatistics.yieldpointOptInsertedForBackedge++;
YieldpointStatistics.yieldpointInserted(RVMThread.BACKEDGE, ir.method);
if (org.mmtk.vm.VM.config.YIELDPOINT_IMPL == org.mmtk.vm.Config.USE_CHECKING_YP)
expandYieldpoint(p, ir, Entrypoints.optThreadSwitchFromBackedgeMethod, IA32ConditionOperand.GT());
......
......@@ -44,7 +44,7 @@ import org.vmmagic.unboxed.Word;
@Uninterruptible
public final class ThinLock {
private static final boolean ENABLE_BIASED_LOCKING = false;
private static final boolean ENABLE_BIASED_LOCKING = true;
@Inline
@NoNullCheck
......
......@@ -104,6 +104,7 @@ public class TimerThread extends SystemThread {
printExceptionAndDie(e);
}
}
@UninterruptibleNoWarn
private static void printExceptionAndDie(Throwable e) {
VM.sysWriteln("Unexpected exception thrown in timer thread: ",e.toString());
......
......@@ -4,6 +4,9 @@ import org.jikesrvm.VM;
import org.jikesrvm.adaptive.controller.Controller;
import org.jikesrvm.adaptive.database.AOSDatabase;
import org.jikesrvm.adaptive.measurements.instrumentation.Instrumentation;
import org.jikesrvm.classloader.NormalMethod;
import org.jikesrvm.classloader.RVMMethod;
import org.jikesrvm.compilers.common.CompiledMethod;
import org.jikesrvm.compilers.common.CompiledMethods;
import org.jikesrvm.compilers.opt.controlflow.YieldPoints;
import org.jikesrvm.mm.mmtk.SynchronizedCounter;
......@@ -33,6 +36,9 @@ public class YieldpointStatistics {
public static long yieldpointOptInsertedForEpilogue = 0;
public static long yieldpointOptInsertedForBackedge = 0;
public static long yieldpointBaselineInserted = 0;
public static long yieldpointOptInsertedForVM = 0;
public static long yieldpointOptInsertedForApp = 0;
public static long gcRequestBlockTime;
......@@ -78,6 +84,18 @@ public class YieldpointStatistics {
Instrumentation.disableInstrumentation();
}
public static void yieldpointInserted(int position, NormalMethod method) {
switch(position) {
case RVMThread.PROLOGUE: yieldpointOptInsertedForPrologue++; break;
case RVMThread.EPILOGUE: yieldpointOptInsertedForEpilogue++; break;
case RVMThread.BACKEDGE: yieldpointOptInsertedForBackedge++; break;
}
if (method.isInVM())
yieldpointOptInsertedForVM++;
else yieldpointOptInsertedForApp++;
}
public static void yieldpointsPatched(int patched) {
if (patched > maxYieldpointsPatched)
maxYieldpointsPatched = patched;
......@@ -106,7 +124,7 @@ public class YieldpointStatistics {
stopData();
if (ENABLE_YP_COUNT) {
showYieldpointExecutedDist();
// showYieldpointExecutedDist();
}
printStatistics();
......@@ -152,6 +170,12 @@ public class YieldpointStatistics {
}
}
}
public static void printStatisticsForBootImage() {
VM.sysWriteln("============================");
VM.sysWriteln("yieldpoint inserted for VM: ", yieldpointOptInsertedForVM);
VM.sysWriteln("yieldpoint inserted for APP:", yieldpointOptInsertedForApp);
}
public static void printStatistics() {
VM.sysWriteln("============================ Tabulate Statistics ============================");
......@@ -173,6 +197,10 @@ public class YieldpointStatistics {
printColumn("yieldpointInsertedForEpilogue");
printColumn("yieldpointInsertedForBackedge");
printColumn("yieldpointInsertedForBaseline");
printColumn("yieldpointInsertedForVM");
printColumn("yieldpointInsertedForApp");
printColumn("totalInstructionsInVM");
printColumn("totalInstructionsInApp");
}
printNewLine();
printColumn(yieldpointTurnedOnLatency);
......@@ -193,11 +221,46 @@ public class YieldpointStatistics {
printColumn((double)yieldpointOptInsertedForEpilogue);
printColumn((double)yieldpointOptInsertedForBackedge);
printColumn((double)yieldpointBaselineInserted);
printColumn((double)yieldpointOptInsertedForVM);
printColumn((double)yieldpointOptInsertedForApp);
printColumn(countInstructionsForVM());
printColumn(countInstructionsForApp());
}
printNewLine();
VM.sysWriteln("------------------------------ End Tabulate Statistics -----------------------------");
}
private static double countInstructionsForApp() {
double ret = 0;
for (int i = 0, n = CompiledMethods.numCompiledMethods(); i < n; i ++) {
CompiledMethod cm = CompiledMethods.getCompiledMethodUnchecked(i);
if (cm != null && cm.isCompiled() && cm.getCompilerType() == CompiledMethod.OPT) {
// cm.size();
if (!cm.getMethod().isInVM())
ret += cm.numberOfInstructions();
}
}
return ret;
}
private static double countInstructionsForVM() {
double ret = 0;
for (int i = 0, n = CompiledMethods.numCompiledMethods(); i < n; i ++) {
CompiledMethod cm = CompiledMethods.getCompiledMethodUnchecked(i);
if (cm != null && cm.isCompiled() && cm.getCompilerType() == CompiledMethod.OPT) {
if (cm.getMethod().isInVM())
ret += cm.numberOfInstructions();
}
}
return ret;
}
private static void printColumn(String s) {
VM.sysWrite(s);
VM.sysWrite("\t");
......
......@@ -86,6 +86,7 @@ import org.jikesrvm.runtime.Entrypoints;
import org.jikesrvm.runtime.Magic;
import org.jikesrvm.runtime.Statics;
import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.YieldpointStatistics;
import org.vmmagic.unboxed.Address;
import org.vmmagic.unboxed.Extent;
import org.vmmagic.unboxed.ObjectReference;
......@@ -1113,6 +1114,8 @@ public class BootImageWriter extends BootImageWriterMessages {
if (demographics) {
spaceReport();
}
YieldpointStatistics.printStatisticsForBootImage();
//
// Summarize status of types that were referenced by objects we put into
......
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