[vmkit-commits] [vmkit] r199645 - Define the compilation mode directly in the class loader.

Gael Thomas gael.thomas at lip6.fr
Mon Jan 20 03:03:15 PST 2014


Author: gthomas
Date: Mon Jan 20 05:03:15 2014
New Revision: 199645

URL: http://llvm.org/viewvc/llvm-project?rev=199645&view=rev
Log:
Define the compilation mode directly in the class loader.

Modified:
    vmkit/branches/mcjit/include/j3/j3class.h
    vmkit/branches/mcjit/include/j3/j3classloader.h
    vmkit/branches/mcjit/include/j3/j3method.h
    vmkit/branches/mcjit/lib/j3/vm/j3.cc
    vmkit/branches/mcjit/lib/j3/vm/j3class.cc
    vmkit/branches/mcjit/lib/j3/vm/j3method.cc

Modified: vmkit/branches/mcjit/include/j3/j3class.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3class.h?rev=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3class.h (original)
+++ vmkit/branches/mcjit/include/j3/j3class.h Mon Jan 20 05:03:15 2014
@@ -229,7 +229,7 @@ namespace j3 {
 	public:
 		J3Class(J3ClassLoader* loader, const vmkit::Name* name, J3ClassBytes* bytes, J3ObjectHandle* protectionDomain, const char* source);
 
-		void                aotCompile();
+		void                compileAll();
 		void                aotSnapshot(llvm::Linker* linker);
 
 		J3ObjectHandle*     clone(J3ObjectHandle* obj);

Modified: vmkit/branches/mcjit/include/j3/j3classloader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3classloader.h?rev=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3classloader.h (original)
+++ vmkit/branches/mcjit/include/j3/j3classloader.h Mon Jan 20 05:03:15 2014
@@ -38,6 +38,8 @@ namespace j3 {
 
 		static J3InterfaceMethodLess  j3InterfaceMethodLess;
 
+		uint32_t                             _compileMode;
+
 		J3ObjectHandle*                      _javaClassLoader;
 		J3GlobalReferences                   _globalReferences;
 
@@ -59,6 +61,9 @@ namespace j3 {
 	public:
 		J3ClassLoader(J3ObjectHandle* javaClassLoader, vmkit::BumpAllocator* allocator);
 
+		uint32_t                      compileMode() { return _compileMode; }
+		void                          setCompileMode(uint32_t mode) { _compileMode = mode; }
+
 		void                          aotSnapshot(llvm::Linker* linker);
 
 		void                          addNativeLibrary(void* handle);

Modified: vmkit/branches/mcjit/include/j3/j3method.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3method.h?rev=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3method.h (original)
+++ vmkit/branches/mcjit/include/j3/j3method.h Mon Jan 20 05:03:15 2014
@@ -92,7 +92,6 @@ namespace j3 {
 		J3Value             invokeVirtual(J3ObjectHandle* obj, J3Value* args);
 		J3Value             invokeVirtual(J3ObjectHandle* obj, va_list va);
 
-		void                aotCompile();
 		void                aotSnapshot(llvm::Linker* linker);
 		void                ensureCompiled(uint32_t mode);
 		J3Signature::function_t cxxCaller();

Modified: vmkit/branches/mcjit/lib/j3/vm/j3.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3.cc?rev=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3.cc Mon Jan 20 05:03:15 2014
@@ -12,6 +12,7 @@
 #include "j3/j3lib.h"
 #include "j3/j3field.h"
 #include "j3/j3utf16.h"
+#include "j3/j3codegen.h"
 
 #include "llvm/IR/Type.h"
 #include "llvm/IR/DerivedTypes.h"
@@ -190,6 +191,8 @@ void J3::compileApplication() {
 																																		names()->get("()Ljava/lang/ClassLoader;"))->invokeStatic().valObject);
 
 
+	loader->setCompileMode(J3CodeGen::OnlyTranslate | J3CodeGen::NotUseStub);
+
 	if(options()->mainClass)
 		J3::internalError("compiling a single class is not yet supported");
 	else {
@@ -209,7 +212,7 @@ void J3::compileApplication() {
 				char buf[name->length() - 5];
 				memcpy(buf, name->cStr(), name->length() - 6);
 				buf[name->length()-6] = 0;
-				loader->getTypeFromQualified(0, buf)->asClass()->aotCompile();
+				loader->getTypeFromQualified(0, buf)->asClass()->compileAll();
 			}
 		}
 	}

Modified: vmkit/branches/mcjit/lib/j3/vm/j3class.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3class.cc?rev=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3class.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3class.cc Mon Jan 20 05:03:15 2014
@@ -17,6 +17,7 @@
 #include "j3/j3thread.h"
 #include "j3/j3field.h"
 #include "j3/j3attribute.h"
+#include "j3/j3codegen.h"
 
 using namespace j3;
 
@@ -320,15 +321,17 @@ J3Class::J3Class(J3ClassLoader* loader,
 	status = LOADED;
 }
 
-void J3Class::aotCompile() {
+void J3Class::compileAll() {
 	resolve();
 
 	for(uint32_t i=0; i<nbMethods(); i++) {
-		methods()[i]->aotCompile();
+		if(!J3Cst::isAbstract(methods()[i]->access()))
+			methods()[i]->ensureCompiled(J3CodeGen::WithMethod);
 	}
 
 	for(uint32_t i=0; i<staticLayout()->nbMethods(); i++) {
-		staticLayout()->methods()[i]->aotCompile();
+		if(!J3Cst::isAbstract(staticLayout()->methods()[i]->access()))
+			staticLayout()->methods()[i]->ensureCompiled(J3CodeGen::WithMethod);
 	}
 }
 

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=199645&r1=199644&r2=199645&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3method.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3method.cc Mon Jan 20 05:03:15 2014
@@ -52,13 +52,6 @@ J3Signature::function_t J3Method::cxxCal
 	return signature()->caller(access());
 }
 
-void J3Method::aotCompile() {
-	if(!J3Cst::isAbstract(access())) {
-		//fprintf(stderr, "compiling: %s::%s%s\n", cl()->name()->cStr(), name()->cStr(), signature()->name()->cStr());
-		ensureCompiled(J3CodeGen::WithMethod | J3CodeGen::OnlyTranslate | J3CodeGen::NotUseStub);
-	}
-}
-
 void J3Method::aotSnapshot(llvm::Linker* linker) {
 	if(_llvmFunction) {
 		std::string err;





More information about the vmkit-commits mailing list