[vmkit-commits] [vmkit] r76573 - in /vmkit/trunk: include/jnjvm/JnjvmModule.h lib/JnJVM/Compiler/JavaJIT.cpp lib/JnJVM/Compiler/JnjvmModule.cpp lib/JnJVM/LLVMRuntime/runtime-default.ll lib/JnJVM/LLVMRuntime/runtime-isolate.ll lib/JnJVM/VMCore/JavaRuntimeJIT.cpp lib/JnJVM/VMCore/LinkJavaRuntime.h lib/JnJVM/VMCore/VirtualTables.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Jul 21 05:33:03 PDT 2009
Author: geoffray
Date: Tue Jul 21 07:32:49 2009
New Revision: 76573
URL: http://llvm.org/viewvc/llvm-project?rev=76573&view=rev
Log:
Re-animate jnjvmStringLookup and avoid doing any GC-allocation
when compiling.
Modified:
vmkit/trunk/include/jnjvm/JnjvmModule.h
vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll
vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-isolate.ll
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/LinkJavaRuntime.h
vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
Modified: vmkit/trunk/include/jnjvm/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/jnjvm/JnjvmModule.h?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/include/jnjvm/JnjvmModule.h (original)
+++ vmkit/trunk/include/jnjvm/JnjvmModule.h Tue Jul 21 07:32:49 2009
@@ -258,6 +258,7 @@
llvm::Function* ForceInitialisationCheckFunction;
llvm::Function* ForceLoadedCheckFunction;
llvm::Function* ClassLookupFunction;
+ llvm::Function* StringLookupFunction;
#ifndef WITHOUT_VTABLE
llvm::Function* VirtualLookupFunction;
#endif
@@ -273,8 +274,6 @@
llvm::Function* MultiCallNewFunction;
llvm::Function* GetArrayClassFunction;
-#ifdef ISOLATE
- llvm::Function* StringLookupFunction;
#ifdef ISOLATE_SHARING
llvm::Function* GetCtpCacheNodeFunction;
llvm::Function* GetCtpClassFunction;
@@ -284,7 +283,6 @@
llvm::Function* StaticCtpLookupFunction;
llvm::Function* SpecialCtpLookupFunction;
#endif
-#endif
#ifdef SERVICE
llvm::Function* ServiceCallStartFunction;
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Tue Jul 21 07:32:49 2009
@@ -1097,34 +1097,27 @@
uint8 type = ctpInfo->typeAt(index);
if (type == JavaConstantPool::ConstantString) {
-#if defined(ISOLATE)
- if (compilingClass->classLoader !=
- compilingClass->classLoader->bootstrapLoader) {
- const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
- JavaString* str = compilingClass->classLoader->UTF8ToStr(utf8);
-
- Value* val = module->getString(str, currentBlock);
+#if defined(ISOLATE)
+ abort();
+#else
+
+ JavaString* str = (JavaString*)ctpInfo->ctpRes[index];
+ if (str) {
+ Value* val = TheCompiler->getString(str);
push(val, false);
} else {
-
+ if (TheCompiler->isStaticCompiling()) {
+ const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
+ JavaString* str = compilingClass->classLoader->UTF8ToStr(utf8);
+ Value* val = TheCompiler->getString(str);
+ push(val, false);
+ }
// Lookup the constant pool cache
Value* val = getConstantPoolAt(index, module->StringLookupFunction,
module->JavaObjectType, 0, false);
push(val, false);
}
-#elif defined(ISOLATE_SHARING)
- // Lookup the constant pool cache
- Value* val = getConstantPoolAt(index, module->StringLookupFunction,
- module->JavaObjectType, 0, false);
- push(val, false);
-#else
- const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
- JavaString* str = compilingClass->classLoader->UTF8ToStr(utf8);
-
- Value* val = TheCompiler->getString(str);
- push(val, false);
-#endif
-
+#endif
} else if (type == JavaConstantPool::ConstantLong) {
push(llvmContext->getConstantInt(Type::Int64Ty, ctpInfo->LongAt(index)),
false);
@@ -1141,11 +1134,6 @@
UserCommonClass* cl = 0;
Value* res = getResolvedCommonClass(index, false, &cl);
-#ifndef ISOLATE
- if (cl) res = TheCompiler->getJavaClass(cl);
- else
-#endif
-
res = CallInst::Create(module->GetClassDelegateeFunction, res, "",
currentBlock);
push(res, false);
Modified: vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp Tue Jul 21 07:32:49 2009
@@ -256,7 +256,7 @@
VirtualFieldLookupFunction = module->getFunction("jnjvmVirtualFieldLookup");
StaticFieldLookupFunction = module->getFunction("jnjvmStaticFieldLookup");
-
+ StringLookupFunction = module->getFunction("jnjvmStringLookup");
JniProceedPendingExceptionFunction =
module->getFunction("jnjvmJNIProceedPendingException");
GetSJLJBufferFunction = module->getFunction("jnjvmGetSJLJBuffer");
@@ -291,8 +291,6 @@
GetFinalDoubleFieldFunction = module->getFunction("getFinalDoubleField");
GetFinalObjectFieldFunction = module->getFunction("getFinalObjectField");
-#ifdef ISOLATE
- StringLookupFunction = module->getFunction("jnjvmStringLookup");
#ifdef ISOLATE_SHARING
EnveloppeLookupFunction = module->getFunction("jnjvmEnveloppeLookup");
GetCtpCacheNodeFunction = module->getFunction("getCtpCacheNode");
@@ -303,7 +301,6 @@
StaticCtpLookupFunction = module->getFunction("jnjvmStaticCtpLookup");
SpecialCtpLookupFunction = module->getFunction("jnjvmSpecialCtpLookup");
#endif
-#endif
#ifdef SERVICE
ServiceCallStartFunction = module->getFunction("jnjvmServiceCallStart");
Modified: vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll Tue Jul 21 07:32:49 2009
@@ -165,6 +165,10 @@
;;; jnjvmStaticFieldLookup - Look up a specific static field.
declare i8* @jnjvmStaticFieldLookup(%JavaClass*, i32, ...)
+;;; jnjvmStringLookup - Find the isolate-specific string at the given offset in
+;;; the constant pool.
+declare i8* @jnjvmStringLookup(%JavaClass*, i32, ...) readnone
+
;;; jnjvmJavaObjectAquire - This function is called when starting a synchronized
;;; block or method.
declare void @jnjvmJavaObjectAquire(%JavaObject*)
Modified: vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-isolate.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-isolate.ll?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-isolate.ll (original)
+++ vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-isolate.ll Tue Jul 21 07:32:49 2009
@@ -22,10 +22,6 @@
;;; jnjvmEnveloppeLookup - Find the enveloppe for the current user class.
declare i8* @jnjvmEnveloppeLookup(%JavaClass*, i32, ...) readnone
-;;; jnjvmStringLookup - Find the isolate-specific string at the given offset in
-;;; the constant pool.
-declare i8* @jnjvmStringLookup(%JavaClass*, i32, ...) readnone
-
;;; jnjvmStaticCtpLookup - Find the user constant pool at the given offset in
;;; the constant pool.
declare i8* @jnjvmStaticCtpLookup(%JavaClass*, i32, ...) readnone
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Tue Jul 21 07:32:49 2009
@@ -632,6 +632,16 @@
}
+extern "C" void* jnjvmStringLookup(UserClass* cl, uint32 index) {
+ UserConstantPool* ctpInfo = cl->getConstantPool();
+ const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
+ JavaString* str = cl->classLoader->UTF8ToStr(utf8);
+#if defined(ISOLATE_SHARING) || !defined(ISOLATE)
+ ctpInfo->ctpRes[index] = str;
+#endif
+ return (void*)str;
+}
+
extern "C" void jnjvmPrintMethodStart(JavaMethod* meth) {
fprintf(stderr, "[%p] executing %s.%s\n", (void*)mvm::Thread::get(),
UTF8Buffer(meth->classDef->name).cString(),
@@ -669,16 +679,6 @@
#endif
-#ifdef ISOLATE
-extern "C" void* jnjvmStringLookup(UserClass* cl, uint32 index) {
- UserConstantPool* ctpInfo = cl->getConstantPool();
- const UTF8* utf8 = ctpInfo->UTF8AtForString(index);
- JavaString* str = JavaThread::get()->getJVM()->internalUTF8ToStr(utf8);
-#ifdef ISOLATE_SHARING
- ctpInfo->ctpRes[index] = str;
-#endif
- return (void*)str;
-}
#ifdef ISOLATE_SHARING
extern "C" void* jnjvmEnveloppeLookup(UserClass* cl, uint32 index) {
@@ -728,5 +728,3 @@
}
#endif
-
-#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/LinkJavaRuntime.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LinkJavaRuntime.h?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LinkJavaRuntime.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LinkJavaRuntime.h Tue Jul 21 07:32:49 2009
@@ -30,6 +30,7 @@
extern "C" void* jnjvmVirtualFieldLookup(UserClass* caller, uint32 index);
extern "C" void* jnjvmStaticFieldLookup(UserClass* caller, uint32 index);
extern "C" void* jnjvmVirtualTableLookup(UserClass* caller, uint32 index, ...);
+extern "C" void* jnjvmStringLookup(UserClass* cl, uint32 index);
extern "C" void* jnjvmClassLookup(UserClass* caller, uint32 index);
extern "C" UserCommonClass* jnjvmRuntimeInitialiseClass(UserClass* cl);
extern "C" JavaObject* jnjvmRuntimeDelegatee(UserCommonClass* cl);
@@ -68,8 +69,6 @@
-#ifdef ISOLATE
-extern "C" void* jnjvmStringLookup(UserClass* cl, uint32 index);
#ifdef ISOLATE_SHARING
extern "C" void* jnjvmEnveloppeLookup(UserClass* cl, uint32 index);
@@ -79,8 +78,6 @@
UserConstantPool** res);
#endif
-#endif
-
namespace {
struct ForceRuntimeLinking {
@@ -119,21 +116,18 @@
(void) jnjvmPrintMethodStart(0);
(void) jnjvmPrintMethodEnd(0);
(void) jnjvmPrintExecution(0, 0, 0);
+ (void) jnjvmStringLookup(0, 0);
#ifdef SERVICE
(void) jnjvmServiceCallStart(0, 0);
(void) jnjvmServiceCallStop(0, 0);
#endif
-#ifdef ISOLATE
- (void) jnjvmStringLookup(0, 0);
-
#ifdef ISOLATE_SHARING
(void) jnjvmEnveloppeLookup(0, 0);
(void) jnjvmStaticCtpLookup(0, 0);
(void) jnjvmSpecialCtpLookup(0, 0, 0);
#endif
-#endif
}
} ForcePassLinking; // Force link by creating a global definition.
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=76573&r1=76572&r2=76573&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Tue Jul 21 07:32:49 2009
@@ -174,7 +174,8 @@
void Class::tracer() {
CommonClass::tracer();
- bytes->markAndTrace();
+ if (classLoader != classLoader->bootstrapLoader)
+ bytes->markAndTrace();
for (uint32 i =0; i < NR_ISOLATES; ++i) {
TaskClassMirror &M = IsolateInfo[i];
More information about the vmkit-commits
mailing list