[vmkit-commits] [vmkit] r96338 - /vmkit/trunk/tools/j3/Main.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Feb 16 00:28:06 PST 2010
Author: geoffray
Date: Tue Feb 16 02:27:58 2010
New Revision: 96338
URL: http://llvm.org/viewvc/llvm-project?rev=96338&view=rev
Log:
Stop being generic when creating the VM.
Modified:
vmkit/trunk/tools/j3/Main.cpp
Modified: vmkit/trunk/tools/j3/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/j3/Main.cpp?rev=96338&r1=96337&r2=96338&view=diff
==============================================================================
--- vmkit/trunk/tools/j3/Main.cpp (original)
+++ vmkit/trunk/tools/j3/Main.cpp Tue Feb 16 02:27:58 2010
@@ -1,4 +1,4 @@
-//===--------- Main.cpp - Simple execution of JnJVM -----------------------===//
+//===------------- Main.cpp - Simple execution of J3 ----------------------===//
//
// The VMKit project
//
@@ -14,26 +14,39 @@
#include "mvm/Threads/Thread.h"
#include "j3/JavaJITCompiler.h"
+#include "../../lib/J3/VMCore/JnjvmClassLoader.h"
+#include "../../lib/J3/VMCore/Jnjvm.h"
#include "llvm/Support/ManagedStatic.h"
using namespace j3;
-using namespace llvm;
using namespace mvm;
int main(int argc, char **argv, char **envp) {
llvm::llvm_shutdown_obj X;
-
+
+ // Initialize base components.
MvmModule::initialise();
Collector::initialise();
+
+ // Tell the compiler to run all optimizations.
+ MvmModule::AddStandardCompilePasses();
+ // Create the allocator that will allocate the bootstrap loader and the JVM.
+ mvm::BumpPtrAllocator Allocator;
JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
- mvm::MvmModule::AddStandardCompilePasses();
- JnjvmClassLoader* JCL = VirtualMachine::initialiseJVM(Comp);
- VirtualMachine* vm = VirtualMachine::createJVM(JCL);
+ JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+ JnjvmBootstrapLoader(Allocator, Comp, true);
+ Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
+
+ // Run the application.
vm->runApplication(argc, argv);
vm->waitForExit();
+ // Destroy everyone.
+ vm->~Jnjvm();
+ loader->~JnjvmBootstrapLoader();
+
return 0;
}
More information about the vmkit-commits
mailing list