[vmkit-commits] [vmkit] r141491 - in /vmkit/trunk: lib/J3/Compiler/JavaJIT.cpp lib/J3/Compiler/JavaJIT.h lib/J3/Compiler/JavaJITOpcodes.cpp lib/J3/Compiler/LowerConstantCalls.cpp mmtk/inline/InlineMethods.cpp mmtk/magic/LowerJavaRT.cpp tools/precompiler/Makefile tools/precompiler/Precompiler.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat Oct 8 05:17:15 PDT 2011
Author: geoffray
Date: Sat Oct 8 07:17:14 2011
New Revision: 141491
URL: http://llvm.org/viewvc/llvm-project?rev=141491&view=rev
Log:
- Remove volatile for loads. GCs do not needs loads to be volatile.
- Enable inlining of malloc and barriers.
Modified:
vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
vmkit/trunk/lib/J3/Compiler/JavaJIT.h
vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
vmkit/trunk/mmtk/inline/InlineMethods.cpp
vmkit/trunk/mmtk/magic/LowerJavaRT.cpp
vmkit/trunk/tools/precompiler/Makefile
vmkit/trunk/tools/precompiler/Precompiler.cpp
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sat Oct 8 07:17:14 2011
@@ -220,7 +220,7 @@
Args.push_back(GV);
Value* targetObject = getTarget(signature);
Args.push_back(new LoadInst(
- targetObject, "", TheCompiler->useCooperativeGC(), currentBlock));
+ targetObject, "", false, currentBlock));
load = invoke(intrinsics->VirtualLookupFunction, Args, "", currentBlock);
node->addIncoming(load, currentBlock);
BranchInst::Create(endResolveVirtual, currentBlock);
@@ -574,7 +574,7 @@
currentBlock = loadBlock;
result = new LoadInst(
- result, "", TheCompiler->useCooperativeGC(), currentBlock);
+ result, "", false, currentBlock);
new StoreInst(result, ResultObject, "", currentBlock);
endNode->addIncoming(result, currentBlock);
@@ -703,7 +703,7 @@
if (isVirtual(compilingMethod->access)) {
assert(thisObject != NULL && "beginSynchronize without this");
obj = new LoadInst(
- thisObject, "", TheCompiler->useCooperativeGC(), currentBlock);
+ thisObject, "", false, currentBlock);
} else {
obj = TheCompiler->getJavaClassPtr(compilingClass);
obj = new LoadInst(obj, "", false, currentBlock);
@@ -716,7 +716,7 @@
if (isVirtual(compilingMethod->access)) {
assert(thisObject != NULL && "endSynchronize without this");
obj = new LoadInst(
- thisObject, "", TheCompiler->useCooperativeGC(), currentBlock);
+ thisObject, "", false, currentBlock);
} else {
obj = TheCompiler->getJavaClassPtr(compilingClass);
obj = new LoadInst(obj, "", false, currentBlock);
@@ -1167,7 +1167,7 @@
if (returnType != Type::getVoidTy(*llvmContext)) {
if (returnValue != NULL) {
Value* obj = new LoadInst(
- returnValue, "", TheCompiler->useCooperativeGC(), currentBlock);
+ returnValue, "", false, currentBlock);
ReturnInst::Create(*llvmContext, obj, currentBlock);
} else {
ReturnInst::Create(*llvmContext, endNode, currentBlock);
@@ -1833,7 +1833,7 @@
object = TheCompiler->getStaticInstance(field->classDef);
} else {
object = new LoadInst(
- object, "", TheCompiler->useCooperativeGC(), currentBlock);
+ object, "", false, currentBlock);
if (!thisReference) JITVerifyNull(object);
type = LCI->getVirtualType();
}
@@ -1862,7 +1862,7 @@
Value* ptr = getConstantPoolAt(index, func, returnType, 0, true);
if (!stat) {
object = new LoadInst(
- object, "", TheCompiler->useCooperativeGC(), currentBlock);
+ object, "", false, currentBlock);
if (!thisReference) JITVerifyNull(object);
Value* tmp = new BitCastInst(object, Pty, "", currentBlock);
Value* args[2] = { zero, ptr };
@@ -2025,7 +2025,7 @@
if (mvm::Collector::needsWriteBarrier() && type == intrinsics->JavaObjectType) {
ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock);
val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock);
- object = new LoadInst(object, "", true, currentBlock);
+ object = new LoadInst(object, "", false, currentBlock);
object = new BitCastInst(object, intrinsics->ptrType, "", currentBlock);
Value* args[3] = { object, ptr, val };
CallInst::Create(intrinsics->FieldWriteBarrierFunction, args, "", currentBlock);
@@ -2122,7 +2122,7 @@
tableIndex);
Value* targetObject = getTarget(signature);
targetObject = new LoadInst(
- targetObject, "", TheCompiler->useCooperativeGC(), currentBlock);
+ targetObject, "", false, currentBlock);
if (!thisReference) JITVerifyNull(targetObject);
// TODO: The following code needs more testing.
#if 0
@@ -2511,7 +2511,7 @@
// Make the load volatile to force the instruction after the call.
// Otherwise, LLVM will merge the load with a previous load because
// the function is readnone.
- obj = new LoadInst(javaExceptionPtr, "", TheCompiler->useCooperativeGC(), currentBlock);
+ obj = new LoadInst(javaExceptionPtr, "", false, currentBlock);
test = new BitCastInst(res, intrinsics->JavaObjectType, "", currentBlock);
test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
@@ -2558,7 +2558,7 @@
F == intrinsics->GetConstantPoolAtFunction ||
F == intrinsics->GetArrayClassFunction ||
F == intrinsics->GetClassDelegateeFunction) {
- obj = new LoadInst(javaExceptionPtr, "", TheCompiler->useCooperativeGC(), currentBlock);
+ obj = new LoadInst(javaExceptionPtr, "", false, currentBlock);
test = new BitCastInst(res, intrinsics->JavaObjectType, "", currentBlock);
test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
@@ -2606,7 +2606,7 @@
F == intrinsics->GetConstantPoolAtFunction ||
F == intrinsics->GetArrayClassFunction ||
F == intrinsics->GetClassDelegateeFunction) {
- obj = new LoadInst(javaExceptionPtr, "", TheCompiler->useCooperativeGC(), currentBlock);
+ obj = new LoadInst(javaExceptionPtr, "", false, currentBlock);
test = new BitCastInst(res, intrinsics->JavaObjectType, "", currentBlock);
test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
@@ -2651,7 +2651,7 @@
F == intrinsics->GetConstantPoolAtFunction ||
F == intrinsics->GetArrayClassFunction ||
F == intrinsics->GetClassDelegateeFunction) {
- obj = new LoadInst(javaExceptionPtr, "", TheCompiler->useCooperativeGC(), currentBlock);
+ obj = new LoadInst(javaExceptionPtr, "", false, currentBlock);
test = new BitCastInst(res, intrinsics->JavaObjectType, "", currentBlock);
test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test, obj, "");
Value* T = new ICmpInst(*currentBlock, ICmpInst::ICMP_NE, obj, zero, "");
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sat Oct 8 07:17:14 2011
@@ -344,7 +344,7 @@
currentBlock);
} else {
return new llvm::LoadInst(objectStack[currentStackIndex - 1], "",
- TheCompiler->useCooperativeGC(), currentBlock);
+ false, currentBlock);
}
}
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sat Oct 8 07:17:14 2011
@@ -290,7 +290,7 @@
case ALOAD :
push(new LoadInst(objectLocals[WREAD_U1(reader, false, i, wide)], "",
- TheCompiler->useCooperativeGC(), currentBlock), false);
+ false, currentBlock), false);
break;
case ILOAD_0 :
@@ -378,22 +378,22 @@
break;
case ALOAD_0 :
- push(new LoadInst(objectLocals[0], "", TheCompiler->useCooperativeGC(), currentBlock),
+ push(new LoadInst(objectLocals[0], "", false, currentBlock),
false);
break;
case ALOAD_1 :
- push(new LoadInst(objectLocals[1], "", TheCompiler->useCooperativeGC(), currentBlock),
+ push(new LoadInst(objectLocals[1], "", false, currentBlock),
false);
break;
case ALOAD_2 :
- push(new LoadInst(objectLocals[2], "", TheCompiler->useCooperativeGC(), currentBlock),
+ push(new LoadInst(objectLocals[2], "", false, currentBlock),
false);
break;
case ALOAD_3 :
- push(new LoadInst(objectLocals[3], "", TheCompiler->useCooperativeGC(), currentBlock),
+ push(new LoadInst(objectLocals[3], "", false, currentBlock),
false);
break;
@@ -680,10 +680,10 @@
// may go into runtime and we don't want values in registers at that
// point.
Value* val = new LoadInst(objectStack[currentStackIndex - 1], "",
- TheCompiler->useCooperativeGC(),
+ false,
currentBlock);
Value* obj = new LoadInst(objectStack[currentStackIndex - 3], "",
- TheCompiler->useCooperativeGC(),
+ false,
currentBlock);
JITVerifyNull(obj);
Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val,
@@ -1877,7 +1877,7 @@
uint8 local = reader.readU1();
i += 1;
Value* _val = new LoadInst(
- objectLocals[local], "", TheCompiler->useCooperativeGC(), currentBlock);
+ objectLocals[local], "", false, currentBlock);
Value* val = new PtrToIntInst(_val, Type::getInt32Ty(*llvmContext), "", currentBlock);
SwitchInst* inst = SwitchInst::Create(val, jsrs[0], jsrs.size(),
currentBlock);
Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sat Oct 8 07:17:14 2011
@@ -146,17 +146,6 @@
}
continue;
}
- // Make sure all Loads on objects are volatile to cooperate with the GC.
- if (LoadInst* LI = dyn_cast<LoadInst>(I)) {
- if (LI->getType() == intrinsics->JavaObjectType &&
- dyn_cast<AllocaInst>(LI->getPointerOperand()) != NULL) {
- if (TheCompiler->useCooperativeGC()) {
- assert(LI->isVolatile());
- } else {
- assert(!LI->isVolatile());
- }
- }
- }
if ((I->getOpcode() == Instruction::Call ||
I->getOpcode() == Instruction::Invoke)) {
Modified: vmkit/trunk/mmtk/inline/InlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/inline/InlineMethods.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/mmtk/inline/InlineMethods.cpp (original)
+++ vmkit/trunk/mmtk/inline/InlineMethods.cpp Sat Oct 8 07:17:14 2011
@@ -38,8 +38,8 @@
}
extern "C" void MMTk_InlineMethods(llvm::Module* module) {
- //mmtk::mmtk_malloc::makeLLVMFunction(module);
- //mmtk::mmtk_field_write::makeLLVMFunction(module);
- //mmtk::mmtk_array_write::makeLLVMFunction(module);
- //mmtk::mmtk_non_heap_write::makeLLVMFunction(module);
+ mmtk::mmtk_malloc::makeLLVMFunction(module);
+ mmtk::mmtk_field_write::makeLLVMFunction(module);
+ mmtk::mmtk_array_write::makeLLVMFunction(module);
+ mmtk::mmtk_non_heap_write::makeLLVMFunction(module);
}
Modified: vmkit/trunk/mmtk/magic/LowerJavaRT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/magic/LowerJavaRT.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/mmtk/magic/LowerJavaRT.cpp (original)
+++ vmkit/trunk/mmtk/magic/LowerJavaRT.cpp Sat Oct 8 07:17:14 2011
@@ -141,6 +141,10 @@
I->clearGC();
}
+ // Rename JavaObject type to avoid collisions when inlining
+ // malloc and barriers.
+ M.getTypeByName("JavaObject")->setName("MMTk.JavaObject");
+
return Changed;
}
Modified: vmkit/trunk/tools/precompiler/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/Makefile?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/Makefile (original)
+++ vmkit/trunk/tools/precompiler/Makefile Sat Oct 8 07:17:14 2011
@@ -12,7 +12,7 @@
DIRS = trainer
TOOLNAME = precompiler
-USEDLIBS = Classpath.a J3.a J3Compiler.a Mvm.a MvmCompiler.a CommonThread.a FinalMMTk.a InlineMMTk.a
+USEDLIBS = Classpath.a J3.a J3Compiler.a Mvm.a MvmCompiler.a CommonThread.a FinalMMTk.a
BUILD_FRAMETABLE = 1
LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo asmparser linker bitwriter
Modified: vmkit/trunk/tools/precompiler/Precompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/Precompiler.cpp?rev=141491&r1=141490&r2=141491&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/Precompiler.cpp (original)
+++ vmkit/trunk/tools/precompiler/Precompiler.cpp Sat Oct 8 07:17:14 2011
@@ -115,3 +115,8 @@
return 0;
}
+
+// Because we don't want inlined methods to show up in the result
+// precompiled code, provide this method in order to link.
+extern "C" void MMTk_InlineMethods(llvm::Module* module) {
+}
More information about the vmkit-commits
mailing list