[llvm-commits] [vmkit] r51643 - in /vmkit/trunk/lib: JnJVM/VMCore/JavaClass.h JnJVM/VMCore/JavaInitialise.cpp JnJVM/VMCore/JavaIsolate.cpp JnJVM/VMCore/JavaTypes.cpp JnJVM/VMCore/JavaTypes.h JnJVM/VMCore/JnjvmModule.cpp JnJVM/VMCore/LockedMap.h JnJVM/VMCore/VirtualTables.cpp Mvm/MvmMemoryManager.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed May 28 07:59:32 PDT 2008
Author: geoffray
Date: Wed May 28 09:59:31 2008
New Revision: 51643
URL: http://llvm.org/viewvc/llvm-project?rev=51643&view=rev
Log:
Make code objects root objects for now.
Typedef, Signdef and TypeMap objects are not GC allocated anymore.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Wed May 28 09:59:31 2008
@@ -279,8 +279,6 @@
unsigned int minor;
unsigned int major;
ArrayUInt8* bytes;
- mvm::Code* codeVirtualTracer;
- mvm::Code* codeStaticTracer;
JavaCtpInfo* ctpInfo;
std::vector<Attribut*> attributs;
std::vector<Class*> innerClasses;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Wed May 28 09:59:31 2008
@@ -50,8 +50,6 @@
INIT(LockObj);
INIT(JavaObject);
INIT(JavaThread);
- INIT(Typedef);
- INIT(Signdef);
INIT(Jnjvm);
INIT(Reader);
INIT(ZipFile);
@@ -59,7 +57,6 @@
INIT(ClassMap);
INIT(ZipFileMap);
INIT(StringMap);
- INIT(jnjvm::TypeMap);
INIT(JavaIsolate);
INIT(JavaString);
#ifdef SERVICE_VM
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed May 28 09:59:31 2008
@@ -467,7 +467,7 @@
bootstrapVM->hashUTF8->copy(isolate->hashUTF8);
isolate->hashStr = vm_new(isolate, StringMap)();
isolate->bootstrapClasses = callingVM->bootstrapClasses;
- isolate->javaTypes = vm_new(isolate, TypeMap)();
+ isolate->javaTypes = new TypeMap();
isolate->globalRefsLock = mvm::Lock::allocNormal();
#ifdef MULTIPLE_VM
isolate->statics = vm_new(isolate, StaticInstanceMap)();
@@ -522,7 +522,7 @@
isolate->jniEnv = &JNI_JNIEnvTable;
isolate->javavmEnv = &JNI_JavaVMTable;
isolate->globalRefsLock = mvm::Lock::allocNormal();
- isolate->javaTypes = vm_new(isolate, TypeMap)();
+ isolate->javaTypes = new TypeMap();
#ifdef MULTIPLE_VM
isolate->statics = vm_new(isolate, StaticInstanceMap)();
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed May 28 09:59:31 2008
@@ -401,10 +401,12 @@
}
}
-void Typedef::print(mvm::PrintBuffer* buf) const {
+const char* Typedef::printString() const {
+ mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc();
buf->write("Type<");
tPrintBuf(buf);
buf->write(">");
+ return buf->contents()->cString();
}
CommonClass* Typedef::assocClass(JavaObject* loader) {
@@ -429,12 +431,14 @@
buf->write(")");
}
-void Signdef::print(mvm::PrintBuffer* buf) const {
+const char* Signdef::printString() const {
+ mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc();
buf->write("Signature<");
ret->tPrintBuf(buf);
buf->write("...");
Typedef::humanPrintArgs(&args, buf);
buf->write(">");
+ return buf->contents()->cString();
}
void Signdef::printWithSign(CommonClass* cl, const UTF8* name,
@@ -473,7 +477,7 @@
typeError(name, 0);
}
- Signdef* res = vm_new(vm, Signdef)();
+ Signdef* res = new Signdef();
res->args = buf;
res->ret = vm->constructType(name->extract(vm, pos, pred));
res->isolate = vm;
@@ -496,7 +500,7 @@
if (funcs == AssessorDesc::dParg) {
return Signdef::signDup(name, vm);
} else {
- Typedef* res = vm_new(vm, Typedef)();
+ Typedef* res = new Typedef();
res->isolate = vm;
res->keyName = name;
res->funcs = funcs;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Wed May 28 09:59:31 2008
@@ -122,16 +122,14 @@
};
-class Typedef : public mvm::Object {
+class Typedef {
public:
- static VirtualTable *VT;
const UTF8* keyName;
const UTF8* pseudoAssocClassName;
const AssessorDesc* funcs;
Jnjvm* isolate;
- virtual void print(mvm::PrintBuffer* buf) const;
- virtual void TRACER;
+ const char* printString() const;
CommonClass* assocClass(JavaObject* loader);
void typePrint(mvm::PrintBuffer* buf);
@@ -154,12 +152,10 @@
void* virtualCallAP();
public:
- static VirtualTable *VT;
std::vector<Typedef*> args;
Typedef* ret;
- virtual void print(mvm::PrintBuffer* buf) const;
- virtual void TRACER;
+ const char* printString() const;
void printWithSign(CommonClass* cl, const UTF8* name, mvm::PrintBuffer* buf);
static Signdef* signDup(const UTF8* name, Jnjvm* vm);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed May 28 09:59:31 2008
@@ -299,10 +299,8 @@
if (!stat) {
LCI->virtualTracerFunction = func;
- cl->codeVirtualTracer = mvm::Code::getCodeFromPointer(codePtr);
} else {
LCI->staticTracerFunction = func;
- cl->codeStaticTracer = mvm::Code::getCodeFromPointer(codePtr);
}
#endif
return res;
Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed May 28 09:59:31 2008
@@ -170,22 +170,31 @@
virtual void TRACER;
};
-class TypeMap :
- public LockedMap<const UTF8*, Typedef*, ltutf8 > {
+class TypeMap {
public:
- static VirtualTable* VT;
+ mvm::Lock* lock;
+
+ std::map<const UTF8*, Typedef*, ltutf8> map;
+ typedef std::map<const UTF8*, Typedef*, ltutf8>::iterator iterator;
- inline Typedef* lookupOrCreate(const UTF8*& V, Jnjvm *vm, funcCreate func) {
- assert(0);
- return 0;
+ inline Typedef* lookup(const UTF8* V) {
+ lock->lock();
+ iterator End = map.end();
+ iterator I = map.find(V);
+ lock->unlock();
+ return I != End ? I->second : 0;
+ }
+
+ inline void hash(const UTF8* k, Typedef* c) {
+ lock->lock();
+ map.insert(std::make_pair(k, c));
+ lock->unlock();
}
TypeMap() {
lock = mvm::Lock::allocRecursive();
}
- virtual void TRACER;
-
};
class StaticInstanceMap :
Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Wed May 28 09:59:31 2008
@@ -48,8 +48,6 @@
INIT(LockObj);
INIT(JavaObject);
INIT(JavaThread);
- INIT(Typedef);
- INIT(Signdef);
INIT(Jnjvm);
INIT(Reader);
INIT(ZipFile);
@@ -57,7 +55,6 @@
INIT(ClassMap);
INIT(ZipFileMap);
INIT(StringMap);
- INIT(TypeMap);
INIT(StaticInstanceMap);
INIT(JavaIsolate);
INIT(JavaString);
@@ -111,19 +108,6 @@
#ifndef MULTIPLE_VM
delegatee->MARK_AND_TRACE;
#endif
-
- for (method_iterator i = staticMethods.begin(), e = staticMethods.end();
- i!= e; ++i) {
- mvm::Code* c = i->second->code;
- if (c) c->MARK_AND_TRACE;
- }
-
- for (method_iterator i = virtualMethods.begin(), e = virtualMethods.end();
- i!= e; ++i) {
- mvm::Code* c = i->second->code;
- if (c) c->MARK_AND_TRACE;
- }
-
}
void Class::TRACER {
@@ -132,8 +116,6 @@
#ifndef MULTIPLE_VM
_staticInstance->MARK_AND_TRACE;
#endif
- codeStaticTracer->MARK_AND_TRACE;
- codeVirtualTracer->MARK_AND_TRACE;
}
void ClassArray::TRACER {
@@ -171,21 +153,10 @@
if (pendingException) pendingException->MARK_AND_TRACE;
}
-void Typedef::TRACER {
-}
-
-void Signdef::TRACER {
- _staticCallBuf->MARK_AND_TRACE;
- _virtualCallBuf->MARK_AND_TRACE;
- _staticCallAP->MARK_AND_TRACE;
- _virtualCallAP->MARK_AND_TRACE;
-}
-
void Jnjvm::TRACER {
appClassLoader->MARK_AND_TRACE;
hashStr->MARK_AND_TRACE;
bootstrapClasses->MARK_AND_TRACE;
- javaTypes->MARK_AND_TRACE;
TRACE_VECTOR(JavaObject*, gc_allocator, globalRefs);
#ifdef MULTIPLE_VM
statics->MARK_AND_TRACE;
@@ -231,12 +202,6 @@
}
}
-void TypeMap::TRACER {
- for (iterator i = map.begin(), e = map.end(); i!= e; ++i) {
- i->second->MARK_AND_TRACE;
- }
-}
-
void StaticInstanceMap::TRACER {
for (iterator i = map.begin(), e = map.end(); i!= e; ++i) {
i->second->second->MARK_AND_TRACE;
Modified: vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp?rev=51643&r1=51642&r2=51643&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp (original)
+++ vmkit/trunk/lib/Mvm/MvmMemoryManager.cpp Wed May 28 09:59:31 2008
@@ -32,6 +32,7 @@
meth->llvmFunction = F;
res->method(meth);
currentMethod = meth;
+ Object::pushRoot(meth);
return (unsigned char*)((unsigned int*)res + 2);
}
More information about the llvm-commits
mailing list