[vmkit-commits] [vmkit] r69882 - in /vmkit/trunk/lib/JnJVM/Compiler: ExceptionsCheck.inc JavaJITOpcodes.cpp LowerConstantCalls.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Thu Apr 23 01:31:06 PDT 2009
Author: geoffray
Date: Thu Apr 23 03:31:05 2009
New Revision: 69882
URL: http://llvm.org/viewvc/llvm-project?rev=69882&view=rev
Log:
Start lowering of runtime type checks in the compiler.
Modified:
vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc
vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp
vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
Modified: vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc?rev=69882&r1=69881&r2=69882&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/ExceptionsCheck.inc Thu Apr 23 03:31:05 2009
@@ -421,23 +421,28 @@
uint32 depth = cur->catchClass->virtualVT->depth;
Value* depthCl = ConstantInt::get(Type::Int32Ty, depth);
-
+ Value* cmp = 0;
+
if (depth >= JavaVirtualTable::getDisplayLength()) {
- assert(0 && "Implement me");
- }
-
-
-
- Value* inDisplay = CallInst::Create(module->GetDisplayFunction,
- objVT, "", currentBlock);
+ Value* classArgs[2] = { objVT, VTVar };
+
+ cmp = CallInst::Create(module->IsSecondaryClassFunction,
+ classArgs, classArgs + 2, "",
+ currentBlock);
+
+ } else {
+
+ Value* inDisplay = CallInst::Create(module->GetDisplayFunction,
+ objVT, "", currentBlock);
- Value* displayArgs[2] = { inDisplay, depthCl };
- Value* VTInDisplay = CallInst::Create(module->GetVTInDisplayFunction,
- displayArgs, displayArgs + 2, "",
- currentBlock);
+ Value* displayArgs[2] = { inDisplay, depthCl };
+ Value* VTInDisplay = CallInst::Create(module->GetVTInDisplayFunction,
+ displayArgs, displayArgs + 2, "",
+ currentBlock);
- Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, VTInDisplay, VTVar, "",
- currentBlock);
+ cmp = new ICmpInst(ICmpInst::ICMP_EQ, VTInDisplay, VTVar, "",
+ currentBlock);
+ }
// Add the Java exception in the phi node of the handler.
Instruction* insn = cur->javaHandler->begin();
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp?rev=69882&r1=69881&r2=69882&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Thu Apr 23 03:31:05 2009
@@ -2055,10 +2055,33 @@
Value* objVT = CallInst::Create(module->GetVTFunction, obj, "",
currentBlock);
Value* classArgs[2] = { objVT, TheVT };
-
- Value* res = CallInst::Create(module->IsAssignableFromFunction,
- classArgs, classArgs + 2, "",
- currentBlock);
+
+ Value* res = 0;
+ if (cl) {
+ if (cl->isSecondaryClass()) {
+ res = CallInst::Create(module->IsSecondaryClassFunction,
+ classArgs, classArgs + 2, "",
+ currentBlock);
+ } else {
+ Value* inDisplay = CallInst::Create(module->GetDisplayFunction,
+ objVT, "", currentBlock);
+
+ uint32 depth = cl->virtualVT->depth;
+ ConstantInt* CI = ConstantInt::get(Type::Int32Ty, depth);
+ Value* displayArgs[2] = { inDisplay, CI };
+ Value* VTInDisplay =
+ CallInst::Create(module->GetVTInDisplayFunction,
+ displayArgs, displayArgs + 2, "",
+ currentBlock);
+
+ res = new ICmpInst(ICmpInst::ICMP_EQ, VTInDisplay, TheVT, "",
+ currentBlock);
+ }
+ } else {
+ res = CallInst::Create(module->IsAssignableFromFunction,
+ classArgs, classArgs + 2, "",
+ currentBlock);
+ }
node->addIncoming(res, currentBlock);
BranchInst::Create(endBlock, currentBlock);
Modified: vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp?rev=69882&r1=69881&r2=69882&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp Thu Apr 23 03:31:05 2009
@@ -526,16 +526,13 @@
} else if (V == module->IsSecondaryClassFunction) {
Changed = true;
Value* VT1 = Call.getArgument(0);
- Value* VT2 = Call.getArgument(0);
+ Value* VT2 = Call.getArgument(1);
Value* args[2] = { VT1, VT2 };
CallInst* res = CallInst::Create(module->IsAssignableFromFunction,
args, args + 2, "", CI);
CI->replaceAllUsesWith(res);
CI->eraseFromParent();
-
-
- break;
}
#ifdef ISOLATE_SHARING
else if (V == module->GetCtpClassFunction) {
More information about the vmkit-commits
mailing list