From gael.thomas at lip6.fr Wed Sep 10 15:08:52 2014 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 10 Sep 2014 22:08:52 -0000 Subject: [vmkit-commits] [vmkit] r217554 - Add the include directory of llvm obj dir in the include path + ignore some generated files for svn. Message-ID: <20140910220852.95C562A6C028@llvm.org> Author: gthomas Date: Wed Sep 10 17:08:52 2014 New Revision: 217554 URL: http://llvm.org/viewvc/llvm-project?rev=217554&view=rev Log: Add the include directory of llvm obj dir in the include path + ignore some generated files for svn. Modified: vmkit/trunk/Makefile.rules vmkit/trunk/lib/j3/ClassLib/OpenJDK/ (props changed) vmkit/trunk/lib/j3/LLVMRuntime/ (props changed) vmkit/trunk/lib/static-gc-pass/ (props changed) vmkit/trunk/lib/static-gc-printer/ (props changed) vmkit/trunk/tools/trainer/ (props changed) Modified: vmkit/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=217554&r1=217553&r2=217554&view=diff ============================================================================== --- vmkit/trunk/Makefile.rules (original) +++ vmkit/trunk/Makefile.rules Wed Sep 10 17:08:52 2014 @@ -36,7 +36,7 @@ LLC_FLAGS+=-disable-cfi -disable-fp-elim OPT_FLAGS+=-disable-cfi -disable-fp-elim INCLUDES+=-I$(PROJ_SRC_CWD) -I$(PROJ_SRC_ROOT)/include -I$(PROJ_SRC_ROOT)/lib/vmkit/MMTk -I$(BUILD_DIR) \ - -I$(shell $(LLVM_CONFIG) --includedir) -I$(shell $(LLVM_CONFIG) --src-root) + -I$(shell $(LLVM_CONFIG) --includedir) -I$(shell $(LLVM_CONFIG) --obj-root)/include -I$(shell $(LLVM_CONFIG) --src-root) WARN_CFLAGS= -Wall -Wno-long-long -Wno-variadic-macros -Wno-unused-private-field -Wno-unused-variable COMMON_CFLAGS+= $(INCLUDES) -ansi -pedantic $(WARN_CFLAGS) -fPIC \ Propchange: vmkit/trunk/lib/j3/ClassLib/OpenJDK/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Sep 10 17:08:52 2014 @@ -0,0 +1,2 @@ +Release+Asserts +classes Propchange: vmkit/trunk/lib/j3/LLVMRuntime/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Sep 10 17:08:52 2014 @@ -1,4 +1,5 @@ Debug+Asserts +Release+Asserts Release LLVMRuntime.inc LLVMRuntime.gen.ll Propchange: vmkit/trunk/lib/static-gc-pass/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Sep 10 17:08:52 2014 @@ -1 +1,2 @@ Debug+Asserts +Release+Asserts Propchange: vmkit/trunk/lib/static-gc-printer/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Sep 10 17:08:52 2014 @@ -1 +1,2 @@ Debug+Asserts +Release+Asserts Propchange: vmkit/trunk/tools/trainer/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Sep 10 17:08:52 2014 @@ -1,2 +1,3 @@ Debug+Asserts +Release+Asserts From gael.thomas at lip6.fr Fri Sep 19 13:12:15 2014 From: gael.thomas at lip6.fr (Gael Thomas) Date: Fri, 19 Sep 2014 20:12:15 -0000 Subject: [vmkit-commits] [vmkit] r218146 - Create a branch to test the aot Message-ID: <20140919201215.2E7E02A6C028@llvm.org> Author: gthomas Date: Fri Sep 19 15:12:14 2014 New Revision: 218146 URL: http://llvm.org/viewvc/llvm-project?rev=218146&view=rev Log: Create a branch to test the aot Added: vmkit/branches/aot/ (props changed) - copied from r218145, vmkit/trunk/ Propchange: vmkit/branches/aot/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Sep 19 15:12:14 2014 @@ -0,0 +1,17 @@ +do-find +Makefile.config +Makefile.llvmbuild +replace.sh +config.log +*.tmp +Release +do-conf +configure.out +config.status +Makefile.common +Release-Asserts +Release+Asserts +Debug+Asserts +Debug +.project + Propchange: vmkit/branches/aot/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Fri Sep 19 15:12:14 2014 @@ -0,0 +1,2 @@ +/vmkit/branches/precise:112509-120199 +/vmkit/branches/release_028:115466-116298 From gael.thomas at lip6.fr Fri Sep 19 14:32:33 2014 From: gael.thomas at lip6.fr (Gael Thomas) Date: Fri, 19 Sep 2014 21:32:33 -0000 Subject: [vmkit-commits] [vmkit] r218153 - Play a little with the AOT (does not work yet): Message-ID: <20140919213233.764492A6C028@llvm.org> Author: gthomas Date: Fri Sep 19 16:32:32 2014 New Revision: 218153 URL: http://llvm.org/viewvc/llvm-project?rev=218153&view=rev Log: Play a little with the AOT (does not work yet): + Add an AOT option to VmkitGCPrinter (-j3-aot), which avoids trying to find a meta data, even if the name starts with JnJVM. I think that handling specialized method (or even AOT compiled Java methods) is not used since several years, and I don't know if this part of the code is usefull. I let it for the moment, but we can know bypass it. + In case of -j3-aot, for each Java method with gc roots, generate a symbol to retrieve the metadata. It should be used to create a Java MethodInfo instead of a C MethodInfo when the bytecode is reloaded (not implemented). After having implemented this reloading, we can remove the comment behind if(J3AOT) at line 305 (indicates that we have a C frame table) + Remove the llcj tool (vmjc seems perfect to do aot) + Add an example of aot usage in examples/aot TODO: + Avoid multiple definition of static_buf and virtual_buf = solution: should probably create a .so from the Java compiled code = In this case, have to generate the frametable with the "normal" way (see Makefile.rules) + Mandatory: start a JVM in the example and load the precompiled code + Probably mandatory: manage correctly the reloading of Method Info? Added: vmkit/branches/aot/examples/ vmkit/branches/aot/examples/aot/ (with props) vmkit/branches/aot/examples/aot/HelloWorld.java vmkit/branches/aot/examples/aot/Makefile (with props) vmkit/branches/aot/examples/aot/hello.cpp Removed: vmkit/branches/aot/tools/llcj/ Modified: vmkit/branches/aot/Makefile.rules vmkit/branches/aot/lib/static-gc-printer/VmkitGCPrinter.cpp vmkit/branches/aot/tools/Makefile Modified: vmkit/branches/aot/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/Makefile.rules?rev=218153&r1=218152&r2=218153&view=diff ============================================================================== --- vmkit/branches/aot/Makefile.rules (original) +++ vmkit/branches/aot/Makefile.rules Fri Sep 19 16:32:32 2014 @@ -191,7 +191,7 @@ CLANG_FILES=$(patsubst %.c,$(BUILD_DIR)/ $(patsubst %.cc,$(BUILD_DIR)/%,$(call all-suffixes,.cc)) \ $(patsubst %.cpp,$(BUILD_DIR)/%,$(call all-suffixes,.cpp)) -BC_FILES=$(addsuffix .bc,$(CLANG_FILES)) $(addprefix $(BUILD_DIR)/,$(filter %.bc, $(GEN))) +BC_FILES+=$(addsuffix .bc,$(CLANG_FILES)) $(addprefix $(BUILD_DIR)/,$(filter %.bc, $(GEN))) ifdef NEED_BC # if we need bytecode, we link a module with all the bc in the build_dir directory, optimize this module @@ -262,7 +262,7 @@ DEP_LIBS=$(patsubst %,$(LIB_DIR)/lib%.a, $(BIN_DIR)/$(TOOL)$(EXEEXT): $(MODULE_A) $(DEP_LIBS) $(BUILD_DIR)/frametables.o $(SELF) $(BIN_DIR)/.dir $(Echo) "Linking executable '$(notdir $@)'" - $(Verb) $(CLANGXX) -o $@ $(LDFLAGS) $(MODULE_A) $(BUILD_DIR)/frametables.o $(DEP_LIBS) $(DEP_LIBS) $(LIBS) + $(Verb) $(CLANGXX) -o $@ $(LDFLAGS) $(BUILD_DIR)/frametables.o $(MODULE_A) $(DEP_LIBS) $(DEP_LIBS) $(LIBS) $(LIB_DIR)/$(LIBRARY)$(SHLIBEXT): $(MODULE_A) $(DEP_LIBS) $(SELF) $(LIB_DIR)/.dir $(Echo) "Linking shared library '$(notdir $@)'" Propchange: vmkit/branches/aot/examples/aot/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Sep 19 16:32:32 2014 @@ -0,0 +1 @@ +Release+Asserts Added: vmkit/branches/aot/examples/aot/HelloWorld.java URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/examples/aot/HelloWorld.java?rev=218153&view=auto ============================================================================== --- vmkit/branches/aot/examples/aot/HelloWorld.java (added) +++ vmkit/branches/aot/examples/aot/HelloWorld.java Fri Sep 19 16:32:32 2014 @@ -0,0 +1,7 @@ + + +class HelloWorld { + public static void main(String args[]) throws Exception { + System.out.println(" *** bip bip *****"); + } +} Added: vmkit/branches/aot/examples/aot/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/examples/aot/Makefile?rev=218153&view=auto ============================================================================== --- vmkit/branches/aot/examples/aot/Makefile (added) +++ vmkit/branches/aot/examples/aot/Makefile Fri Sep 19 16:32:32 2014 @@ -0,0 +1,28 @@ +##===- tools/j3/Makefile -----------------------------------*- Makefile -*-===## +# +# The VMKit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL=../.. + +BC_FILES=$(BUILD_DIR)/HelloWorld.class.bc +TOOL=aot-test +LINK_USE=Classpath J3 J3Compiler Vmkit VmkitCompiler CommonThread FinalMMTk Precompiled + +include $(LEVEL)/Makefile.common + +%.class.o: %.class.bc + $(LLC) -load $(STATIC_GC_PRINTER_LIB) -j3-aot -filetype=obj -o $@ $< + +%.class.bc: %.class + cd $(BUILD_DIR) && $(VMJC) $(notdir $<) + +$(BUILD_DIR)/%.class: %.java $(BUILD_DIR)/.dir + $(JAVAC) -d $(BUILD_DIR) $< + +check: + echo $(MODULE_A_DEP) + Propchange: vmkit/branches/aot/examples/aot/Makefile ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/branches/aot/examples/aot/hello.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/examples/aot/hello.cpp?rev=218153&view=auto ============================================================================== --- vmkit/branches/aot/examples/aot/hello.cpp (added) +++ vmkit/branches/aot/examples/aot/hello.cpp Fri Sep 19 16:32:32 2014 @@ -0,0 +1,5 @@ +#include + +int main(int argc, char** argv) { + fprintf(stderr, "TODO...\n"); +} Modified: vmkit/branches/aot/lib/static-gc-printer/VmkitGCPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/lib/static-gc-printer/VmkitGCPrinter.cpp?rev=218153&r1=218152&r2=218153&view=diff ============================================================================== --- vmkit/branches/aot/lib/static-gc-printer/VmkitGCPrinter.cpp (original) +++ vmkit/branches/aot/lib/static-gc-printer/VmkitGCPrinter.cpp Fri Sep 19 16:32:32 2014 @@ -32,11 +32,14 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" #include #include using namespace llvm; +cl::opt J3AOT("j3-aot", cl::desc("Consider that the bitcode was generated by the J3 AOT")); + namespace { class VmkitAOTGC : public GCStrategy { public: @@ -208,32 +211,33 @@ static bool methodNameMatches(StringRef Constant* FindMetadata(const Function& F) { LLVMContext& context = F.getParent()->getContext(); - for (Value::const_use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { - if (const Constant* C = dyn_cast(*I)) { - if (PointerType* PTy = dyn_cast(C->getType())) { - if (isa(PTy->getContainedType(0))) { - // We have found the bitcast constant that casts the method in a i8* - for (Value::const_use_iterator CI = C->use_begin(), CE = C->use_end(); CI != CE; ++CI) { - if (StructType* STy = dyn_cast((*CI)->getType())) { - if (STy->getName().equals("JavaMethod")) { - const Constant* Method = dyn_cast(*CI); - const Constant* Array = dyn_cast(*((*CI)->use_begin())); - Constant* VirtualMethods = dyn_cast(const_cast((*(Array->use_begin())))); - uint32_t index = 0; - for (; index < Array->getNumOperands(); index++) { - if (Array->getOperand(index) == Method) break; - } - assert(index != Array->getNumOperands()); - Constant* GEPs[2] = { ConstantInt::get(Type::getInt32Ty(context), 0), - ConstantInt::get(Type::getInt32Ty(context), index) }; - return ConstantExpr::getGetElementPtr(VirtualMethods, GEPs, 2); - } - } - } - } - } - } - } + + for (Value::const_use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { + if (const Constant* C = dyn_cast(*I)) { + if (PointerType* PTy = dyn_cast(C->getType())) { + if (isa(PTy->getContainedType(0))) { + // We have found the bitcast constant that casts the method in a i8* + for (Value::const_use_iterator CI = C->use_begin(), CE = C->use_end(); CI != CE; ++CI) { + if (StructType* STy = dyn_cast((*CI)->getType())) { + if (STy->getName().equals("JavaMethod")) { + const Constant* Method = dyn_cast(*CI); + const Constant* Array = dyn_cast(*((*CI)->use_begin())); + Constant* VirtualMethods = dyn_cast(const_cast((*(Array->use_begin())))); + uint32_t index = 0; + for (; index < Array->getNumOperands(); index++) { + if (Array->getOperand(index) == Method) break; + } + assert(index != Array->getNumOperands()); + Constant* GEPs[2] = { ConstantInt::get(Type::getInt32Ty(context), 0), + ConstantInt::get(Type::getInt32Ty(context), index) }; + return ConstantExpr::getGetElementPtr(VirtualMethods, GEPs, 2); + } + } + } + } + } + } + } StringRef name = F.getName(); if (name.startswith("JnJVM")) { @@ -265,8 +269,10 @@ Constant* FindMetadata(const Function& F return ConstantExpr::getGetElementPtr(VirtualMethods, GEPs, 2); } } - assert(0 && "Should have found a JavaMethod"); + + assert(0 && "Should have found a JavaMethod"); } + return NULL; } @@ -290,11 +296,15 @@ Constant* FindMetadata(const Function& F /// void VmkitAOTGCMetadataPrinter::finishAssembly(AsmPrinter &AP) { unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize(0); + uint32_t funcNumber = 0; AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection()); AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3); - EmitVmkitGlobal(getModule(), AP, "frametable"); + + //if(!J3AOT) + EmitVmkitGlobal(getModule(), AP, "frametable"); + int NumMethodFrames = 0; for (iterator I = begin(), IE = end(); I != IE; ++I) { NumMethodFrames++; @@ -305,7 +315,17 @@ void VmkitAOTGCMetadataPrinter::finishAs for (iterator I = begin(), IE = end(); I != IE; ++I) { GCFunctionInfo &FI = **I; - Constant* Metadata = FindMetadata(FI.getFunction()); + Constant* Metadata = J3AOT ? 0 : FindMetadata(FI.getFunction()); + + AP.OutStreamer.AddComment("live roots for " + + Twine(FI.getFunction().getName())); + AP.OutStreamer.AddBlankLine(); + + if(J3AOT) { + MCSymbol *FuncId = AP.OutContext.GetOrCreateSymbol("frames_of__" + FI.getFunction().getName()); + AP.OutStreamer.EmitSymbolAttribute(FuncId, MCSA_Global); + AP.OutStreamer.EmitLabel(FuncId); + } int NumDescriptors = 0; for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) { @@ -327,10 +347,6 @@ void VmkitAOTGCMetadataPrinter::finishAs "(" + Twine(uintptr_t(&FI)) + ")"); } - AP.OutStreamer.AddComment("live roots for " + - Twine(FI.getFunction().getName())); - AP.OutStreamer.AddBlankLine(); - for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) { size_t LiveCount = FI.live_size(J); if (LiveCount >= 1<<16) { @@ -347,11 +363,11 @@ void VmkitAOTGCMetadataPrinter::finishAs if (Metadata != NULL) { AP.EmitGlobalConstant(Metadata); } else { - AP.EmitInt32(0); - if (IntPtrSize == 8) { - AP.EmitInt32(0); - } - } + AP.EmitInt32(0); + if (IntPtrSize == 8) { + AP.EmitInt32(0); + } + } // Return address const MCExpr* address = MCSymbolRefExpr::Create(J->Label, AP.OutStreamer.getContext()); Modified: vmkit/branches/aot/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/tools/Makefile?rev=218153&r1=218152&r2=218153&view=diff ============================================================================== --- vmkit/branches/aot/tools/Makefile (original) +++ vmkit/branches/aot/tools/Makefile Fri Sep 19 16:32:32 2014 @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = .. -DIRS=j3 vmjc llcj +DIRS=j3 vmjc include $(LEVEL)/Makefile.common From gael.thomas at lip6.fr Sat Sep 20 01:13:54 2014 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 20 Sep 2014 08:13:54 -0000 Subject: [vmkit-commits] [vmkit] r218180 - Remove llcj from configure Message-ID: <20140920081354.504882A6C028@llvm.org> Author: gthomas Date: Sat Sep 20 03:13:53 2014 New Revision: 218180 URL: http://llvm.org/viewvc/llvm-project?rev=218180&view=rev Log: Remove llcj from configure Added: vmkit/branches/aot/examples/aot/java/ vmkit/branches/aot/examples/aot/java/HelloWorld.java vmkit/branches/aot/examples/aot/java/Makefile (with props) Modified: vmkit/branches/aot/autoconf/configure.ac vmkit/branches/aot/configure Modified: vmkit/branches/aot/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/autoconf/configure.ac?rev=218180&r1=218179&r2=218180&view=diff ============================================================================== --- vmkit/branches/aot/autoconf/configure.ac (original) +++ vmkit/branches/aot/autoconf/configure.ac Sat Sep 20 03:13:53 2014 @@ -457,7 +457,6 @@ AC_CONFIG_SRCDIR(["Makefile.common.in"]) dnl Configure a common Makefile AC_CONFIG_FILES(Makefile.common) AC_CONFIG_FILES([lib/j3/ClassLib/Classpath.h]) -AC_CONFIG_FILES([tools/llcj/LinkPaths.h]) AC_CONFIG_FILES([mmtk/java/src/org/j3/config/Selected.java]) AC_CONFIG_FILES([mmtk/java/build.xml]) Modified: vmkit/branches/aot/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/configure?rev=218180&r1=218179&r2=218180&view=diff ============================================================================== --- vmkit/branches/aot/configure (original) +++ vmkit/branches/aot/configure Sat Sep 20 03:13:53 2014 @@ -5033,8 +5033,6 @@ ac_config_files="$ac_config_files Makefi ac_config_files="$ac_config_files lib/j3/ClassLib/Classpath.h" -ac_config_files="$ac_config_files tools/llcj/LinkPaths.h" - ac_config_files="$ac_config_files mmtk/java/src/org/j3/config/Selected.java" ac_config_files="$ac_config_files mmtk/java/build.xml" @@ -5737,7 +5735,6 @@ do "include/vmkit/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/vmkit/config.h" ;; "Makefile.common") CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; "lib/j3/ClassLib/Classpath.h") CONFIG_FILES="$CONFIG_FILES lib/j3/ClassLib/Classpath.h" ;; - "tools/llcj/LinkPaths.h") CONFIG_FILES="$CONFIG_FILES tools/llcj/LinkPaths.h" ;; "mmtk/java/src/org/j3/config/Selected.java") CONFIG_FILES="$CONFIG_FILES mmtk/java/src/org/j3/config/Selected.java" ;; "mmtk/java/build.xml") CONFIG_FILES="$CONFIG_FILES mmtk/java/build.xml" ;; Added: vmkit/branches/aot/examples/aot/java/HelloWorld.java URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/examples/aot/java/HelloWorld.java?rev=218180&view=auto ============================================================================== --- vmkit/branches/aot/examples/aot/java/HelloWorld.java (added) +++ vmkit/branches/aot/examples/aot/java/HelloWorld.java Sat Sep 20 03:13:53 2014 @@ -0,0 +1,7 @@ + + +class HelloWorld { + public static void main(String args[]) throws Exception { + System.out.println(" *** bip bip *****"); + } +} Added: vmkit/branches/aot/examples/aot/java/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/aot/examples/aot/java/Makefile?rev=218180&view=auto ============================================================================== --- vmkit/branches/aot/examples/aot/java/Makefile (added) +++ vmkit/branches/aot/examples/aot/java/Makefile Sat Sep 20 03:13:53 2014 @@ -0,0 +1,24 @@ +##===- tools/j3/Makefile -----------------------------------*- Makefile -*-===## +# +# The VMKit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL=../../.. + +BC_FILES=$(BUILD_DIR)/HelloWorld.class.bc +MODULE=HelloWorld + +include $(LEVEL)/Makefile.common + +%.class.o: %.class.bc + $(LLC) -load $(STATIC_GC_PRINTER_LIB) -j3-aot -filetype=obj -o $@ $< + +%.class.bc: %.class + cd $(BUILD_DIR) && $(VMJC) $(notdir $<) + +$(BUILD_DIR)/%.class: %.java $(BUILD_DIR)/.dir + $(JAVAC) -d $(BUILD_DIR) $< + Propchange: vmkit/branches/aot/examples/aot/java/Makefile ------------------------------------------------------------------------------ svn:executable = *