[vmkit-commits] [vmkit] r85399 - in /vmkit/trunk/lib/Mvm: Compiler/JIT.cpp MMTk/MvmGC.cpp MMTk/MvmGC.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Oct 28 09:24:32 PDT 2009
Author: geoffray
Date: Wed Oct 28 11:24:32 2009
New Revision: 85399
URL: http://llvm.org/viewvc/llvm-project?rev=85399&view=rev
Log:
Add new functions to be called on boot and by the GC.
Modified:
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp
vmkit/trunk/lib/Mvm/MMTk/MvmGC.h
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=85399&r1=85398&r2=85399&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Wed Oct 28 11:24:32 2009
@@ -74,6 +74,7 @@
}
typedef void (*BootType)(uintptr_t Plan);
+typedef void (*BootHeapType)(intptr_t initial, intptr_t max);
void MvmModule::initialise(CodeGenOpt::Level level, Module* M,
TargetMachine* T) {
@@ -174,6 +175,12 @@
F = dyn_cast<Function>(GA->getAliasee());
gc::MMTkCheckAllocator = (gc::MMTkCheckAllocatorType)
(uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_utility_heap_HeapGrowthManager_boot__Lorg_vmmagic_unboxed_Extent_2Lorg_vmmagic_unboxed_Extent_2");
+ assert(F && "Could not find boot from HeapGrowthManager");
+ BootHeapType BootHeap = (BootHeapType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+ BootHeap(50 * 1024 * 1024, 100 * 1024 * 1024);
GV = globalModule->getGlobalVariable("org_j3_config_Selected_4Plan_static", false);
assert(GV && "No global plan.");
@@ -214,6 +221,40 @@
gc::MMTkProcessRootEdge = (gc::MMTkProcessRootEdgeType)
(uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_isLive__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkIsLive = (gc::MMTkIsLiveType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_retainForFinalize__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkRetainForFinalize = (gc::MMTkRetainForFinalizeType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_retainReferent__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkRetainReferent = (gc::MMTkRetainReferentType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_getForwardedReference__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkGetForwardedReference = (gc::MMTkGetForwardedReferenceType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_getForwardedReferent__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkGetForwardedReferent = (gc::MMTkGetForwardedReferentType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+ F = globalModule->getFunction("JnJVM_org_mmtk_plan_TraceLocal_getForwardedFinalizable__Lorg_vmmagic_unboxed_ObjectReference_2");
+ assert(F && "Could not find isLive from TraceLocal");
+ gc::MMTkGetForwardedFinalizable = (gc::MMTkGetForwardedFinalizableType)
+ (uintptr_t)executionEngine->getPointerToFunction(F);
+
+
+
}
#endif
Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp?rev=85399&r1=85398&r2=85399&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp (original)
+++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp Wed Oct 28 11:24:32 2009
@@ -21,6 +21,13 @@
gc::MMTkDelayedRootType gc::MMTkDelayedRoot = 0;
gc::MMTkProcessEdgeType gc::MMTkProcessEdge = 0;
gc::MMTkProcessRootEdgeType gc::MMTkProcessRootEdge = 0;
+gc::MMTkIsLiveType gc::MMTkIsLive = 0;
+
+gc::MMTkRetainReferentType gc::MMTkRetainReferent = 0;
+gc::MMTkRetainForFinalizeType gc::MMTkRetainForFinalize = 0;
+gc::MMTkGetForwardedReferentType gc::MMTkGetForwardedReferent = 0;
+gc::MMTkGetForwardedReferenceType gc::MMTkGetForwardedReference = 0;
+gc::MMTkGetForwardedFinalizableType gc::MMTkGetForwardedFinalizable = 0;
uintptr_t Collector::TraceLocal = 0;
@@ -84,7 +91,7 @@
extern "C" void conditionalSafePoint() {
mvm::Thread::get()->startNative(1);
- abort();
+ mvm::Thread::get()->MyVM->rendezvous.traceThreadStack();
mvm::Thread::get()->endNative();
}
Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.h?rev=85399&r1=85398&r2=85399&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MMTk/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.h Wed Oct 28 11:24:32 2009
@@ -57,7 +57,13 @@
typedef void (*MMTkProcessRootEdgeType)(uintptr_t TraceLocal, void* slot,
uint8_t untraced);
- typedef void (*MMTkIsLiveType)(uintptr_t TraceLocal, void* obj);
+ typedef uint8_t (*MMTkIsLiveType)(uintptr_t TraceLocal, void* obj);
+
+ typedef gc* (*MMTkRetainReferentType)(uintptr_t TraceLocal, void* obj);
+ typedef MMTkRetainReferentType MMTkRetainForFinalizeType;
+ typedef MMTkRetainReferentType MMTkGetForwardedReferenceType;
+ typedef MMTkRetainReferentType MMTkGetForwardedReferentType;
+ typedef MMTkRetainReferentType MMTkGetForwardedFinalizableType;
static MMTkAllocType MMTkGCAllocator;
@@ -70,6 +76,14 @@
static MMTkProcessEdgeType MMTkProcessEdge;
static MMTkProcessRootEdgeType MMTkProcessRootEdge;
+
+ static MMTkIsLiveType MMTkIsLive;
+
+ static MMTkRetainReferentType MMTkRetainReferent;
+ static MMTkRetainForFinalizeType MMTkRetainForFinalize;
+ static MMTkGetForwardedReferenceType MMTkGetForwardedReference;
+ static MMTkGetForwardedReferentType MMTkGetForwardedReferent;
+ static MMTkGetForwardedFinalizableType MMTkGetForwardedFinalizable;
void* operator new(size_t sz, VirtualTable *VT) {
@@ -95,12 +109,8 @@
static uintptr_t TraceLocal;
- static bool isLive(gc*) {
- abort();
- }
-
- static void traceStackThread() {
- abort();
+ static bool isLive(gc* ptr) {
+ return gc::MMTkIsLive(TraceLocal, ptr);
}
static void scanObject(void** ptr) {
@@ -119,6 +129,31 @@
gc::MMTkProcessRootEdge(TraceLocal, ptr, true);
}
+ static gc* retainForFinalize(gc* val) {
+ assert(TraceLocal && "scanning without a trace local");
+ return gc::MMTkRetainForFinalize(TraceLocal, val);
+ }
+
+ static gc* retainReferent(gc* val) {
+ assert(TraceLocal && "scanning without a trace local");
+ return gc::MMTkRetainReferent(TraceLocal, val);
+ }
+
+ static gc* getForwardedFinalizable(gc* val) {
+ assert(TraceLocal && "scanning without a trace local");
+ return gc::MMTkGetForwardedFinalizable(TraceLocal, val);
+ }
+
+ static gc* getForwardedReference(gc* val) {
+ assert(TraceLocal && "scanning without a trace local");
+ return gc::MMTkGetForwardedReference(TraceLocal, val);
+ }
+
+ static gc* getForwardedReferent(gc* val) {
+ assert(TraceLocal && "scanning without a trace local");
+ return gc::MMTkGetForwardedReferent(TraceLocal, val);
+ }
+
static void collect() {
abort();
}
More information about the vmkit-commits
mailing list