[llvm-commits] [vmkit] r52326 - /vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jun 16 07:12:28 PDT 2008
Author: geoffray
Date: Mon Jun 16 09:12:28 2008
New Revision: 52326
URL: http://llvm.org/viewvc/llvm-project?rev=52326&view=rev
Log:
Fix for buggy Java code in a method where only an exception is thrown,
and something should have been returned.
Also, use the changeType method when creating arguments.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=52326&r1=52325&r2=52326&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Jun 16 09:12:28 2008
@@ -756,6 +756,19 @@
beginSynchronize();
compileOpcodes(&compilingClass->bytes->elements[start], codeLen);
+
+ // Fix a javac(?) bug where a method only throws an exception and des
+ // not return.
+ pred_iterator PI = pred_begin(endBlock);
+ pred_iterator PE = pred_end(endBlock);
+ if (PI == PE) {
+ Instruction* I = currentBlock->getTerminator();
+ assert(isa<UnreachableInst>(I) && "non terminator before buggy return");
+ I->eraseFromParent();
+ BranchInst::Create(endBlock, currentBlock);
+ endNode->addIncoming(Constant::getNullValue(returnType),
+ currentBlock);
+ }
currentBlock = endBlock;
if (isSynchro(compilingMethod->access))
@@ -793,8 +806,8 @@
else
llvm::ReturnInst::Create(currentBlock);
- pred_iterator PI = pred_begin(endExceptionBlock);
- pred_iterator PE = pred_end(endExceptionBlock);
+ PI = pred_begin(endExceptionBlock);
+ PE = pred_end(endExceptionBlock);
if (PI == PE) {
endExceptionBlock->eraseFromParent();
} else {
@@ -1346,15 +1359,8 @@
const Type* type = it->get();
if (tmp->getType() != type) { // int8 or int16
- if (type == Type::Int32Ty) {
- if (func == AssessorDesc::dChar) {
- tmp = new ZExtInst(tmp, type, "", currentBlock);
- } else {
- tmp = new SExtInst(tmp, type, "", currentBlock);
- }
- } else {
- tmp = new TruncInst(tmp, type, "", currentBlock);
- }
+ convertValue(tmp, type, currentBlock,
+ func == AssessorDesc::dChar || func == AssessorDesc::dBool);
}
args[i] = tmp;
More information about the llvm-commits
mailing list