[vmkit-commits] [vmkit] r198501 - Remove the isResolved function from J3Method. Directly use the method index in the generated code.

Gael Thomas gael.thomas at lip6.fr
Sat Jan 4 07:48:47 PST 2014


Author: gthomas
Date: Sat Jan  4 09:48:46 2014
New Revision: 198501

URL: http://llvm.org/viewvc/llvm-project?rev=198501&view=rev
Log:
Remove the isResolved function from J3Method. Directly use the method index in the generated code.

Modified:
    vmkit/branches/mcjit/include/j3/j3method.h
    vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
    vmkit/branches/mcjit/lib/j3/vm/j3class.cc
    vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
    vmkit/branches/mcjit/lib/j3/vm/j3method.cc
    vmkit/branches/mcjit/lib/j3/vm/j3object.cc

Modified: vmkit/branches/mcjit/include/j3/j3method.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3method.h?rev=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3method.h (original)
+++ vmkit/branches/mcjit/include/j3/j3method.h Sat Jan  4 09:48:46 2014
@@ -77,13 +77,11 @@ namespace j3 {
 		char*               llvmStubName(J3Class* from=0);
 
 		void                postInitialise(uint32_t access, J3Attributes* attributes);
-		void                setResolved(uint32_t index); 
+		void                setIndex(uint32_t index); 
 
 		J3Method*           resolve(J3ObjectHandle* obj);
 
 		uint32_t            index();
-		uint32_t*           indexPtr() { return &_index; }
-		bool                isResolved() { return _index != -1; }
 
 		J3Attributes*       attributes() const { return _attributes; }
 		uint16_t            access() const { return _access; }

Modified: vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc?rev=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc (original)
+++ vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc Sat Jan  4 09:48:46 2014
@@ -48,7 +48,6 @@ jobject JNICALL JVM_Clone(JNIEnv* env, j
 	enterJVM(); 
 	res = obj->vt()->type()->asObjectType()->clone(obj);
 	leaveJVM(); 
-	NYI();
 	return res;
 }
 

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=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3class.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3class.cc Sat Jan  4 09:48:46 2014
@@ -587,12 +587,10 @@ void J3Class::readClassBytes(J3Field* hi
 		method->postInitialise(access, attributes);
 		methodsTmp[i] = method;
 
-		if(J3Cst::isStatic(access)) {
+		if(J3Cst::isStatic(access))
 			nbStaticMethods++;
-			method->setResolved(0);
-		} else {
+		else
 			nbVirtualMethods++;
-		}
 	}
 
 	staticLayout()->_methods = (J3Method**)loader()->allocator()->allocate(sizeof(J3Method*)*nbStaticMethods);

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=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Sat Jan  4 09:48:46 2014
@@ -424,12 +424,7 @@ void J3CodeGen::invokeInterface(uint32_t
 void J3CodeGen::invokeVirtual(uint32_t idx) {
 	J3Method*     target = cl->methodAt(idx, 0);
 	J3Signature* type = target->signature();
-	llvm::Value*  funcEntry;
-
-	if(target->isResolved())
-		funcEntry = builder->getInt32(target->index());
-	else
-		funcEntry = builder->CreateCall(funcJ3MethodIndex, methodDescriptor(target));
+	llvm::Value*  funcEntry = funcEntry = builder->getInt32(target->index());
 
 	llvm::Value*  obj = nullCheck(stack.top(type->nbIns()));
 	llvm::Value*  gepFunc[] = { builder->getInt32(0),

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=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3method.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3method.cc Sat Jan  4 09:48:46 2014
@@ -55,15 +55,7 @@ J3Signature::function_t J3Method::cxxCal
 void J3Method::ensureCompiled(bool withCaller) {
 	if(!fnPtr() || (withCaller && !cxxCaller())) {
 		// fprintf(stderr, "materializing: %s::%s%s\n", this, cl()->name()->cStr(), name()->cStr(), signature()->cStr());
-		if(!isResolved()) {
-			if(cl()->loader()->vm()->options()->debugLinking)
-				fprintf(stderr, "linking %s::%s\n", cl()->name()->cStr(), name()->cStr());
-			
-			cl()->initialise();
-			if(!isResolved())
-				J3::noSuchMethodError("unable to find method", cl(), name(), signature());
-		}
-
+		cl()->initialise();
 		J3CodeGen::translate(this, !fnPtr(), withCaller);
  	}
 }
@@ -92,9 +84,7 @@ void* J3Method::getSymbolAddress() {
 	return this;
 }
 
-void J3Method::setResolved(uint32_t index) { 
-	if(isResolved())
-		J3::internalError("trying to re-resolve a resolved method, should not happen");
+void J3Method::setIndex(uint32_t index) { 
 	_index = index; 
 }
 

Modified: vmkit/branches/mcjit/lib/j3/vm/j3object.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3object.cc?rev=198501&r1=198500&r2=198501&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3object.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3object.cc Sat Jan  4 09:48:46 2014
@@ -56,10 +56,10 @@ J3VirtualTable* J3VirtualTable::create(J
 		
 		if(parent) {
 			pm[i] = parent;
-			meth->setResolved(parent->index());
+			meth->setIndex(parent->index());
 		} else {
 			pm[i] = meth;
-			meth->setResolved(n);
+			meth->setIndex(n);
 			n++;
 		}
 	}





More information about the vmkit-commits mailing list