[vmkit-commits] [vmkit] r117227 - in /vmkit/branches/precise: include/mvm/VirtualMachine.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/JavaInitialise.cpp lib/J3/VMCore/Jnjvm.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Oct 24 08:15:30 PDT 2010
Author: geoffray
Date: Sun Oct 24 10:15:30 2010
New Revision: 117227
URL: http://llvm.org/viewvc/llvm-project?rev=117227&view=rev
Log:
Code cleanup. No functionality change.
Removed:
vmkit/branches/precise/lib/J3/VMCore/JavaInitialise.cpp
Modified:
vmkit/branches/precise/include/mvm/VirtualMachine.h
vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp
vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp
vmkit/branches/precise/tools/vmjc/vmjc.cpp
vmkit/branches/precise/tools/vmkit/Launcher.cpp
Modified: vmkit/branches/precise/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/include/mvm/VirtualMachine.h?rev=117227&r1=117226&r2=117227&view=diff
==============================================================================
--- vmkit/branches/precise/include/mvm/VirtualMachine.h (original)
+++ vmkit/branches/precise/include/mvm/VirtualMachine.h Sun Oct 24 10:15:30 2010
@@ -50,25 +50,13 @@
FunctionMap();
};
-class CompilationUnit;
-
-
/// VirtualMachine - This class is the root of virtual machine classes. It
/// defines what a VM should be.
///
class VirtualMachine : public mvm::PermanentObject {
protected:
VirtualMachine(mvm::BumpPtrAllocator &Alloc) :
- allocator(Alloc) {
-#ifdef SERVICE
- memoryLimit = ~0;
- executionLimit = ~0;
- GCLimit = ~0;
- threadLimit = ~0;
- parent = this;
- status = 1;
- _since_last_collection = 4*1024*1024;
-#endif
+ allocator(Alloc) {
mainThread = 0;
NumberOfThreads = 0;
}
@@ -208,36 +196,6 @@
/// waitForExit - Wait until the virtual machine stops its execution.
virtual void waitForExit() = 0;
-
- static j3::JnjvmClassLoader* initialiseJVM(j3::JavaCompiler* C,
- bool dlLoad = true);
- static VirtualMachine* createJVM(j3::JnjvmClassLoader* C = 0);
-
- static CompilationUnit* initialiseCLIVM();
- static VirtualMachine* createCLIVM(CompilationUnit* C = 0);
-
-#ifdef ISOLATE
- size_t IsolateID;
-#endif
-
-#ifdef SERVICE
- uint64_t memoryUsed;
- uint64_t gcTriggered;
- uint64_t executionTime;
- uint64_t numThreads;
- CompilationUnit* CU;
- virtual void stopService() {}
-
- uint64_t memoryLimit;
- uint64_t executionLimit;
- uint64_t threadLimit;
- uint64_t GCLimit;
-
- int _since_last_collection;
- VirtualMachine* parent;
- uint32 status;
-#endif
-
};
} // end namespace mvm
Modified: vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp?rev=117227&r1=117226&r2=117227&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp Sun Oct 24 10:15:30 2010
@@ -430,9 +430,11 @@
newArgv[0] = newArgv[1];
newArgv[1] = mainClass;
+ mvm::BumpPtrAllocator Allocator;
JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
- mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
+ JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+ JnjvmBootstrapLoader(Allocator, Comp, true);
+ Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
vm->runApplication(argc + 1, newArgv);
vm->waitForExit();
Removed: vmkit/branches/precise/lib/J3/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JavaInitialise.cpp?rev=117226&view=auto
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JavaInitialise.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JavaInitialise.cpp (removed)
@@ -1,56 +0,0 @@
-//===-------- JavaInitialise.cpp - Initialization of JnJVM ----------------===//
-//
-// The VMKit project
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "mvm/VirtualMachine.h"
-#include "j3/JavaCompiler.h"
-
-#include "JavaArray.h"
-#include "JavaClass.h"
-#include "JavaObject.h"
-#include "Jnjvm.h"
-#include "JnjvmClassLoader.h"
-
-#ifdef ISOLATE_SHARING
-#include "SharedMaps.h"
-#include "IsolateSharedLoader.h"
-#endif
-
-using namespace j3;
-
-
-#ifdef ISOLATE_SHARING
-JnjvmClassLoader* mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp) {
- JnjvmSharedLoader::sharedLoader = JnjvmSharedLoader::createSharedLoader(Comp);
- return JnjvmSharedLoader::sharedLoader;
-}
-
-mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvClassLoader* JCL) {
- mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
- mvm::BumpPtrAllocator* C = new mvm::BumpPtrAllocator();
- JnjvmBootstraLoader* bootstrapLoader =
- new(*C) JnjvmBootstrapLoader(*C, JCL->getCompiler());
- Jnjvm* vm = new(*A, "VM") Jnjvm(*A, bootstrapLoader);
- vm->scanner = JCL->getCompiler()->createStackScanner();
- return vm;
-}
-#else
-
-JnjvmClassLoader*
-mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp, bool dlLoad) {
- mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
- return new(*A, "Bootstrap loader") JnjvmBootstrapLoader(*A, Comp, dlLoad);
-}
-
-mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvmClassLoader* C) {
- mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
- Jnjvm* vm = new(*A, "VM") Jnjvm(*A, (JnjvmBootstrapLoader*)C);
- return vm;
-}
-
-#endif
Modified: vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp?rev=117227&r1=117226&r2=117227&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp Sun Oct 24 10:15:30 2010
@@ -1545,7 +1545,7 @@
};
-// Helper function to run Jnjvm without JIT.
+// Helper function to run J3 without JIT.
extern "C" int StartJnjvmWithoutJIT(int argc, char** argv, char* mainClass) {
mvm::Collector::initialise();
@@ -1555,9 +1555,12 @@
newArgv[0] = newArgv[1];
newArgv[1] = mainClass;
+ mvm::BumpPtrAllocator Allocator;
JavaCompiler* Comp = new JavaStaticCompiler();
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
- mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
+ JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+ JnjvmBootstrapLoader(Allocator, Comp, true);
+ Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
+
vm->runApplication(argc + 1, newArgv);
vm->waitForExit();
Modified: vmkit/branches/precise/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/tools/vmjc/vmjc.cpp?rev=117227&r1=117226&r2=117227&view=diff
==============================================================================
--- vmkit/branches/precise/tools/vmjc/vmjc.cpp (original)
+++ vmkit/branches/precise/tools/vmjc/vmjc.cpp Sun Oct 24 10:15:30 2010
@@ -178,15 +178,16 @@
mvm::Collector::initialise();
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp, false);
+ mvm::BumpPtrAllocator allocator;
+ JnjvmBootstrapLoader* loader = new(allocator, "Bootstrap loader")
+ JnjvmBootstrapLoader(allocator, Comp, false);
if (DisableExceptions) Comp->disableExceptions();
if (DisableStubs) Comp->generateStubs = false;
if (AssumeCompiled) Comp->assumeCompiled = true;
if (DisableCooperativeGC) Comp->disableCooperativeGC();
- mvm::BumpPtrAllocator A;
- Jnjvm* vm = new(A, "Bootstrap loader") Jnjvm(A, (JnjvmBootstrapLoader*)JCL);
+ Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, loader);
for (std::vector<std::string>::iterator i = Properties.begin(),
e = Properties.end(); i != e; ++i) {
Modified: vmkit/branches/precise/tools/vmkit/Launcher.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/tools/vmkit/Launcher.cpp?rev=117227&r1=117226&r2=117227&view=diff
==============================================================================
--- vmkit/branches/precise/tools/vmkit/Launcher.cpp (original)
+++ vmkit/branches/precise/tools/vmkit/Launcher.cpp Sun Oct 24 10:15:30 2010
@@ -26,6 +26,8 @@
#include "mvm/Threads/Thread.h"
#include "j3/JavaJITCompiler.h"
+#include "../../lib/J3/VMCore/JnjvmClassLoader.h"
+#include "../../lib/J3/VMCore/Jnjvm.h"
#include "CommandLine.h"
@@ -33,14 +35,12 @@
using namespace llvm;
enum VMType {
- Interactive, RunJava, RunNet
+ RunJava
};
static llvm::cl::opt<VMType> VMToRun(llvm::cl::desc("Choose VM to run:"),
llvm::cl::values(
- clEnumValN(Interactive , "i", "Run in interactive mode"),
clEnumValN(RunJava , "java", "Run the JVM"),
- clEnumValN(RunNet, "net", "Run the CLI VM"),
clEnumValEnd));
static llvm::cl::opt<bool> Fast("fast",
@@ -57,55 +57,26 @@
}
int main(int argc, char** argv) {
- // Disable the lcean shutdown, as deamon threads may still
- // continue to execute and use LLVM things.
- //llvm::llvm_shutdown_obj X;
-
+ llvm::llvm_shutdown_obj X;
int pos = found(argv, argc, "-java");
if (pos) {
llvm::cl::ParseCommandLineOptions(pos, argv);
} else {
- pos = found(argv, argc, "-net");
- if (pos) {
- llvm::cl::ParseCommandLineOptions(pos, argv);
- } else {
- llvm::cl::ParseCommandLineOptions(argc, argv);
- }
+ fprintf(stderr, "Only -java is supported\n");
+ return 0;
}
mvm::MvmModule::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive);
mvm::Collector::initialise();
if (VMToRun == RunJava) {
-#if WITH_J3
+ mvm::BumpPtrAllocator Allocator;
JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
- mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
- vm->runApplication(argc, argv);
- vm->waitForExit();
-#endif
- } else if (VMToRun == RunNet) {
-#if WITH_N3
- mvm::CompilationUnit* CU = mvm::VirtualMachine::initialiseCLIVM();
- mvm::VirtualMachine* vm = mvm::VirtualMachine::createCLIVM(CU);
+ JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+ JnjvmBootstrapLoader(Allocator, Comp, true);
+ Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
vm->runApplication(argc, argv);
vm->waitForExit();
-#endif
- } else {
- mvm::CommandLine MyCl;
-#if WITH_J3
- JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
- JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
- MyCl.vmlets["java"] = (create_vm_t)(mvm::VirtualMachine::createJVM);
- MyCl.compilers["java"] = (mvm::Object*)JCL;
-#endif
-#if WITH_N3
- mvm::CompilationUnit* CLICompiler =
- mvm::VirtualMachine::initialiseCLIVM();
- MyCl.vmlets["net"] = (create_vm_t)(mvm::VirtualMachine::createCLIVM);
- MyCl.compilers["net"] = (mvm::Object*)CLICompiler;
-#endif
- MyCl.start();
}
return 0;
More information about the vmkit-commits
mailing list