[vmkit-commits] [vmkit] r68314 - in /vmkit/trunk: include/mvm/VirtualMachine.h lib/JnJVM/VMCore/JavaInitialise.cpp lib/JnJVM/VMCore/JnjvmClassLoader.cpp lib/JnJVM/VMCore/JnjvmClassLoader.h tools/vmjc/vmjc.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Thu Apr 2 07:35:23 PDT 2009
Author: geoffray
Date: Thu Apr 2 09:35:22 2009
New Revision: 68314
URL: http://llvm.org/viewvc/llvm-project?rev=68314&view=rev
Log:
Add an argument to the creation of a bootstrap loader to specify
that we want the loader to find lbvmjc.so.
Modified:
vmkit/trunk/include/mvm/VirtualMachine.h
vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h
vmkit/trunk/tools/vmjc/vmjc.cpp
Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=68314&r1=68313&r2=68314&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Thu Apr 2 09:35:22 2009
@@ -56,7 +56,8 @@
/// waitForExit - Wait until the virtual machine stops its execution.
virtual void waitForExit() = 0;
- static jnjvm::JnjvmClassLoader* initialiseJVM(jnjvm::JavaCompiler* C = 0);
+ static jnjvm::JnjvmClassLoader* initialiseJVM(jnjvm::JavaCompiler* C,
+ bool dlLoad = true);
static VirtualMachine* createJVM(jnjvm::JnjvmClassLoader* C = 0);
static CompilationUnit* initialiseCLIVM();
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=68314&r1=68313&r2=68314&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Thu Apr 2 09:35:22 2009
@@ -74,9 +74,9 @@
#else
JnjvmClassLoader*
-mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp) {
+mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp, bool dlLoad) {
initialiseVT();
- return gc_new(JnjvmBootstrapLoader)(Comp);
+ return gc_new(JnjvmBootstrapLoader)(Comp, dlLoad);
}
mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvmClassLoader* C) {
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=68314&r1=68313&r2=68314&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Thu Apr 2 09:35:22 2009
@@ -63,7 +63,7 @@
typedef void (*static_init_t)(JnjvmClassLoader*);
-JnjvmBootstrapLoader::JnjvmBootstrapLoader(JavaCompiler* Comp) {
+JnjvmBootstrapLoader::JnjvmBootstrapLoader(JavaCompiler* Comp, bool dlLoad) {
hashUTF8 = new(allocator) UTF8Map(allocator, 0);
classes = new(allocator) ClassMap();
@@ -164,19 +164,21 @@
// Now that native types have been loaded, try to find if we have a
// pre-compiled rt.jar
- nativeHandle = dlopen("libvmjc"DYLD_EXTENSION, RTLD_LAZY | RTLD_GLOBAL);
- if (nativeHandle) {
- // Found it!
- SuperArray = (Class*)dlsym(nativeHandle, "java.lang.Object");
-
- if (SuperArray) {
- ClassArray::SuperArray = (Class*)SuperArray->getInternal();
- // We have the java/lang/Object class, execute the static initializer.
- static_init_t init = (static_init_t)(uintptr_t)SuperArray->classLoader;
- assert(init && "Loaded the wrong boot library");
- init(this);
- ClassArray::initialiseVT(SuperArray);
- }
+ if (dlLoad) {
+ nativeHandle = dlopen("libvmjc"DYLD_EXTENSION, RTLD_LAZY | RTLD_GLOBAL);
+ if (nativeHandle) {
+ // Found it!
+ SuperArray = (Class*)dlsym(nativeHandle, "java.lang.Object");
+
+ if (SuperArray) {
+ ClassArray::SuperArray = (Class*)SuperArray->getInternal();
+ // We have the java/lang/Object class, execute the static initializer.
+ static_init_t init = (static_init_t)(uintptr_t)SuperArray->classLoader;
+ assert(init && "Loaded the wrong boot library");
+ init(this);
+ ClassArray::initialiseVT(SuperArray);
+ }
+ }
}
// We haven't found a pre-compiled rt.jar, load the root class ourself.
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h?rev=68314&r1=68313&r2=68314&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h Thu Apr 2 09:35:22 2009
@@ -337,9 +337,10 @@
void analyseClasspathEnv(const char*);
/// createBootstrapLoader - Creates the bootstrap loader, first thing
- /// to do before any execution of a JVM.
+ /// to do before any execution of a JVM. Also try to load libvmjc.so
+ /// if dlLoad is not false.
///
- JnjvmBootstrapLoader(JavaCompiler* Comp);
+ JnjvmBootstrapLoader(JavaCompiler* Comp, bool dlLoad = true);
JnjvmBootstrapLoader() {}
virtual JavaString* UTF8ToStr(const UTF8* utf8);
Modified: vmkit/trunk/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/vmjc.cpp?rev=68314&r1=68313&r2=68314&view=diff
==============================================================================
--- vmkit/trunk/tools/vmjc/vmjc.cpp (original)
+++ vmkit/trunk/tools/vmjc/vmjc.cpp Thu Apr 2 09:35:22 2009
@@ -111,6 +111,11 @@
static cl::opt<std::string>
WithClinit("with-clinit", cl::desc("Clinit the given file"));
+static cl::opt<bool>
+PrintStats("print-aot-stats",
+ cl::desc("Print stats by the AOT compiler"));
+
+
inline void addPass(FunctionPassManager *PM, Pass *P) {
@@ -209,7 +214,7 @@
Collector::initialise(0);
Collector::enable(0);
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
+ JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp, false);
addCommandLinePass(argv);
if (!WithClinit.empty()) {
@@ -229,6 +234,8 @@
MAOT->generateMain(MainClass.c_str(), WithJIT);
}
+ if (PrintStats)
+ MAOT->printStats();
if (DontPrint) {
// Just use stdout. We won't actually print anything on it.
More information about the vmkit-commits
mailing list