[vmkit-commits] [vmkit] r105538 - in /vmkit/trunk: include/mvm/MethodInfo.h include/mvm/VirtualMachine.h lib/J3/VMCore/JavaClass.cpp lib/J3/VMCore/JavaClass.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jun 7 11:15:20 PDT 2010
Author: geoffray
Date: Mon Jun 7 13:15:20 2010
New Revision: 105538
URL: http://llvm.org/viewvc/llvm-project?rev=105538&view=rev
Log:
Give the CamlFrame info to a static Java method.
Modified:
vmkit/trunk/include/mvm/MethodInfo.h
vmkit/trunk/include/mvm/VirtualMachine.h
vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
vmkit/trunk/lib/J3/VMCore/JavaClass.h
Modified: vmkit/trunk/include/mvm/MethodInfo.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/MethodInfo.h?rev=105538&r1=105537&r2=105538&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/MethodInfo.h (original)
+++ vmkit/trunk/include/mvm/MethodInfo.h Mon Jun 7 13:15:20 2010
@@ -44,8 +44,8 @@
};
class CamlMethodInfo : public MethodInfo {
- CamlFrame* CF;
public:
+ CamlFrame* CF;
virtual void scan(uintptr_t closure, void* ip, void* addr);
CamlMethodInfo(CamlFrame* C, void* ip);
};
Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=105538&r1=105537&r2=105538&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Mon Jun 7 13:15:20 2010
@@ -45,6 +45,19 @@
/// FunctionMapLock - Spin lock to protect the Functions map.
///
mvm::SpinLock FunctionMapLock;
+
+ /// IPToMethodInfo - Map a code start instruction instruction to the MethodInfo.
+ ///
+ MethodInfo* CodeStartToMethodInfo(void* ip) {
+ FunctionMapLock.acquire();
+ std::map<void*, MethodInfo*>::iterator I = Functions.find(ip);
+ MethodInfo* res = NULL;
+ if (I != Functions.end()) {
+ res = I->second;
+ }
+ FunctionMapLock.release();
+ return res;
+ }
};
/// StartEndFunctionMap - This map is for functions for which we have
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=105538&r1=105537&r2=105538&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Mon Jun 7 13:15:20 2010
@@ -302,10 +302,11 @@
if (code == 0) {
code = ptr;
Jnjvm* vm = JavaThread::get()->getJVM();
- JavaStaticMethodInfo* MI =
+ mvm::MethodInfo* MI = vm->SharedStaticFunctions.CodeStartToMethodInfo(ptr);
+ JavaStaticMethodInfo* JMI =
new (classDef->classLoader->allocator, "JavaStaticMethodInfo")
- JavaStaticMethodInfo(0, code, this);
- vm->StaticFunctions.addMethodInfo(MI, code);
+ JavaStaticMethodInfo((mvm::CamlMethodInfo*)MI, code, this);
+ vm->StaticFunctions.addMethodInfo(JMI, code);
classDef->classLoader->getCompiler()->setMethod(this, ptr, name);
}
access |= ACC_NATIVE;
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=105538&r1=105537&r2=105538&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Mon Jun 7 13:15:20 2010
@@ -963,11 +963,12 @@
class JavaStaticMethodInfo : public mvm::CamlMethodInfo {
protected:
JavaMethod* meth;
+
public:
virtual void print(void* ip, void* addr);
- JavaStaticMethodInfo(mvm::CamlFrame* CF, void* ip, JavaMethod* M) :
- mvm::CamlMethodInfo(CF, ip) {
+ JavaStaticMethodInfo(mvm::CamlMethodInfo* super, void* ip, JavaMethod* M) :
+ mvm::CamlMethodInfo(super != NULL ? super->CF : NULL, ip) {
meth = M;
MethodType = 1;
}
More information about the vmkit-commits
mailing list