[vmkit-commits] [vmkit] r180289 - Applyed patch from llvm repository.
Peter Senna Tschudin
peter.senna at gmail.com
Thu Apr 25 09:50:11 PDT 2013
Author: peter.senna
Date: Thu Apr 25 11:48:11 2013
New Revision: 180289
URL: http://llvm.org/viewvc/llvm-project?rev=180289&view=rev
Log:
Applyed patch from llvm repository.
(cherry picked from commit f8942a207a40cb9e47467d9e7ed0b46909686372)
Modified:
vmkit/trunk/autoconf/configure.ac
vmkit/trunk/configure
vmkit/trunk/include/j3/JavaLLVMCompiler.h
vmkit/trunk/include/vmkit/JIT.h
vmkit/trunk/lib/j3/ClassLib/Makefile
vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/j3/Compiler/JavaJIT.cpp
vmkit/trunk/lib/j3/Compiler/JavaJITCompiler.cpp
vmkit/trunk/lib/j3/Compiler/JavaLLVMCompiler.cpp
vmkit/trunk/lib/j3/Compiler/LLVMInfo.cpp
vmkit/trunk/lib/vmkit/Compiler/EscapeAnalysis.cpp
vmkit/trunk/lib/vmkit/Compiler/InlineMalloc.cpp
vmkit/trunk/lib/vmkit/Compiler/JIT.cpp
vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp
vmkit/trunk/tools/vmjc/vmjc.cpp
Modified: vmkit/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/autoconf/configure.ac (original)
+++ vmkit/trunk/autoconf/configure.ac Thu Apr 25 11:48:11 2013
@@ -31,12 +31,12 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
-AC_INIT([vmkit],[0.31svn],[nicolas.geoffray at gmail.com])
+AC_INIT([vmkit],[0.32svn],[nicolas.geoffray at gmail.com])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
-AC_SUBST(VMKIT_COPYRIGHT,["Copyright (c) 2003-2011 Universite Pierre et Marie Curie."])
-AC_COPYRIGHT([Copyright (c) 2003-2011 Universite Pierre et Marie Curie.])
+AC_SUBST(VMKIT_COPYRIGHT,["Copyright (c) 2003-2012 Universite Pierre et Marie Curie."])
+AC_COPYRIGHT([Copyright (c) 2003-2012 Universite Pierre et Marie Curie.])
dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
dnl use some autoconf macros only available in 2.59.
Modified: vmkit/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/configure (original)
+++ vmkit/trunk/configure Thu Apr 25 11:48:11 2013
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for vmkit 0.31svn.
+# Generated by GNU Autoconf 2.68 for vmkit 0.32svn.
#
# Report bugs to <nicolas.geoffray at gmail.com>.
#
@@ -13,7 +13,7 @@
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
#
-# Copyright (c) 2003-2011 Universite Pierre et Marie Curie.
+# Copyright (c) 2003-2012 Universite Pierre et Marie Curie.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
@@ -562,8 +562,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='vmkit'
PACKAGE_TARNAME='vmkit'
-PACKAGE_VERSION='0.31svn'
-PACKAGE_STRING='vmkit 0.31svn'
+PACKAGE_VERSION='0.32svn'
+PACKAGE_STRING='vmkit 0.32svn'
PACKAGE_BUGREPORT='nicolas.geoffray at gmail.com'
PACKAGE_URL=''
@@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures vmkit 0.31svn to adapt to many kinds of systems.
+\`configure' configures vmkit 0.32svn to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1335,7 +1335,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of vmkit 0.31svn:";;
+ short | recursive ) echo "Configuration of vmkit 0.32svn:";;
esac
cat <<\_ACEOF
@@ -1435,14 +1435,14 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-vmkit configure 0.31svn
+vmkit configure 0.32svn
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
-Copyright (c) 2003-2011 Universite Pierre et Marie Curie.
+Copyright (c) 2003-2012 Universite Pierre et Marie Curie.
_ACEOF
exit
fi
@@ -1898,7 +1898,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by vmkit $as_me 0.31svn, which was
+It was created by vmkit $as_me 0.32svn, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2247,7 +2247,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-VMKIT_COPYRIGHT="Copyright (c) 2003-2011 Universite Pierre et Marie Curie."
+VMKIT_COPYRIGHT="Copyright (c) 2003-2012 Universite Pierre et Marie Curie."
@@ -6323,7 +6323,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by vmkit $as_me 0.31svn, which was
+This file was extended by vmkit $as_me 0.32svn, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6389,7 +6389,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-vmkit config.status 0.31svn
+vmkit config.status 0.32svn
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Modified: vmkit/trunk/include/j3/JavaLLVMCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaLLVMCompiler.h?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaLLVMCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaLLVMCompiler.h Thu Apr 25 11:48:11 2013
@@ -51,8 +51,7 @@ protected:
llvm::Module* TheModule;
llvm::DIBuilder* DebugFactory;
J3Intrinsics JavaIntrinsics;
- const llvm::TargetData* TheTargetData;
- bool compilingMMTk;
+ const llvm::DataLayout* TheDataLayout;
private:
bool enabledException;
@@ -85,9 +84,8 @@ private:
llvm::DenseMap<llvm::FunctionType*, llvm::Function*> staticAPs;
public:
- JavaLLVMCompiler(const std::string &ModuleID, bool compilingMMTk=false);
-
- bool isCompilingMMTk() {return compilingMMTk;}
+ JavaLLVMCompiler(const std::string &ModuleID);
+
virtual bool isStaticCompiling() = 0;
virtual bool emitFunctionName() = 0;
virtual void* GenerateStub(llvm::Function* F) = 0;
@@ -125,7 +123,7 @@ public:
cooperativeGC = false;
}
- virtual JavaCompiler* Create(const std::string& ModuleID, bool compilingMMTk=false) = 0;
+ virtual JavaCompiler* Create(const std::string& ModuleID) = 0;
virtual ~JavaLLVMCompiler();
@@ -196,7 +194,7 @@ public:
virtual llvm::Constant* getNativeClass(CommonClass* cl) = 0;
virtual llvm::Constant* getJavaClass(CommonClass* cl) = 0;
virtual llvm::Constant* getJavaClassPtr(CommonClass* cl) = 0;
- virtual llvm::Constant* getStaticInstance(Class* cl, isolate_id_t isolateID = CURRENT_ISOLATE) = 0;
+ virtual llvm::Constant* getStaticInstance(Class* cl) = 0;
virtual llvm::Constant* getVirtualTable(JavaVirtualTable*) = 0;
virtual llvm::Constant* getMethodInClass(JavaMethod* meth) = 0;
Modified: vmkit/trunk/include/vmkit/JIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/vmkit/JIT.h?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/include/vmkit/JIT.h (original)
+++ vmkit/trunk/include/vmkit/JIT.h Thu Apr 25 11:48:11 2013
@@ -33,7 +33,7 @@ namespace llvm {
class JIT;
class Module;
class PointerType;
- class TargetData;
+ class DataLayout;
class TargetMachine;
class Type;
}
Modified: vmkit/trunk/lib/j3/ClassLib/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/ClassLib/Makefile?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/ClassLib/Makefile (original)
+++ vmkit/trunk/lib/j3/ClassLib/Makefile Thu Apr 25 11:48:11 2013
@@ -13,6 +13,8 @@ EXTRA_DIST = ArrayCopy.inc \
ClasspathConstructor.inc \
ClasspathField.inc \
ClasspathMethod.inc \
+ DefineClass.inc \
+ Reflect.inc \
SetProperties.inc \
Unsafe.inc
Modified: vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp Thu Apr 25 11:48:11 2013
@@ -15,7 +15,7 @@
#include "llvm/PassManager.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "vmkit/UTF8.h"
#include "vmkit/Thread.h"
@@ -1851,8 +1851,8 @@ JavaAOTCompiler::JavaAOTCompiler(const s
options.NoFramePointerElim = true;
TargetMachine* TM = TheTarget->createTargetMachine(
vmkit::VmkitModule::getHostTriple(), "", "", options);
- TheTargetData = TM->getTargetData();
- TheModule->setDataLayout(TheTargetData->getStringRepresentation());
+ TheDataLayout = TM->getDataLayout();
+ TheModule->setDataLayout(TheDataLayout->getStringRepresentation());
TheModule->setTargetTriple(TM->getTargetTriple());
JavaIntrinsics.init(TheModule);
initialiseAssessorInfo();
@@ -1939,7 +1939,7 @@ void JavaAOTCompiler::printStats() {
Module* Mod = getLLVMModule();
for (Module::const_global_iterator i = Mod->global_begin(),
e = Mod->global_end(); i != e; ++i) {
- size += TheTargetData->getTypeAllocSize(i->getType());
+ size += TheDataLayout->getTypeAllocSize(i->getType());
}
fprintf(stdout, "%lluB\n", (unsigned long long int)size);
}
Modified: vmkit/trunk/lib/j3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaJIT.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaJIT.cpp Thu Apr 25 11:48:11 2013
@@ -20,8 +20,6 @@
#include <llvm/Instructions.h>
#include <llvm/Module.h>
#include <llvm/Type.h>
-#include <llvm/Analysis/DebugInfo.h>
-#include "llvm/Analysis/DIBuilder.h"
#include <llvm/Support/CFG.h>
#include "vmkit/JIT.h"
@@ -61,7 +59,6 @@ void JavaJIT::updateStackInfo(Opinfo& in
}
bool JavaJIT::needsInitialisationCheck(Class* cl) {
-/*
if (cl->isReadyForCompilation() ||
(!cl->isInterface() && compilingClass->isSubclassOf(cl))) {
return false;
@@ -75,13 +72,6 @@ bool JavaJIT::needsInitialisationCheck(C
}
return true;
-*/
- bool needs_check = cl->needsInitialisationCheck();
-
- if (needs_check && TheCompiler->isCompilingMMTk() && cl->isReadyForCompilation(0))
- needs_check = false;
-
- return needs_check;
}
void JavaJIT::checkYieldPoint() {
@@ -106,7 +96,7 @@ bool JavaJIT::canBeInlined(JavaMethod* m
if (isSynchro(meth->access)) return false;
if (isNative(meth->access)) return false;
- JavaAttribute* codeAtt = meth->lookupAttribute(JavaAttribute::codeAttribute);
+ Attribut* codeAtt = meth->lookupAttribut(Attribut::codeAttribut);
if (codeAtt == NULL) return false;
Reader reader(codeAtt, meth->classDef->bytes);
@@ -119,7 +109,7 @@ bool JavaJIT::canBeInlined(JavaMethod* m
if (handlers != 0) return false;
reader.cursor = start;
- JavaJIT jit(TheCompiler, meth, llvmFunction, customizing ? customizeFor : NULL, compilingMMTk);
+ JavaJIT jit(TheCompiler, meth, llvmFunction, customizing ? customizeFor : NULL);
jit.inlineMethods = inlineMethods;
jit.inlineMethods[meth] = true;
if (!jit.analyzeForInlining(reader, codeLen)) return false;
@@ -218,18 +208,14 @@ void JavaJIT::invokeVirtual(uint16 index
PHINode* node = 0;
Value* indexes2[2];
indexes2[0] = intrinsics->constantZero;
-
- Value* targetObject = getTarget(signature);
- targetObject = new LoadInst(targetObject, "", false, currentBlock);
- if (!thisReference) JITVerifyNull(targetObject);
- if (!TheCompiler->isCompilingMMTk())
- CallInst::Create(intrinsics->InitialisationCheckForJavaObjectFunction, targetObject, "", currentBlock);
+ bool nullChecked = false;
if (meth) {
LLVMMethodInfo* LMI = TheCompiler->getMethodInfo(meth);
Constant* Offset = LMI->getOffset();
indexes2[1] = Offset;
} else {
+ nullChecked = true;
GlobalVariable* GV = new GlobalVariable(*llvmFunction->getParent(),
Type::getInt32Ty(*llvmContext),
false,
@@ -251,6 +237,9 @@ void JavaJIT::invokeVirtual(uint16 index
Args.push_back(TheCompiler->getNativeClass(compilingClass));
Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
Args.push_back(GV);
+ Value* targetObject = getTarget(signature);
+ targetObject = new LoadInst(targetObject, "", false, currentBlock);
+ if (!thisReference) JITVerifyNull(targetObject);
Args.push_back(targetObject);
load = invoke(intrinsics->VirtualLookupFunction, Args, "", currentBlock);
node->addIncoming(load, currentBlock);
@@ -261,7 +250,7 @@ void JavaJIT::invokeVirtual(uint16 index
}
makeArgs(it, index, args, signature->nbArguments + 1);
-
+ if (!nullChecked && !thisReference) JITVerifyNull(args[0]);
Value* VT = CallInst::Create(intrinsics->GetVTFunction, args[0], "",
currentBlock);
@@ -311,6 +300,14 @@ llvm::Value* JavaJIT::getJavaThreadPtr(l
return new BitCastInst(mutatorThreadPtr, intrinsics->JavaThreadType, "", currentBlock);
}
+llvm::Value* JavaJIT::getIsolateIDPtr(llvm::Value* mutatorThreadPtr) {
+ Value* GEP[3] = { intrinsics->constantZero,
+ intrinsics->OffsetThreadInMutatorThreadConstant,
+ intrinsics->OffsetIsolateIDInThreadConstant };
+
+ return GetElementPtrInst::Create(mutatorThreadPtr, GEP, "", currentBlock);
+}
+
llvm::Value* JavaJIT::getVMPtr(llvm::Value* mutatorThreadPtr) {
Value* GEP[3] = { intrinsics->constantZero,
intrinsics->OffsetThreadInMutatorThreadConstant,
@@ -372,80 +369,6 @@ static llvm::Function* GetNativeCallee(J
return callee;
}
-/*
-Value* JavaJIT::getCommonClass(Value* ClassOrObject)
-{
- Type *Ty = ClassOrObject->getType();
-
- if (Ty == intrinsics->JavaObjectType) {
- // This is equivalent to "JavaObject::getClass(targetObject)"
-
- ClassOrObject = new BitCastInst(ClassOrObject, intrinsics->ptrPtrType, "", currentBlock);
- ClassOrObject = new LoadInst(ClassOrObject, "", currentBlock);
- ClassOrObject = new BitCastInst(ClassOrObject, intrinsics->JavaVTType, "objectVT", currentBlock);
-
- Value* GEP[] = {intrinsics->constantZero, intrinsics->OffsetCommonClassInJavaVirtualTableConstant};
- ClassOrObject = GetElementPtrInst::Create(ClassOrObject, GEP, "", currentBlock);
- ClassOrObject = new LoadInst(ClassOrObject, "commonClass", currentBlock);
- } else if (Ty == intrinsics->JavaClassType) {
- Value* GEP[] = {intrinsics->constantZero, intrinsics->OffsetCommonClassInClassConstant};
- ClassOrObject = GetElementPtrInst::Create(ClassOrObject, GEP, "targetCommonClass", currentBlock);
- }
-
- assert((ClassOrObject->getType() == intrinsics->JavaCommonClassType) && "Invalid target class or object.");
- return ClassOrObject;
-}
-*/
-
-Value* JavaJIT::getClassDelegateePtr(CommonClass* cl)
-{
- Value* obj = TheCompiler->getNativeClass(cl);
- obj = new BitCastInst(obj, intrinsics->JavaCommonClassType, "", currentBlock);
- return CallInst::Create(intrinsics->GetClassDelegateePtrFunction, obj, "", currentBlock);
-}
-
-bool JavaJIT::shouldMethodChangeCurrentIsolate()
-{
- JnjvmClassLoader* loader = compilingClass->classLoader;
-
- // We are compiling the Java runtime:
- // This code must run in the isolate ID of its caller, so as to account consumed resources
- // to the caller.
- if (loader == loader->bootstrapLoader) return false;
-
- // We are compiling the <clinit> method:
- // This code must run in the isolate ID of its caller, so as to enable initializing
- // the class (not the object) in any desired isolate ID.
- if (compilingMethod->name->equals(loader->bootstrapLoader->clinitName)) return false;
-
- return true;
-}
-
-Value* JavaJIT::setCurrentIsolateForCompilingMethod(Value* currentIsolateID, bool alwaysSet)
-{
- Constant *isolateID;
- if (this->shouldMethodChangeCurrentIsolate())
- isolateID = ConstantInt::get(Type::getInt32Ty(TheCompiler->getLLVMContext()), compilingClass->classLoader->getIsolateID());
- else if (alwaysSet)
- isolateID = intrinsics->CurrentIsolateID;
- else
- return NULL;
-
- if (!currentIsolateID) currentIsolateID = intrinsics->constantPtr32Null;
-
- Value *Args[] = {isolateID, currentIsolateID};
- // Return the old isolate value, whether it was set or not
- return CallInst::Create(intrinsics->SetIsolateFunction, Args, "oldIsolateID", currentBlock);
-}
-
-void JavaJIT::restoreCurrentIsolateForCompilingMethod(Value* oldIsolateID, bool alwaysRestore)
-{
- if (!oldIsolateID || (!alwaysRestore && !this->shouldMethodChangeCurrentIsolate())) return;
-
- Value *Args[] = {oldIsolateID, intrinsics->constantPtr32Null};
- CallInst::Create(intrinsics->SetIsolateFunction, Args, "", currentBlock);
-}
-
llvm::Function* JavaJIT::nativeCompile(word_t natPtr) {
PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "native compile %s.%s\n",
@@ -548,7 +471,7 @@ llvm::Function* JavaJIT::nativeCompile(w
uint32 index = 0;
if (stat) {
- Value* cl = getClassDelegateePtr(compilingClass);
+ Value* cl = TheCompiler->getJavaClassPtr(compilingClass);
nativeArgs.push_back(cl);
index = 2;
} else {
@@ -649,8 +572,6 @@ llvm::Function* JavaJIT::nativeCompile(w
}
nativeArgs[0] = nativeFunc;
- Value *oldIsolateID = this->setCurrentIsolateForCompilingMethod(NULL, false);
-
// Synchronize before saying we're entering native
if (isSynchro(compilingMethod->access)) {
nbHandlers = 1;
@@ -696,8 +617,6 @@ llvm::Function* JavaJIT::nativeCompile(w
if (isSynchro(compilingMethod->access))
endSynchronize();
- this->restoreCurrentIsolateForCompilingMethod(oldIsolateID, false);
-
BasicBlock* ifNormal = createBasicBlock("");
BasicBlock* ifException = createBasicBlock("");
Value* javaExceptionPtr = getJavaExceptionPtr(getJavaThreadPtr(getMutatorThreadPtr()));
@@ -820,7 +739,7 @@ void JavaJIT::beginSynchronize() {
obj = new LoadInst(
thisObject, "", false, currentBlock);
} else {
- obj = getClassDelegateePtr(compilingClass);
+ obj = TheCompiler->getJavaClassPtr(compilingClass);
obj = new LoadInst(obj, "", false, currentBlock);
}
monitorEnter(obj);
@@ -833,7 +752,7 @@ void JavaJIT::endSynchronize() {
obj = new LoadInst(
thisObject, "", false, currentBlock);
} else {
- obj = getClassDelegateePtr(compilingClass);
+ obj = TheCompiler->getJavaClassPtr(compilingClass);
obj = new LoadInst(obj, "", false, currentBlock);
}
monitorExit(obj);
@@ -880,7 +799,7 @@ static void removeUnusedObjects(std::vec
Instruction* JavaJIT::inlineCompile(BasicBlock*& curBB,
BasicBlock* endExBlock,
std::vector<Value*>& args) {
- JavaAttribute* codeAtt = compilingMethod->lookupAttribute(JavaAttribute::codeAttribute);
+ Attribut* codeAtt = compilingMethod->lookupAttribut(Attribut::codeAttribut);
Reader reader(codeAtt, compilingClass->bytes);
uint16 maxStack = reader.readU2();
uint16 maxLocals = reader.readU2();
@@ -1054,7 +973,7 @@ llvm::Function* JavaJIT::javaCompile() {
DbgSubprogram = TheCompiler->getDebugFactory()->createFunction(
DIDescriptor(), "", "", DIFile(), 0, DIType(), false, false, 0);
- JavaAttribute* codeAtt = compilingMethod->lookupAttribute(JavaAttribute::codeAttribute);
+ Attribut* codeAtt = compilingMethod->lookupAttribut(Attribut::codeAttribut);
if (!codeAtt) {
fprintf(stderr, "I haven't verified your class file and it's malformed:"
@@ -1172,26 +1091,20 @@ llvm::Function* JavaJIT::javaCompile() {
// Now that arguments have been setup, we can proceed with runtime calls.
#if JNJVM_EXECUTE > 0
- if (!TheCompiler->isCompilingMMTk() && compilingClass->name->elements[0] == 'i') {
- Value* arg = TheCompiler->getMethodInClass(compilingMethod);
+ {
+ Value* arg = TheCompiler->getMethodInClass(compilingMethod);
- llvm::CallInst::Create(intrinsics->PrintMethodStartFunction, arg, "",
+ llvm::CallInst::Create(intrinsics->PrintMethodStartFunction, arg, "",
currentBlock);
}
#endif
- Value *currentIsolateID = NULL;
nbHandlers = readExceptionTable(reader, codeLen);
if (nbHandlers != 0) {
- jmpBuffer = new AllocaInst(ArrayType::get(Type::getInt8Ty(*llvmContext), sizeof(vmkit::ExceptionBuffer)), "ExceptionBufferBytes", currentBlock);
- jmpBuffer = new BitCastInst(jmpBuffer, intrinsics->ExceptionBufferType, "ExceptionBuffer", currentBlock);
-
- Value *GEP[] = {intrinsics->constantZero, intrinsics->OffsetHandlerIsolateIDInExceptionBufferConstant};
- currentIsolateID = GetElementPtrInst::Create(jmpBuffer, GEP, "handlerIsolateID", currentBlock);
+ jmpBuffer = new AllocaInst(ArrayType::get(Type::getInt8Ty(*llvmContext), sizeof(vmkit::ExceptionBuffer)), "", currentBlock);
+ jmpBuffer = new BitCastInst(jmpBuffer, intrinsics->ptrType, "", currentBlock);
}
- Value *oldIsolateID = this->setCurrentIsolateForCompilingMethod(currentIsolateID, nbHandlers != 0);
-
reader.cursor = start;
exploreOpcodes(reader, codeLen);
@@ -1269,13 +1182,11 @@ llvm::Function* JavaJIT::javaCompile() {
endSynchronize();
}
- this->restoreCurrentIsolateForCompilingMethod(oldIsolateID, false);
-
#if JNJVM_EXECUTE > 0
- if (!TheCompiler->isCompilingMMTk() && compilingClass->name->elements[0] == 'i') {
+ {
Value* arg = TheCompiler->getMethodInClass(compilingMethod);
CallInst::Create(intrinsics->PrintMethodEndFunction, arg, "", currentBlock);
- }
+ }
#endif
finishExceptions();
@@ -1334,8 +1245,8 @@ llvm::Function* JavaJIT::javaCompile() {
UTF8Buffer(compilingClass->name).cString(),
UTF8Buffer(compilingMethod->name).cString());
- JavaAttribute* annotationsAtt =
- compilingMethod->lookupAttribute(JavaAttribute::annotationsAttribute);
+ Attribut* annotationsAtt =
+ compilingMethod->lookupAttribut(Attribut::annotationsAttribut);
if (annotationsAtt) {
Reader reader(annotationsAtt, compilingClass->bytes);
@@ -1346,10 +1257,11 @@ llvm::Function* JavaJIT::javaCompile() {
const UTF8* name =
compilingClass->ctpInfo->UTF8At(AR.AnnotationNameIndex);
if (name->equals(TheCompiler->InlinePragma)) {
- llvmFunction->removeFnAttr(llvm::Attribute::NoInline);
- llvmFunction->addFnAttr(llvm::Attribute::AlwaysInline);
+ llvmFunction->removeFnAttr(
+ Attributes::get(*llvmContext, Attributes::NoInline));
+ llvmFunction->addFnAttr(Attributes::AlwaysInline);
} else if (name->equals(TheCompiler->NoInlinePragma)) {
- llvmFunction->addFnAttr(llvm::Attribute::NoInline);
+ llvmFunction->addFnAttr(Attributes::NoInline);
}
}
}
@@ -1384,7 +1296,7 @@ void JavaJIT::loadConstant(uint16 index)
Value* val = TheCompiler->getString(str);
push(val, false, upcalls->newString);
} else {
- JavaString** str = (JavaString**)ctpInfo->getCachedValue(index);
+ JavaString** str = (JavaString**)ctpInfo->ctpRes[index];
if ((str != NULL) && !TheCompiler->isStaticCompiling()) {
Value* val = TheCompiler->getStringPtr(str);
val = new LoadInst(val, "", currentBlock);
@@ -1659,7 +1571,7 @@ Instruction* JavaJIT::lowerDoubleOps(con
Instruction* JavaJIT::invokeInline(JavaMethod* meth,
std::vector<Value*>& args,
bool customized) {
- JavaJIT jit(TheCompiler, meth, llvmFunction, customized ? customizeFor : NULL, compilingMMTk);
+ JavaJIT jit(TheCompiler, meth, llvmFunction, customized ? customizeFor : NULL);
jit.unifiedUnreachable = unifiedUnreachable;
jit.inlineMethods = inlineMethods;
jit.inlineMethods[meth] = true;
@@ -1824,11 +1736,13 @@ Value* JavaJIT::getConstantPoolAt(uint32
// This makes unswitch loop very unhappy time-wise, but makes GVN happy
// number-wise. IMO, it's better to have this than Unswitch.
+ JavaConstantPool* ctp = compilingClass->ctpInfo;
+ Value* CTP = TheCompiler->getResolvedConstantPool(ctp);
Value* Cl = TheCompiler->getNativeClass(compilingClass);
std::vector<Value*> Args;
Args.push_back(resolver);
- Args.push_back(compilingMMTk ? intrinsics->constantZero : intrinsics->CurrentIsolateID);
+ Args.push_back(CTP);
Args.push_back(Cl);
Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
if (additionalArg) Args.push_back(additionalArg);
@@ -1972,8 +1886,6 @@ Value* JavaJIT::ldResolved(uint16 index,
}
object = TheCompiler->getStaticInstance(field->classDef);
- if (!object)
- object = CallInst::Create(intrinsics->GetStaticInstanceFunction, Cl, "", currentBlock);
} else {
object = new LoadInst(
object, "", false, currentBlock);
@@ -2406,11 +2318,7 @@ Instruction* JavaJIT::invoke(Value *F, s
if (jmpBuffer != NULL) {
BasicBlock* doCall = createBasicBlock("");
ifException = createBasicBlock("");
-
- Value* GEP[] = {intrinsics->constantZero, intrinsics->OffsetSetJmpBufferInExceptionBufferConstant, intrinsics->constantZero};
- Value *setjmpBuffer = GetElementPtrInst::Create(jmpBuffer, GEP, "setjmpBuffer", currentBlock);
- Instruction* check = CallInst::Create(intrinsics->SetjmpFunction, setjmpBuffer, "", currentBlock);
-
+ Instruction* check = CallInst::Create(intrinsics->SetjmpFunction, jmpBuffer, "", currentBlock);
check = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, check, intrinsics->constantZero, "");
BranchInst::Create(doCall, ifException, check, currentBlock);
currentBlock = doCall;
@@ -2427,14 +2335,6 @@ Instruction* JavaJIT::invoke(Value *F, s
BranchInst::Create(ifNormal, currentBlock);
currentBlock = ifException;
-
- // Restore the isolate ID of the current method.
- // The called method had an exception and might not have restored the isolate ID as necessary.
- Value* GEP[] = {intrinsics->constantZero, intrinsics->OffsetHandlerIsolateIDInExceptionBufferConstant};
- Value *handlerIsolateID = GetElementPtrInst::Create(jmpBuffer, GEP, "", currentBlock);
- handlerIsolateID = new LoadInst(handlerIsolateID, "handlerIsolateID", currentBlock);
- this->restoreCurrentIsolateForCompilingMethod(handlerIsolateID, true);
-
CallInst::Create(intrinsics->UnregisterSetjmpFunction, jmpBuffer, "", currentBlock);
BranchInst::Create(currentExceptionBlock, currentBlock);
currentBlock = ifNormal;
Modified: vmkit/trunk/lib/j3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaJITCompiler.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaJITCompiler.cpp Thu Apr 25 11:48:11 2013
@@ -22,7 +22,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include <../lib/ExecutionEngine/JIT/JIT.h>
#include <../lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h>
@@ -177,8 +177,8 @@ JavaJITCompiler::JavaJITCompiler(const s
executionEngine = engine.create();
executionEngine->RegisterJITEventListener(&listener);
- TheTargetData = executionEngine->getTargetData();
- TheModule->setDataLayout(TheTargetData->getStringRepresentation());
+ TheDataLayout = executionEngine->getDataLayout();
+ TheModule->setDataLayout(TheDataLayout->getStringRepresentation());
TheModule->setTargetTriple(vmkit::VmkitModule::getHostTriple());
JavaIntrinsics.init(TheModule);
initialiseAssessorInfo();
Modified: vmkit/trunk/lib/j3/Compiler/JavaLLVMCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaLLVMCompiler.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaLLVMCompiler.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaLLVMCompiler.cpp Thu Apr 25 11:48:11 2013
@@ -12,7 +12,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/DIBuilder.h"
#include "llvm/Analysis/LoopPass.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "vmkit/JIT.h"
@@ -108,13 +108,13 @@ llvm::FunctionPass* createLowerConstantC
void JavaLLVMCompiler::addJavaPasses() {
JavaNativeFunctionPasses = new FunctionPassManager(TheModule);
- JavaNativeFunctionPasses->add(new TargetData(TheModule));
+ JavaNativeFunctionPasses->add(new DataLayout(TheModule));
J3FunctionPasses = new FunctionPassManager(TheModule);
J3FunctionPasses->add(createLowerConstantCallsPass(this));
JavaFunctionPasses = new FunctionPassManager(TheModule);
- JavaFunctionPasses->add(new TargetData(TheModule));
+ JavaFunctionPasses->add(new DataLayout(TheModule));
vmkit::VmkitModule::addCommandLinePasses(JavaFunctionPasses);
}
Modified: vmkit/trunk/lib/j3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/LLVMInfo.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/LLVMInfo.cpp Thu Apr 25 11:48:11 2013
@@ -14,7 +14,7 @@
#include "llvm/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MutexGuard.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "vmkit/JIT.h"
@@ -38,7 +38,7 @@ using namespace llvm;
Type* LLVMClassInfo::getVirtualType() {
if (!virtualType) {
std::vector<llvm::Type*> fields;
- const TargetData* targetData = Compiler->TheTargetData;
+ const DataLayout* targetData = Compiler->TheDataLayout;
const StructLayout* sl = 0;
StructType* structType = 0;
LLVMContext& context = Compiler->getLLVMModule()->getContext();
@@ -109,7 +109,7 @@ Type* LLVMClassInfo::getStaticType() {
StructType* structType = StructType::get(context, fields, false);
staticType = PointerType::getUnqual(structType);
- const TargetData* targetData = Compiler->TheTargetData;
+ const DataLayout* targetData = Compiler->TheDataLayout;
const StructLayout* sl = targetData->getStructLayout(structType);
// TODO: put that elsewhere.
@@ -191,9 +191,9 @@ Function* LLVMMethodInfo::getMethod(Clas
result->setGC("vmkit");
if (Compiler->useCooperativeGC()) {
- result->addFnAttr(Attribute::NoInline);
+ result->addFnAttr(Attributes::NoInline);
}
- result->addFnAttr(Attribute::NoUnwind);
+ result->addFnAttr(Attributes::NoUnwind);
Compiler->functions.insert(std::make_pair(result, methodDef));
if (!Compiler->isStaticCompiling() && !customizing && methodDef->code) {
@@ -468,8 +468,8 @@ Function* LLVMSignatureInfo::createFunct
}
res->setGC("vmkit");
- res->addFnAttr(Attribute::NoInline);
- res->addFnAttr(Attribute::NoUnwind);
+ res->addFnAttr(Attributes::NoInline);
+ res->addFnAttr(Attributes::NoUnwind);
if (virt) {
Compiler->virtualBufs[FTy] = res;
@@ -558,8 +558,8 @@ Function* LLVMSignatureInfo::createFunct
}
res->setGC("vmkit");
- res->addFnAttr(Attribute::NoInline);
- res->addFnAttr(Attribute::NoUnwind);
+ res->addFnAttr(Attributes::NoInline);
+ res->addFnAttr(Attributes::NoUnwind);
if (virt) {
Compiler->virtualAPs[FTy] = res;
@@ -676,8 +676,8 @@ Function* LLVMSignatureInfo::createFunct
}
stub->setGC("vmkit");
- stub->addFnAttr(Attribute::NoInline);
- stub->addFnAttr(Attribute::NoUnwind);
+ stub->addFnAttr(Attributes::NoInline);
+ stub->addFnAttr(Attributes::NoUnwind);
if (virt) {
Compiler->virtualStubs[FTy] = stub;
Modified: vmkit/trunk/lib/vmkit/Compiler/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/vmkit/Compiler/EscapeAnalysis.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/vmkit/Compiler/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/vmkit/Compiler/EscapeAnalysis.cpp Thu Apr 25 11:48:11 2013
@@ -127,7 +127,7 @@ static bool escapes(Value* Ins, std::map
CallSite::arg_iterator B = CS.arg_begin(), E = CS.arg_end();
for (CallSite::arg_iterator A = B; A != E; ++A) {
if (A->get() == Ins &&
- !CS.paramHasAttr(A - B + 1, Attribute::NoCapture)) {
+ !CS.paramHasAttr(A - B + 1, Attributes::NoCapture)) {
return true;
}
}
Modified: vmkit/trunk/lib/vmkit/Compiler/InlineMalloc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/vmkit/Compiler/InlineMalloc.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/vmkit/Compiler/InlineMalloc.cpp (original)
+++ vmkit/trunk/lib/vmkit/Compiler/InlineMalloc.cpp Thu Apr 25 11:48:11 2013
@@ -16,7 +16,7 @@
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "vmkit/JIT.h"
@@ -45,7 +45,7 @@ bool InlineMalloc::runOnFunction(Functio
Function* ArrayWriteBarrier = F.getParent()->getFunction("arrayWriteBarrier");
Function* NonHeapWriteBarrier = F.getParent()->getFunction("nonHeapWriteBarrier");
bool Changed = false;
- const TargetData *TD = getAnalysisIfAvailable<TargetData>();
+ const DataLayout *TD = getAnalysisIfAvailable<DataLayout>();
for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; BI++) {
BasicBlock *Cur = BI;
for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
Modified: vmkit/trunk/lib/vmkit/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/vmkit/Compiler/JIT.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/vmkit/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/vmkit/Compiler/JIT.cpp Thu Apr 25 11:48:11 2013
@@ -9,6 +9,7 @@
#include <llvm/CallingConv.h>
#include <llvm/Constants.h>
+#include <llvm/DebugInfo.h>
#include <llvm/DerivedTypes.h>
#include <llvm/Instructions.h>
#include <llvm/LinkAllPasses.h>
@@ -32,7 +33,7 @@
#include <llvm/Support/PassNameParser.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/Support/TargetSelect.h>
-#include <llvm/Target/TargetData.h>
+#include <llvm/DataLayout.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetOptions.h>
#include <../lib/ExecutionEngine/JIT/JIT.h>
Modified: vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp (original)
+++ vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp Thu Apr 25 11:48:11 2013
@@ -23,7 +23,7 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
@@ -289,7 +289,7 @@ Constant* FindMetadata(const Function& F
/// either condition is detected in a function which uses the GC.
///
void VmkitAOTGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
- unsigned IntPtrSize = AP.TM.getTargetData()->getPointerSize();
+ unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize(0);
AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
Modified: vmkit/trunk/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/vmjc.cpp?rev=180289&r1=180288&r2=180289&view=diff
==============================================================================
--- vmkit/trunk/tools/vmjc/vmjc.cpp (original)
+++ vmkit/trunk/tools/vmjc/vmjc.cpp Thu Apr 25 11:48:11 2013
@@ -34,7 +34,7 @@
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
More information about the vmkit-commits
mailing list