[vmkit-commits] [vmkit] r101669 - in /vmkit/trunk/lib/J3: Compiler/JavaJIT.cpp Compiler/JavaJIT.h Compiler/JavaJITCompiler.cpp Compiler/JavaJITOpcodes.cpp VMCore/JavaClass.cpp VMCore/JavaClass.h VMCore/JavaRuntimeJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat Apr 17 13:43:27 PDT 2010
Author: geoffray
Date: Sat Apr 17 15:43:27 2010
New Revision: 101669
URL: http://llvm.org/viewvc/llvm-project?rev=101669&view=rev
Log:
Take into account invokeinterface on abstract methods in j3ResolveVirtualStub.
Modified:
vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
vmkit/trunk/lib/J3/Compiler/JavaJIT.h
vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
vmkit/trunk/lib/J3/VMCore/JavaClass.h
vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sat Apr 17 15:43:27 2010
@@ -524,13 +524,12 @@
UTF8Buffer(compilingMethod->name).cString());
if (codeInfo.size()) {
- mvm::BumpPtrAllocator& Alloc = compilingClass->classLoader->allocator;
- compilingMethod->codeInfo =
- new(Alloc, "CodeLineInfo") CodeLineInfo[codeInfo.size()];
+ compilingMethod->codeInfo = new CodeLineInfo[codeInfo.size()];
for (uint32 i = 0; i < codeInfo.size(); i++) {
compilingMethod->codeInfo[i].lineNumber = codeInfo[i].lineNumber;
compilingMethod->codeInfo[i].ctpIndex = codeInfo[i].ctpIndex;
compilingMethod->codeInfo[i].bytecodeIndex = codeInfo[i].bytecodeIndex;
+ compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
}
}
@@ -1361,6 +1360,7 @@
compilingMethod->codeInfo[i].lineNumber = codeInfo[i].lineNumber;
compilingMethod->codeInfo[i].ctpIndex = codeInfo[i].ctpIndex;
compilingMethod->codeInfo[i].bytecodeIndex = codeInfo[i].bytecodeIndex;
+ compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
}
}
@@ -2608,7 +2608,8 @@
}
DebugLoc JavaJIT::CreateLocation() {
- LineInfo LI = { currentLineNumber, currentCtpIndex, currentBytecodeIndex };
+ LineInfo LI = { currentLineNumber, currentCtpIndex, currentBytecodeIndex,
+ currentBytecode };
codeInfo.push_back(LI);
DebugLoc DL = DebugLoc::get(callNumber++, 0, DbgSubprogram);
return DL;
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sat Apr 17 15:43:27 2010
@@ -68,6 +68,7 @@
uint16 lineNumber;
uint16 ctpIndex;
uint16 bytecodeIndex;
+ uint16 bytecode;
};
/// JavaJIT - The compilation engine of J3. Parses the bycode and returns
@@ -92,6 +93,7 @@
currentLineNumber = 0;
currentBytecodeIndex = 0;
currentCtpIndex = -1;
+ currentBytecode = -1;
callNumber = 0;
}
@@ -164,6 +166,9 @@
/// currentCtpIndex - The constant pool index being processed.
uint16 currentCtpIndex;
+ /// currentBytecode - The bytecode being processed.
+ uint16 currentBytecode;
+
/// callNumber - The number of a call for a single opcode.
uint16 callNumber;
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sat Apr 17 15:43:27 2010
@@ -115,6 +115,8 @@
currentCompiledMethod->codeInfo[first].bytecodeIndex;
infoTable[i].ctpIndex =
currentCompiledMethod->codeInfo[first].ctpIndex;
+ infoTable[i].bytecode =
+ currentCompiledMethod->codeInfo[first].bytecode;
}
delete[] currentCompiledMethod->codeInfo;
currentCompiledMethod->codeInfo = infoTable;
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sat Apr 17 15:43:27 2010
@@ -173,6 +173,7 @@
currentCtpIndex = -1;
currentBytecodeIndex = i;
+ currentBytecode = bytecodes[i];
// To prevent a gcj bug with useless goto
if (currentBlock->getTerminator() != 0) {
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sat Apr 17 15:43:27 2010
@@ -1748,6 +1748,17 @@
}
}
+CodeLineInfo* JavaMethod::lookupCodeLineInfo(uintptr_t ip) {
+ for(uint16 i = 0; i < codeInfoLength; ++i) {
+ if (codeInfo[i].address > ip) {
+ assert(i > 0 && "Wrong ip address for method");
+ return &(codeInfo[i - 1]);
+ }
+ }
+ if (codeInfoLength) return &(codeInfo[codeInfoLength - 1]);
+ return NULL;
+}
+
uint16 JavaMethod::lookupLineNumber(uintptr_t ip) {
for(uint16 i = 0; i < codeInfoLength; ++i) {
if (codeInfo[i].address > ip) {
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sat Apr 17 15:43:27 2010
@@ -983,6 +983,7 @@
uint16 lineNumber;
uint16 ctpIndex;
uint16 bytecodeIndex;
+ uint16 bytecode;
// TODO: Use these fields when inlining.
JavaMethod* executingMethod;
// The code where the inlined method starts.
@@ -1083,6 +1084,11 @@
/// related to the given instruction pointer.
///
uint16 lookupCtpIndex(uintptr_t ip);
+
+ /// lookupCodeLineInfo - Lookup the code line info related to the given
+ /// instruction pointer.
+ ///
+ CodeLineInfo* lookupCodeLineInfo(uintptr_t ip);
/// getSignature - Get the signature of thes method, resolving it if
/// necessary.
Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=101669&r1=101668&r2=101669&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sat Apr 17 15:43:27 2010
@@ -604,7 +604,9 @@
void* ip = *Walker;
// Lookup the method info in the constant pool of the caller.
- uint16 ctpIndex = meth->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+ CodeLineInfo* CLInfo =
+ meth->lookupCodeLineInfo(reinterpret_cast<uintptr_t>(ip));
+ uint16 ctpIndex = CLInfo->ctpIndex;
assert(ctpIndex && "No constant pool index");
JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
CommonClass* ctpCl = 0;
@@ -629,7 +631,7 @@
"The method's offset is greater than the virtual table size");
((void**)obj->getVirtualTable())[Virt->offset] = result;
- if (ctpCl->isInterface()) {
+ if (CLInfo->bytecode == 0xB9) { // INVOKEINTERFACE
InterfaceMethodTable* IMT = cl->virtualVT->IMT;
uint32_t index = InterfaceMethodTable::getIndex(Virt->name, Virt->type);
if ((IMT->contents[index] & 1) == 0) {
More information about the vmkit-commits
mailing list