[vmkit-commits] [vmkit] r100963 - in /vmkit/trunk: include/j3/ include/mvm/GC/ lib/J3/Compiler/ lib/J3/VMCore/ lib/Mvm/CommonThread/ lib/Mvm/GCMmap2/ lib/Mvm/MMTk/ lib/Mvm/Runtime/ lib/N3/VMCore/ mmtk/mmtk-alloc/ mmtk/mmtk-j3/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Apr 11 09:26:48 PDT 2010
Author: geoffray
Date: Sun Apr 11 11:26:48 2010
New Revision: 100963
URL: http://llvm.org/viewvc/llvm-project?rev=100963&view=rev
Log:
Code cleanup and start working on specialized tracing for MMTk.
Modified:
vmkit/trunk/include/j3/JavaLLVMCompiler.h
vmkit/trunk/include/mvm/GC/GC.h
vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/J3/VMCore/JavaObject.h
vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp
vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h
vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp
vmkit/trunk/lib/Mvm/MMTk/MvmGC.h
vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
vmkit/trunk/lib/N3/VMCore/LockedMap.h
vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp
vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp
vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
vmkit/trunk/mmtk/mmtk-j3/FinalizableProcessor.cpp
vmkit/trunk/mmtk/mmtk-j3/ReferenceProcessor.cpp
vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp
Modified: vmkit/trunk/include/j3/JavaLLVMCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaLLVMCompiler.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaLLVMCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaLLVMCompiler.h Sun Apr 11 11:26:48 2010
@@ -17,6 +17,8 @@
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
+#include <map>
+
namespace llvm {
class BasicBlock;
class DIFactory;
Modified: vmkit/trunk/include/mvm/GC/GC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/GC/GC.h (original)
+++ vmkit/trunk/include/mvm/GC/GC.h Sun Apr 11 11:26:48 2010
@@ -12,27 +12,8 @@
#define MVM_GC_H
#include <stdint.h>
-#include <map>
-struct VirtualTable {
- uintptr_t destructor;
- uintptr_t operatorDelete;
- uintptr_t tracer;
-
- uintptr_t* getFunctions() {
- return &destructor;
- }
-
- VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) {
- destructor = d;
- operatorDelete = o;
- tracer = t;
- }
-
- VirtualTable() {}
-
- static void emptyTracer(void*) {}
-};
+struct VirtualTable;
class gcRoot {
public:
Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Sun Apr 11 11:26:48 2010
@@ -108,12 +108,22 @@
JavaArraySizeOffsetConstant = constantOne;
JavaObjectLockOffsetConstant = constantOne;
JavaObjectVTOffsetConstant = constantZero;
- OffsetClassInVTConstant = constantThree;
- OffsetDepthInVTConstant = constantFour;
- OffsetDisplayInVTConstant = constantSeven;
+
+ OffsetClassInVTConstant =
+ ConstantInt::get(Type::getInt32Ty(Context),
+ JavaVirtualTable::getClassIndex());
+ OffsetDepthInVTConstant =
+ ConstantInt::get(Type::getInt32Ty(Context),
+ JavaVirtualTable::getDepthIndex());
+ OffsetDisplayInVTConstant =
+ ConstantInt::get(Type::getInt32Ty(Context),
+ JavaVirtualTable::getDisplayIndex());
OffsetBaseClassVTInVTConstant =
- ConstantInt::get(Type::getInt32Ty(Context), 17);
- OffsetIMTInVTConstant = ConstantInt::get(Type::getInt32Ty(Context), 18);
+ ConstantInt::get(Type::getInt32Ty(Context),
+ JavaVirtualTable::getBaseClassIndex());
+ OffsetIMTInVTConstant =
+ ConstantInt::get(Type::getInt32Ty(Context),
+ JavaVirtualTable::getIMTIndex());
OffsetAccessInCommonClassConstant = constantOne;
IsArrayConstant = ConstantInt::get(Type::getInt16Ty(Context),
Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Sun Apr 11 11:26:48 2010
@@ -1399,6 +1399,11 @@
Elemts.push_back(Tracer ?
ConstantExpr::getCast(Instruction::BitCast, Tracer, PTy) : N);
+
+ for (uint32_t i = 0; i < VirtualTable::numberOfSpecializedTracers(); i++) {
+ // Push null for now.
+ Elemts.push_back(N);
+ }
// Class
Elemts.push_back(ConstantExpr::getCast(Instruction::BitCast,
Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaObject.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaObject.h Sun Apr 11 11:26:48 2010
@@ -131,13 +131,13 @@
/// getFirstJavaMethodIndex - Get the word offset of the first Java method.
///
static uint32_t getFirstJavaMethodIndex() {
- return 19;
+ return numberOfBaseFunctions() + 16;
}
/// getBaseSize - Get the size of the java.lang.Object virtual table.
///
static uint32_t getBaseSize() {
- return 30;
+ return numberOfBaseFunctions() + 27;
}
/// getNumJavaMethods - Get the number of methods of the java.lang.Object
@@ -153,32 +153,62 @@
return 8;
}
- /// getCacheIndex - Get the word offset of the type cache.
+ /// getClassIndex - Get the word offset of the class.
///
- static uint32_t getCacheIndex() {
- return 6;
+ static uint32_t getClassIndex() {
+ return numberOfBaseFunctions();
+ }
+
+ /// getDepthIndex - Get the word offset of the depth.
+ ///
+ static uint32_t getDepthIndex() {
+ return numberOfBaseFunctions() + 1;
}
/// getOffsetIndex - Get the word offset of the type cache.
///
static uint32_t getOffsetIndex() {
- return 5;
+ return numberOfBaseFunctions() + 2;
}
- /// getSecondaryTypesIndex - Get the word offset of the secondary types
- /// list.
+ /// getCacheIndex - Get the word offset of the type cache.
///
- static uint32_t getSecondaryTypesIndex() {
- return 16;
+ static uint32_t getCacheIndex() {
+ return numberOfBaseFunctions() + 3;
+ }
+
+ /// getDisplayIndex - Get the word offset of the display.
+ ///
+ static uint32_t getDisplayIndex() {
+ return numberOfBaseFunctions() + 4;
}
/// getNumSecondaryTypesIndex - Get the word offset of the number of
/// secondary types.
///
static uint32_t getNumSecondaryTypesIndex() {
- return 15;
+ return numberOfBaseFunctions() + 12;
}
-
+
+ /// getSecondaryTypesIndex - Get the word offset of the secondary types
+ /// list.
+ ///
+ static uint32_t getSecondaryTypesIndex() {
+ return numberOfBaseFunctions() + 13;
+ }
+
+ /// getBaseClassIndex - Get the word offset of the base class.
+ ///
+ static uint32_t getBaseClassIndex() {
+ return numberOfBaseFunctions() + 14;
+ }
+
+ /// getIMTIndex - Get the word offset of the IMT.
+ ///
+ static uint32_t getIMTIndex() {
+ return numberOfBaseFunctions() + 15;
+ }
+
/// isSubtypeOf - Returns true if the given VT is a subtype of the this
/// VT.
///
Modified: vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Sun Apr 11 11:26:48 2010
@@ -9,6 +9,8 @@
#include <cassert>
#include "MvmGC.h"
+#include "mvm/VirtualMachine.h"
+#include "mvm/Threads/CollectionRV.h"
using namespace mvm;
Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Sun Apr 11 11:26:48 2010
@@ -16,12 +16,34 @@
#include "gcalloc.h"
#define gc_allocator std::allocator
-#define gc_new(Class) __gc_new(Class::VT) Class
-#define __gc_new new
+struct VirtualTable {
+ uintptr_t destructor;
+ uintptr_t operatorDelete;
+ uintptr_t tracer;
+
+ static uint32_t numberOfBaseFunctions() {
+ return 3;
+ }
+
+ static uint32_t numberOfSpecializedTracers() {
+ return 0;
+ }
-#define TRACER tracer()
-#define CALL_TRACER tracer()
+ uintptr_t* getFunctions() {
+ return &destructor;
+ }
+
+ VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) {
+ destructor = d;
+ operatorDelete = o;
+ tracer = t;
+ }
+
+ VirtualTable() {}
+
+ static void emptyTracer(void*) {}
+};
namespace mvm {
Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp (original)
+++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp Sun Apr 11 11:26:48 2010
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "MvmGC.h"
+#include "MutatorThread.h"
+#include "mvm/VirtualMachine.h"
#include <set>
Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MMTk/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.h Sun Apr 11 11:26:48 2010
@@ -11,22 +11,39 @@
#ifndef MVM_MMTK_GC_H
#define MVM_MMTK_GC_H
-#include "MutatorThread.h"
-#include "mvm/VirtualMachine.h"
#include "mvm/GC/GC.h"
+#include <cstdlib>
-#include "llvm/Support/MathExtras.h"
+#define gc_allocator std::allocator
+struct VirtualTable {
+ uintptr_t destructor;
+ uintptr_t operatorDelete;
+ uintptr_t tracer;
+ uintptr_t specializedTracers[1];
+
+ static uint32_t numberOfBaseFunctions() {
+ return 4;
+ }
-#define gc_allocator std::allocator
-#define gc_new(Class) __gc_new(Class::VT) Class
-#define __gc_new new
+ static uint32_t numberOfSpecializedTracers() {
+ return 1;
+ }
+ uintptr_t* getFunctions() {
+ return &destructor;
+ }
+
+ VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) {
+ destructor = d;
+ operatorDelete = o;
+ tracer = t;
+ }
-#define TRACER tracer()
-#define MARK_AND_TRACE markAndTrace()
-#define CALL_TRACER tracer()
+ VirtualTable() {}
+ static void emptyTracer(void*) {}
+};
extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT);
@@ -34,7 +51,6 @@
public:
size_t objectSize() const {
- fprintf(stderr, "Implement object size\n");
abort();
return 0;
}
Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Sun Apr 11 11:26:48 2010
@@ -9,9 +9,11 @@
#include "mvm/Allocator.h"
#include "mvm/MethodInfo.h"
+#include "mvm/VirtualMachine.h"
#include "MvmGC.h"
#include <dlfcn.h>
+#include <map>
#if defined(__MACH__)
#define SELF_HANDLE RTLD_DEFAULT
Modified: vmkit/trunk/lib/N3/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/LockedMap.h?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/N3/VMCore/LockedMap.h Sun Apr 11 11:26:48 2010
@@ -95,10 +95,10 @@
lock->unlock();
}
- virtual void TRACER {
+ virtual void tracer() {
//lock->MARK_AND_TRACE;
for (iterator i = map.begin(), e = map.end(); i!= e; ++i) {
- i->second->CALL_TRACER;
+ i->second->tracer();
}
}
Modified: vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Sun Apr 11 11:26:48 2010
@@ -40,69 +40,69 @@
#define CALL_TRACER_VECTOR(type, name, alloc) { \
for (std::vector<type, alloc<type> >::iterator i = name.begin(), e = name.end(); \
i!= e; ++i) { \
- (*i)->CALL_TRACER; }}
+ (*i)->tracer(); }}
// internal objects
-void VMThread::TRACER {
+void VMThread::tracer() {
mvm::Collector::markAndTraceRoot(&ooo_appThread);
mvm::Collector::markAndTraceRoot(&ooo_pendingException);
// I suppose that the vm is already traced by the gc
- // vm->CALL_TRACER;
+ // vm->tracer();
}
-void N3::TRACER {
+void N3::tracer() {
// If I understand, the gc already call trace for all VMThread
// if (bootstrapThread) {
-// bootstrapThread->CALL_TRACER;
+// bootstrapThread->tracer();
// for (VMThread* th = (VMThread*)bootstrapThread->next();
// th != bootstrapThread; th = (VMThread*)th->next())
-// th->CALL_TRACER;
+// th->tracer();
// }
- loadedAssemblies->CALL_TRACER;
+ loadedAssemblies->tracer();
}
-void Assembly::TRACER {
- loadedNameClasses->CALL_TRACER;
+void Assembly::tracer() {
+ loadedNameClasses->tracer();
mvm::Collector::markAndTraceRoot(&ooo_delegatee);
}
-void VMCommonClass::TRACER {
+void VMCommonClass::tracer() {
mvm::Collector::markAndTraceRoot(&ooo_delegatee);
CALL_TRACER_VECTOR(VMMethod*, virtualMethods, std::allocator);
CALL_TRACER_VECTOR(VMMethod*, staticMethods, std::allocator);
CALL_TRACER_VECTOR(Property*, properties, gc_allocator);
}
-void VMClass::TRACER {
- VMCommonClass::CALL_TRACER;
+void VMClass::tracer() {
+ VMCommonClass::tracer();
mvm::Collector::markAndTraceRoot(&staticInstance);
mvm::Collector::markAndTraceRoot(&virtualInstance);
}
-void VMGenericClass::TRACER {
- VMClass::CALL_TRACER;
+void VMGenericClass::tracer() {
+ VMClass::tracer();
}
-void VMClassArray::TRACER {
- VMCommonClass::CALL_TRACER;
+void VMClassArray::tracer() {
+ VMCommonClass::tracer();
}
-void VMClassPointer::TRACER {
- VMCommonClass::CALL_TRACER;
+void VMClassPointer::tracer() {
+ VMCommonClass::tracer();
}
-void VMMethod::TRACER {
+void VMMethod::tracer() {
mvm::Collector::markAndTraceRoot(&ooo_delegatee);
}
-void VMGenericMethod::TRACER {
- VMMethod::CALL_TRACER;
+void VMGenericMethod::tracer() {
+ VMMethod::tracer();
}
-void Property::TRACER {
+void Property::tracer() {
mvm::Collector::markAndTraceRoot(&ooo_delegatee);
}
// useless (never called or used) but it simplifies the definition of LockedMap
-void VMField::TRACER {
+void VMField::tracer() {
}
Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Sun Apr 11 11:26:48 2010
@@ -10,6 +10,8 @@
#include "MutatorThread.h"
#include "MvmGC.h"
+#include "mvm/VirtualMachine.h"
+
#include <sys/mman.h>
#include <set>
Modified: vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp Sun Apr 11 11:26:48 2010
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "mvm/VirtualMachine.h"
+
#include "JavaClass.h"
#include "JavaObject.h"
#include "JavaThread.h"
Modified: vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Collection.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Collection.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Collection.cpp Sun Apr 11 11:26:48 2010
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "mvm/VirtualMachine.h"
+
#include "JavaObject.h"
#include "JavaThread.h"
Modified: vmkit/trunk/mmtk/mmtk-j3/FinalizableProcessor.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/FinalizableProcessor.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/FinalizableProcessor.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/FinalizableProcessor.cpp Sun Apr 11 11:26:48 2010
@@ -8,6 +8,8 @@
//
//===----------------------------------------------------------------------===//
+#include "mvm/VirtualMachine.h"
+
#include "JavaObject.h"
#include "JavaThread.h"
Modified: vmkit/trunk/mmtk/mmtk-j3/ReferenceProcessor.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/ReferenceProcessor.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/ReferenceProcessor.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/ReferenceProcessor.cpp Sun Apr 11 11:26:48 2010
@@ -8,6 +8,8 @@
//
//===----------------------------------------------------------------------===//
+#include "mvm/VirtualMachine.h"
+
#include "JavaObject.h"
#include "JavaThread.h"
Modified: vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp?rev=100963&r1=100962&r2=100963&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp Sun Apr 11 11:26:48 2010
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "mvm/VirtualMachine.h"
+
#include "JavaObject.h"
#include "JavaThread.h"
More information about the vmkit-commits
mailing list