[vmkit-commits] [vmkit] r100329 - in /vmkit/trunk: include/mvm/Allocator.h lib/J3/Compiler/JavaJIT.cpp lib/J3/Compiler/JavaJIT.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/Compiler/JavaJITOpcodes.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Apr 4 06:04:19 PDT 2010
Author: geoffray
Date: Sun Apr 4 08:04:18 2010
New Revision: 100329
URL: http://llvm.org/viewvc/llvm-project?rev=100329&view=rev
Log:
LLVM API change on debug locations.
Modified:
vmkit/trunk/include/mvm/Allocator.h
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
Modified: vmkit/trunk/include/mvm/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Allocator.h?rev=100329&r1=100328&r2=100329&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Allocator.h (original)
+++ vmkit/trunk/include/mvm/Allocator.h Sun Apr 4 08:04:18 2010
@@ -58,7 +58,7 @@
const char* name) {
return allocator.Allocate(sz, name);
}
-
+
void operator delete(void* ptr) {
free(ptr);
}
@@ -67,6 +67,14 @@
const char* name) {
return allocator.Allocate(sz, name);
}
+
+ void* operator new[](size_t sz) {
+ return malloc(sz);
+ }
+
+ void operator delete[](void* ptr) {
+ return free(ptr);
+ }
};
/// JITInfo - This class can be derived from to hold private JIT-specific
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=100329&r1=100328&r2=100329&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun Apr 4 08:04:18 2010
@@ -523,6 +523,16 @@
UTF8Buffer(compilingClass->name).cString(),
UTF8Buffer(compilingMethod->name).cString());
+ if (codeInfo.size()) {
+ mvm::BumpPtrAllocator& Alloc = compilingClass->classLoader->allocator;
+ compilingMethod->codeInfo =
+ new(Alloc, "CodeLineInfo") 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;
+ }
+ }
return llvmFunction;
}
@@ -1324,7 +1334,7 @@
#ifndef DWARF_EXCEPTIONS
if (codeLen < 5 && !callsStackWalker && !TheCompiler->isStaticCompiling())
- compilingMethod->canBeInlined = true;
+ compilingMethod->canBeInlined = false;
#endif
Attribut* annotationsAtt =
@@ -1345,6 +1355,15 @@
}
}
}
+
+ if (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;
+ }
+ }
return llvmFunction;
}
@@ -2590,10 +2609,10 @@
}
MDNode* JavaJIT::CreateLocation() {
- uint32_t first = currentLineNumber | (currentBytecodeIndex << 16);
- uint32_t second = currentCtpIndex | (callNumber << 16);
+ LineInfo LI = { currentLineNumber, currentCtpIndex, currentBytecodeIndex };
+ codeInfo.push_back(LI);
DILocation Location = TheCompiler->getDebugFactory()->CreateLocation(
- first, second, DIScope(DbgSubprogram));
+ callNumber, 0, DIScope(DbgSubprogram));
callNumber++;
return Location.getNode();
}
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=100329&r1=100328&r2=100329&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sun Apr 4 08:04:18 2010
@@ -63,6 +63,12 @@
};
+struct LineInfo {
+ uint16 lineNumber;
+ uint16 ctpIndex;
+ uint16 bytecodeIndex;
+};
+
/// JavaJIT - The compilation engine of J3. Parses the bycode and returns
/// its LLVM representation.
///
@@ -163,6 +169,9 @@
/// CreateLocation - Create debug information for a call.
llvm::MDNode* CreateLocation();
+ // codeInfo - List of LineInfo for this method.
+ std::vector<LineInfo> codeInfo;
+
//===--------------------------- Inline support ---------------------------===//
/// inlineCompile - Parse the method and start its LLVM representation
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=100329&r1=100328&r2=100329&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sun Apr 4 08:04:18 2010
@@ -101,17 +101,26 @@
uint32 infoLength = Details.LineStarts.size();
currentCompiledMethod->codeInfoLength = infoLength;
if (infoLength) {
- currentCompiledMethod->codeInfo =
+ CodeLineInfo* infoTable =
new(Alloc, "CodeLineInfo") CodeLineInfo[infoLength];
for (uint32 i = 0; i < infoLength; ++i) {
- DILocation DLT = Details.MF->getDILocation(Details.LineStarts[i].Loc);
- uint32_t first = DLT.getLineNumber();
- uint32_t second = DLT.getColumnNumber();
- currentCompiledMethod->codeInfo[i].address =
- Details.LineStarts[i].Address;
- currentCompiledMethod->codeInfo[i].lineNumber = first & 0xFFFF;
- currentCompiledMethod->codeInfo[i].bytecodeIndex = first >> 16;
- currentCompiledMethod->codeInfo[i].ctpIndex = second & 0xFFFF;
+ DebugLoc DL = Details.LineStarts[i].Loc;
+ uint32_t first = DL.getLine();
+ uint32_t second = DL.getCol();
+ assert(second == 0 && "Wrong column number");
+ infoTable[i].address = Details.LineStarts[i].Address;
+ infoTable[i].lineNumber =
+ currentCompiledMethod->codeInfo[first].lineNumber;
+ infoTable[i].bytecodeIndex =
+ currentCompiledMethod->codeInfo[first].bytecodeIndex;
+ infoTable[i].ctpIndex =
+ currentCompiledMethod->codeInfo[first].ctpIndex;
+ }
+ delete[] currentCompiledMethod->codeInfo;
+ currentCompiledMethod->codeInfo = infoTable;
+ } else {
+ if (currentCompiledMethod->codeInfo) {
+ delete[] currentCompiledMethod->codeInfo;
}
}
}
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=100329&r1=100328&r2=100329&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sun Apr 4 08:04:18 2010
@@ -173,7 +173,6 @@
currentCtpIndex = -1;
currentBytecodeIndex = i;
- callNumber = 0;
// To prevent a gcj bug with useless goto
if (currentBlock->getTerminator() != 0) {
More information about the vmkit-commits
mailing list