# HG changeset patch # User Thomas Wuerthinger # Date 1294856072 -3600 # Node ID 3c0a889a176bc209b9bb5bb040ccd2a48306b77a # Parent 0db8c8cc5b4a27273e6c7ae8c8e6f986d66791cd Added GC stats. Enabling intrinsics. diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java Wed Jan 12 19:14:32 2011 +0100 @@ -20,6 +20,7 @@ */ package com.sun.hotspot.c1x; +import java.lang.management.*; import java.lang.reflect.Proxy; import java.net.*; @@ -40,6 +41,7 @@ public final class Compiler { private static Compiler theInstance; + private static boolean PrintGCStats = false; public static Compiler getInstance() { if (theInstance == null) { @@ -62,9 +64,33 @@ if (C1XOptions.PrintTimers) { C1XTimers.print(); } + + if (PrintGCStats) { + printGCStats(); + } } } + public static void printGCStats() { + long totalGarbageCollections = 0; + long garbageCollectionTime = 0; + + for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) { + long count = gc.getCollectionCount(); + if (count >= 0) { + totalGarbageCollections += count; + } + + long time = gc.getCollectionTime(); + if (time >= 0) { + garbageCollectionTime += time; + } + } + + System.out.println("Total Garbage Collections: " + totalGarbageCollections); + System.out.println("Total Garbage Collection Time (ms): " + garbageCollectionTime); + } + public static VMExits initializeServer(VMEntries entries) { if (Logger.ENABLED) { vmEntries = LoggingProxy.getProxy(VMEntries.class, entries); diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerObject.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerObject.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerObject.java Wed Jan 12 19:14:32 2011 +0100 @@ -28,5 +28,26 @@ * * @author Lukas Stadler */ -public interface CompilerObject extends Serializable { +public abstract class CompilerObject implements Serializable { + + + private static final boolean PrintStats = false; + private static int AllocatedCount; + private static int FinalizeCount; + + public CompilerObject() { + AllocatedCount++; + if (PrintStats && AllocatedCount % 1000 == 0) { + System.out.println("Allocated " + AllocatedCount); + } + } + + @Override + protected void finalize() throws Throwable { + FinalizeCount++; + if (PrintStats && FinalizeCount % 1000 == 0) { + System.out.println("Finalized " + FinalizeCount); + } + super.finalize(); + } } diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java Wed Jan 12 19:14:32 2011 +0100 @@ -27,7 +27,7 @@ * * @author Thomas Wuerthinger, Lukas Stadler */ -public class HotSpotConstantPool implements RiConstantPool, CompilerObject { +public class HotSpotConstantPool extends CompilerObject implements RiConstantPool { private final long vmId; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotExceptionHandler.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotExceptionHandler.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotExceptionHandler.java Wed Jan 12 19:14:32 2011 +0100 @@ -23,7 +23,7 @@ import com.sun.cri.ri.*; -public class HotSpotExceptionHandler implements RiExceptionHandler, CompilerObject { +public class HotSpotExceptionHandler extends CompilerObject implements RiExceptionHandler { private int startBci; private int endBci; private int handlerBci; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java Wed Jan 12 19:14:32 2011 +0100 @@ -31,7 +31,7 @@ * * @author Thomas Wuerthinger, Lukas Stadler */ -public class HotSpotField implements RiField, CompilerObject { +public class HotSpotField extends CompilerObject implements RiField { private final RiType holder; private final String name; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethod.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethod.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethod.java Wed Jan 12 19:14:32 2011 +0100 @@ -23,6 +23,6 @@ import com.sun.cri.ri.*; -public interface HotSpotMethod extends RiMethod, CompilerObject { +public interface HotSpotMethod extends RiMethod { } diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethodResolved.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethodResolved.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethodResolved.java Wed Jan 12 19:14:32 2011 +0100 @@ -30,7 +30,7 @@ * * @author Thomas Wuerthinger, Lukas Stadler */ -public class HotSpotMethodResolved implements HotSpotMethod { +public class HotSpotMethodResolved extends CompilerObject implements HotSpotMethod { private final long vmId; private final String name; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotSignature.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotSignature.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotSignature.java Wed Jan 12 19:14:32 2011 +0100 @@ -30,7 +30,7 @@ * * @author Thomas Wuerthinger, Lukas Stadler */ -public class HotSpotSignature implements RiSignature, CompilerObject { +public class HotSpotSignature extends CompilerObject implements RiSignature { private final List arguments = new ArrayList(); private final String returnType; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java Wed Jan 12 19:14:32 2011 +0100 @@ -31,7 +31,7 @@ * * @author Lukas Stadler */ -public final class HotSpotTargetMethod implements CompilerObject { +public final class HotSpotTargetMethod extends CompilerObject { public final CiTargetMethod targetMethod; public final HotSpotMethodResolved method; // used only for methods diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotType.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotType.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotType.java Wed Jan 12 19:14:32 2011 +0100 @@ -27,7 +27,7 @@ * * @author Lukas Stadler */ -public interface HotSpotType extends RiType, CompilerObject { +public interface HotSpotType extends RiType { String simpleName(); diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypePrimitive.java Wed Jan 12 19:14:32 2011 +0100 @@ -28,7 +28,7 @@ * * @author Thomas Wuerthinger, Lukas Stadler */ -public final class HotSpotTypePrimitive implements HotSpotType { +public final class HotSpotTypePrimitive extends CompilerObject implements HotSpotType { private CiKind kind; diff -r 0db8c8cc5b4a -r 3c0a889a176b c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java Tue Jan 11 17:02:38 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java Wed Jan 12 19:14:32 2011 +0100 @@ -27,7 +27,7 @@ * * @author Lukas Stadler */ -public class HotSpotVMConfig implements CompilerObject { +public class HotSpotVMConfig extends CompilerObject { // os information, register layout, code generation, ... public boolean windowsOs; diff -r 0db8c8cc5b4a -r 3c0a889a176b src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Tue Jan 11 17:02:38 2011 +0100 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Wed Jan 12 19:14:32 2011 +0100 @@ -1343,8 +1343,8 @@ // will be place in C abi locations #ifdef _LP64 - __ verify_oop(c_rarg0); - __ mov(rax, c_rarg0); + __ verify_oop((UseC1X) ? j_rarg0 : c_rarg0); + __ mov(rax, (UseC1X) ? j_rarg0 : c_rarg0); #else // The object is passed on the stack and we haven't pushed a // frame yet so it's one work away from top of stack. diff -r 0db8c8cc5b4a -r 3c0a889a176b src/share/vm/c1x/c1x_CodeInstaller.cpp --- a/src/share/vm/c1x/c1x_CodeInstaller.cpp Tue Jan 11 17:02:38 2011 +0100 +++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp Wed Jan 12 19:14:32 2011 +0100 @@ -520,9 +520,12 @@ call->set_destination(Runtime1::entry_for(Runtime1::c1x_arithmetic_drem_id)); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); TRACE_C1X_3("CiRuntimeCall::ArithmeticDrem()"); + } else if (runtime_call == CiRuntimeCall::RegisterFinalizer()) { + call->set_destination(Runtime1::entry_for(Runtime1::register_finalizer_id)); + _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); } else { - TRACE_C1X_1("runtime_call not implemented: "); - IF_TRACE_C1X_1 runtime_call->print(); + runtime_call->print(); + fatal("runtime_call not implemented"); } } else if (global_stub != NULL) { NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);