[vmkit-commits] [vmkit] r198492 - Invoke does not use Java type anymore.

Gael Thomas gael.thomas at lip6.fr
Sat Jan 4 06:06:24 PST 2014


Author: gthomas
Date: Sat Jan  4 08:06:24 2014
New Revision: 198492

URL: http://llvm.org/viewvc/llvm-project?rev=198492&view=rev
Log:
Invoke does not use Java type anymore.

Modified:
    vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc

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=198492&r1=198491&r2=198492&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Sat Jan  4 08:06:24 2014
@@ -375,18 +375,15 @@ llvm::Value* J3CodeGen::nullCheck(llvm::
 
 void J3CodeGen::invoke(uint32_t access, J3Method* target, llvm::Value* func) {
 	J3Signature* type = target->signature();
+	llvm::FunctionType* fType = target->signature()->functionType(access);
+	uint32_t n = fType->getNumParams();
 	std::vector<llvm::Value*> args;
-	uint32_t d = 0;
+	uint32_t i=n-1;
 
-	if(!J3Cst::isStatic(access)) {
-		args.push_back(stack.top(type->nbIns()));
-		d = 1;
-	}
+	for(llvm::FunctionType::param_iterator it=fType->param_begin(); it!=fType->param_end(); it++)
+		args.push_back(unflatten(stack.top(i--), *it));
 
-	for(uint32_t i=0; i<type->nbIns(); i++)
-		args.push_back(unflatten(stack.top(type->nbIns() - i - 1), type->javaIns(i)->llvmType()));
-
-	stack.drop(d + type->nbIns());
+	stack.drop(n);
 
 	llvm::Value* res;
 
@@ -399,9 +396,8 @@ void J3CodeGen::invoke(uint32_t access,
 	} else
 		res = builder->CreateCall(func, args);
 	
-	if(type->javaOut() != vm->typeVoid) {
-		stack.push(flatten(res, type->javaOut()->llvmType()));
-	}
+	if(!fType->getReturnType()->isVoidTy())
+		stack.push(flatten(res, fType->getReturnType()));
 }
 
 void J3CodeGen::invokeInterface(uint32_t idx) {





More information about the vmkit-commits mailing list