[vmkit-commits] [vmkit] r196295 - each Java method has its own compilation module
Gael Thomas
gael.thomas at lip6.fr
Tue Dec 3 08:47:22 PST 2013
Author: gthomas
Date: Tue Dec 3 10:47:22 2013
New Revision: 196295
URL: http://llvm.org/viewvc/llvm-project?rev=196295&view=rev
Log:
each Java method has its own compilation module
Modified:
vmkit/branches/mcjit/include/j3/j3classloader.h
vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
vmkit/branches/mcjit/lib/j3/vm/j3method.cc
Modified: vmkit/branches/mcjit/include/j3/j3classloader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3classloader.h?rev=196295&r1=196294&r2=196295&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3classloader.h (original)
+++ vmkit/branches/mcjit/include/j3/j3classloader.h Tue Dec 3 10:47:22 2013
@@ -15,7 +15,6 @@ namespace llvm {
class DataLayout;
class Type;
class Function;
- class DIBuilder;
namespace legacy {
class FunctionPassManager;
@@ -59,7 +58,6 @@ namespace j3 {
vmkit::NameMap<J3Type*>::map types; /* shortcut to find types */
vmkit::NameMap<J3MethodType*>::map methodTypes; /* shortcut to find method types - REMOVE */
llvm::Module* _module; /* the associated llvm module */
- llvm::DIBuilder* _dbgBuilder;
MethodRefMap methods; /* all te known method */
void wrongType(J3Class* from, const vmkit::Name* type);
@@ -79,8 +77,6 @@ namespace j3 {
static void destroy(J3ClassLoader* loader);
- llvm::DIBuilder* dbgBuilder() const { return _dbgBuilder; }
-
J3FixedPoint* fixedPoint() { return &_fixedPoint; }
J3ObjectHandle* javaClassLoader() { return _javaClassLoader; }
Modified: vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc?rev=196295&r1=196294&r2=196295&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc Tue Dec 3 10:47:22 2013
@@ -10,7 +10,6 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/DerivedTypes.h"
-#include "llvm/DIBuilder.h"
#include "vmkit/allocator.h"
@@ -57,10 +56,6 @@ J3ClassLoader::J3ClassLoader(J3* v, J3Ob
_vm = v;
_module = new llvm::Module("j3", vm()->self()->getContext());
- _dbgBuilder = new llvm::DIBuilder(*module());
- _pm = vm()->preparePM(module());
-
- vm()->ee()->addModule(module());
}
void J3ClassLoader::addSymbol(const char* id, J3Symbol* symbol) {
Modified: vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc?rev=196295&r1=196294&r2=196295&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Tue Dec 3 10:47:22 2013
@@ -1369,20 +1369,22 @@ void J3CodeGen::generateJava() {
->CreateIntToPtr(llvm::ConstantInt::get(vm->dataLayout()->getIntPtrType(module->getContext()), (uintptr_t)0),
vm->typeJ3ObjectPtr);
+ llvm::DIBuilder* dbgBuilder = new llvm::DIBuilder(*module);
+
dbgInfo =
- loader->dbgBuilder()->createFunction(llvm::DIDescriptor(), // Function scope
- llvmFunction->getName(), // Function name
- llvmFunction->getName(), // Mangled name
- llvm::DIFile(), // File where this variable is defined
- 0, // Line number
- loader->dbgBuilder() // Function type.
+ dbgBuilder->createFunction(llvm::DIDescriptor(), // Function scope
+ llvmFunction->getName(), // Function name
+ llvmFunction->getName(), // Mangled name
+ llvm::DIFile(), // File where this variable is defined
+ 0, // Line number
+ dbgBuilder // Function type.
->createSubroutineType(llvm::DIFile(), // File in which this subroutine is defined
llvm::DIArray()), // An array of subroutine parameter types.
// This includes return type at 0th index.
- false, // True if this function is not externally visible
- false, // True if this is a function definition
- 0 // Set to the beginning of the scope this starts
- );
+ false, // True if this function is not externally visible
+ false, // True if this is a function definition
+ 0 // Set to the beginning of the scope this starts
+ );
uint32_t maxStack = reader.readU2();
uint32_t nbLocals = reader.readU2();
Modified: vmkit/branches/mcjit/lib/j3/vm/j3method.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3method.cc?rev=196295&r1=196294&r2=196295&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3method.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3method.cc Tue Dec 3 10:47:22 2013
@@ -58,13 +58,14 @@ void* J3Method::fnPtr() {
J3::noSuchMethodError(L"unable to find method", cl(), name(), sign());
}
- llvm::Module* module = cl()->loader()->module();
+ llvm::Module* module = new llvm::Module(llvmFunctionName(), cl()->loader()->vm()->self()->getContext());
_llvmFunction = llvmFunction(0, module);
J3CodeGen::translate(this, _llvmFunction);
- cl()->loader()->pm()->run(*_llvmFunction);
+ cl()->loader()->vm()->preparePM(module)->run(*_llvmFunction); /* TODO, check memory */
llvm::ExecutionEngine* ee = cl()->loader()->vm()->ee();
+ ee->addModule(module);
_fnPtr = (uint8_t*)ee->recompileAndRelinkFunction(_llvmFunction);
}
More information about the vmkit-commits
mailing list