[vmkit-commits] [vmkit] r114740 - in /vmkit/branches/precise: ./ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/LLVMRuntime/ lib/J3/VMCore/ lib/Mvm/CommonThread/ lib/Mvm/Compiler/ mmtk/magic/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Fri Sep 24 11:05:18 PDT 2010
Author: geoffray
Date: Fri Sep 24 13:05:18 2010
New Revision: 114740
URL: http://llvm.org/viewvc/llvm-project?rev=114740&view=rev
Log:
Merge with trunk
Use the new GC infrastructure for precise debug and GC information.
Modified:
vmkit/branches/precise/ (props changed)
vmkit/branches/precise/lib/J3/Classpath/JavaUpcalls.cpp
vmkit/branches/precise/lib/J3/Compiler/ExceptionsCheck.inc
vmkit/branches/precise/lib/J3/Compiler/JavaAOTCompiler.cpp
vmkit/branches/precise/lib/J3/Compiler/JavaJIT.cpp
vmkit/branches/precise/lib/J3/Compiler/JavaJIT.h
vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp
vmkit/branches/precise/lib/J3/Compiler/JavaJITOpcodes.cpp
vmkit/branches/precise/lib/J3/Compiler/LowerConstantCalls.cpp
vmkit/branches/precise/lib/J3/LLVMRuntime/runtime-default.ll
vmkit/branches/precise/lib/J3/VMCore/JavaClass.cpp
vmkit/branches/precise/lib/J3/VMCore/JavaClass.h
vmkit/branches/precise/lib/J3/VMCore/JavaConstantPool.h
vmkit/branches/precise/lib/J3/VMCore/JavaRuntimeJIT.cpp
vmkit/branches/precise/lib/J3/VMCore/JnjvmClassLoader.cpp
vmkit/branches/precise/lib/J3/VMCore/LinkJavaRuntime.h
vmkit/branches/precise/lib/Mvm/CommonThread/ctthread.cpp
vmkit/branches/precise/lib/Mvm/Compiler/EscapeAnalysis.cpp
vmkit/branches/precise/lib/Mvm/Compiler/InlineMalloc.cpp
vmkit/branches/precise/lib/Mvm/Compiler/LoopSafePoints.cpp
vmkit/branches/precise/mmtk/magic/LowerMagic.cpp
Propchange: vmkit/branches/precise/
------------------------------------------------------------------------------
svn:mergeinfo = /vmkit/trunk:112509-114734
Modified: vmkit/branches/precise/lib/J3/Classpath/JavaUpcalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Classpath/JavaUpcalls.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Classpath/JavaUpcalls.cpp (original)
+++ vmkit/branches/precise/lib/J3/Classpath/JavaUpcalls.cpp Fri Sep 24 13:05:18 2010
@@ -742,7 +742,7 @@
loadInClassLoader =
UPCALL_METHOD(loader, "java/lang/ClassLoader", "loadClass",
- "(Ljava/lang/String;Z)Ljava/lang/Class;", ACC_VIRTUAL);
+ "(Ljava/lang/String;)Ljava/lang/Class;", ACC_VIRTUAL);
JavaMethod* internString =
UPCALL_METHOD(loader, "java/lang/VMString", "intern",
Modified: vmkit/branches/precise/lib/J3/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/ExceptionsCheck.inc?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/branches/precise/lib/J3/Compiler/ExceptionsCheck.inc Fri Sep 24 13:05:18 2010
@@ -541,7 +541,6 @@
// Restore currentBlock.
currentBlock = temp;
return nbe;
-
}
void JavaJIT::finishExceptions() {
Modified: vmkit/branches/precise/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaAOTCompiler.cpp Fri Sep 24 13:05:18 2010
@@ -167,6 +167,7 @@
}
Constant* JavaAOTCompiler::getString(JavaString* str) {
+ assert(!useCooperativeGC());
string_iterator SI = strings.find(str);
if (SI != strings.end()) {
return SI->second;
@@ -304,6 +305,7 @@
Constant* JavaAOTCompiler::getFinalObject(JavaObject* obj, CommonClass* objCl) {
+ assert(!useCooperativeGC());
llvm::GlobalVariable* varGV = 0;
final_object_iterator End = finalObjects.end();
final_object_iterator I = finalObjects.find(obj);
Modified: vmkit/branches/precise/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaJIT.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaJIT.cpp Fri Sep 24 13:05:18 2010
@@ -299,9 +299,10 @@
char* functionName = (char*)allocator.Allocate(
3 + JNI_NAME_PRE_LEN + ((mnlen + clen + mtlen) << 3));
- if (!natPtr)
+ if (!natPtr) {
natPtr = compilingClass->classLoader->nativeLookup(compilingMethod, j3,
functionName);
+ }
if (!natPtr && !TheCompiler->isStaticCompiling()) {
currentBlock = createBasicBlock("start");
@@ -543,18 +544,6 @@
UTF8Buffer(compilingClass->name).cString(),
UTF8Buffer(compilingMethod->name).cString());
- 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;
- compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
- }
- } else {
- compilingMethod->codeInfo = NULL;
- }
-
return llvmFunction;
}
@@ -896,23 +885,6 @@
readExceptionTable(reader, codeLen);
- // Lookup line number table attribute.
- uint16 nba = reader.readU2();
- for (uint16 i = 0; i < nba; ++i) {
- const UTF8* attName = compilingClass->ctpInfo->UTF8At(reader.readU2());
- uint32 attLen = reader.readU4();
- if (attName->equals(Attribut::lineNumberTableAttribut)) {
- uint16 lineLength = reader.readU2();
- for (uint16 i = 0; i < lineLength; ++i) {
- uint16 pc = reader.readU2();
- uint16 ln = reader.readU2();
- opcodeInfos[pc].lineNumber = ln;
- }
- } else {
- reader.seek(attLen, Reader::SeekCur);
- }
- }
-
reader.cursor = start;
exploreOpcodes(reader, codeLen);
@@ -1146,23 +1118,6 @@
readExceptionTable(reader, codeLen);
- // Lookup line number table attribute.
- uint16 nba = reader.readU2();
- for (uint16 i = 0; i < nba; ++i) {
- const UTF8* attName = compilingClass->ctpInfo->UTF8At(reader.readU2());
- uint32 attLen = reader.readU4();
- if (attName->equals(Attribut::lineNumberTableAttribut)) {
- uint16 lineLength = reader.readU2();
- for (uint16 i = 0; i < lineLength; ++i) {
- uint16 pc = reader.readU2();
- uint16 ln = reader.readU2();
- opcodeInfos[pc].lineNumber = ln;
- }
- } else {
- reader.seek(attLen, Reader::SeekCur);
- }
- }
-
reader.cursor = start;
exploreOpcodes(reader, codeLen);
@@ -1346,18 +1301,6 @@
}
}
- 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;
- compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
- }
- } else {
- compilingMethod->codeInfo = NULL;
- }
-
return llvmFunction;
}
@@ -2137,7 +2080,7 @@
abort();
}
} else {
- if (TheCompiler->isStaticCompiling()) {
+ if (TheCompiler->isStaticCompiling() && !TheCompiler->useCooperativeGC()) {
JavaObject* val = field->getStaticObjectField();
JnjvmClassLoader* JCL = field->classDef->classLoader;
Value* V = TheCompiler->getFinalObject(val, sign->assocClass(JCL));
@@ -2630,10 +2573,7 @@
}
DebugLoc JavaJIT::CreateLocation() {
- LineInfo LI = { currentLineNumber, currentCtpIndex, currentBytecodeIndex,
- currentBytecode };
- codeInfo.push_back(LI);
- DebugLoc DL = DebugLoc::get(callNumber++, 0, DbgSubprogram);
+ DebugLoc DL = DebugLoc::get(currentBytecodeIndex, 0, DbgSubprogram);
return DL;
}
Modified: vmkit/branches/precise/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaJIT.h?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaJIT.h Fri Sep 24 13:05:18 2010
@@ -58,19 +58,9 @@
/// stack - The stack at this location if there is a new block
///
std::vector<CommonClass*> stack;
-
- /// lineNumber - The line number of this bytecode.
- uint16 lineNumber;
};
-struct LineInfo {
- uint16 lineNumber;
- uint16 ctpIndex;
- uint16 bytecodeIndex;
- uint16 bytecode;
-};
-
/// JavaJIT - The compilation engine of J3. Parses the bycode and returns
/// its LLVM representation.
///
@@ -90,11 +80,7 @@
callsStackWalker = false;
endNode = 0;
currentStackIndex = 0;
- currentLineNumber = 0;
currentBytecodeIndex = 0;
- currentCtpIndex = -1;
- currentBytecode = -1;
- callNumber = 0;
thisObject = NULL;
}
@@ -158,27 +144,12 @@
llvm::MDNode* DbgSubprogram;
- /// currentLineIndex - The current line being processed.
- uint16 currentLineNumber;
-
/// currentBytecodeIndex - The current bytecode being processed.
uint16 currentBytecodeIndex;
- /// 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;
-
/// CreateLocation - Create debug information for a call.
llvm::DebugLoc 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/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaJITCompiler.cpp Fri Sep 24 13:05:18 2010
@@ -15,12 +15,14 @@
#include "llvm/Module.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/CodeGen/GCStrategy.h"
+#include <llvm/CodeGen/JITCodeEmitter.h>
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+#include <../lib/ExecutionEngine/JIT/JIT.h>
#include "MvmGC.h"
#include "mvm/VirtualMachine.h"
@@ -58,7 +60,8 @@
if (info != NULL) {
fprintf(stderr, "; %p in %s.%s (line %d, bytecode %d, code start %p)", new_ip,
UTF8Buffer(meth->classDef->name).cString(),
- UTF8Buffer(meth->name).cString(), info->lineNumber,
+ UTF8Buffer(meth->name).cString(),
+ meth->lookupLineNumber((uintptr_t)ip),
info->bytecodeIndex, meth->code);
} else {
fprintf(stderr, "; %p in %s.%s (native method, code start %p)", new_ip,
@@ -74,8 +77,7 @@
void *Code, size_t Size,
const EmittedFunctionDetails &Details) {
- // The following could be changed to an assert when -load-bc supports
- // the verifier.
+ // The following is necessary for -load-bc.
if (F.getParent() != TheCompiler->getLLVMModule()) return;
assert(F.hasGC());
@@ -107,35 +109,34 @@
} else {
MI = new(Alloc, "JavaJITMethodInfo") JavaJITMethodInfo(GFI, meth);
}
- MI->addToVM(vm, (JIT*)TheCompiler->executionEngine);
+ JIT* jit = (JIT*)TheCompiler->executionEngine;
+ MI->addToVM(vm, jit);
- if (meth != NULL) {
- uint32 infoLength = Details.LineStarts.size();
- meth->codeInfoLength = infoLength;
- if (infoLength > 0) {
- mvm::BumpPtrAllocator& JavaAlloc = meth->classDef->classLoader->allocator;
- CodeLineInfo* infoTable =
- new(JavaAlloc, "CodeLineInfo") CodeLineInfo[infoLength];
- for (uint32 i = 0; i < infoLength; ++i) {
- 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 = meth->codeInfo[first].lineNumber;
- infoTable[i].bytecodeIndex = meth->codeInfo[first].bytecodeIndex;
- infoTable[i].ctpIndex = meth->codeInfo[first].ctpIndex;
- infoTable[i].bytecode = meth->codeInfo[first].bytecode;
- }
- delete[] meth->codeInfo;
- meth->codeInfo = infoTable;
- } else {
- if (meth->codeInfo != NULL) {
- delete[] meth->codeInfo;
- meth->codeInfo = NULL;
- }
- }
+ if (meth == NULL) return;
+
+ uint32_t infoLength = GFI->size();
+ meth->codeInfoLength = infoLength;
+ if (infoLength == 0) {
+ meth->codeInfo = NULL;
+ return;
+ }
+
+ mvm::BumpPtrAllocator& JavaAlloc = meth->classDef->classLoader->allocator;
+ CodeLineInfo* infoTable =
+ new(JavaAlloc, "CodeLineInfo") CodeLineInfo[infoLength];
+ uint32_t index = 0;
+ for (GCFunctionInfo::iterator I = GFI->begin(), E = GFI->end();
+ I != E;
+ I++, index++) {
+ DebugLoc DL = I->Loc;
+ uint32_t bytecodeIndex = DL.getLine();
+ uint32_t second = DL.getCol();
+ assert(second == 0 && "Wrong column number");
+ uintptr_t address = jit->getCodeEmitter()->getLabelAddress(I->Label);
+ infoTable[index].address = address;
+ infoTable[index].bytecodeIndex = bytecodeIndex;
}
+ meth->codeInfo = infoTable;
}
Constant* JavaJITCompiler::getNativeClass(CommonClass* classDef) {
Modified: vmkit/branches/precise/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/JavaJITOpcodes.cpp Fri Sep 24 13:05:18 2010
@@ -148,13 +148,7 @@
currentExceptionBlock = opinfo->exceptionBlock;
- // Update the line number information.
- if (opinfo->lineNumber)
- currentLineNumber = opinfo->lineNumber;
-
- currentCtpIndex = -1;
currentBytecodeIndex = i;
- currentBytecode = bytecode;
// To prevent a gcj bug with useless goto
if (currentBlock->getTerminator() != 0) {
@@ -2013,7 +2007,6 @@
case INVOKEVIRTUAL : {
uint16 index = reader.readU2();
i += 2;
- currentCtpIndex = index;
invokeVirtual(index);
break;
}
@@ -2021,7 +2014,6 @@
case INVOKESPECIAL : {
uint16 index = reader.readU2();
i += 2;
- currentCtpIndex = index;
invokeSpecial(index);
break;
}
@@ -2029,7 +2021,6 @@
case INVOKESTATIC : {
uint16 index = reader.readU2();
i += 2;
- currentCtpIndex = index;
invokeStatic(index);
break;
}
@@ -2037,7 +2028,6 @@
case INVOKEINTERFACE : {
uint16 index = reader.readU2();
i += 2;
- currentCtpIndex = index;
invokeInterface(index);
i += 2;
break;
Modified: vmkit/branches/precise/lib/J3/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/Compiler/LowerConstantCalls.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/branches/precise/lib/J3/Compiler/LowerConstantCalls.cpp Fri Sep 24 13:05:18 2010
@@ -143,14 +143,18 @@
Cmp->eraseFromParent();
break;
}
-
- CallSite Ca = CallSite::get(Arg);
- Instruction* CI = Ca.getInstruction();
- if (CI && Ca.getCalledValue() == intrinsics->AllocateFunction) {
- Changed = true;
- Cmp->replaceAllUsesWith(ConstantInt::getFalse(*Context));
- Cmp->eraseFromParent();
- break;
+
+ Instruction* InsArg = dyn_cast<Instruction>(Arg);
+ if (InsArg != NULL &&
+ (InsArg->getOpcode() == Instruction::Call ||
+ InsArg->getOpcode() == Instruction::Invoke)) {
+ CallSite Ca(Arg);
+ if (Ca.getCalledValue() == intrinsics->AllocateFunction) {
+ Changed = true;
+ Cmp->replaceAllUsesWith(ConstantInt::getFalse(*Context));
+ Cmp->eraseFromParent();
+ break;
+ }
}
}
}
@@ -164,10 +168,15 @@
if (dyn_cast<StoreInst>(*UI)) continue;
if (BitCastInst* BI = dyn_cast<BitCastInst>(*UI)) {
if (BI->hasOneUse()) {
- CallSite Call = CallSite::get(*(BI->use_begin()));
- Instruction* CI = Call.getInstruction();
- if (CI && Call.getCalledFunction() == intrinsics->llvm_gc_gcroot)
- continue;
+ Instruction* use = dyn_cast<Instruction>(*(BI->use_begin()));
+ if (use != NULL &&
+ (use->getOpcode() == Instruction::Call ||
+ use->getOpcode() == Instruction::Invoke)) {
+ CallSite Call(use);
+ if (Call.getCalledFunction() == intrinsics->llvm_gc_gcroot) {
+ continue;
+ }
+ }
}
}
@@ -185,7 +194,7 @@
if (dyn_cast<Instruction>(II) == SI) ++II;
SI->eraseFromParent();
} else if (BitCastInst* BI = dyn_cast<BitCastInst>(Temp)) {
- CallSite Call = CallSite::get(*(BI->use_begin()));
+ CallSite Call(*(BI->use_begin()));
Instruction* CI = Call.getInstruction();
if (dyn_cast<Instruction>(II) == CI) ++II;
CI->eraseFromParent();
@@ -205,9 +214,10 @@
}
}
- CallSite Call = CallSite::get(I);
- Instruction* CI = Call.getInstruction();
- if (CI) {
+ if ((I->getOpcode() == Instruction::Call ||
+ I->getOpcode() == Instruction::Invoke)) {
+ Instruction* CI = I;
+ CallSite Call(I);
Value* V = Call.getCalledValue();
if (V == intrinsics->ArrayLengthFunction) {
Changed = true;
@@ -374,8 +384,9 @@
PHINode* phi = PHINode::Create(intrinsics->JavaObjectType, "", DelegateeOK);
phi->addIncoming(Del, CI->getParent());
- Value* Res = CallInst::Create(intrinsics->RuntimeDelegateeFunction,
- Call.getArgument(0), "", NoDelegatee);
+ Instruction* Res = CallInst::Create(intrinsics->RuntimeDelegateeFunction,
+ Call.getArgument(0), "", NoDelegatee);
+ Res->setDebugLoc(CI->getDebugLoc());
BranchInst::Create(DelegateeOK, NoDelegatee);
phi->addIncoming(Res, NoDelegatee);
@@ -414,7 +425,7 @@
BranchInst::Create(trueCl, falseCl, test, CI);
- Value* res = 0;
+ Instruction* res = 0;
if (InvokeInst* Invoke = dyn_cast<InvokeInst>(CI)) {
Value* Args[1] = { Cl };
BasicBlock* UI = Invoke->getUnwindDest();
@@ -448,6 +459,7 @@
Cl, "", falseCl);
BranchInst::Create(trueCl, falseCl);
}
+ res->setDebugLoc(CI->getDebugLoc());
node->addIncoming(res, falseCl);
@@ -498,7 +510,7 @@
Args.push_back(Call.getArgument(i));
}
- Value* res = 0;
+ Instruction* res = 0;
if (InvokeInst* Invoke = dyn_cast<InvokeInst>(CI)) {
BasicBlock* UI = Invoke->getUnwindDest();
res = InvokeInst::Create(resolver, trueCl, UI, Args.begin(),
@@ -530,9 +542,9 @@
BranchInst::Create(trueCl, falseCl);
}
+ res->setDebugLoc(CI->getDebugLoc());
node->addIncoming(res, falseCl);
-
CI->replaceAllUsesWith(node);
CI->eraseFromParent();
BranchInst::Create(NBB, trueCl);
@@ -564,8 +576,9 @@
BranchInst::Create(NotOKBlock, OKBlock, cmp, CI);
Value* args[3] = { Call.getArgument(0), Call.getArgument(1), GV };
- Value* res = CallInst::Create(intrinsics->GetArrayClassFunction, args,
- args + 3, "", NotOKBlock);
+ Instruction* res = CallInst::Create(intrinsics->GetArrayClassFunction, args,
+ args + 3, "", NotOKBlock);
+ res->setDebugLoc(CI->getDebugLoc());
BranchInst::Create(OKBlock, NotOKBlock);
node->addIncoming(res, NotOKBlock);
@@ -615,7 +628,8 @@
CurVT = new LoadInst(CurVT, "", false, CI);
CurVT = new BitCastInst(CurVT, intrinsics->VTType, "", CI);
- Value* res = new ICmpInst(CI, ICmpInst::ICMP_EQ, CurVT, VT2, "");
+ Instruction* res =
+ new ICmpInst(CI, ICmpInst::ICMP_EQ, CurVT, VT2, "");
node->addIncoming(ConstantInt::getTrue(*Context), CI->getParent());
BranchInst::Create(CurEndBlock, FailedBlock, res, CI);
@@ -623,6 +637,7 @@
Value* Args[2] = { VT1, VT2 };
res = CallInst::Create(intrinsics->IsSecondaryClassFunction, Args,
Args + 2, "", FailedBlock);
+ res->setDebugLoc(CI->getDebugLoc());
node->addIncoming(res, FailedBlock);
BranchInst::Create(CurEndBlock, FailedBlock);
Modified: vmkit/branches/precise/lib/J3/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/LLVMRuntime/runtime-default.ll?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/branches/precise/lib/J3/LLVMRuntime/runtime-default.ll Fri Sep 24 13:05:18 2010
@@ -29,6 +29,7 @@
%JavaThread = type { %MutatorThread, i8*, %JavaObject* }
+%JavaConstantPool = type { %JavaClass*, i32, i8*, i32*, i8** }
%Attribut = type { %UTF8*, i32, i32 }
@@ -38,7 +39,7 @@
%JavaField = type { i8*, i16, %UTF8*, %UTF8*, %Attribut*, i16, %JavaClass*, i32,
i16 }
-%CodeLineInfo = type { i8*, i16, i16, %JavaMethod*, %CodeLineInfo* }
+%CodeLineInfo = type { i8*, %JavaMethod*, %CodeLineInfo* }
%JavaMethod = type { i8*, i16, %Attribut*, i16, %JavaClass*,
%UTF8*, %UTF8*, i8, i8*, %CodeLineInfo*, i16, i32 }
Modified: vmkit/branches/precise/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JavaClass.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JavaClass.cpp Fri Sep 24 13:05:18 2010
@@ -1830,31 +1830,54 @@
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 (codeInfo[i].address == ip) {
+ return &(codeInfo[i]);
}
}
- if (codeInfoLength) return &(codeInfo[codeInfoLength - 1]);
return NULL;
}
uint16 JavaMethod::lookupLineNumber(uintptr_t ip) {
- for(uint16 i = 1; i < codeInfoLength; ++i) {
- if (codeInfo[i].address > ip) {
- return codeInfo[i - 1].lineNumber;
+ for(uint16 i = 0; i < codeInfoLength; ++i) {
+ if (codeInfo[i].address == ip) {
+ Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);
+ Reader reader(codeAtt, &(classDef->bytes));
+ reader.readU2(); // max_stack
+ reader.readU2(); // max_locals;
+ uint32_t codeLength = reader.readU4();
+ reader.seek(codeLength, Reader::SeekCur);
+ uint16_t exceptionTableLength = reader.readU2();
+ reader.seek(8 * exceptionTableLength, Reader::SeekCur);
+ uint16_t nba = reader.readU2();
+ for (uint16 att = 0; att < nba; ++att) {
+ const UTF8* attName = classDef->ctpInfo->UTF8At(reader.readU2());
+ uint32 attLen = reader.readU4();
+ if (attName->equals(Attribut::lineNumberTableAttribut)) {
+ uint16_t lineLength = reader.readU2();
+ uint16_t currentLine = 0;
+ for (uint16 j = 0; j < lineLength; ++j) {
+ uint16 pc = reader.readU2();
+ if (pc > codeInfo[i].bytecodeIndex + 1) return currentLine;
+ currentLine = reader.readU2();
+ }
+ return currentLine;
+ } else {
+ reader.seek(attLen, Reader::SeekCur);
+ }
+ }
}
}
- if (codeInfoLength) return codeInfo[codeInfoLength - 1].lineNumber;
return 0;
}
uint16 JavaMethod::lookupCtpIndex(uintptr_t ip) {
- for(uint16 i = 1; i < codeInfoLength; ++i) {
- if (codeInfo[i].address > ip) {
- return codeInfo[i - 1].ctpIndex;
+ for(uint16 i = 0; i < codeInfoLength; ++i) {
+ if (codeInfo[i].address == ip) {
+ Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);
+ Reader reader(codeAtt, &(classDef->bytes));
+ reader.cursor = reader.cursor + 2 + 2 + 4 + codeInfo[i].bytecodeIndex + 1;
+ return reader.readU2();
}
}
- if (codeInfoLength) return codeInfo[codeInfoLength - 1].ctpIndex;
return 0;
}
Modified: vmkit/branches/precise/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JavaClass.h?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JavaClass.h Fri Sep 24 13:05:18 2010
@@ -912,10 +912,7 @@
class CodeLineInfo : public mvm::PermanentObject {
public:
uintptr_t address;
- uint16 lineNumber;
- uint16 ctpIndex;
uint16 bytecodeIndex;
- uint16 bytecode;
// TODO: Use these fields when inlining.
JavaMethod* executingMethod;
// The code where the inlined method starts.
Modified: vmkit/branches/precise/lib/J3/VMCore/JavaConstantPool.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JavaConstantPool.h?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JavaConstantPool.h (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JavaConstantPool.h Fri Sep 24 13:05:18 2010
@@ -52,7 +52,7 @@
/// ctpRes - Objects resolved dynamically, e.g. UTF8s, classes, methods,
/// fields, string pointers.
///
- void** ctpRes;
+ void** ctpRes;
/// operator new - Redefine the operator to allocate the arrays of a
/// constant pool inline.
Modified: vmkit/branches/precise/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JavaRuntimeJIT.cpp Fri Sep 24 13:05:18 2010
@@ -614,9 +614,7 @@
void* ip = *Walker;
// Lookup the method info in the constant pool of the caller.
- CodeLineInfo* CLInfo =
- meth->lookupCodeLineInfo(reinterpret_cast<uintptr_t>(ip));
- uint16 ctpIndex = CLInfo->ctpIndex;
+ uint16 ctpIndex = meth->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
assert(ctpIndex && "No constant pool index");
JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
CommonClass* ctpCl = 0;
Modified: vmkit/branches/precise/lib/J3/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/JnjvmClassLoader.cpp Fri Sep 24 13:05:18 2010
@@ -383,7 +383,7 @@
strName = JavaString::internalToJava(name, isolate);
}
obj = loadClassMethod->invokeJavaObjectVirtual(isolate, forCtp, javaLoader,
- &strName, doResolve);
+ &strName);
cl = JavaObjectClass::getClass(((JavaObjectClass*)obj));
}
Modified: vmkit/branches/precise/lib/J3/VMCore/LinkJavaRuntime.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/LinkJavaRuntime.h?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/LinkJavaRuntime.h (original)
+++ vmkit/branches/precise/lib/J3/VMCore/LinkJavaRuntime.h Fri Sep 24 13:05:18 2010
@@ -45,7 +45,6 @@
extern "C" void j3JavaObjectAquire(JavaObject* obj);
extern "C" void j3JavaObjectRelease(JavaObject* obj);
extern "C" void j3ThrowException(JavaObject* obj);
-extern "C" void j3OverflowThinLock(JavaObject* obj);
extern "C" JavaObject* j3NullPointerException();
extern "C" JavaObject* j3NegativeArraySizeException(sint32 val);
extern "C" JavaObject* j3OutOfMemoryError(sint32 val);
@@ -105,7 +104,6 @@
(void) j3JavaObjectAquire(0);
(void) j3JavaObjectRelease(0);
(void) j3ThrowException(0);
- (void) j3OverflowThinLock(0);
(void) j3NullPointerException();
(void) j3NegativeArraySizeException(0);
(void) j3OutOfMemoryError(0);
Modified: vmkit/branches/precise/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/Mvm/CommonThread/ctthread.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/branches/precise/lib/Mvm/CommonThread/ctthread.cpp Fri Sep 24 13:05:18 2010
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "debug.h"
+
#include "MvmGC.h"
#include "mvm/VirtualMachine.h"
#include "mvm/Threads/Cond.h"
@@ -336,9 +338,13 @@
assert(sz < (size_t)getpagesize() && "Thread local data too big");
void* res = (void*)TheStackManager.allocate();
// Give it a second chance.
- if (!res) {
+ if (res == NULL) {
Collector::collect();
- res = (void*)TheStackManager.allocate();
+ // Wait for the finalizer to have cleaned up the threads.
+ while (res == NULL) {
+ mvm::Thread::yield();
+ res = (void*)TheStackManager.allocate();
+ }
}
return res;
}
Modified: vmkit/branches/precise/lib/Mvm/Compiler/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/Mvm/Compiler/EscapeAnalysis.cpp (original)
+++ vmkit/branches/precise/lib/Mvm/Compiler/EscapeAnalysis.cpp Fri Sep 24 13:05:18 2010
@@ -76,9 +76,12 @@
for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
Instruction *I = II;
II++;
- CallSite Call = CallSite::get(I);
- if (Call.getInstruction() && Call.getCalledValue() == Allocator) {
-
+ if (I->getOpcode() != Instruction::Call &&
+ I->getOpcode() != Instruction::Invoke) {
+ continue;
+ }
+ CallSite Call(I);
+ if (Call.getCalledValue() == Allocator) {
if (CurLoop) {
bool escapesLoop = false;
for (Value::use_iterator U = I->use_begin(), E = I->use_end();
@@ -118,7 +121,7 @@
if (II->getOpcode() == Instruction::Call ||
II->getOpcode() == Instruction::Invoke) {
- CallSite CS = CallSite::get(II);
+ CallSite CS(II);
if (!CS.onlyReadsMemory()) return true;
CallSite::arg_iterator B = CS.arg_begin(), E = CS.arg_end();
Modified: vmkit/branches/precise/lib/Mvm/Compiler/InlineMalloc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/Mvm/Compiler/InlineMalloc.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/Mvm/Compiler/InlineMalloc.cpp (original)
+++ vmkit/branches/precise/lib/Mvm/Compiler/InlineMalloc.cpp Fri Sep 24 13:05:18 2010
@@ -49,16 +49,17 @@
for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
Instruction *I = II;
II++;
- CallSite Call = CallSite::get(I);
- Instruction* CI = Call.getInstruction();
- if (CI) {
- Function* Temp = Call.getCalledFunction();
- if (Temp == Malloc) {
- if (dyn_cast<Constant>(Call.getArgument(0))) {
- InlineFunctionInfo IFI(NULL, mvm::MvmModule::TheTargetData);
- Changed |= InlineFunction(Call, IFI);
- break;
- }
+ if (I->getOpcode() != Instruction::Call &&
+ I->getOpcode() != Instruction::Invoke) {
+ continue;
+ }
+ CallSite Call(I);
+ Function* Temp = Call.getCalledFunction();
+ if (Temp == Malloc) {
+ if (dyn_cast<Constant>(Call.getArgument(0))) {
+ InlineFunctionInfo IFI(NULL, mvm::MvmModule::TheTargetData);
+ Changed |= InlineFunction(Call, IFI);
+ break;
}
}
}
Modified: vmkit/branches/precise/lib/Mvm/Compiler/LoopSafePoints.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/Mvm/Compiler/LoopSafePoints.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/lib/Mvm/Compiler/LoopSafePoints.cpp (original)
+++ vmkit/branches/precise/lib/Mvm/Compiler/LoopSafePoints.cpp Fri Sep 24 13:05:18 2010
@@ -82,8 +82,13 @@
for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
Instruction *I = II;
II++;
- CallSite Call = CallSite::get(I);
- if (Call.getInstruction() && Call.getCalledValue() == SafeFunction) {
+ if (I->getOpcode() != Instruction::Call &&
+ I->getOpcode() != Instruction::Invoke) {
+ continue;
+ }
+
+ CallSite Call(I);
+ if (Call.getCalledValue() == SafeFunction) {
if (BasicBlock* Incoming = Cur->getSinglePredecessor()) {
if (BranchInst* T = dyn_cast<BranchInst>(Incoming->getTerminator())) {
if (LoadInst* LI = dyn_cast<LoadInst>(T->getCondition())) {
Modified: vmkit/branches/precise/mmtk/magic/LowerMagic.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/mmtk/magic/LowerMagic.cpp?rev=114740&r1=114739&r2=114740&view=diff
==============================================================================
--- vmkit/branches/precise/mmtk/magic/LowerMagic.cpp (original)
+++ vmkit/branches/precise/mmtk/magic/LowerMagic.cpp Fri Sep 24 13:05:18 2010
@@ -422,9 +422,13 @@
for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
Instruction *I = II;
II++;
- CallSite Call = CallSite::get(I);
- Instruction* CI = Call.getInstruction();
- if (CI) {
+ if (I->getOpcode() != Instruction::Call &&
+ I->getOpcode() != Instruction::Invoke) {
+ continue;
+ }
+
+ CallSite Call(I);
+ Instruction* CI = I;
Value* V = Call.getCalledValue();
if (Function* FCur = dyn_cast<Function>(V)) {
const char* name = FCur->getName().data();
@@ -1250,7 +1254,6 @@
}
}
}
- }
}
}
return Changed;
More information about the vmkit-commits
mailing list