[vmkit-commits] [vmkit] r62087 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaJIT.cpp JnjvmClassLoader.cpp JnjvmModule.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jan 12 02:18:02 PST 2009
Author: geoffray
Date: Mon Jan 12 04:17:53 2009
New Revision: 62087
URL: http://llvm.org/viewvc/llvm-project?rev=62087&view=rev
Log:
Give the method as a parameter to nativeLoad, not its name.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=62087&r1=62086&r2=62087&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Jan 12 04:17:53 2009
@@ -296,20 +296,8 @@
Value* nativeFunc = module->getNativeFunction(compilingMethod, (void*)natPtr);
if (module->isStaticCompiling()) {
+ Value* Arg = module->getMethodInClass(compilingMethod);
- if (compilingClass->isNativeOverloaded(compilingMethod)) {
- compilingMethod->jniConsFromMethOverloaded(functionName);
- } else {
- compilingMethod->jniConsFromMeth(functionName);
- }
-
- Constant* Arg = ConstantArray::get(std::string(functionName), true);
- GlobalVariable* GV = new GlobalVariable(Arg->getType(), true,
- GlobalValue::InternalLinkage, Arg,
- "", module);
- Arg = ConstantExpr::getBitCast(GV, module->ptrType);
- Value* Args[2] = { module->getNativeClass(compilingClass), Arg };
-
// If the global variable is null, then load it.
BasicBlock* unloadedBlock = createBasicBlock("");
BasicBlock* endBlock = createBasicBlock("");
@@ -322,8 +310,7 @@
BranchInst::Create(unloadedBlock, endBlock, cmp, currentBlock);
currentBlock = unloadedBlock;
- Value* res = CallInst::Create(module->NativeLoader, Args, Args + 2, "",
- currentBlock);
+ Value* res = CallInst::Create(module->NativeLoader, Arg, "", currentBlock);
res = new BitCastInst(res, Ty, "", currentBlock);
new StoreInst(res, nativeFunc, currentBlock);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=62087&r1=62086&r2=62087&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Mon Jan 12 04:17:53 2009
@@ -1035,9 +1035,18 @@
JCL->strings.push_back(val);
}
-extern "C" intptr_t vmjcNativeLoader(UserClass* cl, const char* name) {
+extern "C" intptr_t vmjcNativeLoader(JavaMethod* meth) {
bool jnjvm = false;
- intptr_t res = cl->classLoader->loadInLib(name, jnjvm);
+ const UTF8* jniConsClName = meth->classDef->name;
+ const UTF8* jniConsName = meth->name;
+ const UTF8* jniConsType = meth->type;
+ sint32 clen = jniConsClName->size;
+ sint32 mnlen = jniConsName->size;
+ sint32 mtlen = jniConsType->size;
+
+ char* buf = (char*)alloca(3 + JNI_NAME_PRE_LEN + 1 +
+ ((mnlen + clen + mtlen) << 1));
+ intptr_t res = meth->classDef->classLoader->nativeLookup(meth, jnjvm, buf);
assert(res && "Could not find required native method");
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=62087&r1=62086&r2=62087&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Mon Jan 12 04:17:53 2009
@@ -2023,8 +2023,7 @@
"Init", this);
llvmArgs.clear();
- llvmArgs.push_back(JavaClassType);
- llvmArgs.push_back(ptrType);
+ llvmArgs.push_back(JavaMethodType);
FTy = FunctionType::get(ptrType, llvmArgs, false);
More information about the vmkit-commits
mailing list