[vmkit-commits] [vmkit] r195628 - initial import
Gael Thomas
gael.thomas at lip6.fr
Mon Nov 25 01:27:11 PST 2013
Author: gthomas
Date: Mon Nov 25 03:27:09 2013
New Revision: 195628
URL: http://llvm.org/viewvc/llvm-project?rev=195628&view=rev
Log:
initial import
Added:
vmkit/branches/mcjit/Makefile
vmkit/branches/mcjit/Makefile.config
vmkit/branches/mcjit/Makefile.config.in
vmkit/branches/mcjit/Makefile.rules
vmkit/branches/mcjit/autoconf/
vmkit/branches/mcjit/autoconf/configure.ac
vmkit/branches/mcjit/autoconf/install-sh (with props)
vmkit/branches/mcjit/configure (with props)
vmkit/branches/mcjit/include/
vmkit/branches/mcjit/include/j3/
vmkit/branches/mcjit/include/j3/j3.h
vmkit/branches/mcjit/include/j3/j3bc.def
vmkit/branches/mcjit/include/j3/j3class.h
vmkit/branches/mcjit/include/j3/j3classloader.h
vmkit/branches/mcjit/include/j3/j3codegen.h
vmkit/branches/mcjit/include/j3/j3codegenvar.h
vmkit/branches/mcjit/include/j3/j3config.h
vmkit/branches/mcjit/include/j3/j3config.h.in
vmkit/branches/mcjit/include/j3/j3constants.h
vmkit/branches/mcjit/include/j3/j3jni.h
vmkit/branches/mcjit/include/j3/j3lib.h
vmkit/branches/mcjit/include/j3/j3mangler.h
vmkit/branches/mcjit/include/j3/j3method.h
vmkit/branches/mcjit/include/j3/j3object.h
vmkit/branches/mcjit/include/j3/j3options.h
vmkit/branches/mcjit/include/j3/j3reader.h
vmkit/branches/mcjit/include/j3/j3thread.h
vmkit/branches/mcjit/include/j3/j3typesdef.h
vmkit/branches/mcjit/include/j3/j3zip.h
vmkit/branches/mcjit/include/jni_md.h
vmkit/branches/mcjit/include/safepoint.h
vmkit/branches/mcjit/include/vmkit/
vmkit/branches/mcjit/include/vmkit/allocator.h
vmkit/branches/mcjit/include/vmkit/gc.h
vmkit/branches/mcjit/include/vmkit/names.h
vmkit/branches/mcjit/include/vmkit/thread.h
vmkit/branches/mcjit/include/vmkit/util.h
vmkit/branches/mcjit/include/vmkit/vmkit.h
vmkit/branches/mcjit/lib/
vmkit/branches/mcjit/lib/Makefile
vmkit/branches/mcjit/lib/j3/
vmkit/branches/mcjit/lib/j3/Makefile
vmkit/branches/mcjit/lib/j3/openjdk/
vmkit/branches/mcjit/lib/j3/openjdk/Makefile
vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
vmkit/branches/mcjit/lib/j3/openjdk/jvm.h
vmkit/branches/mcjit/lib/j3/vm/
vmkit/branches/mcjit/lib/j3/vm/Makefile
vmkit/branches/mcjit/lib/j3/vm/j3.cc
vmkit/branches/mcjit/lib/j3/vm/j3class.cc
vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
vmkit/branches/mcjit/lib/j3/vm/j3codegenvar.cc
vmkit/branches/mcjit/lib/j3/vm/j3constants.cc
vmkit/branches/mcjit/lib/j3/vm/j3jni.cc
vmkit/branches/mcjit/lib/j3/vm/j3mangler.cc
vmkit/branches/mcjit/lib/j3/vm/j3method.cc
vmkit/branches/mcjit/lib/j3/vm/j3object.cc
vmkit/branches/mcjit/lib/j3/vm/j3options.cc
vmkit/branches/mcjit/lib/j3/vm/j3reader.cc
vmkit/branches/mcjit/lib/j3/vm/j3thread.cc
vmkit/branches/mcjit/lib/j3/vm/j3zip.cc
vmkit/branches/mcjit/lib/vmkit/
vmkit/branches/mcjit/lib/vmkit/Makefile
vmkit/branches/mcjit/lib/vmkit/allocator.cc
vmkit/branches/mcjit/lib/vmkit/gc.cc
vmkit/branches/mcjit/lib/vmkit/gcrootpass.cc
vmkit/branches/mcjit/lib/vmkit/names.cc
vmkit/branches/mcjit/lib/vmkit/thread.cc
vmkit/branches/mcjit/lib/vmkit/util.cc
vmkit/branches/mcjit/lib/vmkit/vmkit.cc
vmkit/branches/mcjit/tools/
vmkit/branches/mcjit/tools/Makefile
vmkit/branches/mcjit/tools/j3/
vmkit/branches/mcjit/tools/j3/Makefile
vmkit/branches/mcjit/tools/j3/main.cc
Added: vmkit/branches/mcjit/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/Makefile (added)
+++ vmkit/branches/mcjit/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := .
+
+DIRS := lib tools
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/Makefile.config
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.config?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/Makefile.config (added)
+++ vmkit/branches/mcjit/Makefile.config Mon Nov 25 03:27:09 2013
@@ -0,0 +1,33 @@
+
+SHOPT=-Wl,-all_load -Wl,-compatibility_version,1 -Wl,-current_version,1
+EXEEXT=
+SHLIBEXT=.dylib
+
+OPTIMIZED=0
+DEBUG=1
+ASSERT=1
+
+PROJ_SRC_ROOT := $(subst //,/,/Users/gthomas/research/vmkit4/vmkit)
+PROJ_OBJ_ROOT := $(subst //,/,/Users/gthomas/research/vmkit4/vmkit)
+
+CONFIG_FILES= Makefile.config include/j3/j3config.h
+CONFIG_HEADERS=
+
+BUILD_NAME=Debug+Asserts
+
+GAWK=/opt/local/bin/gawk
+
+CLANG=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/clang
+CLANGXX=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/clang++
+LLC=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/llc
+LLNM=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/llvm-nm
+LLOPT=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/opt
+LLLINK=/Users/gthomas/research/vmkit4/llvm/Release+Asserts/bin/llvm-link
+
+LLVM_CXXFLAGS=-I/Users/gthomas/research/vmkit4/llvm/include -I/Users/gthomas/research/vmkit4/llvm/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fvisibility-inlines-hidden -fno-common -Woverloaded-virtual -Wcast-qual -I/Users/gthomas/research/vmkit4/llvm/include
+LLVM_LIBS=-lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArc!
h64Disass
embler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lgtest_main -lgtest -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport
+LLVM_LDFLAGS=-L/Users/gthomas/research/vmkit4/llvm/Release+Asserts/lib -lz -lpthread -lcurses -lm
+
+OPENJDK_HOME=/Users/gthomas/research/vmkit4/jdk8/build/macosx-x86_64-normal-server-release/images/j2sdk-bundle/jdk1.8.0.jdk/Contents/Home/
+
+OS=darwin
Added: vmkit/branches/mcjit/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.config.in?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/Makefile.config.in (added)
+++ vmkit/branches/mcjit/Makefile.config.in Mon Nov 25 03:27:09 2013
@@ -0,0 +1,33 @@
+
+SHOPT=@SHOPT@
+EXEEXT=@EXEEXT@
+SHLIBEXT=@SHLIBEXT@
+
+OPTIMIZED=@OPTIMIZED@
+DEBUG=@DEBUG@
+ASSERT=@ASSERT@
+
+PROJ_SRC_ROOT := $(subst //,/, at abs_top_srcdir@)
+PROJ_OBJ_ROOT := $(subst //,/, at abs_top_builddir@)
+
+CONFIG_FILES=@ac_config_files@
+CONFIG_HEADERS=@ac_config_headers@
+
+BUILD_NAME=@BUILD_NAME@
+
+GAWK=@GAWK@
+
+CLANG=@CLANG@
+CLANGXX=@CLANGXX@
+LLC=@LLC@
+LLNM=@LLNM@
+LLOPT=@LLOPT@
+LLLINK=@LLLINK@
+
+LLVM_CXXFLAGS=@LLVM_CXXFLAGS@
+LLVM_LIBS=@LLVM_LIBS@
+LLVM_LDFLAGS=@LLVM_LDFLAGS@
+
+OPENJDK_HOME=@jdkhome@
+
+OS=@OS@
\ No newline at end of file
Added: vmkit/branches/mcjit/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.rules?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/Makefile.rules (added)
+++ vmkit/branches/mcjit/Makefile.rules Mon Nov 25 03:27:09 2013
@@ -0,0 +1,320 @@
+
+-include $(LEVEL)/Makefile.config
+
+###############################################################################
+# Configuration
+###############################################################################
+PROJ_OBJ_CWD:= $(call realpath, .)
+PROJ_SRC_CWD:= $(call realpath, $(patsubst $(PROJ_OBJ_ROOT)%,$(PROJ_SRC_ROOT)%,$(PROJ_OBJ_CWD)))
+
+BUILD_DIR=$(PROJ_OBJ_CWD)/$(BUILD_NAME)
+BIN_DIR=$(PROJ_OBJ_ROOT)/$(BUILD_NAME)/bin
+LIB_DIR=$(PROJ_OBJ_ROOT)/$(BUILD_NAME)/lib
+
+###############################################################################
+# Nice printing
+###############################################################################
+ifndef PROF
+PROF=.
+endif
+
+EchoMsg="[$(MAKECMDGOALS) $(PROF)]:"
+Echo=@echo $(EchoMsg)
+
+ifndef VERBOSE
+ SUB_OPT=--no-print-directory -s
+ Verb:=@
+endif
+
+###############################################################################
+# Compilation flags
+###############################################################################
+COMMON_FLAGS:=-Wall -Wno-return-type-c-linkage -Wno-varargs -Wno-unused-private-field -Werror -Wno-unused-variable \
+ -I$(PROJ_SRC_ROOT)/include -I$(OPENJDK_HOME)/include -I$(OPENJDK_HOME)/include/$(OS) $(COMMON_FLAGS) \
+ -fno-omit-frame-pointer
+
+ifeq ($(OPTIMIZED),1)
+ COMMON_FLAGS+=-O3
+ LLCFLAGS+=-O=3
+else
+ COMMON_FLAGS+=-O0
+ LLCFLAGS+=-O=0
+endif
+
+ifneq ($(DEBUG),0)
+ COMMON_FLAGS+=-g
+endif
+
+LLCFLAGS+=-disable-cfi -disable-fp-elim -relocation-model=pic
+OPTFLAGS+=-disable-cfi -disable-fp-elim -disable-opt
+
+#LDFLAGS=-fno-common -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-rpath,$(OPENJDK_HOME)/jre/lib/server
+#LDFLAGS=-Wl,-rpath,$(OPENJDK_HOME)/jre/lib/server
+#LDFLAGS=-Wl,-flat_namespace -rdynamic
+CXXFLAGS=$(COMMON_FLAGS) $(LLVM_CXXFLAGS) -std=gnu++98 -fPIC
+SHFLAGS=$(SHOPT) -fno-common -Wl,-flat_namespace -Wl,-undefined,suppress
+
+###############################################################################
+# Targets
+###############################################################################
+.PHONY: all tidy clean cleanall confclean
+.SECONDARY:
+.SUFFIXES:
+
+all::
+
+check::
+ $(Echo) "---- building with: "
+ $(Echo) " PROJ_SRC_ROOT: $(PROJ_SRC_ROOT)"
+ $(Echo) " PROJ_OBJ_ROOT: $(PROJ_OBJ_ROOT)"
+ $(Echo) " SHFLAGS: $(SHFLAGS)"
+ $(Echo) " EXEEXT: $(EXEEXT)"
+ $(Echo) " SHLIBEXT: $(SHLIBEXT)"
+ $(Echo) " OPTIMIZED: $(OPTIMIZED)"
+ $(Echo) " DEBUG: $(DEBUG)"
+ $(Echo) " ASSERT: $(ASSERT)"
+ $(Echo) " CONFIG_FILES: $(CONFIG_FILES)"
+ $(Echo) " CONFIG_HEADERS: $(CONFIG_HEADERS)"
+ $(Echo) " BUILD_NAME: $(BUILD_NAME)"
+ $(Echo) " CLANG: $(CLANG)"
+ $(Echo) " CLANGXX: $(CLANGXX)"
+ $(Echo) " LLC: $(LLC)"
+ $(Echo) " LOPT: $(LOPT)"
+
+###############################################################################
+# Recursive target managment
+###############################################################################
+RECURSIVE_TARGETS=all clean cleanall
+
+define do_sub_target
+$1::
+ #$(Echo) "Entering directory $$(PROF)/$2"
+ $(Verb) $(MAKE) $(SUB_OPT) -C $2 $1 PROF=$(PROF)/$2; \
+ if [ $$$$? != 0 ]; then echo "$$(EchoMsg) abort with errors in $$(PROF)/$2"; exit 1; fi
+endef
+
+$(foreach target,$(RECURSIVE_TARGETS),$(foreach dir,$(DIRS),$(eval $(call do_sub_target,$(target),$(dir)))))
+
+tidy:
+ $(Echo) "Cleaning temporary files"
+ $(Verb) find $(PROJ_OBJ_ROOT) \( -iname "*~" -o -iname "\#*" \) -exec rm -f {} \;
+
+clean::
+ $(Echo) "Cleaning compilation files"
+ $(Verb) rm -Rf $(BUILD_DIR)
+
+cleanall::
+ $(Echo) "Cleaning all compilation files"
+
+confclean: clean
+ $(Echo) "Cleaning configuration"
+ $(Verb) rm -Rf $(patsubst $(PROJ_OBJ_ROOT)/%,%,$(CONFIG_FILES))
+ $(Verb) rm -Rf $(patsubst $(PROJ_OBJ_ROOT)/%,%,$(CONFIG_HEADERS))
+ $(Verb) rm -Rf $(PROJ_OBJ_ROOT)/config.status $(PROJ_OBJ_ROOT)/config.log
+ $(Verb) rm -Rf $(PROJ_OBJ_ROOT)/autoconf/autom4te.cache $(PROJ_OBJ_ROOT)/autoconf/configure.bak
+
+###############################################################################
+# Build system managment
+###############################################################################
+SELF=$(PROJ_SRC_ROOT)/Makefile.rules $(PROJ_OBJ_ROOT)/Makefile.config $(PROJ_SRC_CWD)/Makefile
+
+$(PROJ_SRC_ROOT)/configure: $(PROJ_SRC_ROOT)/autoconf/configure.ac
+ $(Echo) "Rebootstraping project"
+ $(Verb) cd $(PROJ_SRC_ROOT)/autoconf && autoconf -o $@ $< && touch $@
+ $(Verb) cd $(PROJ_OBJ_ROOT) && ./config.status --recheck
+
+define define_config_rule
+$$(LEVEL)/$1 $$(PROJ_OBJ_ROOT)/$1: $$(PROJ_SRC_ROOT)/$1.in $$(PROJ_SRC_ROOT)/configure
+ $(Echo) "Regenerating project files $$1"
+ $(Verb) cd $(PROJ_OBJ_ROOT) && ./config.status -q --$2=$1 && touch $$@
+endef
+
+$(foreach cur,$(CONFIG_FILES),$(eval $(call define_config_rule,$(cur),file)))
+$(foreach cur,$(CONFIG_HEADERS),$(eval $(call define_config_rule,$(cur),header)))
+
+
+###############################################################################
+# Find sources
+###############################################################################
+define find-sources
+ $(basename $(notdir $(wildcard $(PROJ_SRC_CWD)/*$1)))
+endef
+
+# $(wildcard $(BUILD_DIR)/*$1)))
+
+ifndef BASE_OBJ_FILES
+ BASE_OBJ_FILES=$(call find-sources,.cc)
+endif
+BC_FILES+=$(addsuffix .bc,$(addprefix $(BUILD_DIR)/,$(BASE_OBJ_FILES)))
+OBJ_FILES+=$(addsuffix .o,$(addprefix $(BUILD_DIR)/,$(BASE_OBJ_FILES)))
+DEP_FILES=$(addsuffix .d,$(addprefix $(BUILD_DIR)/,$(BASE_OBJ_FILES)))
+
+check::
+ $(Echo) " BC_FILES: $(BC_FILES)"
+ $(Echo) " DEP_FILES: $(DEP_FILES)"
+
+###############################################################################
+# Module
+###############################################################################
+ifdef MODULE
+
+GEN_MODULE=$(LIB_DIR)/$(MODULE)
+
+all:: $(LIB_DIR)/.dir $(GEN_MODULE).a $(GEN_MODULE).bc
+
+# not used for the moment
+ifdef __EXTRACT__
+
+EXTRACT_NAME=$(BUILD_DIR)/$(MODULE)-llvm-functions
+TABLE_NAME=$(BUILD_DIR)/$(MODULE).table
+STRIP_NAME=$(BUILD_DIR)/$(MODULE).strip
+
+OBJ_FILES+=$(EXTRACT_NAME).o
+
+$(EXTRACT_NAME).cc: $(STRIP_NAME).bc $(TABLE_NAME) $(SELF)
+ $(Echo) "Extracting llvm runtime functions into '$(notdir $@)'"
+ $(Verb) doit() { \
+ echo '#include "llvm/IR/Module.h"'; \
+ echo '#include "llvm/IR/Constants.h"'; \
+ echo '#include "llvm/IR/Instructions.h"'; \
+ echo '#include "j3/j3classloader.h"'; \
+ echo 'using namespace llvm;'; \
+ set -o pipefail; \
+ for f in $(EXTRACT); do \
+ mangled=`cat $(TABLE_NAME) | grep -F "$$f" | gawk -F'@' '{ print $$2 }' | tail -n 1`; \
+ $(LLC) $< -march=cpp -cppgen=function -cppfor="$$mangled" -o - \
+ | sed -e "s/makeLLVMFunction/makeLLVMFunction_$(MODULE)_$$mangled/" \
+ | sed -e "s/\\x22//"; \
+ if [ "$$?" != 0 ]; then \
+ echo "Unable to find: $$f" >&2; \
+ exit 1; \
+ fi; \
+ done; \
+ for f in $(EXTRACT_TYPE); do \
+ $(LLC) $< -march=cpp -cppgen=type -cppfor="$$f" -o - \
+ | sed -e "s/makeLLVMType/makeLLVMType_$(MODULE)_`echo $$f | sed -e 's/\./_/' | sed -e 's/::/_/'`/" \
+ | sed -e "s/\\x22//" \
+ ; \
+ done; \
+ echo "void j3::J3InitialClassLoader::makeLLVMFunctions_$(MODULE)() {"; \
+ for f in $(EXTRACT); do \
+ mangled=`cat $(TABLE_NAME) | grep -F "$$f" | gawk -F'@' '{ print $$2 }' | tail -n 1`; \
+ unmangled=`cat $(TABLE_NAME) | grep -F "$$f" | gawk -F'@' '{ print $$1 }' | tail -n 1`; \
+ echo " makeLLVMFunction_$(MODULE)_$$mangled(module());"; \
+ echo " registerCMangling(\"$$mangled\", \"$$unmangled\");"; \
+ done; \
+ for f in $(EXTRACT_TYPE); do \
+ echo " makeLLVMType_$(MODULE)_`echo $$f | sed -e 's/\./_/' | sed -e 's/::/_/'`(module());"; \
+ done; \
+ echo "}"; \
+ }; doit > $@
+
+$(STRIP_NAME).bc: $(GEN_MODULE).bc
+ $(Echo) "Strip debug info from '$(notdir $<)'"
+ $(Verb) $(LLOPT) -strip-debug $< -o $@
+
+$(TABLE_NAME): $(GEN_MODULE).bc
+ $(Echo) "Demangling '$(notdir $<)' in '$(notdir $@)'"
+ $(Verb) $(LLNM) --defined-only $< | tr -s ' ' | $(GAWK) -F' ' '{ print $$2 }' | \
+ tee $(TABLE_NAME).mangled | c++filt -n > $(TABLE_NAME).demangled
+ $(Verb) $(GAWK) '{ d=$$0; getline < "'"$(TABLE_NAME).mangled"'"; m=$$0; printf("%s@%s\n", d, m); }' \
+ < $(TABLE_NAME).demangled > $@
+
+endif
+
+endif
+
+###############################################################################
+# Tool
+###############################################################################
+ifdef TOOL
+TOOL_OUT=$(BIN_DIR)/$(TOOL)$(EXEEXT)
+
+GEN_MODULE=$(LIB_DIR)/libjvm
+SONAME=$(GEN_MODULE)
+
+BC_FILES+=$(addsuffix .bc,$(addprefix $(LIB_DIR)/,$(LIBS)))
+SO_FILES=$(addsuffix .a,$(addprefix $(LIB_DIR)/,$(LIBS)))
+SO_LIBS=$(LLVM_LIBS)
+
+all:: $(BIN_DIR)/.dir $(TOOL_OUT) $(GEN_MODULE).bc
+
+$(TOOL_OUT): $(OBJ_FILES) $(SONAME)$(SHLIBEXT)
+ $(Echo) "Linking '$(notdir $@)'"
+ $(Verb) $(CLANGXX) -o $@ -Wl,-rpath,$(LIB_DIR) $(LDFLAGS) $^
+
+endif
+
+###############################################################################
+# Library
+###############################################################################
+ifdef LIBRARY
+SONAME=$(LIB_DIR)/$(LIBRARY)
+all:: $(LIB_DIR)/.dir $(SONAME)$(SHLIBEXT)
+
+SO_FILES=$(OBJ_FILES)
+
+endif
+
+###############################################################################
+# GC Managment
+###############################################################################
+STATIC_GC_PASS_LIB=$(LIB_DIR)/static-gc-pass$(SHLIBEXT)
+STATIC_GC_PRINTER_LIB=$(LIB_DIR)/static-gc-printer$(SHLIBEXT)
+
+NO_GC=1
+ifdef NO_GC
+GC_OBJ_FILES=$(OBJ_FILES)
+else
+GC_OBJ_FILES=$(patsubst %.o,%-gc.o,$(OBJ_FILES))
+GC_LLCFLAGS:=-load=$(STATIC_GC_PRINTER_LIB)
+endif
+
+###############################################################################
+# Compilation
+###############################################################################
+DEPEND_OPTIONS=-MMD -MP -MF "$(BUILD_DIR)/$$*.d.tmp" -MT "$(BUILD_DIR)/$$*.bc" -MT "$(BUILD_DIR)/$$*.d"
+DOM=then mv -f "$(BUILD_DIR)/$$*.d.tmp" "$(BUILD_DIR)/$$*.d"; else rm -f "$(BUILD_DIR)/$$*.d.tmp"; exit 1; fi
+
+$(SONAME)$(SHLIBEXT): $(SO_FILES)
+ $(Echo) "Linking shared library '$(notdir $@)'"
+ $(Verb) $(CLANGXX) -shared $(LLVM_LDFLAGS) $(SHFLAGS) -o $@ $(SHFLAGS) $^ $(SO_LIBS)
+
+$(GEN_MODULE).bc: $(BC_FILES)
+ $(Echo) "Linking bc module '$(notdir $@)'"
+ $(Verb) $(LLLINK) $^ -o $@
+
+$(GEN_MODULE).a: $(GC_OBJ_FILES)
+ $(Echo) "Linking module '$(notdir $@)'"
+ $(Verb) libtool -static -o $@ $^
+
+%.o: %.bc
+ $(Echo) "Assembling '$(notdir $<)'"
+ $(Verb) $(LLC) $(LLCFLAGS) $(GC_LLCFLAGS) -filetype=obj $< -o $@
+
+%-gc.bc: %.bc
+ $(Echo) "Preparing GC '$(notdir $<)'"
+ $(Verb) $(LLOPT) -load=$(STATIC_GC_PASS_LIB) $(OPTFLAGS) -StaticGCPass $< -o $@
+
+define define_compile_rule
+$(BUILD_DIR)/%.bc: %$1 $(SELF) $(BUILD_DIR)/.dir
+ $(Echo) "Compiling '$$(notdir $$<)'"
+ $(Verb) if $2 $3 $(DEPEND_OPTIONS) -emit-llvm -c "$$<" -o $$@; $(DOM)
+
+$(BUILD_DIR)/%.bc: $(BUILD_DIR)/%$1 $(SELF) $(BUILD_DIR)/.dir
+ $(Echo) "Compiling '$$(notdir $$<)'"
+ $(Verb) if $2 $3 $(DEPEND_OPTIONS) -emit-llvm -c "$$<" -o $$@; $(DOM)
+endef
+
+$(eval $(call define_compile_rule,.cc,$(CLANGXX),$(CXXFLAGS)))
+
+%/.dir:
+ $(Verb) mkdir -p $(dir $@) && touch $@
+
+ifneq ($(MAKECMDGOALS),tidy)
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),cleanall)
+-include $(DEP_FILES)
+endif
+endif
+endif
Added: vmkit/branches/mcjit/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/autoconf/configure.ac?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/autoconf/configure.ac (added)
+++ vmkit/branches/mcjit/autoconf/configure.ac Mon Nov 25 03:27:09 2013
@@ -0,0 +1,280 @@
+dnl === configure.ac --------------------------------------------------------===
+dnl SECTION 1: Initialization & Setup
+dnl SECTION 2: Architecture, target, and host checks
+dnl SECTION 3: Command line arguments for the configure script.
+dnl SECTION 4: Check for programs we need and that they are the right version
+dnl SECTION 5: Check for libraries
+dnl SECTION 6: Check for header files
+dnl SECTION 7: Check for types and structures
+dnl SECTION 8: Check for specific functions needed
+dnl SECTION 9: Additional checks, variables, etc.
+dnl SECTION 10: Specify the output files and generate it
+dnl
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 1: Initialization & Setup
+dnl===
+dnl===-----------------------------------------------------------------------===
+dnl Initialize autoconf and define the package name, version number and
+dnl email address for reporting bugs.
+AC_INIT([vmkit],[0.1],[gael.thomas at lip6.fr])
+
+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_COPYRIGHT([Copyright (c) 2013 Purdue Univeristy/Université 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.
+AC_PREREQ(2.59)
+
+dnl Verify that the source directory is valid. This makes sure that we are
+dnl configuring reactor and not some other package (it validates --srcdir argument)
+AC_CONFIG_SRCDIR([include/j3/j3config.h.in])
+
+dnl Place all of the extra autoconf files into the config subdirectory. Tell
+dnl various tools where the m4 autoconf macros are.
+AC_CONFIG_AUX_DIR([autoconf])
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 2: Architecture, target, and host checks
+dnl===
+dnl===-----------------------------------------------------------------------===
+AC_CANONICAL_TARGET
+
+dnl Determine the platform type and cache its value. This helps us configure
+dnl the System library to the correct build platform.
+AC_CACHE_CHECK([type of operating system we're going to host on],
+ [vmkit_cv_os_type],
+[case $host in
+ *-*-aix*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-irix*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-cygwin*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-darwin*)
+ OS="darwin"
+ SHLIBEXT=".dylib"
+# SHOPT="-fno-common -Wl,-flat_namespace -Wl,-undefined,suppress"
+ SHOPT="-Wl,-all_load -Wl,-compatibility_version,1 -Wl,-current_version,1"
+ EXEEXT="" ;;
+ *-*-freebsd*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-openbsd*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-netbsd*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-hpux*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-interix*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-linux*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-solaris*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-win32*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *-*-mingw*)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+ *)
+ AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+esac])
+
+dnl Make sure we aren't attempting to configure for an unknown system
+AC_SUBST([OS])
+AC_SUBST([SHLIBEXT])
+AC_SUBST([SHOPT])
+AC_SUBST([EXEEXT])
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 3: Command line arguments for the configure script.
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl **************************************************************************
+dnl optimization and debug
+dnl **************************************************************************
+AC_ARG_ENABLE(optimized,
+ AS_HELP_STRING([--enable-optimized],
+ [Build with all optimization flag enable (default is yes)]),,
+ enable_optimized=yes)
+case "$enable_optimized" in
+ yes) AC_SUBST(OPTIMIZED,[1]) ;;
+ no) AC_SUBST(OPTIMIZED,[0]) ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-optimized. Use "yes" or "no"]) ;;
+esac
+
+AC_ARG_ENABLE(debug,
+ AS_HELP_STRING([--enable-debug],
+ [Build with debug flags (default is no)]),,
+ enable_debug=no)
+case "$enable_debug" in
+ yes) AC_SUBST(DEBUG,[1]) ;;
+ no) AC_SUBST(DEBUG,[0]) ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-debug. Use "yes" or "no"]) ;;
+esac
+
+AC_ARG_ENABLE(assert,
+ AS_HELP_STRING([--enable-assert],
+ [Build with assert flags (default is yes)]),,
+ enable_assert=yes)
+
+case "$enable_assert" in
+ yes) AC_SUBST(ASSERT,[1]) ;;
+ no) AC_SUBST(ASSERT,[0]) ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-assert. Use "yes" or "no"]) ;;
+esac
+
+if test "$enable_optimized" = "yes"; then
+ BUILD_NAME=Release
+ if test "$enable_debug" = "yes"; then
+ BUILD_NAME="$BUILD_NAME"+Debug
+ fi
+else
+ if test "$enable_debug" = "yes"; then
+ BUILD_NAME=Debug
+ else
+ BUILD_NAME=Unoptimized
+ fi
+fi
+
+if test "$enable_assert" = "yes"; then
+ BUILD_NAME="$BUILD_NAME"+Asserts
+fi
+
+AC_SUBST([BUILD_NAME], ["$BUILD_NAME"])
+
+dnl **************************************************************************
+dnl llvm
+dnl **************************************************************************
+AC_ARG_WITH(llvm-config-path,
+ [AS_HELP_STRING(--with-llvm-config-path=path,
+ [llvm-config path (use default path)])],
+ [[LLVM_CONFIG=$with_llvm_config_path]],
+ [[LLVM_CONFIG="llvm-config"]]
+)
+
+if test ! -x "$LLVM_CONFIG"; then
+ AC_MSG_ERROR([Cannot find $LLVM_CONFIG (or not executable)])
+fi
+
+LLVM_PATH="`$LLVM_CONFIG --bindir`"
+
+llvm_cfg=`$LLVM_CONFIG --cxxflags | sed -e 's/-O3//'`
+
+if ! test -z "`echo $llvm_cfg | grep -- -fno-exceptions`"; then
+ AC_MSG_ERROR([You have to compile LLVM with exception enabled, please compile it with 'make REQUIRES_EH=1'])
+fi
+
+AC_SUBST(LLVM_CXXFLAGS, [$llvm_cfg" "-I`$LLVM_CONFIG --src-root`/include])
+AC_SUBST(LLVM_LIBS, [`$LLVM_CONFIG --libs`])
+AC_SUBST(LLVM_LDFLAGS, [`$LLVM_CONFIG --ldflags`])
+
+dnl **************************************************************************
+dnl clang
+dnl **************************************************************************
+AC_ARG_WITH(clang-path,
+ [AS_HELP_STRING(--with-clang-path=path,
+ [clang path (use llvm-config --bindir and then default path)])],
+ [[CLANG_PATH=$with_clang_path]]
+)
+
+if test -z "$CLANG_PATH" -a ! -z "$LLVM_CONFIG"; then
+ CLANG_PATH="`$LLVM_CONFIG --bindir`"
+fi
+
+dnl **************************************************************************
+dnl OpenJDK
+dnl **************************************************************************
+
+AC_ARG_WITH(jdkhome,
+ [AS_HELP_STRING(--with-jdkhome,
+ [Build J3 with OpenJDK JRE install (default is $JAVA_HOME or /usr/lib/java)])],
+ [[jdkhome=$with_jdkhome]],
+ [[jdkhome=""]]
+)
+
+if test -z "$jdkhome"; then
+ if test -z "$JAVA_HOME"; then
+ jdkhome=/usr/lib/java
+ else
+ jdkhome=$JAVA_HOME
+ fi
+fi
+
+AC_SUBST([jdkhome])
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 4: Check for programs we need and that they are the right version
+dnl===
+dnl===-----------------------------------------------------------------------===
+dnl Check for compilation tools
+AC_PROG_CPP
+
+dnl Find the install program
+AC_PROG_INSTALL
+
+dnl AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
+
+AC_DEFUN([AX_PATH_PROG_FAIL_OR_SUBST], [
+ AC_PATH_PROG([$1], [$2], [no], [$3:$PATH])
+ if test x"${$1}" == x"no"; then
+ AC_MSG_ERROR([Unable to find $2, please install $2])
+ fi
+ AC_SUBST([$1])
+])
+
+AX_PATH_PROG_FAIL_OR_SUBST([LLC], llc, $LLVM_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([LLOPT], opt, $LLVM_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([LLLINK], llvm-link, $LLVM_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([LLNM], llvm-nm, $LLVM_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([CLANG], clang, $CLANG_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([CLANGXX], clang++, $CLANG_PATH)
+AX_PATH_PROG_FAIL_OR_SUBST([GAWK], gawk, "")
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 5: Check for libraries
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 6: Check for header files
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 7: Check for types and structures
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 8: Check for specific functions needed
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 9: Additional checks, variables, etc.
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl===-----------------------------------------------------------------------===
+dnl===
+dnl=== SECTION 10: Specify the output files and generate it
+dnl===
+dnl===-----------------------------------------------------------------------===
+
+dnl Configure header files
+AC_CONFIG_FILES([Makefile.config include/j3/j3config.h])
+
+AC_SUBST([ac_config_files])
+AC_SUBST([ac_config_headers])
+
+AC_OUTPUT
Added: vmkit/branches/mcjit/autoconf/install-sh
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/autoconf/install-sh?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/autoconf/install-sh (added)
+++ vmkit/branches/mcjit/autoconf/install-sh Mon Nov 25 03:27:09 2013
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Propchange: vmkit/branches/mcjit/autoconf/install-sh
------------------------------------------------------------------------------
svn:executable = *
Added: vmkit/branches/mcjit/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/configure?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/configure (added)
+++ vmkit/branches/mcjit/configure Mon Nov 25 03:27:09 2013
@@ -0,0 +1,4698 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for vmkit 0.1.
+#
+# Report bugs to <gael.thomas at lip6.fr>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 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) 2013 Purdue Univeristy/Université Pierre et Marie Curie.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: gael.thomas at lip6.fr about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='vmkit'
+PACKAGE_TARNAME='vmkit'
+PACKAGE_VERSION='0.1'
+PACKAGE_STRING='vmkit 0.1'
+PACKAGE_BUGREPORT='gael.thomas at lip6.fr'
+PACKAGE_URL=''
+
+ac_unique_file="include/j3/j3config.h.in"
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+ac_config_headers
+ac_config_files
+GAWK
+CLANGXX
+CLANG
+LLNM
+LLLINK
+LLOPT
+LLC
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+CPP
+OBJEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+jdkhome
+LLVM_LDFLAGS
+LLVM_LIBS
+LLVM_CXXFLAGS
+BUILD_NAME
+ASSERT
+DEBUG
+OPTIMIZED
+EXEEXT
+SHOPT
+SHLIBEXT
+OS
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_optimized
+enable_debug
+enable_assert
+with_llvm_config_path
+with_clang_path
+with_jdkhome
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+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.1 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/vmkit]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of vmkit 0.1:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-optimized Build with all optimization flag enable (default is
+ yes)
+ --enable-debug Build with debug flags (default is no)
+ --enable-assert Build with assert flags (default is yes)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-llvm-config-path=path
+ llvm-config path (use default path)
+ --with-clang-path=path clang path (use llvm-config --bindir and then
+ default path)
+ --with-jdkhome Build J3 with OpenJDK JRE install (default is
+ $JAVA_HOME or /usr/lib/java)
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <gael.thomas at lip6.fr>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+vmkit configure 0.1
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 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) 2013 Purdue Univeristy/Université Pierre et Marie Curie.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+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.1, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in autoconf "$srcdir"/autoconf; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in autoconf \"$srcdir\"/autoconf" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of operating system we're going to host on" >&5
+$as_echo_n "checking type of operating system we're going to host on... " >&6; }
+if ${vmkit_cv_os_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-aix*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-irix*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-cygwin*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-darwin*)
+ OS="darwin"
+ SHLIBEXT=".dylib"
+# SHOPT="-fno-common -Wl,-flat_namespace -Wl,-undefined,suppress"
+ SHOPT="-Wl,-all_load -Wl,-compatibility_version,1 -Wl,-current_version,1"
+ EXEEXT="" ;;
+ *-*-freebsd*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-openbsd*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-netbsd*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-hpux*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-interix*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-linux*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-solaris*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-win32*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *-*-mingw*)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+ *)
+ as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vmkit_cv_os_type" >&5
+$as_echo "$vmkit_cv_os_type" >&6; }
+
+
+
+
+
+
+
+# Check whether --enable-optimized was given.
+if test "${enable_optimized+set}" = set; then :
+ enableval=$enable_optimized;
+else
+ enable_optimized=yes
+fi
+
+case "$enable_optimized" in
+ yes) OPTIMIZED=1
+ ;;
+ no) OPTIMIZED=0
+ ;;
+ *) as_fn_error $? "Invalid setting for --enable-optimized. Use \"yes\" or \"no\"" "$LINENO" 5 ;;
+esac
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+ enableval=$enable_debug;
+else
+ enable_debug=no
+fi
+
+case "$enable_debug" in
+ yes) DEBUG=1
+ ;;
+ no) DEBUG=0
+ ;;
+ *) as_fn_error $? "Invalid setting for --enable-debug. Use \"yes\" or \"no\"" "$LINENO" 5 ;;
+esac
+
+# Check whether --enable-assert was given.
+if test "${enable_assert+set}" = set; then :
+ enableval=$enable_assert;
+else
+ enable_assert=yes
+fi
+
+
+case "$enable_assert" in
+ yes) ASSERT=1
+ ;;
+ no) ASSERT=0
+ ;;
+ *) as_fn_error $? "Invalid setting for --enable-assert. Use \"yes\" or \"no\"" "$LINENO" 5 ;;
+esac
+
+if test "$enable_optimized" = "yes"; then
+ BUILD_NAME=Release
+ if test "$enable_debug" = "yes"; then
+ BUILD_NAME="$BUILD_NAME"+Debug
+ fi
+else
+ if test "$enable_debug" = "yes"; then
+ BUILD_NAME=Debug
+ else
+ BUILD_NAME=Unoptimized
+ fi
+fi
+
+if test "$enable_assert" = "yes"; then
+ BUILD_NAME="$BUILD_NAME"+Asserts
+fi
+
+BUILD_NAME="$BUILD_NAME"
+
+
+
+# Check whether --with-llvm-config-path was given.
+if test "${with_llvm_config_path+set}" = set; then :
+ withval=$with_llvm_config_path; LLVM_CONFIG=$with_llvm_config_path
+else
+ LLVM_CONFIG="llvm-config"
+
+fi
+
+
+if test ! -x "$LLVM_CONFIG"; then
+ as_fn_error $? "Cannot find $LLVM_CONFIG (or not executable)" "$LINENO" 5
+fi
+
+LLVM_PATH="`$LLVM_CONFIG --bindir`"
+
+llvm_cfg=`$LLVM_CONFIG --cxxflags | sed -e 's/-O3//'`
+
+if ! test -z "`echo $llvm_cfg | grep -- -fno-exceptions`"; then
+ as_fn_error $? "You have to compile LLVM with exception enabled, please compile it with 'make REQUIRES_EH=1'" "$LINENO" 5
+fi
+
+LLVM_CXXFLAGS=$llvm_cfg" "-I`$LLVM_CONFIG --src-root`/include
+
+LLVM_LIBS=`$LLVM_CONFIG --libs`
+
+LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+
+
+
+# Check whether --with-clang-path was given.
+if test "${with_clang_path+set}" = set; then :
+ withval=$with_clang_path; CLANG_PATH=$with_clang_path
+
+fi
+
+
+if test -z "$CLANG_PATH" -a ! -z "$LLVM_CONFIG"; then
+ CLANG_PATH="`$LLVM_CONFIG --bindir`"
+fi
+
+
+
+# Check whether --with-jdkhome was given.
+if test "${with_jdkhome+set}" = set; then :
+ withval=$with_jdkhome; jdkhome=$with_jdkhome
+else
+ jdkhome=""
+
+fi
+
+
+if test -z "$jdkhome"; then
+ if test -z "$JAVA_HOME"; then
+ jdkhome=/usr/lib/java
+ else
+ jdkhome=$JAVA_HOME
+ fi
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+
+
+
+ # Extract the first word of "llc", so it can be a program name with args.
+set dummy llc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LLC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LLC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LLC="$LLC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$LLVM_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_LLC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_LLC" && ac_cv_path_LLC="no"
+ ;;
+esac
+fi
+LLC=$ac_cv_path_LLC
+if test -n "$LLC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLC" >&5
+$as_echo "$LLC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${LLC}" == x"no"; then
+ as_fn_error $? "Unable to find llc, please install llc" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "opt", so it can be a program name with args.
+set dummy opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LLOPT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LLOPT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LLOPT="$LLOPT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$LLVM_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_LLOPT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_LLOPT" && ac_cv_path_LLOPT="no"
+ ;;
+esac
+fi
+LLOPT=$ac_cv_path_LLOPT
+if test -n "$LLOPT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLOPT" >&5
+$as_echo "$LLOPT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${LLOPT}" == x"no"; then
+ as_fn_error $? "Unable to find opt, please install opt" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "llvm-link", so it can be a program name with args.
+set dummy llvm-link; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LLLINK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LLLINK in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LLLINK="$LLLINK" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$LLVM_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_LLLINK="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_LLLINK" && ac_cv_path_LLLINK="no"
+ ;;
+esac
+fi
+LLLINK=$ac_cv_path_LLLINK
+if test -n "$LLLINK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLLINK" >&5
+$as_echo "$LLLINK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${LLLINK}" == x"no"; then
+ as_fn_error $? "Unable to find llvm-link, please install llvm-link" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "llvm-nm", so it can be a program name with args.
+set dummy llvm-nm; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LLNM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LLNM in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LLNM="$LLNM" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$LLVM_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_LLNM="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_LLNM" && ac_cv_path_LLNM="no"
+ ;;
+esac
+fi
+LLNM=$ac_cv_path_LLNM
+if test -n "$LLNM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLNM" >&5
+$as_echo "$LLNM" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${LLNM}" == x"no"; then
+ as_fn_error $? "Unable to find llvm-nm, please install llvm-nm" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CLANG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CLANG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CLANG="$CLANG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$CLANG_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CLANG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CLANG" && ac_cv_path_CLANG="no"
+ ;;
+esac
+fi
+CLANG=$ac_cv_path_CLANG
+if test -n "$CLANG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG" >&5
+$as_echo "$CLANG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${CLANG}" == x"no"; then
+ as_fn_error $? "Unable to find clang, please install clang" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "clang++", so it can be a program name with args.
+set dummy clang++; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CLANGXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CLANGXX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CLANGXX="$CLANGXX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$CLANG_PATH:$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CLANGXX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CLANGXX" && ac_cv_path_CLANGXX="no"
+ ;;
+esac
+fi
+CLANGXX=$ac_cv_path_CLANGXX
+if test -n "$CLANGXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANGXX" >&5
+$as_echo "$CLANGXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${CLANGXX}" == x"no"; then
+ as_fn_error $? "Unable to find clang++, please install clang++" "$LINENO" 5
+ fi
+
+
+
+ # Extract the first word of "gawk", so it can be a program name with args.
+set dummy gawk; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GAWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GAWK in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GAWK="$GAWK" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy=""":$PATH"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_GAWK="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GAWK" && ac_cv_path_GAWK="no"
+ ;;
+esac
+fi
+GAWK=$ac_cv_path_GAWK
+if test -n "$GAWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GAWK" >&5
+$as_echo "$GAWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test x"${GAWK}" == x"no"; then
+ as_fn_error $? "Unable to find gawk, please install gawk" "$LINENO" 5
+ fi
+
+
+
+
+
+
+
+
+
+ac_config_files="$ac_config_files Makefile.config include/j3/j3config.h"
+
+
+
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# 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.1, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <gael.thomas at lip6.fr>."
+
+_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.1
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
+ "include/j3/j3config.h") CONFIG_FILES="$CONFIG_FILES include/j3/j3config.h" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
Propchange: vmkit/branches/mcjit/configure
------------------------------------------------------------------------------
svn:executable = *
Added: vmkit/branches/mcjit/include/j3/j3.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3.h (added)
+++ vmkit/branches/mcjit/include/j3/j3.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,110 @@
+#ifndef _J3_J3_
+#define _J3_J3_
+
+#include <pthread.h>
+#include <vector>
+
+#include "vmkit/names.h"
+#include "vmkit/vmkit.h"
+#include "vmkit/allocator.h"
+
+#include "j3/j3options.h"
+#include "j3/j3typesdef.h"
+#include "j3/j3jni.h"
+
+
+namespace j3 {
+ class J3InitialClassLoader;
+ class J3Class;
+ class J3ArrayClass;
+ class J3Type;
+ class J3Object;
+ class J3ObjectHandle;
+ class J3Primitive;
+ class J3Lib;
+ class J3Method;
+
+ class J3 : public vmkit::VMKit {
+ typedef std::map<J3ObjectHandle*, J3ObjectHandle*, vmkit::T_ptr_less_t<J3ObjectHandle*>,
+ vmkit::StdAllocator<std::pair<J3ObjectHandle*, J3ObjectHandle*> > > StringMap;
+
+ static vmkit::T_ptr_less_t<J3ObjectHandle*> charArrayLess;
+
+ J3Options _options;
+
+ pthread_mutex_t stringsMutex;
+ vmkit::NameMap<J3ObjectHandle*>::map nameToCharArrays;
+ StringMap charArrayToStrings;
+ vmkit::Names _names;
+
+ void introspect();
+
+ J3(vmkit::BumpAllocator* allocator);
+ public:
+ J3InitialClassLoader* initialClassLoader;
+
+ static J3* create();
+
+#define defPrimitive(name, ctype, llvmtype) \
+ J3Primitive* type##name;
+ onJavaTypes(defPrimitive)
+#undef defPrimitive
+
+ J3Type** arrayInterfaces;
+ uint32_t nbArrayInterfaces;
+ J3Class* objectClass;
+ J3ArrayClass* charArrayClass;
+
+ J3Class* stringClass;
+ J3Method* stringInit;
+ J3Field* stringValue;
+
+ J3Class* classClass;
+ J3Method* classInit;
+ J3Field* classVMData;
+
+ const vmkit::Name* codeAttr;
+ const vmkit::Name* constantValueAttr;
+ const vmkit::Name* initName;
+ const vmkit::Name* clinitName;
+ const vmkit::Name* clinitSign;
+
+ llvm::Type* typeJNIEnvPtr;
+ llvm::Type* typeJ3VirtualTablePtr;
+ llvm::Type* typeJ3Type;
+ llvm::Type* typeJ3TypePtr;
+ llvm::Type* typeJ3ObjectTypePtr;
+ llvm::Type* typeJ3Class;
+ llvm::Type* typeJ3ClassPtr;
+ llvm::Type* typeJ3ArrayClass;
+ llvm::Type* typeJ3ArrayClassPtr;
+ llvm::Type* typeJ3Method;
+ llvm::Type* typeJ3ArrayObject;
+ llvm::Type* typeJ3ArrayObjectPtr;
+ llvm::Type* typeJ3Object;
+ llvm::Type* typeJ3ObjectPtr;
+ llvm::Type* typeJ3ObjectHandlePtr;
+ llvm::Type* typeGXXException;
+
+ J3Options* options() { return &_options; }
+ vmkit::Names* names() { return &_names; }
+ J3ObjectHandle* utfToString(const char* name);
+ J3ObjectHandle* nameToString(const vmkit::Name* name);
+ J3ObjectHandle* arrayToString(J3ObjectHandle* array);
+
+ void start(int argc, char** argv);
+
+ static JNIEnv* jniEnv();
+
+ static void noClassDefFoundError(J3Class* cl) __attribute__((noreturn));
+ static void classFormatError(J3Class* cl, const wchar_t* reason, ...) __attribute__((noreturn));
+ static void noSuchMethodError(const wchar_t* msg,
+ J3Class* clName, const vmkit::Name* name, const vmkit::Name* sign) __attribute__((noreturn));
+ static void linkageError(J3Method* method) __attribute__((noreturn));
+
+ static void nullPointerException() __attribute__((noreturn));
+ static void classCastException() __attribute__((noreturn));
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3bc.def
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3bc.def?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3bc.def (added)
+++ vmkit/branches/mcjit/include/j3/j3bc.def Mon Nov 25 03:27:09 2013
@@ -0,0 +1,205 @@
+defOpcode(nop, 0x00, nyi())
+defOpcode(aconst_null, 0x01, eat(0))
+defOpcode(iconst_m1, 0x02, eat(0))
+defOpcode(iconst_0, 0x03, eat(0))
+defOpcode(iconst_1, 0x04, eat(0))
+defOpcode(iconst_2, 0x05, eat(0))
+defOpcode(iconst_3, 0x06, eat(0))
+defOpcode(iconst_4, 0x07, eat(0))
+defOpcode(iconst_5, 0x08, eat(0))
+defOpcode(lconst_0, 0x09, eat(0))
+defOpcode(lconst_1, 0x0a, eat(0))
+defOpcode(fconst_0, 0x0b, eat(0))
+defOpcode(fconst_1, 0x0c, eat(0))
+defOpcode(fconst_2, 0x0d, eat(0))
+defOpcode(dconst_0, 0x0e, eat(0))
+defOpcode(dconst_1, 0x0f, eat(0))
+defOpcode(bipush, 0x10, nyi())
+defOpcode(sipush, 0x11, nyi())
+defOpcode(ldc, 0x12, nyi())
+defOpcode(ldc_w, 0x13, nyi())
+defOpcode(ldc2_w, 0x14, nyi())
+defOpcode(iload, 0x15, nyi())
+defOpcode(lload, 0x16, nyi())
+defOpcode(fload, 0x17, nyi())
+defOpcode(dload, 0x18, nyi())
+defOpcode(aload, 0x19, nyi())
+defOpcode(iload_0, 0x1a, nyi())
+defOpcode(iload_1, 0x1b, nyi())
+defOpcode(iload_2, 0x1c, nyi())
+defOpcode(iload_3, 0x1d, nyi())
+defOpcode(lload_0, 0x1e, nyi())
+defOpcode(lload_1, 0x1f, nyi())
+defOpcode(lload_2, 0x20, nyi())
+defOpcode(lload_3, 0x21, nyi())
+defOpcode(fload_0, 0x22, nyi())
+defOpcode(fload_1, 0x23, nyi())
+defOpcode(fload_2, 0x24, nyi())
+defOpcode(fload_3, 0x25, nyi())
+defOpcode(dload_0, 0x26, nyi())
+defOpcode(dload_1, 0x27, nyi())
+defOpcode(dload_2, 0x28, nyi())
+defOpcode(dload_3, 0x29, nyi())
+defOpcode(aload_0, 0x2a, nyi())
+defOpcode(aload_1, 0x2b, nyi())
+defOpcode(aload_2, 0x2c, nyi())
+defOpcode(aload_3, 0x2d, nyi())
+defOpcode(iaload, 0x2e, nyi())
+defOpcode(laload, 0x2f, nyi())
+defOpcode(faload, 0x30, nyi())
+defOpcode(daload, 0x31, nyi())
+defOpcode(aaload, 0x32, nyi())
+defOpcode(baload, 0x33, nyi())
+defOpcode(caload, 0x34, nyi())
+defOpcode(saload, 0x35, nyi())
+defOpcode(istore, 0x36, nyi())
+defOpcode(lstore, 0x37, nyi())
+defOpcode(fstore, 0x38, nyi())
+defOpcode(dstore, 0x39, nyi())
+defOpcode(astore, 0x3a, nyi())
+defOpcode(istore_0, 0x3b, nyi())
+defOpcode(istore_1, 0x3c, nyi())
+defOpcode(istore_2, 0x3d, nyi())
+defOpcode(istore_3, 0x3e, nyi())
+defOpcode(lstore_0, 0x3f, nyi())
+defOpcode(lstore_1, 0x40, nyi())
+defOpcode(lstore_2, 0x41, nyi())
+defOpcode(lstore_3, 0x42, nyi())
+defOpcode(fstore_0, 0x43, nyi())
+defOpcode(fstore_1, 0x44, nyi())
+defOpcode(fstore_2, 0x45, nyi())
+defOpcode(fstore_3, 0x46, nyi())
+defOpcode(dstore_0, 0x47, nyi())
+defOpcode(dstore_1, 0x48, nyi())
+defOpcode(dstore_2, 0x49, nyi())
+defOpcode(dstore_3, 0x4a, nyi())
+defOpcode(astore_0, 0x4b, nyi())
+defOpcode(astore_1, 0x4c, nyi())
+defOpcode(astore_2, 0x4d, nyi())
+defOpcode(astore_3, 0x4e, nyi())
+defOpcode(iastore, 0x4f, nyi())
+defOpcode(lastore, 0x50, nyi())
+defOpcode(fastore, 0x51, nyi())
+defOpcode(dastore, 0x52, nyi())
+defOpcode(aastore, 0x53, nyi())
+defOpcode(bastore, 0x54, nyi())
+defOpcode(castore, 0x55, nyi())
+defOpcode(sastore, 0x56, nyi())
+defOpcode(pop, 0x57, nyi())
+defOpcode(pop2, 0x58, nyi())
+defOpcode(dup, 0x59, eat(0))
+defOpcode(dup_x1, 0x5a, nyi())
+defOpcode(dup_x2, 0x5b, nyi())
+defOpcode(dup2, 0x5c, nyi())
+defOpcode(dup2_x1, 0x5d, nyi())
+defOpcode(dup2_x2, 0x5e, nyi())
+defOpcode(swap, 0x5f, nyi())
+defOpcode(iadd, 0x60, nyi())
+defOpcode(ladd, 0x61, nyi())
+defOpcode(fadd, 0x62, nyi())
+defOpcode(dadd, 0x63, nyi())
+defOpcode(isub, 0x64, nyi())
+defOpcode(lsub, 0x65, nyi())
+defOpcode(fsub, 0x66, nyi())
+defOpcode(dsub, 0x67, nyi())
+defOpcode(imul, 0x68, nyi())
+defOpcode(lmul, 0x69, nyi())
+defOpcode(fmul, 0x6a, nyi())
+defOpcode(dmul, 0x6b, nyi())
+defOpcode(idiv, 0x6c, nyi())
+defOpcode(ldiv, 0x6d, nyi())
+defOpcode(fdiv, 0x6e, nyi())
+defOpcode(ddiv, 0x6f, nyi())
+defOpcode(irem, 0x70, nyi())
+defOpcode(lrem, 0x71, nyi())
+defOpcode(frem, 0x72, nyi())
+defOpcode(drem, 0x73, nyi())
+defOpcode(ineg, 0x74, nyi())
+defOpcode(lneg, 0x75, nyi())
+defOpcode(fneg, 0x76, nyi())
+defOpcode(dneg, 0x77, nyi())
+defOpcode(ishl, 0x78, nyi())
+defOpcode(lshl, 0x79, nyi())
+defOpcode(ishr, 0x7a, nyi())
+defOpcode(lshr, 0x7b, nyi())
+defOpcode(iushr, 0x7c, nyi())
+defOpcode(lushr, 0x7d, nyi())
+defOpcode(iand, 0x7e, nyi())
+defOpcode(land, 0x7f, nyi())
+defOpcode(ior, 0x80, nyi())
+defOpcode(lor, 0x81, nyi())
+defOpcode(ixor, 0x82, nyi())
+defOpcode(lxor, 0x83, nyi())
+defOpcode(iinc, 0x84, nyi())
+defOpcode(i2l, 0x85, nyi())
+defOpcode(i2f, 0x86, nyi())
+defOpcode(i2d, 0x87, nyi())
+defOpcode(l2i, 0x88, nyi())
+defOpcode(l2f, 0x89, nyi())
+defOpcode(l2d, 0x8a, nyi())
+defOpcode(f2i, 0x8b, nyi())
+defOpcode(f2l, 0x8c, nyi())
+defOpcode(f2d, 0x8d, nyi())
+defOpcode(d2i, 0x8e, nyi())
+defOpcode(d2l, 0x8f, nyi())
+defOpcode(d2f, 0x90, nyi())
+defOpcode(i2b, 0x91, nyi())
+defOpcode(i2c, 0x92, nyi())
+defOpcode(i2s, 0x93, nyi())
+defOpcode(lcmp, 0x94, nyi())
+defOpcode(fcmpl, 0x95, nyi())
+defOpcode(fcmpg, 0x96, nyi())
+defOpcode(dcmpl, 0x97, nyi())
+defOpcode(dcmpg, 0x98, nyi())
+defOpcode(ifeq, 0x99, nyi())
+defOpcode(ifne, 0x9a, nyi())
+defOpcode(iflt, 0x9b, nyi())
+defOpcode(ifge, 0x9c, nyi())
+defOpcode(ifgt, 0x9d, nyi())
+defOpcode(ifle, 0x9e, nyi())
+defOpcode(if_icmpeq, 0x9f, nyi())
+defOpcode(if_icmpne, 0xa0, nyi())
+defOpcode(if_icmplt, 0xa1, nyi())
+defOpcode(if_icmpge, 0xa2, nyi())
+defOpcode(if_icmpgt, 0xa3, nyi())
+defOpcode(if_icmple, 0xa4, nyi())
+defOpcode(if_acmpeq, 0xa5, nyi())
+defOpcode(if_acmpne, 0xa6, nyi())
+defOpcode(goto, 0xa7, nyi())
+defOpcode(jsr, 0xa8, nyi())
+defOpcode(ret, 0xa9, nyi())
+defOpcode(tableswitch, 0xaa, nyi())
+defOpcode(lookupswitch, 0xab, nyi())
+defOpcode(ireturn, 0xac, nyi())
+defOpcode(lreturn, 0xad, nyi())
+defOpcode(freturn, 0xae, nyi())
+defOpcode(dreturn, 0xaf, nyi())
+defOpcode(areturn, 0xb0, nyi())
+defOpcode(return, 0xb1, eat(0))
+defOpcode(getstatic, 0xb2, nyi())
+defOpcode(putstatic, 0xb3, eat(2))
+defOpcode(getfield, 0xb4, nyi())
+defOpcode(putfield, 0xb5, nyi())
+defOpcode(invokevirtual, 0xb6, nyi())
+defOpcode(invokespecial, 0xb7, eat(2))
+defOpcode(invokestatic, 0xb8, eat(2))
+defOpcode(invokeinterface, 0xb9, nyi())
+defOpcode(xxxunusedxxx1, 0xba, nyi())
+defOpcode(new, 0xbb, eat(2))
+defOpcode(newarray, 0xbc, nyi())
+defOpcode(anewarray, 0xbd, eat(2))
+defOpcode(arraylength, 0xbe, nyi())
+defOpcode(athrow, 0xbf, nyi())
+defOpcode(checkcast, 0xc0, nyi())
+defOpcode(instanceof, 0xc1, nyi())
+defOpcode(monitorenter, 0xc2, nyi())
+defOpcode(monitorexit, 0xc3, nyi())
+defOpcode(wide, 0xc4, nyi())
+defOpcode(multianewarray, 0xc5, nyi())
+defOpcode(ifnull, 0xc6, nyi())
+defOpcode(ifnonnull, 0xc7, nyi())
+defOpcode(goto_w, 0xc8, nyi())
+defOpcode(jsr_w, 0xc9, nyi())
+defOpcode(breakpoint, 0xca, nyi())
+defOpcode(impdep1, 0xfe, nyi())
+defOpcode(impdep2, 0xff, nyi())
Added: vmkit/branches/mcjit/include/j3/j3class.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3class.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3class.h (added)
+++ vmkit/branches/mcjit/include/j3/j3class.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,292 @@
+#ifndef _J3_CLASS_H_
+#define _J3_CLASS_H_
+
+#include <pthread.h>
+#include <stdint.h>
+#include <vector>
+
+#include "vmkit/allocator.h"
+
+namespace llvm {
+ class StructType;
+ class Type;
+ class GlobalValue;
+ class Module;
+}
+
+namespace vmkit {
+ class Name;
+}
+
+namespace j3 {
+ class J3ClassLoader;
+ class J3ClassBytes;
+ class J3Reader;
+ class J3Primitive;
+ class J3Class;
+ class J3Layout;
+ class J3ArrayClass;
+ class J3ObjectType;
+ class J3Method;
+ class J3VirtualTable;
+ class J3ObjectHandle;
+ class J3Field;
+
+ class J3Type : public vmkit::PermanentObject {
+ pthread_mutex_t _mutex;
+ J3ClassLoader* _loader;
+ J3ArrayClass* volatile _array;
+
+ protected:
+ enum { CITED, LOADED, RESOLVED, INITED };
+
+ const vmkit::Name* _name;
+ char* _nativeName;
+ uint32_t _nativeNameLength;
+ J3VirtualTable* _vt;
+
+ volatile int status;
+
+ virtual void doResolve(J3Field* hiddenFields, size_t nbHiddenFields) { status = RESOLVED; }
+ virtual void doInitialise() { status = INITED; }
+
+ public:
+ J3Type(J3ClassLoader* loader, const vmkit::Name* name);
+
+ virtual llvm::GlobalValue* llvmDescriptor(llvm::Module* module) { return 0; }
+
+ bool isResolved() { return status >= RESOLVED; }
+ bool isInitialised() { return status == INITED; }
+ J3Type* resolve(J3Field* hiddenFields, uint32_t nbHiddenFields);
+ J3Type* resolve();
+ J3Type* initialise();
+
+ J3VirtualTable* vt();
+
+ bool isAssignableTo(J3Type* parent);
+
+ char* nativeName();
+ uint32_t nativeNameLength();
+
+ void lock() { pthread_mutex_lock(&_mutex); }
+ void unlock() { pthread_mutex_unlock(&_mutex); }
+
+ const vmkit::Name* name() const { return _name; }
+ J3ArrayClass* getArray(uint32_t prof=1, const vmkit::Name* name=0);
+
+ J3ClassLoader* loader() { return _loader; }
+
+ J3ObjectType* asObjectType();
+ J3Class* asClass();
+ J3Primitive* asPrimitive();
+ J3ArrayClass* asArrayClass();
+ J3Layout* asLayout();
+
+ virtual bool isObjectType() { return 0; }
+ virtual bool isArrayClass() { return 0; }
+ virtual bool isLayout() { return 0; }
+ virtual bool isClass() { return 0; }
+ virtual bool isPrimitive() { return 0; }
+ virtual llvm::Type* llvmType() = 0;
+
+ void dump();
+ };
+
+ class J3Attribute : public vmkit::PermanentObject {
+ friend class J3Class;
+
+ const vmkit::Name* _id;
+ uint32_t _offset;
+ public:
+
+ const vmkit::Name* id() { return _id; }
+ uint32_t offset() { return _offset; }
+ };
+
+ class J3Attributes : public vmkit::PermanentObject {
+ size_t _nbAttributes;
+ J3Attribute _attributes[1];
+ public:
+ J3Attributes(size_t n) { _nbAttributes = n; }
+
+ void* operator new(size_t unused, vmkit::BumpAllocator* allocator, size_t n) {
+ return vmkit::PermanentObject::operator new(sizeof(J3Attributes) + (n - 1) * sizeof(J3Attribute), allocator);
+ }
+
+ size_t nbAttributes() { return _nbAttributes; }
+ J3Attribute* attribute(size_t n);
+
+ J3Attribute* lookup(const vmkit::Name* attr);
+ };
+
+ class J3Field : public vmkit::PermanentObject {
+ friend class J3Class;
+
+ J3Class* _cl;
+ uint16_t _access;
+ const vmkit::Name* _name;
+ J3Type* _type;
+ J3Attributes* _attributes;
+ uint32_t _num;
+
+ public:
+ J3Field() {}
+ J3Field(uint16_t access, const vmkit::Name* name, J3Type* type) { _access = access; _name = name; _type = type; }
+
+ J3Attributes* attributes() const { return _attributes; }
+ uint16_t access() { return _access; }
+ J3Class* cl() { return _cl; }
+ const vmkit::Name* name() { return _name; }
+ J3Type* type() { return _type; }
+
+ uint32_t num() { return _num; }
+
+ void dump();
+ };
+
+ class J3ObjectType : public J3Type {
+ J3ObjectHandle* _javaClass;
+
+ public:
+ J3ObjectType(J3ClassLoader* loader, const vmkit::Name* name);
+
+ virtual J3Method* findVirtualMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error=1);
+ virtual J3Method* findStaticMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error=1);
+
+ bool isObjectType() { return 1; }
+
+ J3ObjectHandle* javaClass();
+
+ static J3ObjectType* nativeClass(J3ObjectHandle* handle);
+ };
+
+ class J3Layout : public J3ObjectType {
+ friend class J3Class;
+
+ llvm::Type* _llvmType;
+
+ size_t nbFields;
+ J3Field* fields;
+
+ size_t _nbMethods;
+ J3Method** _methods;
+ public:
+ J3Layout(J3ClassLoader* loader, const vmkit::Name* name);
+
+ virtual bool isLayout() { return 1; }
+
+ size_t nbMethods() { return _nbMethods; }
+ J3Method** methods() { return _methods; }
+
+ J3Method* findMethod(const vmkit::Name* name, const vmkit::Name* sign);
+ J3Field* findField(const vmkit::Name* name, const J3Type* type);
+ llvm::Type* llvmType() { return _llvmType; }
+ };
+
+ class J3Class : public J3Layout {
+ J3Layout staticLayout;
+
+ uint16_t _access;
+
+ size_t _size;
+
+ size_t _nbInterfaces;
+ J3Class** _interfaces;
+ J3Class* _super; /* this for root */
+
+ J3Attributes* _attributes;
+
+ llvm::GlobalValue* _nomcjitDescriptor;
+ J3ClassBytes* _bytes;
+ size_t nbCtp;
+ uint8_t* ctpTypes;
+ uint32_t* ctpValues;
+ void** ctpResolved;
+
+ /* GC Object */
+ J3ObjectHandle* _staticInstance;
+
+ J3Attributes* readAttributes(J3Reader* reader);
+ void readClassBytes(std::vector<llvm::Type*>* virtualBody, J3Field* hiddenFields, uint32_t nbHiddenFields);
+
+ void check(uint16_t idx, uint32_t id=-1);
+
+ void fillFields(std::vector<llvm::Type*>* staticBody, std::vector<llvm::Type*>* virtualBody, J3Field** fields, size_t n);
+
+ void createLLVMTypes();
+
+ void load();
+ void doResolve(J3Field* hiddenFields, size_t nbHiddenFields);
+ void doInitialise();
+ public:
+ J3Class(J3ClassLoader* loader, const vmkit::Name* name);
+
+ size_t nbInterfaces() { return _nbInterfaces; }
+ J3Class** interfaces() { return _interfaces; }
+ J3Class* super() { return _super; }
+ uint16_t access() { return _access; }
+
+ void adjustSize(uint32_t n) { _size += n; }
+ size_t size();
+ J3ObjectHandle* staticInstance();
+
+ void registerNative(const vmkit::Name* methName, const vmkit::Name* methSign, void* fnPtr);
+
+ uint8_t getCtpType(uint16_t idx);
+ void* getCtpResolved(uint16_t idx);
+
+ const vmkit::Name* nameAt(uint16_t idx);
+ float floatAt(uint16_t idx);
+ double doubleAt(uint16_t idx);
+ uint32_t integerAt(uint16_t idx);
+ uint64_t longAt(uint16_t idx);
+ J3ObjectHandle* stringAt(uint16_t idx);
+ J3Class* classAt(uint16_t idx);
+ J3Method* methodAt(uint16_t idx, uint16_t access);
+ J3Field* fieldAt(uint16_t idx, uint16_t access);
+
+ llvm::Type* llvmType();
+ llvm::Type* staticLLVMType();
+ llvm::Type* virtualLLVMType();
+ llvm::GlobalValue* llvmDescriptor(llvm::Module* module);
+
+ J3ClassBytes* bytes() { return _bytes; }
+
+ bool isClass() { return 1; }
+
+ J3Method* findVirtualMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error=1);
+ J3Method* findStaticMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error=1);
+ J3Field* findVirtualField(const vmkit::Name* name, const J3Type* type, bool error=1);
+ J3Field* findStaticField(const vmkit::Name* name, const J3Type* type, bool error=1);
+ };
+
+ class J3ArrayClass : public J3ObjectType {
+ llvm::Type* _llvmType;
+ J3Type* _component;
+ llvm::GlobalValue* _nomcjitDescriptor;
+
+ void doResolve(J3Field* hiddenFields, size_t nbHiddenFields);
+ void doInitialise();
+ public:
+ J3ArrayClass(J3ClassLoader* loader, J3Type* component, const vmkit::Name* name);
+
+
+ llvm::GlobalValue* llvmDescriptor(llvm::Module* module);
+
+ J3Type* component() { return _component; }
+ bool isArrayClass() { return 1; }
+ llvm::Type* llvmType();
+ };
+
+ class J3Primitive : public J3Type {
+ llvm::Type* _llvmType;
+
+ public:
+ J3Primitive(J3ClassLoader* loader, char id, llvm::Type* type);
+
+ bool isPrimitive() { return 1; }
+ llvm::Type* llvmType() { return _llvmType; }
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3classloader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3classloader.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3classloader.h (added)
+++ vmkit/branches/mcjit/include/j3/j3classloader.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,118 @@
+#ifndef _CLASSLOADER_H_
+#define _CLASSLOADER_H_
+
+#include <map>
+#include <vector>
+
+#include "vmkit/allocator.h"
+#include "vmkit/names.h"
+
+#include "j3/j3object.h"
+
+namespace llvm {
+ class ExecutionEngine;
+ class DataLayout;
+ class Type;
+ class Function;
+ class DIBuilder;
+
+ namespace legacy {
+ class FunctionPassManager;
+ }
+ using legacy::FunctionPassManager;
+}
+
+namespace j3 {
+ class J3ZipArchive;
+ class J3ClassBytes;
+ class J3MethodType;
+ class J3Method;
+ class J3Type;
+ class J3;
+ class J3Class;
+
+
+ class J3ClassLoader {
+ struct J3MethodLess : public std::binary_function<wchar_t*,wchar_t*,bool> {
+ bool operator()(const J3Method* lhs, const J3Method* rhs) const;
+ };
+
+ typedef std::map<J3Method*, J3Method*, J3MethodLess,
+ vmkit::StdAllocator<std::pair<J3Method*, J3Method*> > > MethodRefMap;
+
+ static J3MethodLess j3MethodLess;
+
+ J3ObjectHandle* _javaClassLoader;
+ J3FixedPoint _fixedPoint;
+ llvm::FunctionPassManager* _pm;
+ pthread_mutex_t _mutex; /* a lock */
+ vmkit::BumpAllocator* _allocator; /* the local allocator */
+ J3* _vm; /* my vm */
+ vmkit::NameMap<J3Class*>::map classes; /* classes managed by this class loader */
+ vmkit::NameMap<J3Type*>::map types; /* shortcut to find types */
+ vmkit::NameMap<J3MethodType*>::map methodTypes; /* shortcut to find method types - REMOVE */
+ llvm::Module* _module; /* the associated llvm module */
+ llvm::DIBuilder* _dbgBuilder;
+ MethodRefMap methods; /* all te known method */
+
+ void wrongType(J3Class* from, const vmkit::Name* type);
+ J3Type* getTypeInternal(J3Class* from, const vmkit::Name* type, uint32_t start, uint32_t* end);
+
+ protected:
+ std::vector<void*, vmkit::StdAllocator<void*> > nativeLibraries;
+
+ public:
+ void* operator new(size_t n, vmkit::BumpAllocator* allocator);
+ J3ClassLoader(J3* vm, J3ObjectHandle* javaClassLoader, vmkit::BumpAllocator* allocator);
+
+ static void destroy(J3ClassLoader* loader);
+
+ llvm::DIBuilder* dbgBuilder() const { return _dbgBuilder; }
+
+ J3FixedPoint* fixedPoint() { return &_fixedPoint; }
+
+ J3ObjectHandle* javaClassLoader() { return _javaClassLoader; }
+
+ void lock() { pthread_mutex_lock(&_mutex); }
+ void unlock() { pthread_mutex_unlock(&_mutex); }
+
+ vmkit::BumpAllocator* allocator() { return _allocator; }
+ J3* vm() const { return _vm; };
+ llvm::FunctionPassManager* pm() { return _pm; }
+
+ J3Method* method(uint16_t access, J3Class* cl,
+ const vmkit::Name* name, const vmkit::Name* sign); /* find a method ref */
+ J3Method* method(uint16_t access, const vmkit::Name* clName,
+ const vmkit::Name* name, const vmkit::Name* sign);
+ J3Method* method(uint16_t access, const wchar_t* clName, const wchar_t* name, const wchar_t* sign);
+
+ J3Class* getClass(const vmkit::Name* name); /* find a class */
+ J3Type* getType(J3Class* from, const vmkit::Name* type); /* find a type */
+ J3MethodType* getMethodType(J3Class* from, const vmkit::Name* sign); /* get a method type */
+ llvm::Module* module() { return _module; }
+
+ virtual J3ClassBytes* lookup(const vmkit::Name* name);
+
+ void* lookupNativeFunctionPointer(J3Method* method, const char* symb);
+ };
+
+ struct char_ptr_less : public std::binary_function<char*,char*,bool> {
+ bool operator()(const char* lhs, const char* rhs) const;
+ };
+
+ class J3InitialClassLoader : public J3ClassLoader {
+ J3ZipArchive* archive;
+ std::map<const char*, const char*, char_ptr_less> _cmangled;
+ public:
+ J3InitialClassLoader(J3* vm, const char* rtjar, vmkit::BumpAllocator* allocator);
+
+ J3ClassBytes* lookup(const vmkit::Name* name);
+
+ const char* cmangled(const char* demangled) { return _cmangled[demangled]; }
+
+ void makeLLVMFunctions_j3();
+ void registerCMangling(const char* mangled, const char* demangled);
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3codegen.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3codegen.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3codegen.h (added)
+++ vmkit/branches/mcjit/include/j3/j3codegen.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,209 @@
+#ifndef _J3_CODE_GEN_H_
+#define _J3_CODE_GEN_H_
+
+#include "llvm/IR/IRBuilder.h"
+#include "j3/j3codegenvar.h"
+
+namespace llvm {
+ class Function;
+ class Value;
+}
+
+namespace vmkit {
+ class BumpAllocator;
+}
+
+namespace j3 {
+ class J3;
+ class J3Type;
+ class J3Class;
+ class J3ArrayClass;
+ class J3ClassLoader;
+ class J3Field;
+ class J3Method;
+ class J3MethodType;
+ class J3Reader;
+ class J3ObjectType;
+
+ class J3ExceptionEntry {
+ public:
+ uint32_t startPC;
+ uint32_t endPC;
+ uint32_t handlerPC;
+ uint32_t catchType;
+ llvm::BasicBlock* bb;
+
+ void dump();
+ };
+
+ class J3ExceptionNode {
+ public:
+ uint32_t pc;
+ uint32_t nbEntries;
+ llvm::BasicBlock* landingPad;
+ llvm::BasicBlock* curCheck;
+ J3ExceptionEntry* entries[1];
+ };
+
+ class J3OpInfo {
+ public:
+ llvm::Instruction* insn;
+ llvm::BasicBlock* bb;
+ llvm::Type** metaStack;
+ size_t topStack;
+ };
+
+ class J3CodeGen {
+ friend class J3CodeGenVar;
+
+ vmkit::BumpAllocator* allocator;
+ llvm::Module* module;
+ llvm::BasicBlock* bb;
+ llvm::IRBuilder<>* builder;
+ llvm::Function* llvmFunction;
+
+ J3* vm;
+ J3Class* cl;
+ J3ClassLoader* loader;
+ J3Method* method;
+ J3MethodType* methodType;
+ J3Reader* codeReader;
+
+ llvm::BasicBlock* bbCheckCastFailed;
+ llvm::BasicBlock* bbNullCheckFailed;
+ llvm::BasicBlock* bbRet;
+
+ J3ExceptionEntry* exceptionEntries;
+ J3ExceptionNode** exceptionNodes;
+ uint32_t nbExceptionEntries;
+ uint32_t nbExceptionNodes;
+ uint32_t curExceptionNode;
+
+ J3OpInfo* opInfos;
+ uint32_t* pendingBranchs;
+ uint32_t topPendingBranchs;
+
+ llvm::Value* nullValue;
+
+ llvm::MDNode* dbgInfo;
+ uint32_t javaPC;
+
+ J3CodeGenVar locals;
+ J3CodeGenVar stack;
+ J3CodeGenVar ret;
+
+ bool closeBB;
+
+ bool isWide;
+
+ uint32_t wideReadU1();
+ uint32_t wideReadS1();
+
+ llvm::Value* nullCheck(llvm::Value* obj);
+
+ bool onEndPoint();
+ llvm::BasicBlock* forwardBranch(const char* id, uint32_t pc, bool doAlloc, bool doPush);
+ void condBr(llvm::Value* op);
+
+ llvm::Value* flatten(llvm::Value* v, J3Type* type);
+ llvm::Value* unflatten(llvm::Value* v, J3Type* type);
+
+ llvm::Value* handleToObject(llvm::Value* obj);
+ llvm::Value* javaClass(J3ObjectType* type);
+ llvm::Value* staticInstance(J3Class* cl);
+ llvm::Value* vt(J3Type* cl);
+ llvm::Value* vt(llvm::Value* obj);
+ void initialiseJ3Type(J3Type* cl);
+
+ llvm::Value* isAssignableTo(llvm::Value* obj, J3Type* type);
+ void instanceof(llvm::Value* obj, J3Type* type);
+ void checkCast(llvm::Value* obj, J3Type* type);
+
+ void floatToInteger(J3Type* from, J3Type* to);
+ void compareFP(bool isL);
+ void compareLong();
+
+ void get(llvm::Value* obj, J3Field* field);
+ void getField(uint32_t idx);
+ void getStatic(uint32_t idx);
+
+ void put(llvm::Value* obj, llvm::Value* val, J3Field* field);
+ void putField(uint32_t idx);
+ void putStatic(uint32_t idx);
+
+ void invoke(J3Method* method, llvm::Value* func);
+ void invokeVirtual(uint32_t idx);
+ void invokeStatic(uint32_t idx);
+ void invokeSpecial(uint32_t idx);
+
+ llvm::Value* arrayContent(J3Type* cType, llvm::Value* array, llvm::Value* idx);
+
+ void arrayBoundCheck(llvm::Value* obj, llvm::Value* idx);
+ llvm::Value* arrayLength(llvm::Value* obj);
+ llvm::Value* arrayLengthPtr(llvm::Value* obj);
+ void arrayStore(J3Type* cType);
+ void arrayLoad(J3Type* cType);
+
+ void newArray(uint8_t atype);
+ void newArray(J3ArrayClass* type);
+ void newObject(J3Class* cl);
+
+ void ldc(uint32_t idx);
+
+ void translate();
+
+ void initExceptionNode(J3ExceptionNode** pnode, uint32_t pc, J3ExceptionNode* node);
+ void addToExceptionNode(J3ExceptionNode* node, J3ExceptionEntry* entry);
+ void closeExceptionNode(J3ExceptionNode* node);
+
+ void generateJava();
+ void generateNative();
+
+ llvm::Value* buildString(const char* msg);
+
+ static void echoDebugEnter(uint32_t isLeave, const char* msg, ...);
+ static void echoDebugExecute(uint32_t level, const char* msg, ...);
+
+ llvm::Function* funcJ3MethodIndex;
+ llvm::Function* funcJ3TypeVT;
+ llvm::Function* funcJ3TypeInitialise;
+ llvm::Function* funcJ3ObjectTypeJavaClass;
+ llvm::Function* funcJ3ClassSize;
+ llvm::Function* funcJ3ClassStaticInstance;
+ llvm::Function* funcJ3ClassStringAt;
+ llvm::Function* funcJ3ObjectAllocate;
+ llvm::Function* funcJniEnv;
+ llvm::Function* funcClassCastException;
+ llvm::Function* funcNullPointerException;
+ llvm::Function* funcThrowException;
+ llvm::Function* funcSlowIsAssignableTo;
+ llvm::Function* funcFastIsAssignableToPrimaryChecker;
+ llvm::Function* funcFastIsAssignableToNonPrimaryChecker;
+ llvm::Function* funcJ3ThreadPushHandle;
+ llvm::Function* funcJ3ThreadPush;
+ llvm::Function* funcJ3ThreadTell;
+ llvm::Function* funcJ3ThreadRestore;
+ llvm::Function* funcJ3ThreadGet;
+ llvm::Function* funcEchoDebugExecute;
+ llvm::Function* funcEchoDebugEnter;
+ llvm::Function* funcCXABeginCatch; /* __cxa_begin_catch */
+ llvm::Function* funcCXAEndCatch; /* __cxa_end_catch */
+ llvm::Function* funcGXXPersonality; /* __gxx_personality_v0 */
+ llvm::Function* gcRoot;
+ llvm::Function* ziTry;
+ llvm::GlobalValue* gvTypeInfo; /* typename void* */
+
+ J3CodeGen(vmkit::BumpAllocator* _allocator, J3Method* method);
+ ~J3CodeGen();
+
+ void* operator new(size_t n, vmkit::BumpAllocator* _allocator);
+ void operator delete(void* ptr);
+ public:
+ static J3CodeGen* create(J3Method* method);
+ static void destroy(J3CodeGen* codeGen);
+
+ llvm::Function* generate();
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3codegenvar.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3codegenvar.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3codegenvar.h (added)
+++ vmkit/branches/mcjit/include/j3/j3codegenvar.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,45 @@
+#ifndef _J3_CODEGEN_VAR_H_
+#define _J3_CODEGEN_VAR_H_
+
+#include <stdint.h>
+
+namespace llvm {
+ class AllocaInst;
+ class Value;
+ class Type;
+}
+
+namespace j3 {
+ class J3CodeGen;
+
+ class J3CodeGenVar {
+ void killUnused(llvm::AllocaInst** stack, bool isObj);
+ public:
+ J3CodeGen* codeGen;
+ llvm::AllocaInst** intStack;
+ llvm::AllocaInst** longStack;
+ llvm::AllocaInst** floatStack;
+ llvm::AllocaInst** doubleStack;
+ llvm::AllocaInst** refStack;
+ llvm::Type** metaStack;
+ uint32_t topStack;
+ uint32_t maxStack;
+
+ static uint32_t reservedSize(uint32_t max);
+ void init(J3CodeGen* _codeGen, uint32_t max, void* space);
+
+ void killUnused();
+
+ uint32_t metaStackSize();
+
+ llvm::Value* at(uint32_t idx);
+ void setAt(llvm::Value* value, uint32_t idx);
+ void drop(uint32_t n);
+ llvm::Value* top(uint32_t idx=0);
+ llvm::Value* pop();
+ void push(llvm::Value* value);
+ void dump();
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3config.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3config.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3config.h (added)
+++ vmkit/branches/mcjit/include/j3/j3config.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,6 @@
+
+#define SHLIBEXT ".dylib"
+#define OPENJDK_HOME "/Users/gthomas/research/vmkit4/jdk8/build/macosx-x86_64-normal-server-release/images/j2sdk-bundle/jdk1.8.0.jdk/Contents/Home/"
+
+
+
Added: vmkit/branches/mcjit/include/j3/j3config.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3config.h.in?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3config.h.in (added)
+++ vmkit/branches/mcjit/include/j3/j3config.h.in Mon Nov 25 03:27:09 2013
@@ -0,0 +1,6 @@
+
+#define SHLIBEXT "@SHLIBEXT@"
+#define OPENJDK_HOME "@jdkhome@"
+
+
+
Added: vmkit/branches/mcjit/include/j3/j3constants.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3constants.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3constants.h (added)
+++ vmkit/branches/mcjit/include/j3/j3constants.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,107 @@
+#ifndef _J3_CONSTANTS_H_
+#define _J3_CONSTANTS_H_
+
+#include <stdint.h>
+#include <sys/types.h>
+
+namespace llvm {
+ class Type;
+}
+
+namespace vmkit {
+ class Name;
+ class Names;
+}
+
+namespace j3 {
+ class J3Class;
+ class J3;
+
+ class J3Cst {
+ public:
+ static const char* opcodeNames[];
+
+ static const int MAGIC = 0xcafebabe;
+
+ static wchar_t codeAttr[];
+ static wchar_t constantValueAttr[];
+
+ static wchar_t clinitName[];
+ static wchar_t clinitSign[];
+ static wchar_t initName[];
+ static char nativePrefix[];
+
+ static void initialize(vmkit::Names* names);
+
+ static const int CONSTANT_Utf8 = 1;
+ static const int CONSTANT_Integer = 3;
+ static const int CONSTANT_Float = 4;
+ static const int CONSTANT_Long = 5;
+ static const int CONSTANT_Double = 6;
+ static const int CONSTANT_Class = 7;
+ static const int CONSTANT_String = 8;
+ static const int CONSTANT_Fieldref = 9;
+ static const int CONSTANT_Methodref = 10;
+ static const int CONSTANT_InterfaceMethodref = 11;
+ static const int CONSTANT_NameAndType = 12;
+ static const int CONSTANT_MethodHandle = 15;
+ static const int CONSTANT_MethodType = 16;
+ static const int CONSTANT_InvokeDynamic = 18;
+
+#define DO_IS(name, flag_name, value) \
+ static const uint16_t flag_name = value; \
+ static bool name(uint16_t flag) { return flag & flag_name; }
+
+ DO_IS(isPublic, ACC_PUBLIC, 0x0001);
+ DO_IS(isPrivate, ACC_PRIVATE, 0x0002);
+ DO_IS(isProtected, ACC_PROTECTED, 0x0004);
+ DO_IS(isStatic, ACC_STATIC, 0x0008);
+ DO_IS(isFinal, ACC_FINAL, 0x0010);
+ DO_IS(isSuper, ACC_SUPER, 0x0020);
+ DO_IS(isSynchronized, ACC_SYNCHRONIZED, 0x0020);
+ DO_IS(isNative, ACC_NATIVE, 0x0100);
+ DO_IS(isVolatile, ACC_VOLATILE, 0x0040);
+ DO_IS(isTransient, ACC_TRANSIENT, 0x0080);
+ DO_IS(isInterface, ACC_INTERFACE, 0x0200);
+ DO_IS(isAbstract, ACC_ABSTRACT, 0x0400);
+ DO_IS(isStrict, ACC_STRICT, 0x0800);
+
+#undef DO_IS
+
+ static const wchar_t ID_Void = 'V';
+ static const wchar_t ID_Byte = 'B';
+ static const wchar_t ID_Char = 'C';
+ static const wchar_t ID_Double = 'D';
+ static const wchar_t ID_Float = 'F';
+ static const wchar_t ID_Integer = 'I';
+ static const wchar_t ID_Long = 'J';
+ static const wchar_t ID_Classname = 'L';
+ static const wchar_t ID_End = ';';
+ static const wchar_t ID_Short = 'S';
+ static const wchar_t ID_Boolean = 'Z';
+ static const wchar_t ID_Array = '[';
+ static const wchar_t ID_Left = '(';
+ static const wchar_t ID_Right = ')';
+
+ static const uint8_t T_BOOLEAN = 4;
+ static const uint8_t T_CHAR = 5;
+ static const uint8_t T_FLOAT = 6;
+ static const uint8_t T_DOUBLE = 7;
+ static const uint8_t T_BYTE = 8;
+ static const uint8_t T_SHORT = 9;
+ static const uint8_t T_INT = 10;
+ static const uint8_t T_LONG = 11;
+
+ static uint32_t round(uint32_t value, uint32_t bound) {
+ return ((value - 1) & (-bound)) + bound;
+ }
+
+ static const vmkit::Name* rewrite(J3* vm, const vmkit::Name* clName, const vmkit::Name* orig);
+
+#define defOpcode(ID, val, effect) \
+ static const uint8_t BC_##ID = val;
+#include "j3bc.def"
+#undef defOpcode
+ };
+}
+#endif
Added: vmkit/branches/mcjit/include/j3/j3jni.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3jni.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3jni.h (added)
+++ vmkit/branches/mcjit/include/j3/j3jni.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#ifndef _J3_JNI_H_
+#define _J3_JNI_H_
+
+#include "jni.h"
+
+namespace j3 {
+ extern struct JNINativeInterface_ jniEnvTable;
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3lib.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3lib.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3lib.h (added)
+++ vmkit/branches/mcjit/include/j3/j3lib.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,17 @@
+#ifndef _J3_LIB_H_
+#define _J3_LIB_H_
+
+#include <vmkit/allocator.h>
+#include <vector>
+
+namespace j3 {
+ class J3ClassBytes;
+
+ class J3Lib {
+ public:
+ static const char** systemClassesArchives();
+ static int loadSystemLibraries(std::vector<void*, vmkit::StdAllocator<void*> >* handles);
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3mangler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3mangler.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3mangler.h (added)
+++ vmkit/branches/mcjit/include/j3/j3mangler.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,40 @@
+#ifndef _J3_MANGLER_H_
+#define _J3_MANGLER_H_
+
+#include <stdint.h>
+
+namespace vmkit {
+ class Name;
+}
+
+namespace j3 {
+ class J3Class;
+ class J3Method;
+
+ class J3Mangler {
+ static const uint32_t max = 65536;
+
+ J3Class* from;
+ char buf[max];
+ char* cur;
+ char* next;
+
+ void check(uint32_t n);
+
+ public:
+ static const char* j3Id;
+ static const char* javaId;
+
+ J3Mangler(J3Class* from);
+
+ char* cStr() { return buf; }
+ uint32_t length() { return cur - buf; }
+
+ J3Mangler* mangle(const char* prefix);
+ J3Mangler* mangle(const vmkit::Name* name);
+ J3Mangler* mangle(J3Method* method);
+ J3Mangler* mangleType(J3Method* method);
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3method.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3method.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3method.h (added)
+++ vmkit/branches/mcjit/include/j3/j3method.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,133 @@
+#ifndef _J3_METHOD_H_
+#define _J3_METHOD_H_
+
+#include <stdint.h>
+#include <vector>
+
+#include "vmkit/allocator.h"
+
+namespace llvm {
+ class FunctionType;
+ class Function;
+ class Type;
+ class GlobalValue;
+ class Module;
+ struct GenericValue;
+}
+
+namespace vmkit {
+ class Name;
+}
+
+namespace j3 {
+ class J3Type;
+ class J3Attributes;
+ class J3Class;
+ class J3Method;
+ class J3Value;
+ class J3ObjectHandle;
+
+ class J3MethodType : public vmkit::PermanentObject {
+ llvm::FunctionType* _llvmType;
+ J3Type* _out;
+ uint32_t _nbIns;
+ J3Type* _ins[1];
+
+ public:
+ J3MethodType(J3Type** args, size_t nbArgs);
+
+ llvm::FunctionType* llvmType() { return _llvmType; }
+ uint32_t nbIns() { return _nbIns; }
+ J3Type* out() { return _out; }
+ J3Type* ins(uint32_t idx) { return _ins[idx]; }
+
+ void* operator new(size_t unused, vmkit::BumpAllocator* allocator, size_t n) {
+ return vmkit::PermanentObject::operator new(sizeof(J3MethodType) + (n - 1) * sizeof(J3Type*), allocator);
+ }
+ };
+
+ struct trampolin_t {
+ uint8_t code[1];
+ };
+
+ class J3Method : public vmkit::PermanentObject {
+ public:
+ uint16_t _access;
+ J3Class* _cl;
+ const vmkit::Name* _name;
+ const vmkit::Name* _sign;
+ J3MethodType* _methodType;
+ J3Attributes* _attributes;
+ uint32_t _index;
+ llvm::Function* _nomcjitFunction;
+ llvm::GlobalValue* _nomcjitDescriptor;
+ llvm::Function* _compiledFunction;
+ char* volatile _llvmAllNames; /* md_ + llvm Name */
+ size_t _llvmAllNamesLength;
+ void* _nativeFnPtr;
+
+ uint8_t _trampoline[1];
+
+ llvm::Type* doNativeType(J3Type* type);
+
+ J3Value internalInvoke(bool statically, std::vector<llvm::GenericValue>* args);
+ J3Value internalInvoke(bool statically, J3ObjectHandle* handle, va_list va);
+ J3Value internalInvoke(bool statically, J3ObjectHandle* handle, J3Value* args);
+
+ void* operator new(size_t size, vmkit::BumpAllocator* allocator, size_t trampolineSize);
+
+ void buildLLVMNames(J3Class* from);
+ public:
+ J3Method(uint16_t access, J3Class* cl, const vmkit::Name* name, const vmkit::Name* sign);
+
+ static J3Method* newMethod(vmkit::BumpAllocator* allocator,
+ uint16_t access,
+ J3Class* cl,
+ const vmkit::Name* name,
+ const vmkit::Name* sign);
+
+ size_t llvmFunctionNameLength(J3Class* from=0);
+ char* llvmFunctionName(J3Class* from=0);
+ char* llvmDescriptorName(J3Class* from=0);
+ llvm::FunctionType* llvmType(J3Class* from=0);
+
+ void postInitialise(uint32_t access, J3Attributes* attributes);
+ void setResolved(uint32_t index);
+
+ J3Method* resolve(J3ObjectHandle* obj);
+
+ llvm::Function* nativeLLVMFunction(llvm::Module* module);
+ llvm::GlobalValue* llvmDescriptor(llvm::Module* module);
+ llvm::Function* llvmFunction(bool isStub, llvm::Module* module, J3Class* from=0);
+
+ uint32_t index();
+ uint32_t* indexPtr() { return &_index; }
+ bool isResolved() { return _index != -1; }
+
+ J3Attributes* attributes() const { return _attributes; }
+ uint16_t access() const { return _access; }
+ J3Class* cl() const { return _cl; }
+ const vmkit::Name* name() const { return _name; }
+ const vmkit::Name* sign() const { return _sign; }
+ J3MethodType* methodType(J3Class* from=0);
+
+ void registerNative(void* ptr);
+
+ J3Value invokeStatic(...);
+ J3Value invokeStatic(J3Value* args);
+ J3Value invokeStatic(va_list va);
+ J3Value invokeSpecial(J3ObjectHandle* obj, ...);
+ J3Value invokeSpecial(J3ObjectHandle* obj, J3Value* args);
+ J3Value invokeSpecial(J3ObjectHandle* obj, va_list va);
+ J3Value invokeVirtual(J3ObjectHandle* obj, ...);
+ J3Value invokeVirtual(J3ObjectHandle* obj, J3Value* args);
+ J3Value invokeVirtual(J3ObjectHandle* obj, va_list va);
+
+ void* fnPtr();
+ void* functionPointerOrTrampoline();
+
+ void dump();
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3object.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3object.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3object.h (added)
+++ vmkit/branches/mcjit/include/j3/j3object.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,202 @@
+#ifndef _J3_OBJECT_H_
+#define _J3_OBJECT_H_
+
+#include <pthread.h>
+#include <stdint.h>
+
+#include "j3/j3typesdef.h"
+
+namespace vmkit {
+ class BumpAllocator;
+}
+
+namespace j3 {
+ class J3Type;
+ class J3Class;
+ class J3Layout;
+ class J3ArrayClass;
+ class J3Primitive;
+ class J3Field;
+ class J3VirtualTable;
+ class J3FixedPoint;
+ class J3Method;
+
+ // see: Cliff Click and John Rose. 2002. Fast subtype checking in the HotSpot JVM.
+ // In Proceedings of the 2002 joint ACM-ISCOPE conference on Java Grande (JGI '02). ACM, New York, NY, USA, 96-107.
+ class J3TypeChecker {
+ public:
+ static const uint32_t displayLength = 9;
+ static const uint32_t cacheOffset = displayLength - 1;
+
+ J3VirtualTable* display[displayLength];
+ J3VirtualTable** secondaryTypes;
+ uint32_t nbSecondaryTypes;
+ uint32_t offset; /* offset between 1 and 8 if class, cache otherwise */
+
+ void dump();
+ };
+
+ class J3VirtualTable {
+ public:
+ static const uint32_t gepObjectClass = 0;
+ static const uint32_t gepVirtualMethods = 3;
+
+ private:
+ J3Type* _type;
+ J3TypeChecker checker;
+ size_t _nbVirtualMethods;
+ void* _virtualMethods[1];
+
+ J3VirtualTable(J3Type* type, J3Type* super, J3Type** interfaces, uint32_t nbInterfaces, bool isSecondary);
+ void* operator new(size_t unused, vmkit::BumpAllocator* allocator, size_t n);
+ public:
+ static J3VirtualTable* create(J3Layout* cl);
+ static J3VirtualTable* create(J3Class* cl);
+ static J3VirtualTable* create(J3ArrayClass* cl);
+ static J3VirtualTable* create(J3Primitive* prim);
+
+ uint32_t offset() { return checker.offset; }
+ bool isPrimaryChecker() { return checker.offset < J3TypeChecker::cacheOffset; }
+
+ bool slowIsAssignableTo(J3VirtualTable* parent);
+ bool fastIsAssignableToPrimaryChecker(J3VirtualTable* parent, uint32_t parentOffset);
+ bool fastIsAssignableToNonPrimaryChecker(J3VirtualTable* parent);
+ bool isAssignableTo(J3VirtualTable* parent);
+
+ J3Type* type() const { return _type; }
+ void** virtualMethods() const { return (void**)_virtualMethods; }
+ size_t nbVirtualMethods() const { return _nbVirtualMethods; }
+
+ void dump();
+ };
+
+ class J3Object {
+ friend class J3ArrayObject;
+ friend class J3ObjectHandle;
+ public:
+ static const uint32_t gepVT = 0;
+
+ private:
+ J3VirtualTable* _vt;
+ uintptr_t _header;
+
+ J3Object(); /* never directly allocate an object */
+
+ static J3Object* allocate(J3VirtualTable* vt, size_t n);
+ static J3Object* doNewNoInit(J3Class* cl);
+ static J3Object* doNew(J3Class* cl);
+ public:
+
+ J3VirtualTable* vt();
+ uintptr_t* header();
+ };
+
+ class J3ArrayObject : public J3Object {
+ friend class J3ObjectHandle;
+ public:
+ static const uint32_t gepLength = 1;
+ static const uint32_t gepContent = 2;
+
+ private:
+ uint32_t _length;
+ static J3Object* doNew(J3ArrayClass* cl, uint32_t length);
+
+ public:
+
+ uint32_t length() { return _length; }
+ };
+
+ class J3ObjectHandle {
+ friend class J3FixedPoint;
+ friend class J3Method;
+
+ public:
+ static const uint32_t gepObj = 0;
+
+ private:
+ J3Object* volatile _obj;
+
+ J3Object* obj() { return _obj; }
+ J3ArrayObject* array() { return (J3ArrayObject*)_obj; }
+ public:
+ J3VirtualTable* vt() { return obj()->vt(); }
+ uint32_t arrayLength() { return array()->length(); }
+
+ static J3ObjectHandle* allocate(J3VirtualTable* vt, size_t n);
+ static J3ObjectHandle* doNewObject(J3Class* cl);
+ static J3ObjectHandle* doNewArray(J3ArrayClass* cl, uint32_t length);
+
+ static void* trampoline(J3Object* obj, J3Method* ref);
+
+ void harakiri() { _obj = 0; }
+
+ uint32_t hashCode();
+
+ void rawSetObject(uint32_t offset, J3ObjectHandle* v);
+ J3ObjectHandle* rawGetObject(uint32_t offset);
+ void setObject(J3Field* f, J3ObjectHandle* v);
+ J3ObjectHandle* getObject(J3Field* f);
+ void setObjectAt(uint32_t idx, J3ObjectHandle* v);
+ J3ObjectHandle* getObjectAt(uint32_t idx);
+
+#define defAccessor(name, ctype, llvmtype) \
+ void rawSet##name(uint32_t offset, ctype value); \
+ ctype rawGet##name(uint32_t offset); \
+ void set##name(J3Field* f, ctype value); \
+ ctype get##name(J3Field* f); \
+ void set##name##At(uint32_t idx, ctype value); \
+ ctype get##name##At(uint32_t idx);
+ onJavaPrimitives(defAccessor);
+#undef defAccessor
+ };
+
+ class J3FixedPointNode {
+ public:
+ J3FixedPointNode* nextFree;
+ J3FixedPointNode* nextBusy;
+ J3ObjectHandle* top;
+ J3ObjectHandle* max;
+ };
+
+ class J3FixedPoint {
+ static const uint32_t defaultNodeCapacity = 256;
+
+ pthread_mutex_t mutex;
+ vmkit::BumpAllocator* allocator;
+ J3FixedPointNode* head;
+
+ void createNode(uint32_t capacity=defaultNodeCapacity);
+ public:
+ J3FixedPoint(vmkit::BumpAllocator* _allocator);
+
+ void unsyncEnsureCapacity(uint32_t capacity);
+
+ J3ObjectHandle* syncPush(J3ObjectHandle* handle) { return syncPush(handle->obj()); }
+ J3ObjectHandle* syncPush(J3Object* obj);
+ J3ObjectHandle* unsyncPush(J3ObjectHandle* handle) { return unsyncPush(handle->obj()); }
+ J3ObjectHandle* unsyncPush(J3Object* obj);
+ void unsyncPop();
+
+ J3ObjectHandle* unsyncTell() { return head->top; }
+ void unsyncRestore(J3ObjectHandle* ptr);
+ };
+
+ class J3Value {
+ public:
+ union {
+#define doIt(name, ctype, llvmtype) \
+ ctype val##name;
+ onJavaFields(doIt);
+#undef doIt
+ };
+
+#define doIt(name, ctype, llvmtype) \
+ J3Value(ctype val) { val##name = val; }
+ onJavaFields(doIt);
+#undef doIt
+
+ J3Value() {}
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3options.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3options.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3options.h (added)
+++ vmkit/branches/mcjit/include/j3/j3options.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,44 @@
+#ifndef _J3_CMD_LINE_H_
+#define _J3_CMD_LINE_H_
+
+#include <stdint.h>
+
+namespace j3 {
+ class J3Options;
+
+ class J3CmdLineParser {
+ J3Options* options;
+ char** argv;
+ int argc;
+ int cur;
+
+ void help();
+ public:
+ J3CmdLineParser(J3Options* _options, int _argc, char** _argv);
+
+ void process();
+ };
+
+ class J3Options {
+ friend class J3CmdLineParser;
+
+ public:
+ bool assertionsEnabled;
+ const char* selfBitCodePath;
+ const char* rtJar;
+ bool debugEnterIndent;
+ uint32_t genDebugExecute;
+ uint32_t debugExecute;
+ uint32_t debugLoad;
+ uint32_t debugResolve;
+ uint32_t debugIniting;
+ uint32_t debugTranslate;
+ uint32_t debugLinking;
+
+ J3Options();
+
+ void process(int argc, char** argv);
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3reader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3reader.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3reader.h (added)
+++ vmkit/branches/mcjit/include/j3/j3reader.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,127 @@
+//===----------------- Reader.h - Open and read files ---------------------===//
+//
+// The VMKit project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef JNJVM_READER_H
+#define JNJVM_READER_H
+
+#include <stdint.h>
+
+#include "vmkit/allocator.h"
+
+namespace j3 {
+
+class JnjvmBootstrapLoader;
+class JnjvmClassLoader;
+class J3ZipArchive;
+
+class J3ClassBytes : vmkit::PermanentObject {
+ public:
+ uint32_t size;
+ uint8_t elements[1];
+
+ J3ClassBytes(int l) {
+ size = l;
+ }
+
+ void* operator new(size_t sz, vmkit::BumpAllocator* allocator, int n) {
+ return vmkit::PermanentObject::operator new(sizeof(J3ClassBytes) + (n - 1) * sizeof(uint8_t), allocator);
+ }
+};
+
+class J3Reader {
+ friend class J3ZipArchive;
+
+ J3ClassBytes* bytes;
+ uint32_t min;
+ uint32_t cursor;
+ uint32_t max;
+
+public:
+ J3Reader(J3ClassBytes* bytes, uint32_t s=0, uint32_t nbb=0) {
+ if (!nbb) nbb = bytes->size;
+ this->bytes = bytes;
+ this->cursor = s;
+ this->min = s;
+ this->max = s + nbb;
+ }
+
+ J3Reader(J3Reader& r, uint32_t nbb) {
+ bytes = r.bytes;
+ cursor = r.cursor;
+ min = r.min;
+ max = min + nbb;
+ }
+
+ static const int SeekSet;
+ static const int SeekCur;
+ static const int SeekEnd;
+
+ static J3ClassBytes* openFile(vmkit::BumpAllocator* allocator, const char* path);
+ static J3ClassBytes* openZip(vmkit::BumpAllocator* allocator, J3ZipArchive* archive, const char* filename);
+
+ uint32_t remaining() {
+ return max - cursor;
+ }
+
+ unsigned int tell() {
+ return cursor - min;
+ }
+
+ void seek(uint32_t pos, int from);
+
+ bool adjustSize(uint32_t nbb);
+
+ const uint8_t* pointer() {
+ return bytes->elements + cursor;
+ }
+
+ uint8_t readU1() {
+ ++cursor;
+ return bytes->elements[cursor - 1];
+ }
+
+ int8_t readS1() {
+ ++cursor;
+ return bytes->elements[cursor - 1];
+ }
+
+ uint16_t readU2() {
+ uint16_t tmp = ((uint16_t)(readU1())) << 8;
+ return tmp | ((uint16_t)(readU1()));
+ }
+
+ int16_t readS2() {
+ int16_t tmp = ((int16_t)(readS1())) << 8;
+ return tmp | ((int16_t)(readU1()));
+ }
+
+ uint32_t readU4() {
+ uint32_t tmp = ((uint32_t)(readU2())) << 16;
+ return tmp | ((uint32_t)(readU2()));
+ }
+
+ int32_t readS4() {
+ int32_t tmp = ((int32_t)(readS2())) << 16;
+ return tmp | ((int32_t)(readU2()));
+ }
+
+ uint64_t readU8() {
+ uint64_t tmp = ((uint64_t)(readU4())) << 32;
+ return tmp | ((uint64_t)(readU4()));
+ }
+
+ int64_t readS8() {
+ int64_t tmp = ((int64_t)(readS4())) << 32;
+ return tmp | ((int64_t)(readU4()));
+ }
+};
+
+} // end namespace j3
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3thread.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3thread.h (added)
+++ vmkit/branches/mcjit/include/j3/j3thread.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,40 @@
+#ifndef _J3_THREAD_H_
+#define _J3_THREAD_H_
+
+#include "vmkit/thread.h"
+#include "vmkit/allocator.h"
+#include "j3/j3object.h"
+#include "j3/j3jni.h"
+
+namespace j3 {
+ class J3;
+
+ class J3Thread : public vmkit::Thread {
+ vmkit::BumpAllocator* allocator;
+ JNIEnv _jniEnv;
+ J3FixedPoint _fixedPoint;
+ J3ObjectHandle* _pendingException;
+
+ J3Thread(J3* vm, vmkit::BumpAllocator* allocator);
+ public:
+ static J3Thread* create(J3* j3);
+
+ void ensureCapacity(uint32_t capacity);
+ J3ObjectHandle* pendingException() { return _pendingException; }
+ void setPendingException(J3ObjectHandle* handle) { _pendingException = handle; }
+ J3FixedPoint* fixedPoint() { return &_fixedPoint; }
+
+ J3ObjectHandle* push(J3ObjectHandle* handle);
+ J3ObjectHandle* push(J3Object* obj);
+ J3ObjectHandle* tell();
+ void restore(J3ObjectHandle* obj);
+
+ J3* vm() { return (J3*)Thread::vm(); }
+
+ JNIEnv* jniEnv() { return &_jniEnv; }
+
+ static J3Thread* get();
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3typesdef.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3typesdef.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3typesdef.h (added)
+++ vmkit/branches/mcjit/include/j3/j3typesdef.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,32 @@
+#ifndef _J3_PRIMITIVE_H_
+#define _J3_PRIMITIVE_H_
+
+namespace j3 {
+
+#define onJavaPrimitives(_) \
+ _(Boolean, bool, Int1) \
+ _(Byte, int8_t, Int8) \
+ _(Short, int16_t, Int16) \
+ _(Char, uint16_t, Int16) \
+ _(Integer, int32_t, Int32) \
+ _(Long, int64_t, Int64) \
+ _(Float, float, Float) \
+ _(Double, double, Double) \
+
+#define onJavaObject(_) \
+ _(Object, J3ObjectHandle*, Fatal)
+
+#define onJavaVoid(_) \
+ _(Void, void, Void)
+
+#define onJavaTypes(_) \
+ onJavaPrimitives(_) \
+ onJavaVoid(_)
+
+#define onJavaFields(_) \
+ onJavaPrimitives(_) \
+ onJavaObject(_)
+
+}
+
+#endif
Added: vmkit/branches/mcjit/include/j3/j3zip.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3zip.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3zip.h (added)
+++ vmkit/branches/mcjit/include/j3/j3zip.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,61 @@
+//===----------------- Zip.h - Interface with zlib ------------------------===//
+//
+// The VMKit project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef JNJVM_ZIP_H
+#define JNJVM_ZIP_H
+
+#include <map>
+
+#include "vmkit/allocator.h"
+#include "vmkit/util.h"
+
+namespace j3 {
+
+class J3ClassBytes;
+
+class J3ZipFile : public vmkit::PermanentObject {
+public:
+ char* filename;
+ int ucsize;
+ int csize;
+ uint32_t filenameLength;
+ uint32_t extraFieldLength;
+ uint32_t fileCommentLength;
+ int rolh;
+ int compressionMethod;
+};
+
+
+class J3ZipArchive : public vmkit::PermanentObject {
+ vmkit::BumpAllocator* allocator;
+
+ typedef std::map<const char*, J3ZipFile*, vmkit::Util::char_less_t, vmkit::StdAllocator<std::pair<const char*, J3ZipFile*> > > FileMap;
+
+ int ofscd;
+ FileMap filetable;
+ J3ClassBytes* bytes;
+
+ void findOfscd();
+ void addFiles();
+
+ void remove();
+
+public:
+ J3ZipArchive(J3ClassBytes* bytes, vmkit::BumpAllocator* allocator);
+
+ int getOfscd() { return ofscd; }
+ J3ZipFile* getFile(const char* filename);
+ int readFile(J3ClassBytes* array, const J3ZipFile* file);
+
+ typedef FileMap::iterator table_iterator;
+};
+
+} // end namespace j3
+
+#endif
Added: vmkit/branches/mcjit/include/jni_md.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/jni_md.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/jni_md.h (added)
+++ vmkit/branches/mcjit/include/jni_md.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,72 @@
+#ifndef _JNI_MD_H_
+#define _JNI_MD_H_
+
+#define JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
+
+#include <stdint.h>
+
+namespace j3 {
+ class J3ObjectHandle;
+ class J3Value;
+ class J3ObjectType;
+ class J3Field;
+ class J3Method;
+}
+
+extern "C" {
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
+#define JNIEXPORT __attribute__((visibility("default")))
+#define JNIIMPORT __attribute__((visibility("default")))
+#else
+ #define JNIEXPORT
+ #define JNIIMPORT
+#endif
+
+#define JNICALL
+
+ typedef bool jboolean;
+ typedef int8_t jbyte;
+ typedef uint16_t jchar;
+ typedef int16_t jshort;
+ typedef int32_t jint;
+ typedef int64_t jlong;
+ typedef float jfloat;
+ typedef double jdouble;
+
+ typedef uint32_t jsize;
+
+ typedef j3::J3ObjectHandle* jobject;
+ typedef jobject jclass;
+ typedef jobject jthrowable;
+ typedef jobject jstring;
+ typedef jobject jarray;
+ typedef jarray jbooleanArray;
+ typedef jarray jbyteArray;
+ typedef jarray jcharArray;
+ typedef jarray jshortArray;
+ typedef jarray jintArray;
+ typedef jarray jlongArray;
+ typedef jarray jfloatArray;
+ typedef jarray jdoubleArray;
+ typedef jarray jobjectArray;
+
+ typedef jobject jweak;
+ typedef j3::J3Value jvalue;
+
+ typedef j3::J3Field* jfieldID;
+ typedef j3::J3Method* jmethodID;
+
+ /* Return values from jobjectRefType */
+ typedef enum _jobjectType {
+ JNIInvalidRefType = 0,
+ JNILocalRefType = 1,
+ JNIGlobalRefType = 2,
+ JNIWeakGlobalRefType = 3
+ } jobjectRefType;
+}
+
+#endif
Added: vmkit/branches/mcjit/include/safepoint.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/safepoint.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/safepoint.h (added)
+++ vmkit/branches/mcjit/include/safepoint.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,12 @@
+#ifndef _SAFE_POINT_H_
+#define _SAFE_POINT_H_
+
+namespace vmkit {
+ class SafePoint {
+ llvm::Function* function; /* safe inside this function */
+ uintptr_t ip; /* ip of this safepoint */
+ public:
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/vmkit/allocator.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/allocator.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/allocator.h (added)
+++ vmkit/branches/mcjit/include/vmkit/allocator.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,119 @@
+//===----------- Allocator.h - A memory allocator ------------------------===//
+//
+// The VMKit project
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ALLOCATOR_H
+#define ALLOCATOR_H
+
+#include <pthread.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <map>
+
+namespace vmkit {
+ class BumpAllocatorNode { /* always the first bytes of a bucket */
+ public:
+ BumpAllocatorNode* next;
+ uint8_t* top;
+ };
+
+ class BumpAllocator {
+ static const size_t bucketSize = 64*1024;
+ private:
+ pthread_mutex_t mutex;
+ BumpAllocatorNode* current;
+
+ void* operator new(size_t n);
+ BumpAllocator(); /* private to force an allocation via the new operator */
+ ~BumpAllocator();
+ void operator delete(void* p);
+ public:
+ static size_t round(uint64_t n, uint64_t r) { return ((n - 1) & -r) + r; }
+
+ static BumpAllocator* create();
+ static void destroy(BumpAllocator* allocator);
+
+ static void* map(size_t n);
+ static void unmap(void* p, size_t n);
+
+ void* allocate(size_t size);
+
+ };
+
+ class PermanentObject {
+ void* operator new(size_t size) { return 0; }
+ public:
+ void* operator new(size_t size, BumpAllocator* allocator) {
+ return allocator->allocate(size);
+ }
+
+ void* operator new [](size_t size, BumpAllocator* allocator) {
+ return allocator->allocate(size);
+ }
+
+ void operator delete(void* ptr);
+
+ void operator delete[](void* ptr);
+ };
+
+ template <typename T>
+ class StdAllocator : public PermanentObject {
+ public:
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef T* pointer;
+ typedef const T* const_pointer;
+
+ typedef T& reference;
+ typedef const T& const_reference;
+
+ template <class U> struct rebind { typedef StdAllocator<U> other; };
+
+ size_type max_size( ) const { return 0x1000L*0x1000L; }
+
+ BumpAllocator* _allocator;
+
+ template <class U>
+ StdAllocator(const StdAllocator<U> &other) {
+ _allocator = other._allocator;
+ }
+
+ StdAllocator(BumpAllocator* allocator) {
+ _allocator = allocator;
+ }
+
+ pointer allocate(size_type n, const void* hint=0) {
+ pointer res = (pointer)_allocator->allocate(n*sizeof(T));
+ //printf("allocate %lu object at %p\n", n, res);
+ return res;
+ }
+
+ void deallocate(pointer p, size_type n) {
+ PermanentObject::operator delete(p);
+ }
+
+ pointer address(reference r) const { return &r; }
+ const_pointer address(const_reference r) const { return &r; }
+
+ void construct(pointer p, const T& val) {
+ new (p) T(val);
+ }
+
+ void destroy(pointer p) {
+ p->~T();
+ }
+ };
+
+ template<typename T>
+ struct T_ptr_less_t : public PermanentObject {
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
+ };
+} // end namespace vmkit
+
+#endif // VMKIT_ALLOCATOR_H
Added: vmkit/branches/mcjit/include/vmkit/gc.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/gc.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/gc.h (added)
+++ vmkit/branches/mcjit/include/vmkit/gc.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,13 @@
+#ifndef _GC_H_
+#define _GC_H_
+
+#include <sys/types.h>
+
+namespace vmkit {
+ class GC {
+ public:
+ static void* allocate(size_t sz);
+ };
+};
+
+#endif
Added: vmkit/branches/mcjit/include/vmkit/names.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/names.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/names.h (added)
+++ vmkit/branches/mcjit/include/vmkit/names.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,54 @@
+#ifndef _NAMES_H_
+#define _NAMES_H_
+
+#include <map>
+
+#include "vmkit/allocator.h"
+#include "vmkit/util.h"
+
+namespace vmkit {
+ class Name : public PermanentObject {
+ uint32_t _length;
+ wchar_t _content[1];
+
+ public:
+ void* operator new(size_t unused, BumpAllocator* allocator, size_t length);
+
+ Name(uint32_t length, const wchar_t* content);
+
+ const wchar_t* cStr() const {
+ return _content;
+ }
+
+ uint32_t length() const {
+ return _length;
+ }
+
+ static T_ptr_less_t<const Name*> less;
+ };
+
+ class Names : public PermanentObject {
+ BumpAllocator* allocator;
+ pthread_mutex_t mutex;
+
+ std::map<const wchar_t*, const Name*, Util::wchar_t_less_t,
+ StdAllocator<std::pair<const wchar_t*, const Name*> > > names;
+
+ public:
+ Names(BumpAllocator* allocator);
+
+ const Name* get(const wchar_t* s);
+ const Name* get(const char* s, size_t start=0, size_t length=-1);
+ const Name* get(char c);
+
+ };
+
+ template <class T>
+ class NameMap {
+ public:
+ typedef StdAllocator<std::pair<const Name*, T> > alloc;
+ typedef std::map<const Name*, T, T_ptr_less_t<const Name*>, alloc > map;
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/vmkit/thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/thread.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/thread.h (added)
+++ vmkit/branches/mcjit/include/vmkit/thread.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,39 @@
+#ifndef _THREAD_H_
+#define _THREAD_H_
+
+#include "vmkit/allocator.h"
+
+namespace vmkit {
+ class VMKit;
+
+ class Thread : protected PermanentObject {
+ BumpAllocator* _allocator;
+ VMKit* _vm;
+
+ protected:
+ Thread(VMKit* vm, BumpAllocator* allocator);
+
+ public:
+ static void destroy(Thread* thread);
+
+ VMKit* vm() { return _vm; }
+ BumpAllocator* allocator() { return _allocator; }
+
+ static __thread Thread* _thread;
+
+ static Thread* get() { return _thread; }
+ static void set(Thread* thread) { _thread = thread; }
+ };
+
+ class StackWalker {
+ uintptr_t framePointer;
+
+ public:
+ StackWalker(uint32_t initialPop=1);
+
+ void next(uint32_t nbPop=1);
+ uintptr_t ip();
+ };
+}
+
+#endif
Added: vmkit/branches/mcjit/include/vmkit/util.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/util.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/util.h (added)
+++ vmkit/branches/mcjit/include/vmkit/util.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,20 @@
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+namespace vmkit {
+ class Util {
+ public:
+ struct char_less_t {
+ bool operator()(const char* s1, const char* s2) const;
+ };
+
+ struct wchar_t_less_t {
+ bool operator()(const wchar_t* lhs, const wchar_t* rhs) const;
+ };
+
+ static struct char_less_t char_less;
+ static struct wchar_t_less_t wchar_t_less;
+ };
+};
+
+#endif
Added: vmkit/branches/mcjit/include/vmkit/vmkit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/vmkit.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/vmkit.h (added)
+++ vmkit/branches/mcjit/include/vmkit/vmkit.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,100 @@
+#ifndef _VMKIT_VM_H_
+#define _VMKIT_VM_H_
+
+#include "vmkit/util.h"
+#include "vmkit/allocator.h"
+
+#include "llvm/ExecutionEngine/JITEventListener.h"
+
+namespace llvm {
+ class Module;
+ class ExecutionEngine;
+ class DataLayout;
+ class GlobalValue;
+ class Function;
+ class Type;
+ namespace legacy {
+ class FunctionPassManager;
+ }
+ using legacy::FunctionPassManager;
+}
+
+namespace vmkit {
+ class Thread;
+
+ class Safepoint { /* managed with malloc/free */
+ const llvm::Function* _llvmFunction;
+ uintptr_t _address;
+ size_t _nbSlots;
+ uintptr_t _offsets[1];
+
+ void* operator new(size_t unused, size_t nbSlots);
+ Safepoint(const llvm::Function* llvmFunction, uintptr_t address, size_t nbSlots);
+
+ public:
+ static Safepoint* create(const llvm::Function* llvmFunction, uintptr_t address, size_t nbSlots);
+
+ void setAt(size_t idx, uintptr_t offset) { _offsets[idx] = idx; }
+ };
+
+ class ExceptionDescriptor { /* managed with malloc/free */
+ const llvm::Function* _llvmFunction;
+ uintptr_t _point;
+ uintptr_t _landingPad;
+ public:
+ ExceptionDescriptor(const llvm::Function* llvmFunction, uintptr_t point, uintptr_t landingPad);
+ };
+
+ class VMKit : public llvm::JITEventListener {
+ typedef std::map<const char*, llvm::GlobalValue*, Util::char_less_t,
+ StdAllocator<std::pair<const char*, llvm::GlobalValue*> > > MangleMap;
+
+ std::map<uintptr_t, Safepoint*> safepointMap; /* managed with malloc/free */
+ std::map<uintptr_t, ExceptionDescriptor*> exceptionTable; /* managed with malloc/free */
+ MangleMap mangleMap;
+ BumpAllocator* _allocator;
+ llvm::Module* _self;
+ llvm::ExecutionEngine* _ee;
+ llvm::DataLayout* _dataLayout;
+ void* ptrTypeInfo;
+
+ uintptr_t addSymbol(llvm::GlobalValue* gv);
+
+ static void defaultInternalError(const wchar_t* msg, va_list va) __attribute__((noreturn));
+ protected:
+ void* operator new(size_t n, BumpAllocator* allocator);
+
+ public:
+ static void destroy(VMKit* vm);
+
+ VMKit(BumpAllocator* allocator);
+
+ BumpAllocator* allocator() { return _allocator; }
+
+ void vmkitBootstrap(Thread* initialThread, const char* selfBitCodePath);
+
+ llvm::DataLayout* dataLayout() { return _dataLayout; }
+ llvm::Module* self() { return _self; }
+ llvm::ExecutionEngine* ee() { return _ee; }
+ llvm::FunctionPassManager* preparePM(llvm::Module* mod);
+ llvm::Function* getGCRoot(llvm::Module* mod);
+ llvm::Function* introspectFunction(llvm::Module* dest, const char* name);
+ llvm::GlobalValue* introspectGlobalValue(llvm::Module* dest, const char* name);
+ llvm::Type* introspectType(const char* name);
+
+ void log(const wchar_t* msg, ...);
+
+ virtual void internalError(const wchar_t* msg, va_list va) __attribute__((noreturn));
+
+ static void internalError(const wchar_t* msg, ...) __attribute__((noreturn));
+ static void throwException(void* obj) __attribute__((noreturn));
+
+ void NotifyFunctionEmitted(const llvm::Function &F,
+ void *Code,
+ size_t Size,
+ const llvm::JITEventListener::EmittedFunctionDetails &Details);
+
+ };
+};
+
+#endif
Added: vmkit/branches/mcjit/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/Makefile (added)
+++ vmkit/branches/mcjit/lib/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ..
+
+DIRS := vmkit j3
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/lib/j3/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/Makefile (added)
+++ vmkit/branches/mcjit/lib/j3/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ../..
+
+DIRS := vm openjdk
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/lib/j3/openjdk/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/Makefile (added)
+++ vmkit/branches/mcjit/lib/j3/openjdk/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ../../..
+
+MODULE=openjdk
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc (added)
+++ vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,917 @@
+#include "j3/j3object.h"
+#include "j3/j3lib.h"
+#include "j3/j3config.h"
+#include "j3/j3.h"
+#include "j3/j3thread.h"
+#include "j3/j3classloader.h"
+#include "j3/j3class.h"
+#include "jvm.h"
+
+#include <dlfcn.h>
+
+using namespace j3;
+
+#define enterJVM()
+#define leaveJVM()
+
+#define NYI() { fprintf(stderr, "++ not yet implemented: %s ++\n", __PRETTY_FUNCTION__); abort(); }
+
+#define OPENJDK_PATH OPENJDK_HOME"/jre"
+#define OPENJDK_LIBPATH OPENJDK_PATH"/lib"
+#define OPENJDK_RT OPENJDK_LIBPATH"/rt.jar"
+#define OPENJDK_LIB OPENJDK_LIBPATH"/libjava"SHLIBEXT
+
+static const char* rtjar[] = {
+ OPENJDK_LIBPATH"/rt.jar",
+ 0
+};
+
+const char** J3Lib::systemClassesArchives() {
+ return rtjar;
+}
+
+int J3Lib::loadSystemLibraries(std::vector<void*, vmkit::StdAllocator<void*> >* nativeLibraries) {
+ /* JavaRuntimeSupport checks for a symbol defined in this library */
+ void* h0 = dlopen(OPENJDK_LIBPATH"/libinstrument"SHLIBEXT, RTLD_LAZY | RTLD_GLOBAL);
+ void* handle = dlopen(OPENJDK_LIBPATH"/libjava"SHLIBEXT, RTLD_LAZY | RTLD_LOCAL);
+
+ if(!handle || !h0) {
+ fprintf(stderr, "Fatal: unable to find java system library: %s\n", dlerror());
+ abort();
+ }
+
+ nativeLibraries->push_back(handle);
+
+ return 0;
+}
+
+
+/*************************************************************************
+ PART 0
+ ************************************************************************/
+
+jint JNICALL JVM_GetInterfaceVersion(void) { enterJVM(); NYI(); leaveJVM(); }
+
+/*************************************************************************
+ PART 1: Functions for Native Libraries
+ ************************************************************************/
+/*
+ * java.lang.Object
+ */
+jint JNICALL JVM_IHashCode(JNIEnv* env, jobject obj) {
+ enterJVM();
+ uint32_t res = obj ? obj->hashCode() : 0;
+ leaveJVM();
+ return res;
+}
+
+void JNICALL JVM_MonitorWait(JNIEnv* env, jobject obj, jlong ms) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_MonitorNotify(JNIEnv* env, jobject obj) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_MonitorNotifyAll(JNIEnv* env, jobject obj) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_Clone(JNIEnv* env, jobject obj) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.String
+ */
+jstring JNICALL JVM_InternString(JNIEnv* env, jstring str) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.System
+ */
+jlong JNICALL JVM_CurrentTimeMillis(JNIEnv* env, jclass ignored) { enterJVM(); NYI(); leaveJVM(); }
+jlong JNICALL JVM_NanoTime(JNIEnv* env, jclass ignored) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_ArrayCopy(JNIEnv* env, jclass ignored, jobject src, jint src_pos, jobject dst, jint dst_pos, jint length) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_InitProperties(JNIEnv* env, jobject p) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.io.File
+ */
+void JNICALL JVM_OnExit(void (*func)(void)) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Runtime
+ */
+void JNICALL JVM_Exit(jint code) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_Halt(jint code) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_GC(void) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Returns the number of real-time milliseconds that have elapsed since the
+ * least-recently-inspected heap object was last inspected by the garbage
+ * collector.
+ *
+ * For simple stop-the-world collectors this value is just the time
+ * since the most recent collection. For generational collectors it is the
+ * time since the oldest generation was most recently collected. Other
+ * collectors are free to return a pessimistic estimate of the elapsed time, or
+ * simply the time since the last full collection was performed.
+ *
+ * Note that in the presence of reference objects, a given object that is no
+ * longer strongly reachable may have to be inspected multiple times before it
+ * can be reclaimed.
+ */
+jlong JNICALL JVM_MaxObjectInspectionAge(void) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_TraceInstructions(jboolean on) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_TraceMethodCalls(jboolean on) { enterJVM(); NYI(); leaveJVM(); }
+jlong JNICALL JVM_TotalMemory(void) { enterJVM(); NYI(); leaveJVM(); }
+jlong JNICALL JVM_FreeMemory(void) { enterJVM(); NYI(); leaveJVM(); }
+jlong JNICALL JVM_MaxMemory(void) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_ActiveProcessorCount(void) { enterJVM(); NYI(); leaveJVM(); }
+void * JNICALL JVM_LoadLibrary(const char *name) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_UnloadLibrary(void * handle) { enterJVM(); NYI(); leaveJVM(); }
+void * JNICALL JVM_FindLibraryEntry(void *handle, const char *name) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsSupportedJNIVersion(jint version) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Float and java.lang.Double
+ */
+jboolean JNICALL JVM_IsNaN(jdouble d) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Throwable
+ */
+void JNICALL JVM_FillInStackTrace(JNIEnv* env, jobject throwable) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_GetStackTraceDepth(JNIEnv* env, jobject throwable) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_GetStackTraceElement(JNIEnv* env, jobject throwable, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Compiler
+ */
+void JNICALL JVM_InitializeCompiler (JNIEnv* env, jclass compCls) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsSilentCompiler(JNIEnv* env, jclass compCls) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_CompileClass(JNIEnv* env, jclass compCls, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_CompileClasses(JNIEnv* env, jclass cls, jstring jname) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_CompilerCommand(JNIEnv* env, jclass compCls, jobject arg) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_EnableCompiler(JNIEnv* env, jclass compCls) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_DisableCompiler(JNIEnv* env, jclass compCls) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Thread
+ */
+void JNICALL JVM_StartThread(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_StopThread(JNIEnv* env, jobject thread, jobject exception) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsThreadAlive(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SuspendThread(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_ResumeThread(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SetThreadPriority(JNIEnv* env, jobject thread, jint prio) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_Yield(JNIEnv* env, jclass threadClass) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_CurrentThread(JNIEnv* env, jclass threadClass) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_CountStackFrames(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_Interrupt(JNIEnv* env, jobject thread) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsInterrupted(JNIEnv* env, jobject thread, jboolean clearInterrupted) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_HoldsLock(JNIEnv* env, jclass threadClass, jobject obj) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_DumpAllStacks(JNIEnv* env, jclass unused) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetAllThreads(JNIEnv* env, jclass dummy) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SetNativeThreadName(JNIEnv* env, jobject jthread, jstring name) { enterJVM(); NYI(); leaveJVM(); }
+
+/* getStackTrace() and getAllStackTraces() method */
+jobjectArray JNICALL JVM_DumpThreads(JNIEnv* env, jclass threadClass, jobjectArray threads) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.SecurityManager
+ */
+jclass JNICALL JVM_CurrentLoadedClass(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_CurrentClassLoader(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetClassContext(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_ClassDepth(JNIEnv* env, jstring name) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_ClassLoaderDepth(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Package
+ */
+jstring JNICALL JVM_GetSystemPackage(JNIEnv* env, jstring name) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetSystemPackages(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.io.ObjectInputStream
+ */
+jobject JNICALL JVM_AllocateNewObject(JNIEnv* env, jobject obj, jclass currClass, jclass initClass) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_AllocateNewArray(JNIEnv* env, jobject obj, jclass currClass, jint length) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_LatestUserDefinedLoader(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * This function has been deprecated and should not be considered
+ * part of the specified JVM interface.
+ */
+jclass JNICALL
+JVM_LoadClass0(JNIEnv* env, jobject obj, jclass currClass, jstring currClassName) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.reflect.Array
+ */
+jint JNICALL JVM_GetArrayLength(JNIEnv* env, jobject arr) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_GetArrayElement(JNIEnv* env, jobject arr, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jvalue JNICALL JVM_GetPrimitiveArrayElement(JNIEnv* env, jobject arr, jint index, jint wCode) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SetArrayElement(JNIEnv* env, jobject arr, jint index, jobject val) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SetPrimitiveArrayElement(JNIEnv* env, jobject arr, jint index, jvalue v, unsigned char vCode) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_NewArray(JNIEnv* env, jclass eltClass, jint length) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_NewMultiArray(JNIEnv* env, jclass eltClass, jintArray dim) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.Class and java.lang.ClassLoader
+ */
+
+/*
+ * Returns the immediate caller class of the native method invoking
+ * JVM_GetCallerClass. The Method.invoke and other frames due to
+ * reflection machinery are skipped.
+ *
+ * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
+ * to be marked with sun.reflect.CallerSensitive. The JVM will throw
+ * an error if it is not marked propertly.
+ */
+jclass JNICALL JVM_GetCallerClass(JNIEnv* env, int depth) { enterJVM(); NYI(); leaveJVM(); }
+
+
+/*
+ * Find primitive classes
+ * utf: class name
+ */
+jclass JNICALL JVM_FindPrimitiveClass(JNIEnv* env, const char *utf) {
+ enterJVM();
+ J3* vm = J3Thread::get()->vm();
+
+ J3ClassLoader* loader = vm->initialClassLoader;
+ vmkit::Names* names = vm->names();
+ J3Class* res;
+
+ if(!strcmp(utf, "boolean"))
+ res = loader->getClass(names->get(L"java/lang/Boolean"));
+ else if(!strcmp(utf, "byte"))
+ res = loader->getClass(names->get(L"java/lang/Byte"));
+ else if(!strcmp(utf, "char"))
+ res = loader->getClass(names->get(L"java/lang/Character"));
+ else if(!strcmp(utf, "short"))
+ res = loader->getClass(names->get(L"java/lang/Short"));
+ else if(!strcmp(utf, "int"))
+ res = loader->getClass(names->get(L"java/lang/Integer"));
+ else if(!strcmp(utf, "long"))
+ res = loader->getClass(names->get(L"java/lang/Long"));
+ else if(!strcmp(utf, "float"))
+ res = loader->getClass(names->get(L"java/lang/Float"));
+ else if(!strcmp(utf, "double"))
+ res = loader->getClass(names->get(L"java/lang/Double"));
+ else if(!strcmp(utf, "void"))
+ res = loader->getClass(names->get(L"java/lang/Void"));
+ else
+ J3::internalError(L"unsupported primitive: %s", utf);
+
+ leaveJVM();
+ return res->javaClass();
+}
+
+/*
+ * Link the class
+ */
+void JNICALL JVM_ResolveClass(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Find a class from a boot class loader. Returns NULL if class not found.
+ */
+jclass JNICALL JVM_FindClassFromBootLoader(JNIEnv* env, const char *name) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Find a class from a given class loader. Throw ClassNotFoundException
+ * or NoClassDefFoundError depending on the value of the last
+ * argument.
+ */
+jclass JNICALL JVM_FindClassFromClassLoader(JNIEnv* env, const char *name, jboolean init, jobject loader, jboolean throwError) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Find a class from a given class.
+ */
+jclass JNICALL JVM_FindClassFromClass(JNIEnv* env, const char *name, jboolean init, jclass from) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Find a loaded class cached by the VM */
+jclass JNICALL JVM_FindLoadedClass(JNIEnv* env, jobject loader, jstring name) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Define a class */
+jclass JNICALL JVM_DefineClass(JNIEnv* env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Define a class with a source (added in JDK1.5) */
+jclass JNICALL JVM_DefineClassWithSource(JNIEnv* env, const char *name, jobject loader,
+ const jbyte *buf, jsize len, jobject pd,
+ const char *source) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Reflection support functions
+ */
+
+jstring JNICALL JVM_GetClassName(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetClassInterfaces(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_GetClassLoader(JNIEnv* env, jclass cls) {
+ enterJVM();
+ jobject res = J3Class::nativeClass(cls)->loader()->javaClassLoader();
+ leaveJVM();
+ return res;
+}
+
+jboolean JNICALL JVM_IsInterface(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetClassSigners(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_SetClassSigners(JNIEnv* env, jclass cls, jobjectArray signers) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_GetProtectionDomain(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsArrayClass(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_IsPrimitiveClass(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jclass JNICALL JVM_GetComponentType(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_GetClassModifiers(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetDeclaredClasses(JNIEnv* env, jclass ofClass) { enterJVM(); NYI(); leaveJVM(); }
+jclass JNICALL JVM_GetDeclaringClass(JNIEnv* env, jclass ofClass) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Generics support (JDK 1.5) */
+jstring JNICALL JVM_GetClassSignature(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Annotations support (JDK 1.5) */
+jbyteArray JNICALL JVM_GetClassAnnotations(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Type use annotations support (JDK 1.8) */
+jbyteArray JNICALL JVM_GetClassTypeAnnotations(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+
+/*
+ * New (JDK 1.4) reflection implementation
+ */
+
+jobjectArray JNICALL JVM_GetClassDeclaredMethods(JNIEnv* env, jclass ofClass, jboolean publicOnly) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetClassDeclaredFields(JNIEnv* env, jclass ofClass, jboolean publicOnly) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_GetClassDeclaredConstructors(JNIEnv* env, jclass ofClass, jboolean publicOnly) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Differs from JVM_GetClassModifiers in treatment of inner classes.
+ This returns the access flags for the class as specified in the
+ class file rather than searching the InnerClasses attribute (if
+ present) to find the source-level access flags. Only the values of
+ the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+ valid. */
+jint JNICALL JVM_GetClassAccessFlags(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+/* The following two reflection routines are still needed due to startup time issues */
+/*
+ * java.lang.reflect.Method
+ */
+jobject JNICALL JVM_InvokeMethod(JNIEnv* env, jobject method, jobject obj, jobjectArray args0) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.reflect.Constructor
+ */
+jobject JNICALL JVM_NewInstanceFromConstructor(JNIEnv* env, jobject c, jobjectArray args0) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
+ */
+
+jobject JNICALL JVM_GetClassConstantPool(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_ConstantPoolGetSize(JNIEnv* env, jobject unused, jobject jcpool) { enterJVM(); NYI(); leaveJVM(); }
+jclass JNICALL JVM_ConstantPoolGetClassAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_ConstantPoolGetMethodAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_ConstantPoolGetFieldAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_ConstantPoolGetIntAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jlong JNICALL JVM_ConstantPoolGetLongAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jfloat JNICALL JVM_ConstantPoolGetFloatAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jdouble JNICALL JVM_ConstantPoolGetDoubleAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jstring JNICALL JVM_ConstantPoolGetStringAt(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+jstring JNICALL JVM_ConstantPoolGetUTF8At(JNIEnv* env, jobject unused, jobject jcpool, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Parameter reflection
+ */
+
+jobjectArray JNICALL JVM_GetMethodParameters(JNIEnv* env, jobject method) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.security.*
+ */
+
+jobject JNICALL JVM_DoPrivileged(JNIEnv* env, jclass cls, jobject action, jobject context, jboolean wrapException) {
+ enterJVM();
+
+ // For now, we don't do anything special,
+ // just call the requested 'run()' method...
+ jmethodID mid = env->GetMethodID(env->GetObjectClass(action), "run", "()Ljava/lang/Object;");
+ jobject res = env->CallObjectMethod(action, mid);
+ leaveJVM();
+ return res;
+}
+
+jobject JNICALL JVM_GetInheritedAccessControlContext(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+jobject JNICALL JVM_GetStackAccessControlContext(JNIEnv* env, jclass cls) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Signal support, used to implement the shutdown sequence. Every VM must
+ * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
+ * (^C) and the latter for external termination (kill, system shutdown, etc.).
+ * Other platform-dependent signal values may also be supported.
+ */
+
+void * JNICALL JVM_RegisterSignal(jint sig, void *handler) { enterJVM(); NYI(); leaveJVM(); }
+jboolean JNICALL JVM_RaiseSignal(jint sig) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_FindSignal(const char *name) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Retrieve the assertion directives for the specified class.
+ */
+jboolean JNICALL JVM_DesiredAssertionStatus(JNIEnv* env, jclass unused, jclass cls) {
+ enterJVM();
+ /* TODO: take into account the class name and its package (see j3options) */
+ jboolean res = J3Thread::get()->vm()->options()->assertionsEnabled ? JNI_TRUE : JNI_FALSE;
+ leaveJVM();
+ return res;
+}
+
+/*
+ * Retrieve the assertion directives from the VM.
+ */
+jobject JNICALL JVM_AssertionStatusDirectives(JNIEnv* env, jclass unused) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.util.concurrent.atomic.AtomicLong
+ */
+jboolean JNICALL JVM_SupportsCX8(void) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Get the version number the JVM was built with
+ */
+jint JNICALL JVM_DTraceGetVersion(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Register new probe with given signature, return global handle
+ *
+ * The version passed in is the version that the library code was
+ * built with.
+ */
+jlong JNICALL JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
+ jint providers_count, JVM_DTraceProvider* providers) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Check JSDT probe
+ */
+jboolean JNICALL JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Destroy custom DOF
+ */
+void JNICALL JVM_DTraceDispose(JNIEnv* env, jlong activation_handle) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Check to see if DTrace is supported by OS
+ */
+jboolean JNICALL JVM_DTraceIsSupported(JNIEnv* env) { enterJVM(); NYI(); leaveJVM(); }
+
+/*************************************************************************
+ PART 2: Support for the Verifier and Class File Format Checker
+ ************************************************************************/
+/*
+ * Return the class name in UTF format. The result is valid
+ * until JVM_ReleaseUTf is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetClassNameUTF(JNIEnv* env, jclass cb) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the constant pool types in the buffer provided by "types."
+ */
+void JNICALL JVM_GetClassCPTypes(JNIEnv* env, jclass cb, unsigned char *types) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the number of Constant Pool entries.
+ */
+jint JNICALL JVM_GetClassCPEntriesCount(JNIEnv* env, jclass cb) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the number of *declared* fields or methods.
+ */
+jint JNICALL JVM_GetClassFieldsCount(JNIEnv* env, jclass cb) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_GetClassMethodsCount(JNIEnv* env, jclass cb) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the CP indexes of exceptions raised by a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+void JNICALL JVM_GetMethodIxExceptionIndexes(JNIEnv* env, jclass cb, jint method_index, unsigned short *exceptions) { enterJVM(); NYI(); leaveJVM(); }
+/*
+ * Returns the number of exceptions raised by a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxExceptionsCount(JNIEnv* env, jclass cb, jint method_index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the byte code sequence of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+void JNICALL JVM_GetMethodIxByteCode(JNIEnv* env, jclass cb, jint method_index, unsigned char *code) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the length of the byte code sequence of a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxByteCodeLength(JNIEnv* env, jclass cb, jint method_index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the exception table entry at entry_index of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+void JNICALL JVM_GetMethodIxExceptionTableEntry(JNIEnv* env, jclass cb, jint method_index, jint entry_index,
+ JVM_ExceptionTableEntryType *entry) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the length of the exception table of a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxExceptionTableLength(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the modifiers of a given field.
+ * The field is identified by field_index.
+ */
+jint JNICALL JVM_GetFieldIxModifiers(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the modifiers of a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxModifiers(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the number of local variables of a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxLocalsCount(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the number of arguments (including this pointer) of a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxArgsSize(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the maximum amount of stack (in words) used by a given method.
+ * The method is identified by method_index.
+ */
+jint JNICALL JVM_GetMethodIxMaxStack(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Is a given method a constructor.
+ * The method is identified by method_index.
+ */
+jboolean JNICALL JVM_IsConstructorIx(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Is the given method generated by the VM.
+ * The method is identified by method_index.
+ */
+jboolean JNICALL JVM_IsVMGeneratedMethodIx(JNIEnv* env, jclass cb, int index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the name of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetMethodIxNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the signature of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetMethodIxSignatureUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the name of the field refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPFieldNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the name of the method refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPMethodNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the signature of the method refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPMethodSignatureUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the signature of the field refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPFieldSignatureUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPClassNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The constant pool entry must refer to a CONSTANT_Fieldref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPFieldClassNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The constant pool entry must refer to CONSTANT_Methodref or
+ * CONSTANT_InterfaceMethodref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+const char * JNICALL JVM_GetCPMethodClassNameUTF(JNIEnv* env, jclass cb, jint index) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the modifiers of a field in calledClass. The field is
+ * referred to in class cb at constant pool entry index.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ *
+ * Returns -1 if the field does not exist in calledClass.
+ */
+jint JNICALL JVM_GetCPFieldModifiers(JNIEnv* env, jclass cb, int index, jclass calledClass) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the modifiers of a method in calledClass. The method is
+ * referred to in class cb at constant pool entry index.
+ *
+ * Returns -1 if the method does not exist in calledClass.
+ */
+jint JNICALL JVM_GetCPMethodModifiers(JNIEnv* env, jclass cb, int index, jclass calledClass) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Releases the UTF string obtained from the VM.
+ */
+void JNICALL JVM_ReleaseUTF(const char *utf) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Compare if two classes are in the same package.
+ */
+jboolean JNICALL JVM_IsSameClassPackage(JNIEnv* env, jclass class1, jclass class2) { enterJVM(); NYI(); leaveJVM(); }
+
+/*************************************************************************
+ PART 3: I/O and Network Support
+ ************************************************************************/
+
+/* Write a string into the given buffer, in the platform's local encoding,
+ * that describes the most recent system-level error to occur in this thread.
+ * Return the length of the string or zero if no error occurred.
+ */
+jint JNICALL JVM_GetLastErrorString(char *buf, int len) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Convert a pathname into native format. This function does syntactic
+ * cleanup, such as removing redundant separator characters. It modifies
+ * the given pathname string in place.
+ */
+char * JNICALL JVM_NativePath(char *) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Open a file descriptor. This function returns a negative error code
+ * on error, and a non-negative integer that is the file descriptor on
+ * success.
+ */
+jint JNICALL JVM_Open(const char *fname, jint flags, jint mode) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Close a file descriptor. This function returns -1 on error, and 0
+ * on success.
+ *
+ * fd the file descriptor to close.
+ */
+jint JNICALL JVM_Close(jint fd) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Read data from a file decriptor into a char array.
+ *
+ * fd the file descriptor to read from.
+ * buf the buffer where to put the read data.
+ * nbytes the number of bytes to read.
+ *
+ * This function returns -1 on error, and 0 on success.
+ */
+jint JNICALL JVM_Read(jint fd, char *buf, jint nbytes) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Write data from a char array to a file decriptor.
+ *
+ * fd the file descriptor to read from.
+ * buf the buffer from which to fetch the data.
+ * nbytes the number of bytes to write.
+ *
+ * This function returns -1 on error, and 0 on success.
+ */
+jint JNICALL JVM_Write(jint fd, char *buf, jint nbytes) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns the number of bytes available for reading from a given file
+ * descriptor
+ */
+jint JNICALL JVM_Available(jint fd, jlong *pbytes) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Move the file descriptor pointer from whence by offset.
+ *
+ * fd the file descriptor to move.
+ * offset the number of bytes to move it by.
+ * whence the start from where to move it.
+ *
+ * This function returns the resulting pointer location.
+ */
+jlong JNICALL JVM_Lseek(jint fd, jlong offset, jint whence) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Set the length of the file associated with the given descriptor to the given
+ * length. If the new length is longer than the current length then the file
+ * is extended; the contents of the extended portion are not defined. The
+ * value of the file pointer is undefined after this procedure returns.
+ */
+jint JNICALL JVM_SetLength(jint fd, jlong length) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Synchronize the file descriptor's in memory state with that of the
+ * physical device. Return of -1 is an error, 0 is OK.
+ */
+jint JNICALL JVM_Sync(jint fd) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Networking library support
+ */
+
+jint JNICALL JVM_InitializeSocketLibrary(void) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Socket(jint domain, jint type, jint protocol) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_SocketClose(jint fd) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_SocketShutdown(jint fd, jint howto) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Recv(jint fd, char *buf, jint nBytes, jint flags) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Send(jint fd, char *buf, jint nBytes, jint flags) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Timeout(int fd, long timeout) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Listen(jint fd, jint count) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Connect(jint fd, struct sockaddr *him, jint len) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Bind(jint fd, struct sockaddr *him, jint len) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_Accept(jint fd, struct sockaddr *him, jint *len) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_SocketAvailable(jint fd, jint *result) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_GetSockName(jint fd, struct sockaddr *him, int *len) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen) { enterJVM(); NYI(); leaveJVM(); }
+int JNICALL JVM_GetHostName(char* name, int namelen) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * The standard printing functions supported by the Java VM. (Should they
+ * be renamed to JVM_* in the future?
+ */
+
+/*
+ * BE CAREFUL! The following functions do not implement the
+ * full feature set of standard C printf formats.
+ */
+int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list va) {
+ return vsnprintf(str, count, fmt, va);
+}
+
+int jio_snprintf(char *str, size_t count, const char *fmt, ...) {
+ va_list va;
+ va_start(va, fmt);
+ int res = jio_vsnprintf(str, count, fmt, va);
+ va_end(va);
+ return res;
+}
+
+int jio_fprintf(FILE *f, const char *fmt, ...) {
+ va_list va;
+ va_start(va, fmt);
+ int res = jio_vfprintf(f, fmt, va);
+ va_end(va);
+ return res;
+}
+
+int jio_vfprintf(FILE *f, const char *fmt, va_list va) {
+ return vfprintf(f, fmt, va);
+}
+
+
+void * JNICALL JVM_RawMonitorCreate(void) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_RawMonitorDestroy(void *mon) { enterJVM(); NYI(); leaveJVM(); }
+jint JNICALL JVM_RawMonitorEnter(void *mon) { enterJVM(); NYI(); leaveJVM(); }
+void JNICALL JVM_RawMonitorExit(void *mon) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * java.lang.management support
+ */
+void* JNICALL JVM_GetManagement(jint version) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * com.sun.tools.attach.VirtualMachine support
+ *
+ * Initialize the agent properties with the properties maintained in the VM.
+ */
+jobject JNICALL JVM_InitAgentProperties(JNIEnv* env, jobject agent_props) { enterJVM(); NYI(); leaveJVM(); }
+
+/* Generics reflection support.
+ *
+ * Returns information about the given class's EnclosingMethod
+ * attribute, if present, or null if the class had no enclosing
+ * method.
+ *
+ * If non-null, the returned array contains three elements. Element 0
+ * is the java.lang.Class of which the enclosing method is a member,
+ * and elements 1 and 2 are the java.lang.Strings for the enclosing
+ * method's name and descriptor, respectively.
+ */
+jobjectArray JNICALL JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns an array of the threadStatus values representing the
+ * given Java thread state. Returns NULL if the VM version is
+ * incompatible with the JDK or doesn't support the given
+ * Java thread state.
+ */
+jintArray JNICALL JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState) { enterJVM(); NYI(); leaveJVM(); }
+
+/*
+ * Returns an array of the substate names representing the
+ * given Java thread state. Returns NULL if the VM version is
+ * incompatible with the JDK or the VM doesn't support
+ * the given Java thread state.
+ * values must be the jintArray returned from JVM_GetThreadStateValues
+ * and javaThreadState.
+ */
+jobjectArray JNICALL JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values) { enterJVM(); NYI(); leaveJVM(); }
+
+/* =========================================================================
+ * The following defines a private JVM interface that the JDK can query
+ * for the JVM version and capabilities. sun.misc.Version defines
+ * the methods for getting the VM version and its capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JVM_GetVersionInfo and Abstract_VM_Version class
+ * SDK: Version class
+ *
+ * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
+ * JVM to query for the JDK version and capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JDK_Version class
+ * SDK: JDK_GetVersionInfo0
+ *
+ * ==========================================================================
+ */
+void JNICALL JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size) { enterJVM(); NYI(); leaveJVM(); }
Added: vmkit/branches/mcjit/lib/j3/openjdk/jvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/jvm.h?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/jvm.h (added)
+++ vmkit/branches/mcjit/lib/j3/openjdk/jvm.h Mon Nov 25 03:27:09 2013
@@ -0,0 +1,1505 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JVM_H_
+#define _JAVASOFT_JVM_H_
+
+#include <sys/stat.h>
+
+#include "jni.h"
+//#include "jvm_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This file contains additional functions exported from the VM.
+ * These functions are complementary to the standard JNI support.
+ * There are three parts to this file:
+ *
+ * First, this file contains the VM-related functions needed by native
+ * libraries in the standard Java API. For example, the java.lang.Object
+ * class needs VM-level functions that wait for and notify monitors.
+ *
+ * Second, this file contains the functions and constant definitions
+ * needed by the byte code verifier and class file format checker.
+ * These functions allow the verifier and format checker to be written
+ * in a VM-independent way.
+ *
+ * Third, this file contains various I/O and nerwork operations needed
+ * by the standard Java I/O and network APIs.
+ */
+
+/*
+ * Bump the version number when either of the following happens:
+ *
+ * 1. There is a change in JVM_* functions.
+ *
+ * 2. There is a change in the contract between VM and Java classes.
+ * For example, if the VM relies on a new private field in Thread
+ * class.
+ */
+
+#define JVM_INTERFACE_VERSION 4
+
+JNIEXPORT jint JNICALL
+JVM_GetInterfaceVersion(void);
+
+/*************************************************************************
+ PART 1: Functions for Native Libraries
+ ************************************************************************/
+/*
+ * java.lang.Object
+ */
+JNIEXPORT jint JNICALL
+JVM_IHashCode(JNIEnv *env, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
+
+JNIEXPORT void JNICALL
+JVM_MonitorNotify(JNIEnv *env, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
+
+JNIEXPORT jobject JNICALL
+JVM_Clone(JNIEnv *env, jobject obj);
+
+/*
+ * java.lang.String
+ */
+JNIEXPORT jstring JNICALL
+JVM_InternString(JNIEnv *env, jstring str);
+
+/*
+ * java.lang.System
+ */
+JNIEXPORT jlong JNICALL
+JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
+
+JNIEXPORT jlong JNICALL
+JVM_NanoTime(JNIEnv *env, jclass ignored);
+
+JNIEXPORT void JNICALL
+JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
+ jobject dst, jint dst_pos, jint length);
+
+JNIEXPORT jobject JNICALL
+JVM_InitProperties(JNIEnv *env, jobject p);
+
+/*
+ * java.io.File
+ */
+JNIEXPORT void JNICALL
+JVM_OnExit(void (*func)(void));
+
+/*
+ * java.lang.Runtime
+ */
+JNIEXPORT void JNICALL
+JVM_Exit(jint code);
+
+JNIEXPORT void JNICALL
+JVM_Halt(jint code);
+
+JNIEXPORT void JNICALL
+JVM_GC(void);
+
+/* Returns the number of real-time milliseconds that have elapsed since the
+ * least-recently-inspected heap object was last inspected by the garbage
+ * collector.
+ *
+ * For simple stop-the-world collectors this value is just the time
+ * since the most recent collection. For generational collectors it is the
+ * time since the oldest generation was most recently collected. Other
+ * collectors are free to return a pessimistic estimate of the elapsed time, or
+ * simply the time since the last full collection was performed.
+ *
+ * Note that in the presence of reference objects, a given object that is no
+ * longer strongly reachable may have to be inspected multiple times before it
+ * can be reclaimed.
+ */
+JNIEXPORT jlong JNICALL
+JVM_MaxObjectInspectionAge(void);
+
+JNIEXPORT void JNICALL
+JVM_TraceInstructions(jboolean on);
+
+JNIEXPORT void JNICALL
+JVM_TraceMethodCalls(jboolean on);
+
+JNIEXPORT jlong JNICALL
+JVM_TotalMemory(void);
+
+JNIEXPORT jlong JNICALL
+JVM_FreeMemory(void);
+
+JNIEXPORT jlong JNICALL
+JVM_MaxMemory(void);
+
+JNIEXPORT jint JNICALL
+JVM_ActiveProcessorCount(void);
+
+JNIEXPORT void * JNICALL
+JVM_LoadLibrary(const char *name);
+
+JNIEXPORT void JNICALL
+JVM_UnloadLibrary(void * handle);
+
+JNIEXPORT void * JNICALL
+JVM_FindLibraryEntry(void *handle, const char *name);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsSupportedJNIVersion(jint version);
+
+/*
+ * java.lang.Float and java.lang.Double
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsNaN(jdouble d);
+
+/*
+ * java.lang.Throwable
+ */
+JNIEXPORT void JNICALL
+JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
+
+JNIEXPORT jint JNICALL
+JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
+
+JNIEXPORT jobject JNICALL
+JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
+
+/*
+ * java.lang.Compiler
+ */
+JNIEXPORT void JNICALL
+JVM_InitializeCompiler (JNIEnv *env, jclass compCls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsSilentCompiler(JNIEnv *env, jclass compCls);
+
+JNIEXPORT jboolean JNICALL
+JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);
+
+JNIEXPORT jobject JNICALL
+JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);
+
+JNIEXPORT void JNICALL
+JVM_EnableCompiler(JNIEnv *env, jclass compCls);
+
+JNIEXPORT void JNICALL
+JVM_DisableCompiler(JNIEnv *env, jclass compCls);
+
+/*
+ * java.lang.Thread
+ */
+JNIEXPORT void JNICALL
+JVM_StartThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsThreadAlive(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_SuspendThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_ResumeThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
+
+JNIEXPORT void JNICALL
+JVM_Yield(JNIEnv *env, jclass threadClass);
+
+JNIEXPORT void JNICALL
+JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);
+
+JNIEXPORT jobject JNICALL
+JVM_CurrentThread(JNIEnv *env, jclass threadClass);
+
+JNIEXPORT jint JNICALL
+JVM_CountStackFrames(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_Interrupt(JNIEnv *env, jobject thread);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);
+
+JNIEXPORT jboolean JNICALL
+JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_DumpAllStacks(JNIEnv *env, jclass unused);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetAllThreads(JNIEnv *env, jclass dummy);
+
+JNIEXPORT void JNICALL
+JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);
+
+/* getStackTrace() and getAllStackTraces() method */
+JNIEXPORT jobjectArray JNICALL
+JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
+
+/*
+ * java.lang.SecurityManager
+ */
+JNIEXPORT jclass JNICALL
+JVM_CurrentLoadedClass(JNIEnv *env);
+
+JNIEXPORT jobject JNICALL
+JVM_CurrentClassLoader(JNIEnv *env);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassContext(JNIEnv *env);
+
+JNIEXPORT jint JNICALL
+JVM_ClassDepth(JNIEnv *env, jstring name);
+
+JNIEXPORT jint JNICALL
+JVM_ClassLoaderDepth(JNIEnv *env);
+
+/*
+ * java.lang.Package
+ */
+JNIEXPORT jstring JNICALL
+JVM_GetSystemPackage(JNIEnv *env, jstring name);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetSystemPackages(JNIEnv *env);
+
+/*
+ * java.io.ObjectInputStream
+ */
+JNIEXPORT jobject JNICALL
+JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass,
+ jclass initClass);
+
+JNIEXPORT jobject JNICALL
+JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass,
+ jint length);
+
+JNIEXPORT jobject JNICALL
+JVM_LatestUserDefinedLoader(JNIEnv *env);
+
+/*
+ * This function has been deprecated and should not be considered
+ * part of the specified JVM interface.
+ */
+JNIEXPORT jclass JNICALL
+JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass,
+ jstring currClassName);
+
+/*
+ * java.lang.reflect.Array
+ */
+JNIEXPORT jint JNICALL
+JVM_GetArrayLength(JNIEnv *env, jobject arr);
+
+JNIEXPORT jobject JNICALL
+JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
+
+JNIEXPORT jvalue JNICALL
+JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
+
+JNIEXPORT void JNICALL
+JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
+
+JNIEXPORT void JNICALL
+JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
+ unsigned char vCode);
+
+JNIEXPORT jobject JNICALL
+JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
+
+JNIEXPORT jobject JNICALL
+JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
+
+/*
+ * java.lang.Class and java.lang.ClassLoader
+ */
+
+#define JVM_DEPTH -1
+
+/*
+ * Returns the immediate caller class of the native method invoking
+ * JVM_GetCallerClass. The Method.invoke and other frames due to
+ * reflection machinery are skipped.
+ *
+ * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
+ * to be marked with sun.reflect.CallerSensitive. The JVM will throw
+ * an error if it is not marked propertly.
+ */
+JNIEXPORT jclass JNICALL
+JVM_GetCallerClass(JNIEnv *env, int depth);
+
+
+/*
+ * Find primitive classes
+ * utf: class name
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
+
+/*
+ * Link the class
+ */
+JNIEXPORT void JNICALL
+JVM_ResolveClass(JNIEnv *env, jclass cls);
+
+/*
+ * Find a class from a boot class loader. Returns NULL if class not found.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
+
+/*
+ * Find a class from a given class loader. Throw ClassNotFoundException
+ * or NoClassDefFoundError depending on the value of the last
+ * argument.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
+ jobject loader, jboolean throwError);
+
+/*
+ * Find a class from a given class.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
+ jclass from);
+
+/* Find a loaded class cached by the VM */
+JNIEXPORT jclass JNICALL
+JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
+
+/* Define a class */
+JNIEXPORT jclass JNICALL
+JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+ jsize len, jobject pd);
+
+/* Define a class with a source (added in JDK1.5) */
+JNIEXPORT jclass JNICALL
+JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
+ const jbyte *buf, jsize len, jobject pd,
+ const char *source);
+
+/*
+ * Reflection support functions
+ */
+
+JNIEXPORT jstring JNICALL
+JVM_GetClassName(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobject JNICALL
+JVM_GetClassLoader(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsInterface(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassSigners(JNIEnv *env, jclass cls);
+
+JNIEXPORT void JNICALL
+JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
+
+JNIEXPORT jobject JNICALL
+JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsArrayClass(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
+
+JNIEXPORT jclass JNICALL
+JVM_GetComponentType(JNIEnv *env, jclass cls);
+
+JNIEXPORT jint JNICALL
+JVM_GetClassModifiers(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
+
+JNIEXPORT jclass JNICALL
+JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
+
+/* Generics support (JDK 1.5) */
+JNIEXPORT jstring JNICALL
+JVM_GetClassSignature(JNIEnv *env, jclass cls);
+
+/* Annotations support (JDK 1.5) */
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
+
+/* Type use annotations support (JDK 1.8) */
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
+
+
+/*
+ * New (JDK 1.4) reflection implementation
+ */
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+/* Differs from JVM_GetClassModifiers in treatment of inner classes.
+ This returns the access flags for the class as specified in the
+ class file rather than searching the InnerClasses attribute (if
+ present) to find the source-level access flags. Only the values of
+ the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+ valid. */
+JNIEXPORT jint JNICALL
+JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
+
+/* The following two reflection routines are still needed due to startup time issues */
+/*
+ * java.lang.reflect.Method
+ */
+JNIEXPORT jobject JNICALL
+JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
+
+/*
+ * java.lang.reflect.Constructor
+ */
+JNIEXPORT jobject JNICALL
+JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
+
+/*
+ * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
+ */
+
+JNIEXPORT jobject JNICALL
+JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
+(JNIEnv *env, jobject unused, jobject jcpool);
+
+JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+/*
+ * Parameter reflection
+ */
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetMethodParameters(JNIEnv *env, jobject method);
+
+/*
+ * java.security.*
+ */
+
+JNIEXPORT jobject JNICALL
+JVM_DoPrivileged(JNIEnv *env, jclass cls,
+ jobject action, jobject context, jboolean wrapException);
+
+JNIEXPORT jobject JNICALL
+JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobject JNICALL
+JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
+
+/*
+ * Signal support, used to implement the shutdown sequence. Every VM must
+ * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
+ * (^C) and the latter for external termination (kill, system shutdown, etc.).
+ * Other platform-dependent signal values may also be supported.
+ */
+
+JNIEXPORT void * JNICALL
+JVM_RegisterSignal(jint sig, void *handler);
+
+JNIEXPORT jboolean JNICALL
+JVM_RaiseSignal(jint sig);
+
+JNIEXPORT jint JNICALL
+JVM_FindSignal(const char *name);
+
+/*
+ * Retrieve the assertion directives for the specified class.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
+
+/*
+ * Retrieve the assertion directives from the VM.
+ */
+JNIEXPORT jobject JNICALL
+JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
+
+/*
+ * java.util.concurrent.atomic.AtomicLong
+ */
+JNIEXPORT jboolean JNICALL
+JVM_SupportsCX8(void);
+
+/*
+ * com.sun.dtrace.jsdt support
+ */
+
+#define JVM_TRACING_DTRACE_VERSION 1
+
+/*
+ * Structure to pass one probe description to JVM
+ */
+typedef struct {
+ jmethodID method;
+ jstring function;
+ jstring name;
+ void* reserved[4]; // for future use
+} JVM_DTraceProbe;
+
+/**
+ * Encapsulates the stability ratings for a DTrace provider field
+ */
+typedef struct {
+ jint nameStability;
+ jint dataStability;
+ jint dependencyClass;
+} JVM_DTraceInterfaceAttributes;
+
+/*
+ * Structure to pass one provider description to JVM
+ */
+typedef struct {
+ jstring name;
+ JVM_DTraceProbe* probes;
+ jint probe_count;
+ JVM_DTraceInterfaceAttributes providerAttributes;
+ JVM_DTraceInterfaceAttributes moduleAttributes;
+ JVM_DTraceInterfaceAttributes functionAttributes;
+ JVM_DTraceInterfaceAttributes nameAttributes;
+ JVM_DTraceInterfaceAttributes argsAttributes;
+ void* reserved[4]; // for future use
+} JVM_DTraceProvider;
+
+/*
+ * Get the version number the JVM was built with
+ */
+JNIEXPORT jint JNICALL
+JVM_DTraceGetVersion(JNIEnv* env);
+
+/*
+ * Register new probe with given signature, return global handle
+ *
+ * The version passed in is the version that the library code was
+ * built with.
+ */
+JNIEXPORT jlong JNICALL
+JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
+ jint providers_count, JVM_DTraceProvider* providers);
+
+/*
+ * Check JSDT probe
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
+
+/*
+ * Destroy custom DOF
+ */
+JNIEXPORT void JNICALL
+JVM_DTraceDispose(JNIEnv* env, jlong activation_handle);
+
+/*
+ * Check to see if DTrace is supported by OS
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DTraceIsSupported(JNIEnv* env);
+
+/*************************************************************************
+ PART 2: Support for the Verifier and Class File Format Checker
+ ************************************************************************/
+/*
+ * Return the class name in UTF format. The result is valid
+ * until JVM_ReleaseUTf is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the constant pool types in the buffer provided by "types."
+ */
+JNIEXPORT void JNICALL
+JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
+
+/*
+ * Returns the number of Constant Pool entries.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the number of *declared* fields or methods.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
+
+JNIEXPORT jint JNICALL
+JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the CP indexes of exceptions raised by a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
+ unsigned short *exceptions);
+/*
+ * Returns the number of exceptions raised by a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
+
+/*
+ * Returns the byte code sequence of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
+ unsigned char *code);
+
+/*
+ * Returns the length of the byte code sequence of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
+
+/*
+ * A structure used to a capture exception table entry in a Java method.
+ */
+typedef struct {
+ jint start_pc;
+ jint end_pc;
+ jint handler_pc;
+ jint catchType;
+} JVM_ExceptionTableEntryType;
+
+/*
+ * Returns the exception table entry at entry_index of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
+ jint entry_index,
+ JVM_ExceptionTableEntryType *entry);
+
+/*
+ * Returns the length of the exception table of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the modifiers of a given field.
+ * The field is identified by field_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the modifiers of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the number of local variables of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the number of arguments (including this pointer) of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the maximum amount of stack (in words) used by a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Is a given method a constructor.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Is the given method generated by the VM.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the name of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the name of the field refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the name of the method refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of the method refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of the field refered to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The constant pool entry must refer to a CONSTANT_Fieldref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name refered to at a given constant pool index.
+ *
+ * The constant pool entry must refer to CONSTANT_Methodref or
+ * CONSTANT_InterfaceMethodref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the modifiers of a field in calledClass. The field is
+ * referred to in class cb at constant pool entry index.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ *
+ * Returns -1 if the field does not exist in calledClass.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
+
+/*
+ * Returns the modifiers of a method in calledClass. The method is
+ * referred to in class cb at constant pool entry index.
+ *
+ * Returns -1 if the method does not exist in calledClass.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
+
+/*
+ * Releases the UTF string obtained from the VM.
+ */
+JNIEXPORT void JNICALL
+JVM_ReleaseUTF(const char *utf);
+
+/*
+ * Compare if two classes are in the same package.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
+
+/* Get classfile constants */
+#include "classfile_constants.h"
+
+/*
+ * A function defined by the byte-code verifier and called by the VM.
+ * This is not a function implemented in the VM.
+ *
+ * Returns JNI_FALSE if verification fails. A detailed error message
+ * will be places in msg_buf, whose length is specified by buf_len.
+ */
+typedef jboolean (*verifier_fn_t)(JNIEnv *env,
+ jclass cb,
+ char * msg_buf,
+ jint buf_len);
+
+
+/*
+ * Support for a VM-independent class format checker.
+ */
+typedef struct {
+ unsigned long code; /* byte code */
+ unsigned long excs; /* exceptions */
+ unsigned long etab; /* catch table */
+ unsigned long lnum; /* line number */
+ unsigned long lvar; /* local vars */
+} method_size_info;
+
+typedef struct {
+ unsigned int constants; /* constant pool */
+ unsigned int fields;
+ unsigned int methods;
+ unsigned int interfaces;
+ unsigned int fields2; /* number of static 2-word fields */
+ unsigned int innerclasses; /* # of records in InnerClasses attr */
+
+ method_size_info clinit; /* memory used in clinit */
+ method_size_info main; /* used everywhere else */
+} class_size_info;
+
+/*
+ * Functions defined in libjava.so to perform string conversions.
+ *
+ */
+
+typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
+
+typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
+
+/* This is the function defined in libjava.so that performs class
+ * format checks. This functions fills in size information about
+ * the class file and returns:
+ *
+ * 0: good
+ * -1: out of memory
+ * -2: bad format
+ * -3: unsupported version
+ * -4: bad class name
+ */
+
+typedef jint (*check_format_fn_t)(char *class_name,
+ unsigned char *data,
+ unsigned int data_size,
+ class_size_info *class_size,
+ char *message_buffer,
+ jint buffer_length,
+ jboolean measure_only,
+ jboolean check_relaxed);
+
+#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_SUPER | \
+ JVM_ACC_INTERFACE | \
+ JVM_ACC_ABSTRACT | \
+ JVM_ACC_ANNOTATION | \
+ JVM_ACC_ENUM | \
+ JVM_ACC_SYNTHETIC)
+
+#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_PRIVATE | \
+ JVM_ACC_PROTECTED | \
+ JVM_ACC_STATIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_VOLATILE | \
+ JVM_ACC_TRANSIENT | \
+ JVM_ACC_ENUM | \
+ JVM_ACC_SYNTHETIC)
+
+#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_PRIVATE | \
+ JVM_ACC_PROTECTED | \
+ JVM_ACC_STATIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_SYNCHRONIZED | \
+ JVM_ACC_BRIDGE | \
+ JVM_ACC_VARARGS | \
+ JVM_ACC_NATIVE | \
+ JVM_ACC_ABSTRACT | \
+ JVM_ACC_STRICT | \
+ JVM_ACC_SYNTHETIC)
+
+/*
+ * This is the function defined in libjava.so to perform path
+ * canonicalization. VM call this function before opening jar files
+ * to load system classes.
+ *
+ */
+
+typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
+
+/*************************************************************************
+ PART 3: I/O and Network Support
+ ************************************************************************/
+
+/* Note that the JVM IO functions are expected to return JVM_IO_ERR
+ * when there is any kind of error. The caller can then use the
+ * platform specific support (e.g., errno) to get the detailed
+ * error info. The JVM_GetLastErrorString procedure may also be used
+ * to obtain a descriptive error string.
+ */
+#define JVM_IO_ERR (-1)
+
+/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO
+ * operation has been disrupted by Thread.interrupt. There are a
+ * number of technical difficulties related to interruptible IO that
+ * need to be solved. For example, most existing programs do not handle
+ * InterruptedIOExceptions specially, they simply treat those as any
+ * IOExceptions, which typically indicate fatal errors.
+ *
+ * There are also two modes of operation for interruptible IO. In the
+ * resumption mode, an interrupted IO operation is guaranteed not to
+ * have any side-effects, and can be restarted. In the termination mode,
+ * an interrupted IO operation corrupts the underlying IO stream, so
+ * that the only reasonable operation on an interrupted stream is to
+ * close that stream. The resumption mode seems to be impossible to
+ * implement on Win32 and Solaris. Implementing the termination mode is
+ * easier, but it's not clear that's the right semantics.
+ *
+ * Interruptible IO is not supported on Win32.It can be enabled/disabled
+ * using a compile-time flag on Solaris. Third-party JVM ports do not
+ * need to implement interruptible IO.
+ */
+#define JVM_IO_INTR (-2)
+
+/* Write a string into the given buffer, in the platform's local encoding,
+ * that describes the most recent system-level error to occur in this thread.
+ * Return the length of the string or zero if no error occurred.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetLastErrorString(char *buf, int len);
+
+/*
+ * Convert a pathname into native format. This function does syntactic
+ * cleanup, such as removing redundant separator characters. It modifies
+ * the given pathname string in place.
+ */
+JNIEXPORT char * JNICALL
+JVM_NativePath(char *);
+
+/*
+ * JVM I/O error codes
+ */
+#define JVM_EEXIST -100
+
+/*
+ * Open a file descriptor. This function returns a negative error code
+ * on error, and a non-negative integer that is the file descriptor on
+ * success.
+ */
+JNIEXPORT jint JNICALL
+JVM_Open(const char *fname, jint flags, jint mode);
+
+/*
+ * Close a file descriptor. This function returns -1 on error, and 0
+ * on success.
+ *
+ * fd the file descriptor to close.
+ */
+JNIEXPORT jint JNICALL
+JVM_Close(jint fd);
+
+/*
+ * Read data from a file decriptor into a char array.
+ *
+ * fd the file descriptor to read from.
+ * buf the buffer where to put the read data.
+ * nbytes the number of bytes to read.
+ *
+ * This function returns -1 on error, and 0 on success.
+ */
+JNIEXPORT jint JNICALL
+JVM_Read(jint fd, char *buf, jint nbytes);
+
+/*
+ * Write data from a char array to a file decriptor.
+ *
+ * fd the file descriptor to read from.
+ * buf the buffer from which to fetch the data.
+ * nbytes the number of bytes to write.
+ *
+ * This function returns -1 on error, and 0 on success.
+ */
+JNIEXPORT jint JNICALL
+JVM_Write(jint fd, char *buf, jint nbytes);
+
+/*
+ * Returns the number of bytes available for reading from a given file
+ * descriptor
+ */
+JNIEXPORT jint JNICALL
+JVM_Available(jint fd, jlong *pbytes);
+
+/*
+ * Move the file descriptor pointer from whence by offset.
+ *
+ * fd the file descriptor to move.
+ * offset the number of bytes to move it by.
+ * whence the start from where to move it.
+ *
+ * This function returns the resulting pointer location.
+ */
+JNIEXPORT jlong JNICALL
+JVM_Lseek(jint fd, jlong offset, jint whence);
+
+/*
+ * Set the length of the file associated with the given descriptor to the given
+ * length. If the new length is longer than the current length then the file
+ * is extended; the contents of the extended portion are not defined. The
+ * value of the file pointer is undefined after this procedure returns.
+ */
+JNIEXPORT jint JNICALL
+JVM_SetLength(jint fd, jlong length);
+
+/*
+ * Synchronize the file descriptor's in memory state with that of the
+ * physical device. Return of -1 is an error, 0 is OK.
+ */
+JNIEXPORT jint JNICALL
+JVM_Sync(jint fd);
+
+/*
+ * Networking library support
+ */
+
+JNIEXPORT jint JNICALL
+JVM_InitializeSocketLibrary(void);
+
+struct sockaddr;
+
+JNIEXPORT jint JNICALL
+JVM_Socket(jint domain, jint type, jint protocol);
+
+JNIEXPORT jint JNICALL
+JVM_SocketClose(jint fd);
+
+JNIEXPORT jint JNICALL
+JVM_SocketShutdown(jint fd, jint howto);
+
+JNIEXPORT jint JNICALL
+JVM_Recv(jint fd, char *buf, jint nBytes, jint flags);
+
+JNIEXPORT jint JNICALL
+JVM_Send(jint fd, char *buf, jint nBytes, jint flags);
+
+JNIEXPORT jint JNICALL
+JVM_Timeout(int fd, long timeout);
+
+JNIEXPORT jint JNICALL
+JVM_Listen(jint fd, jint count);
+
+JNIEXPORT jint JNICALL
+JVM_Connect(jint fd, struct sockaddr *him, jint len);
+
+JNIEXPORT jint JNICALL
+JVM_Bind(jint fd, struct sockaddr *him, jint len);
+
+JNIEXPORT jint JNICALL
+JVM_Accept(jint fd, struct sockaddr *him, jint *len);
+
+JNIEXPORT jint JNICALL
+JVM_RecvFrom(jint fd, char *buf, int nBytes,
+ int flags, struct sockaddr *from, int *fromlen);
+
+JNIEXPORT jint JNICALL
+JVM_SendTo(jint fd, char *buf, int len,
+ int flags, struct sockaddr *to, int tolen);
+
+JNIEXPORT jint JNICALL
+JVM_SocketAvailable(jint fd, jint *result);
+
+
+JNIEXPORT jint JNICALL
+JVM_GetSockName(jint fd, struct sockaddr *him, int *len);
+
+JNIEXPORT jint JNICALL
+JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);
+
+JNIEXPORT jint JNICALL
+JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);
+
+JNIEXPORT int JNICALL
+JVM_GetHostName(char* name, int namelen);
+
+/*
+ * The standard printing functions supported by the Java VM. (Should they
+ * be renamed to JVM_* in the future?
+ */
+
+/*
+ * BE CAREFUL! The following functions do not implement the
+ * full feature set of standard C printf formats.
+ */
+int
+jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
+
+int
+jio_snprintf(char *str, size_t count, const char *fmt, ...);
+
+int
+jio_fprintf(FILE *, const char *fmt, ...);
+
+int
+jio_vfprintf(FILE *, const char *fmt, va_list args);
+
+
+JNIEXPORT void * JNICALL
+JVM_RawMonitorCreate(void);
+
+JNIEXPORT void JNICALL
+JVM_RawMonitorDestroy(void *mon);
+
+JNIEXPORT jint JNICALL
+JVM_RawMonitorEnter(void *mon);
+
+JNIEXPORT void JNICALL
+JVM_RawMonitorExit(void *mon);
+
+/*
+ * java.lang.management support
+ */
+JNIEXPORT void* JNICALL
+JVM_GetManagement(jint version);
+
+/*
+ * com.sun.tools.attach.VirtualMachine support
+ *
+ * Initialize the agent properties with the properties maintained in the VM.
+ */
+JNIEXPORT jobject JNICALL
+JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
+
+/* Generics reflection support.
+ *
+ * Returns information about the given class's EnclosingMethod
+ * attribute, if present, or null if the class had no enclosing
+ * method.
+ *
+ * If non-null, the returned array contains three elements. Element 0
+ * is the java.lang.Class of which the enclosing method is a member,
+ * and elements 1 and 2 are the java.lang.Strings for the enclosing
+ * method's name and descriptor, respectively.
+ */
+JNIEXPORT jobjectArray JNICALL
+JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
+
+/*
+ * Java thread state support
+ */
+enum {
+ JAVA_THREAD_STATE_NEW = 0,
+ JAVA_THREAD_STATE_RUNNABLE = 1,
+ JAVA_THREAD_STATE_BLOCKED = 2,
+ JAVA_THREAD_STATE_WAITING = 3,
+ JAVA_THREAD_STATE_TIMED_WAITING = 4,
+ JAVA_THREAD_STATE_TERMINATED = 5,
+ JAVA_THREAD_STATE_COUNT = 6
+};
+
+/*
+ * Returns an array of the threadStatus values representing the
+ * given Java thread state. Returns NULL if the VM version is
+ * incompatible with the JDK or doesn't support the given
+ * Java thread state.
+ */
+JNIEXPORT jintArray JNICALL
+JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState);
+
+/*
+ * Returns an array of the substate names representing the
+ * given Java thread state. Returns NULL if the VM version is
+ * incompatible with the JDK or the VM doesn't support
+ * the given Java thread state.
+ * values must be the jintArray returned from JVM_GetThreadStateValues
+ * and javaThreadState.
+ */
+JNIEXPORT jobjectArray JNICALL
+JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
+
+/* =========================================================================
+ * The following defines a private JVM interface that the JDK can query
+ * for the JVM version and capabilities. sun.misc.Version defines
+ * the methods for getting the VM version and its capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JVM_GetVersionInfo and Abstract_VM_Version class
+ * SDK: Version class
+ *
+ * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
+ * JVM to query for the JDK version and capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JDK_Version class
+ * SDK: JDK_GetVersionInfo0
+ *
+ * ==========================================================================
+ */
+typedef struct {
+ /* Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx */
+ unsigned int jvm_version; /* Consists of major, minor, micro (n.n.n) */
+ /* and build number (xx) */
+ unsigned int update_version : 8; /* Update release version (uu) */
+ unsigned int special_update_version : 8; /* Special update release version (c)*/
+ unsigned int reserved1 : 16;
+ unsigned int reserved2;
+
+ /* The following bits represents JVM supports that JDK has dependency on.
+ * JDK can use these bits to determine which JVM version
+ * and support it has to maintain runtime compatibility.
+ *
+ * When a new bit is added in a minor or update release, make sure
+ * the new bit is also added in the main/baseline.
+ */
+ unsigned int is_attach_supported : 1;
+ unsigned int : 31;
+ unsigned int : 32;
+ unsigned int : 32;
+} jvm_version_info;
+
+#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
+#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
+#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
+
+/* Build number is available only for RE builds.
+ * It will be zero for internal builds.
+ */
+#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
+
+JNIEXPORT void JNICALL
+JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
+
+typedef struct {
+ // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
+ unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */
+ /* and build number (xx) */
+ unsigned int update_version : 8; /* Update release version (uu) */
+ unsigned int special_update_version : 8; /* Special update release version (c)*/
+ unsigned int reserved1 : 16;
+ unsigned int reserved2;
+
+ /* The following bits represents new JDK supports that VM has dependency on.
+ * VM implementation can use these bits to determine which JDK version
+ * and support it has to maintain runtime compatibility.
+ *
+ * When a new bit is added in a minor or update release, make sure
+ * the new bit is also added in the main/baseline.
+ */
+ unsigned int thread_park_blocker : 1;
+ unsigned int post_vm_init_hook_enabled : 1;
+ unsigned int pending_list_uses_discovered_field : 1;
+ unsigned int : 29;
+ unsigned int : 32;
+ unsigned int : 32;
+} jdk_version_info;
+
+#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
+#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
+#define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
+
+/* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)
+ * It will be zero for internal builds.
+ */
+#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
+
+/*
+ * This is the function JDK_GetVersionInfo0 defined in libjava.so
+ * that is dynamically looked up by JVM.
+ */
+typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
+
+/*
+ * This structure is used by the launcher to get the default thread
+ * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
+ * version of 1.1. As it is not supported otherwise, it has been removed
+ * from jni.h
+ */
+typedef struct JDK1_1InitArgs {
+ jint version;
+
+ char **properties;
+ jint checkSource;
+ jint nativeStackSize;
+ jint javaStackSize;
+ jint minHeapSize;
+ jint maxHeapSize;
+ jint verifyMode;
+ char *classpath;
+
+ jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
+ void (JNICALL *exit)(jint code);
+ void (JNICALL *abort)(void);
+
+ jint enableClassGC;
+ jint enableVerboseGC;
+ jint disableAsyncGC;
+ jint verbose;
+ jboolean debugging;
+ jint debugPort;
+} JDK1_1InitArgs;
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JVM_H_ */
Added: vmkit/branches/mcjit/lib/j3/vm/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/Makefile (added)
+++ vmkit/branches/mcjit/lib/j3/vm/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,38 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ../../..
+
+MODULE=j3
+
+ifdef rien
+EXTRACT= \
+ 'j3::J3Type::vt()' \
+ 'j3::J3Method::index()' \
+ 'j3::J3Type::initialise()' \
+ 'j3::J3ObjectType::javaClass()' \
+ 'j3::J3Class::size()' \
+ 'j3::J3Class::staticInstance()' \
+ 'j3::J3Class::stringAt(unsigned short)' \
+ 'j3::J3Object::allocate(j3::J3VirtualTable*, unsigned long)' \
+ 'j3::J3::jniEnv()' \
+ 'j3::J3::throwException(j3::J3Object*)' \
+ 'j3::J3::classCastException()' \
+ 'j3::J3::nullPointerException()' \
+ 'j3::J3VirtualTable::slowIsAssignableTo(j3::J3VirtualTable*)' \
+ 'j3::J3VirtualTable::fastIsAssignableToPrimaryChecker(j3::J3VirtualTable*, unsigned int)' \
+ 'j3::J3VirtualTable::fastIsAssignableToNonPrimaryChecker(j3::J3VirtualTable*)' \
+ 'j3::J3Thread::push(j3::J3ObjectHandle*)' \
+ 'j3::J3Thread::push(j3::J3Object*)' \
+ 'j3::J3Thread::tell()' \
+ 'j3::J3Thread::restore(j3::J3ObjectHandle*)' \
+ 'j3::J3Thread::get()'
+
+EXTRACT_TYPE= \
+ 'struct.JNIEnv_' \
+ 'class.j3::J3ArrayObject'
+endif
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/lib/j3/vm/j3.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,176 @@
+#include <stdio.h>
+#include <cxxabi.h>
+
+#include "j3/j3class.h"
+#include "j3/j3.h"
+#include "j3/j3classloader.h"
+#include "j3/j3constants.h"
+#include "j3/j3method.h"
+#include "j3/j3thread.h"
+
+#include "llvm/IR/Module.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/DerivedTypes.h"
+
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+
+using namespace j3;
+
+vmkit::T_ptr_less_t<J3ObjectHandle*> J3::charArrayLess;
+
+J3::J3(vmkit::BumpAllocator* allocator) :
+ VMKit(allocator),
+ nameToCharArrays(vmkit::Name::less, allocator),
+ charArrayToStrings(charArrayLess, allocator),
+ _names(allocator) {
+ pthread_mutex_init(&stringsMutex, 0);
+ constantValueAttr = names()->get(J3Cst::constantValueAttr);
+ codeAttr = names()->get(J3Cst::codeAttr);
+ clinitName = names()->get(J3Cst::clinitName);
+ clinitSign = names()->get(J3Cst::clinitSign);
+ initName = names()->get(J3Cst::initName);
+}
+
+J3* J3::create() {
+ vmkit::BumpAllocator* allocator = vmkit::BumpAllocator::create();
+ return new(allocator) J3(allocator);
+}
+
+void J3::introspect() {
+ typeJNIEnvPtr = llvm::PointerType::getUnqual(introspectType("struct.JNIEnv_"));
+ typeJ3VirtualTablePtr = llvm::PointerType::getUnqual(introspectType("class.j3::J3VirtualTable"));
+ typeJ3Type = introspectType("class.j3::J3Type");
+ typeJ3TypePtr = llvm::PointerType::getUnqual(typeJ3Type);
+ typeJ3ObjectTypePtr = llvm::PointerType::getUnqual(introspectType("class.j3::J3ObjectType"));
+ typeJ3Class = introspectType("class.j3::J3Class");
+ typeJ3ClassPtr = llvm::PointerType::getUnqual(typeJ3Class);
+ typeJ3ArrayClass = introspectType("class.j3::J3ArrayClass");
+ typeJ3ArrayClassPtr = llvm::PointerType::getUnqual(typeJ3ArrayClass);
+ typeJ3ArrayObject = introspectType("class.j3::J3ArrayObject");
+ typeJ3ArrayObjectPtr = llvm::PointerType::getUnqual(typeJ3ArrayObject);
+ typeJ3Method = introspectType("class.j3::J3Method");
+ typeJ3Object = introspectType("class.j3::J3Object");
+ typeJ3ObjectPtr = llvm::PointerType::getUnqual(typeJ3Object);
+ typeJ3ObjectHandlePtr = llvm::PointerType::getUnqual(introspectType("class.j3::J3ObjectHandle"));
+
+ typeGXXException = llvm::StructType::get(llvm::Type::getInt8Ty(self()->getContext())->getPointerTo(),
+ llvm::Type::getInt32Ty(self()->getContext()), NULL);
+}
+
+void J3::start(int argc, char** argv) {
+ _options.process(argc, argv);
+
+ vmkitBootstrap(J3Thread::create(this), options()->selfBitCodePath);
+
+ introspect();
+
+ vmkit::BumpAllocator* loaderAllocator = vmkit::BumpAllocator::create();
+ initialClassLoader =
+ new(loaderAllocator)
+ J3InitialClassLoader(this, options()->rtJar, loaderAllocator);
+
+ vmkit::BumpAllocator* a = initialClassLoader->allocator();
+
+#define defPrimitive(name, ctype, llvmtype) \
+ type##name = new(a) J3Primitive(initialClassLoader, J3Cst::ID_##name, llvm::Type::get##llvmtype##Ty(self()->getContext()));
+ onJavaTypes(defPrimitive)
+#undef defPrimitive
+
+ nbArrayInterfaces = 2;
+ arrayInterfaces = (J3Type**)initialClassLoader->allocator()->allocate(2*sizeof(J3Type*));
+ arrayInterfaces[0] = initialClassLoader->getClass(names()->get(L"java/lang/Cloneable"));
+ arrayInterfaces[1] = initialClassLoader->getClass(names()->get(L"java/io/Serializable"));
+
+ charArrayClass = typeChar->getArray();
+ objectClass = initialClassLoader->getClass(names()->get(L"java/lang/Object"));
+
+ stringClass = initialClassLoader->getClass(names()->get(L"java/lang/String"));
+ stringInit = initialClassLoader->method(0, stringClass, initName, names()->get(L"([CZ)V"));
+ stringValue = stringClass->findVirtualField(names()->get(L"value"), typeChar->getArray());
+
+ classClass = initialClassLoader->getClass(names()->get(L"java/lang/Class"));
+ J3Field hf(J3Cst::ACC_PRIVATE, names()->get(L"** vmData **"), typeLong);
+ classClass->resolve(&hf, 1);
+ classInit = initialClassLoader->method(0, classClass, initName, names()->get(L"()V"));
+ classVMData = classClass->findVirtualField(hf.name(), hf.type());
+
+ initialClassLoader->method(J3Cst::ACC_STATIC, L"java/lang/System", L"initializeSystemClass", L"()V")->invokeStatic();
+
+#if 0
+ J3Method* m = initialClassLoader->method(J3Cst::ACC_STATIC,
+ L"java/lang/ClassLoader",
+ L"getSystemClassLoader",
+ L"()Ljava/lang/ClassLoader;");
+
+ m->invokeStatic();
+#endif
+}
+
+JNIEnv* J3::jniEnv() {
+ return J3Thread::get()->jniEnv();
+}
+
+J3ObjectHandle* J3::arrayToString(J3ObjectHandle* array) {
+ pthread_mutex_lock(&stringsMutex);
+ J3ObjectHandle* res = charArrayToStrings[array];
+ if(!res) {
+ J3ObjectHandle* prev = J3Thread::get()->tell();
+ res = initialClassLoader->fixedPoint()->syncPush(J3ObjectHandle::doNewObject(stringClass));
+ J3Thread::get()->restore(prev);
+
+ stringInit->invokeSpecial(res, array, 0);
+
+ charArrayToStrings[array] = res;
+ }
+ pthread_mutex_unlock(&stringsMutex);
+ return res;
+}
+
+J3ObjectHandle* J3::nameToString(const vmkit::Name* name) {
+ pthread_mutex_lock(&stringsMutex);
+ J3ObjectHandle* res = nameToCharArrays[name];
+ if(!res) {
+ J3ObjectHandle* prev = J3Thread::get()->tell();
+ res = initialClassLoader->fixedPoint()->syncPush(J3ObjectHandle::doNewArray(charArrayClass, name->length()));
+ J3Thread::get()->restore(prev);
+
+ for(uint32_t i=0; i<name->length(); i++)
+ res->setCharAt(i, name->cStr()[i]);
+ nameToCharArrays[name] = res;
+ }
+ pthread_mutex_unlock(&stringsMutex);
+ return arrayToString(res);
+}
+
+J3ObjectHandle* J3::utfToString(const char* name) {
+ return nameToString(names()->get(name));
+}
+
+void J3::classCastException() {
+ internalError(L"implement me: class cast exception");
+}
+
+void J3::nullPointerException() {
+ internalError(L"implement me: null pointer exception");
+}
+
+void J3::noClassDefFoundError(J3Class* cl) {
+ internalError(L"NoClassDefFoundError: %ls (%p - %p)", cl->name()->cStr(), cl, cl->name());
+}
+
+void J3::noSuchMethodError(const wchar_t* msg, J3Class* cl, const vmkit::Name* name, const vmkit::Name* sign) {
+ internalError(L"%ls: %ls::%ls %ls", msg, cl->name()->cStr(), name->cStr(), sign->cStr());
+}
+
+void J3::classFormatError(J3Class* cl, const wchar_t* reason, ...) {
+ wchar_t buf[65536];
+ va_list va;
+ va_start(va, reason);
+ vswprintf(buf, 65536, reason, va);
+ va_end(va);
+ internalError(L"ClassFormatError in '%ls' caused by '%ls'", cl->name()->cStr(), buf);
+}
+
+void J3::linkageError(J3Method* method) {
+ internalError(L"unable to find native method '%ls::%ls%ls'", method->cl()->name()->cStr(), method->name()->cStr(), method->sign()->cStr());
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3class.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3class.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3class.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3class.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,876 @@
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/DataLayout.h"
+
+#include "j3/j3.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3reader.h"
+#include "j3/j3constants.h"
+#include "j3/j3method.h"
+#include "j3/j3mangler.h"
+#include "j3/j3object.h"
+#include "j3/j3thread.h"
+
+using namespace j3;
+
+/*
+ * ------------ J3Type ------------
+ */
+J3Type::J3Type(J3ClassLoader* loader, const vmkit::Name* name) {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&_mutex, &attr);
+ _loader = loader;
+ _name = name;
+}
+
+J3VirtualTable* J3Type::vt() {
+ return _vt;
+}
+
+void J3Type::dump() {
+ fprintf(stderr, "Type: %ls", name()->cStr());
+}
+
+char* J3Type::nativeName() {
+ if(!_nativeName)
+ llvmType();
+ return _nativeName;
+}
+
+uint32_t J3Type::nativeNameLength() {
+ if(!_nativeNameLength)
+ llvmType();
+ return _nativeNameLength;
+}
+
+J3ArrayClass* J3Type::getArray(uint32_t prof, const vmkit::Name* name) {
+ if(!_array) {
+ lock();
+ if(!_array) {
+ _array = new(loader()->allocator()) J3ArrayClass(loader(), this, name);
+ }
+ unlock();
+ }
+
+ return prof > 1 ? _array->getArray(prof-1) : _array;
+}
+
+bool J3Type::isAssignableTo(J3Type* parent) {
+ resolve();
+ parent->resolve();
+ return vt()->isAssignableTo(parent->vt());
+}
+
+J3Type* J3Type::resolve() {
+ if(status < RESOLVED)
+ doResolve(0, 0);
+ return this;
+}
+
+J3Type* J3Type::resolve(J3Field* hiddenFields, uint32_t nbHiddenFields) {
+ if(status < RESOLVED)
+ doResolve(hiddenFields, nbHiddenFields);
+ else
+ J3::internalError(L"trying to resolve class %ls with hidden fields while it is already loaded", name()->cStr());
+ return this;
+}
+
+J3Type* J3Type::initialise() {
+ if(status < INITED)
+ doInitialise();
+ return this;
+}
+
+J3Class* J3Type::asClass() {
+ if(!isClass())
+ J3::internalError(L"should not happen");
+ return (J3Class*)this;
+}
+
+J3Layout* J3Type::asLayout() {
+ if(!isLayout())
+ J3::internalError(L"should not happen");
+ return (J3Layout*)this;
+}
+
+J3Primitive* J3Type::asPrimitive() {
+ if(!isPrimitive())
+ J3::internalError(L"should not happen");
+ return (J3Primitive*)this;
+}
+
+J3ArrayClass* J3Type::asArrayClass() {
+ if(!isArrayClass())
+ J3::internalError(L"should not happen");
+ return (J3ArrayClass*)this;
+}
+
+J3ObjectType* J3Type::asObjectType() {
+ if(!isObjectType())
+ J3::internalError(L"should not happen");
+ return (J3ObjectType*)this;
+}
+
+/*
+ * ------------ J3ObjectType ------------
+ */
+J3ObjectType::J3ObjectType(J3ClassLoader* loader, const vmkit::Name* name) : J3Type(loader, name) {
+}
+
+J3Method* J3ObjectType::findVirtualMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error) {
+ J3::internalError(L"should not happen");
+}
+
+J3Method* J3ObjectType::findStaticMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error) {
+ J3::internalError(L"should not happen");
+}
+
+J3ObjectType* J3ObjectType::nativeClass(J3ObjectHandle* handle) {
+ return (J3ObjectType*)(uintptr_t)handle->getLong(J3Thread::get()->vm()->classVMData);
+}
+
+J3ObjectHandle* J3ObjectType::javaClass() {
+ if(!_javaClass) {
+ lock();
+ if(!_javaClass) {
+ J3ObjectHandle* prev = J3Thread::get()->tell();
+ _javaClass = J3ObjectHandle::doNewObject(loader()->vm()->classClass);
+ loader()->fixedPoint()->syncPush(_javaClass);
+ J3Thread::get()->restore(prev);
+ _javaClass->setLong(loader()->vm()->classVMData, (int64_t)(uintptr_t)this);
+ loader()->vm()->classInit->invokeSpecial(_javaClass);
+ }
+ unlock();
+ }
+ return _javaClass;
+}
+
+/*
+ * ------------ J3Layout ------------
+ */
+J3Layout::J3Layout(J3ClassLoader* loader, const vmkit::Name* name) : J3ObjectType(loader, name) {
+}
+
+J3Method* J3Layout::findMethod(const vmkit::Name* name, const vmkit::Name* sign) {
+ for(size_t i=0; i<nbMethods(); i++) {
+ J3Method* cur = methods()[i];
+
+ //printf("%ls - %ls\n", cur->name()->cStr(), cur->sign()->cStr());
+ //printf("%ls - %ls\n", name->cStr(), sign->cStr());
+ if(cur->name() == name && cur->sign() == sign) {
+ return cur;
+ }
+ }
+ return 0;
+}
+
+J3Field* J3Layout::findField(const vmkit::Name* name, const J3Type* type) {
+ for(size_t i=0; i<nbFields; i++) {
+ J3Field* cur = fields + i;
+
+ //printf("%ls - %ls\n", cur->name()->cStr(), cur->sign()->cStr());
+ //printf("%ls - %ls\n", name->cStr(), sign->cStr());
+ if(cur->name() == name && cur->type() == type) {
+ return cur;
+ }
+ }
+ return 0;
+}
+
+/*
+ * ------------ J3Class ------------
+ */
+J3Class::J3Class(J3ClassLoader* loader, const vmkit::Name* name) : J3Layout(loader, name), staticLayout(loader, name) {
+ status = CITED;
+}
+
+size_t J3Class::size() {
+ return _size;
+}
+
+llvm::GlobalValue* J3Class::llvmDescriptor(llvm::Module* module) {
+ if(!_nomcjitDescriptor) {
+ _nomcjitDescriptor = llvm::cast<llvm::GlobalValue>(module->getOrInsertGlobal(nativeName(), loader()->vm()->typeJ3Class));
+ loader()->vm()->ee()->addGlobalMapping(_nomcjitDescriptor, this);
+ }
+ return _nomcjitDescriptor;
+}
+
+
+J3Method* J3Class::findVirtualMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error) {
+ //loader()->vm()->log(L"Lookup: %ls %ls in %ls (%d)", methName->cStr(), methSign->cStr(), name()->cStr(), nbVirtualMethods);
+ resolve();
+
+ J3Method* res = findMethod(name, sign);
+
+ if(!res) {
+ if(super() == this) {
+ if(error)
+ J3::noSuchMethodError(L"no such method", this, name, sign);
+ else
+ return 0;
+ }
+ res = super()->findVirtualMethod(name, sign, error);
+ }
+
+ return res;
+}
+
+J3Method* J3Class::findStaticMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error) {
+ //loader()->vm()->log(L"Lookup: %ls %ls in %ls", methName->cStr(), methSign->cStr(), name()->cStr());
+ resolve();
+
+ J3Method* res = staticLayout.findMethod(name, sign);
+
+ if(!res)
+ J3::internalError(L"implement me");
+
+ return res;
+}
+
+J3Field* J3Class::findVirtualField(const vmkit::Name* name, const J3Type* type, bool error) {
+ //loader()->vm()->log(L"Lookup: %ls %ls in %ls", methName->cStr(), methSign->cStr(), name()->cStr());
+ resolve();
+
+ J3Field* res = findField(name, type);
+
+ if(!res)
+ J3::internalError(L"implement me");
+
+ return res;
+}
+
+J3Field* J3Class::findStaticField(const vmkit::Name* fname, const J3Type* ftype, bool error) {
+ //fprintf(stderr, "Lookup static field %ls %ls::%ls\n", ftype->name()->cStr(), name()->cStr(), fname->cStr());
+ resolve();
+
+ J3Field* res = staticLayout.findField(fname, ftype);
+
+ if(!res)
+ J3::internalError(L"implement me");
+
+ return res;
+}
+
+void J3Class::registerNative(const vmkit::Name* methName, const vmkit::Name* methSign, void* fnPtr) {
+ resolve();
+ J3Method* res = staticLayout.findMethod(methName, methSign);
+ if(!res)
+ res = findMethod(methName, methSign);
+ if(!res || !J3Cst::isNative(res->access()))
+ J3::noSuchMethodError(L"unable to find native method", this, methName, methSign);
+
+ res->registerNative(fnPtr);
+}
+
+J3ObjectHandle* J3Class::staticInstance() {
+ return _staticInstance;
+}
+
+void J3Class::doInitialise() {
+ resolve();
+ lock();
+ if(status < INITED) {
+ if(loader()->vm()->options()->debugIniting)
+ fprintf(stderr, "Initing: %ls\n", name()->cStr());
+ status = INITED;
+
+ super()->initialise();
+
+ for(size_t i=0; i<nbInterfaces(); i++)
+ interfaces()[i]->initialise();
+
+ J3ObjectHandle* prev = J3Thread::get()->tell();
+ J3ObjectHandle* stacked = J3ObjectHandle::allocate(staticLayout.vt(),
+ loader()->vm()->dataLayout()->getTypeAllocSize(staticLayout.llvmType()
+ ->getContainedType(0)));
+ _staticInstance = loader()->fixedPoint()->syncPush(stacked);
+ J3Thread::get()->restore(prev);
+
+ for(size_t i=0; i<staticLayout.nbFields; i++) {
+ J3Field* cur = staticLayout.fields + i;
+ J3Attribute* attr = cur->attributes()->lookup(loader()->vm()->constantValueAttr);
+
+ if(attr) {
+ J3Reader reader(bytes());
+ reader.seek(attr->offset(), reader.SeekSet);
+
+ uint32_t length = reader.readU4();
+ if(length != 2)
+ J3::classFormatError(this, L"bad length for ConstantAttribute");
+
+ uint32_t idx = reader.readU2();
+
+ switch(getCtpType(idx)) {
+ case J3Cst::CONSTANT_Long: staticInstance()->setLong(cur, longAt(idx)); break;
+ case J3Cst::CONSTANT_Float: staticInstance()->setFloat(cur, floatAt(idx)); break;
+ case J3Cst::CONSTANT_Double: staticInstance()->setDouble(cur, doubleAt(idx)); break;
+ case J3Cst::CONSTANT_Integer: staticInstance()->setInteger(cur, integerAt(idx)); break;
+ case J3Cst::CONSTANT_String: staticInstance()->setObject(cur, stringAt(idx)); break;
+ default:
+ J3::classFormatError(this, L"invalid ctp entry ConstantAttribute with type %d", getCtpType(idx));
+ }
+ }
+ }
+
+ J3Method* clinit = staticLayout.findMethod(loader()->vm()->clinitName, loader()->vm()->clinitSign);
+
+ if(clinit)
+ clinit->invokeStatic();
+ }
+ unlock();
+}
+
+void J3Class::load() {
+ if(status < LOADED) {
+ lock();
+ if(status < LOADED) {
+ if(loader()->vm()->options()->debugLoad)
+ fprintf(stderr, "Loading: %ls\n", name()->cStr());
+
+ _bytes = loader()->lookup(name());
+
+ if(!_bytes)
+ J3::noClassDefFoundError(this);
+
+ status = LOADED;
+ }
+ unlock();
+ }
+}
+
+void J3Class::doResolve(J3Field* hiddenFields, size_t nbHiddenFields) {
+ load();
+ lock();
+ if(status < RESOLVED) {
+ if(loader()->vm()->options()->debugResolve)
+ fprintf(stderr, "Resolving: %ls\n", name()->cStr());
+
+ std::vector<llvm::Type*> virtualBody;
+ status = RESOLVED;
+ readClassBytes(&virtualBody, hiddenFields, nbHiddenFields);
+
+ if(super() == this) {
+ virtualBody[0] = loader()->vm()->typeJ3Object;
+ } else {
+ super()->resolve();
+ virtualBody[0] = super()->llvmType()->getContainedType(0);
+ }
+
+ llvm::cast<llvm::StructType>(llvmType()->getContainedType(0))->setBody(virtualBody);
+
+ _size = loader()->vm()->dataLayout()->getTypeAllocSize(llvmType()->getContainedType(0));
+
+ staticLayout._vt = J3VirtualTable::create(&staticLayout);
+
+ _vt = J3VirtualTable::create(this);
+
+ //fprintf(stderr, "virtual part of %ls: ", name()->cStr());
+ //llvmType()->getContainedType(0)->dump();
+ //fprintf(stderr, "\n");
+ }
+ unlock();
+}
+
+#if 0
+void J3Class::addHiddenField(J3Field* f, uint32_t num) {
+ if(this == loader()->vm()->classClass) {
+ f->_access = J3Cst::ACC_PRIVATE;
+ f->_name = loader()->vm()->names()->get(L"vmData");
+ f->_type = (sizeof(uintptr_t) == 8) ? loader()->vm()->typeLong : loader()->vm()->typeInteger;
+ f->_attributes = new (loader()->allocator(), 0) J3Attributes(0);
+ }
+}
+#endif
+
+void J3Class::readClassBytes(std::vector<llvm::Type*>* virtualBody, J3Field* hiddenFields, uint32_t nbHiddenFields) {
+ J3Reader reader(_bytes);
+
+ uint32_t magic = reader.readU4();
+ if(magic != J3Cst::MAGIC)
+ J3::classFormatError(this, L"bad magic");
+
+ /* uint16_t minor = */reader.readU2();
+ /* uint16_t major = */reader.readU2();
+
+ nbCtp = reader.readU2();
+
+ if(nbCtp < 1)
+ J3::classFormatError(this, L"zero-sized constant pool");
+
+ ctpTypes = (uint8_t*)loader()->allocator()->allocate(nbCtp * sizeof(uint8_t));
+ ctpValues = (uint32_t*)loader()->allocator()->allocate(nbCtp * sizeof(uint32_t));
+ ctpResolved = (void**)loader()->allocator()->allocate(nbCtp * sizeof(void*));
+
+ ctpTypes[0] = 0;
+
+ for(uint32_t i=1; i<nbCtp; i++) {
+ switch(ctpTypes[i] = reader.readU1()) {
+ case J3Cst::CONSTANT_Utf8:
+ ctpValues[i] = reader.tell();
+ reader.seek(reader.readU2(), reader.SeekCur);
+ break;
+ case J3Cst::CONSTANT_MethodType:
+ case J3Cst::CONSTANT_String:
+ case J3Cst::CONSTANT_Class:
+ ctpValues[i] = reader.readU2();
+ break;
+ case J3Cst::CONSTANT_InvokeDynamic:
+ case J3Cst::CONSTANT_Float:
+ case J3Cst::CONSTANT_Integer:
+ case J3Cst::CONSTANT_Fieldref:
+ case J3Cst::CONSTANT_Methodref:
+ case J3Cst::CONSTANT_InterfaceMethodref:
+ case J3Cst::CONSTANT_NameAndType:
+ ctpValues[i] = reader.readU4();
+ break;
+ case J3Cst::CONSTANT_Long:
+ case J3Cst::CONSTANT_Double:
+ ctpValues[i] = reader.readU4();
+ ctpValues[i+1] = reader.readU4();
+ i++;
+ break;
+ case J3Cst::CONSTANT_MethodHandle:
+ ctpValues[i] = reader.readU1() << 16;
+ ctpValues[i] |= reader.readU2();
+ break;
+ default:
+ J3::classFormatError(this, L"wrong constant pool entry type: %d", ctpTypes[i]);
+ }
+ }
+
+ _access = reader.readU2();
+
+ J3Class* self = classAt(reader.readU2());
+
+ if(self != this)
+ J3::classFormatError(this, L"wrong class file (describes class %ls)", self->name()->cStr());
+
+ uint16_t superIdx = reader.readU2();
+
+ _super = superIdx ? classAt(superIdx) : this;
+
+ _nbInterfaces = reader.readU2();
+ _interfaces = (J3Class**)loader()->allocator()->allocate(nbInterfaces()*sizeof(J3Class*));
+
+ for(size_t i=0; i<nbInterfaces(); i++) {
+ _interfaces[i] = classAt(reader.readU2());
+ }
+
+ size_t n = nbHiddenFields + reader.readU2(), nbStaticFields = 0, nbVirtualFields = 0;
+ fields = (J3Field*)alloca(sizeof(J3Field)*n);
+ J3Field* pFields0[n]; size_t i0 = 0; /* sort fields by reverse size */
+ J3Field* pFields1[n]; size_t i1 = 0;
+ J3Field* pFields2[n]; size_t i2 = 0;
+ J3Field* pFields4[n]; size_t i4 = 0;
+ J3Field* pFields8[n]; size_t i8 = 0;
+
+ memset(fields, 0, sizeof(J3Field)*n);
+
+ for(size_t i=0; i<n; i++) {
+ J3Field* f = fields + i;
+
+ if(i < nbHiddenFields) {
+ f->_cl = this;
+ f->_access = hiddenFields[i].access();
+ f->_name = hiddenFields[i].name();
+ f->_type = hiddenFields[i].type();
+ f->_attributes = new (loader()->allocator(), 0) J3Attributes(0);
+ } else {
+ f->_cl = this;
+ f->_access = reader.readU2();
+ f->_name = nameAt(reader.readU2());
+ f->_type = loader()->getType(this, nameAt(reader.readU2()));
+ f->_attributes = readAttributes(&reader);
+ }
+
+ if(J3Cst::isStatic(f->access()))
+ nbStaticFields++;
+ else
+ nbVirtualFields++;
+
+ switch(loader()->vm()->dataLayout()->getTypeSizeInBits(f->_type->llvmType())) {
+ case 1: pFields0[i0++] = f; break;
+ case 8: pFields1[i1++] = f; break;
+ case 16: pFields2[i2++] = f; break;
+ case 32: pFields4[i4++] = f; break;
+ case 64: pFields8[i8++] = f; break;
+ default: J3::internalError(L"should not happen");
+ }
+ }
+
+ staticLayout.fields = new(loader()->allocator()) J3Field[nbStaticFields];
+ fields = new(loader()->allocator()) J3Field[nbVirtualFields];
+
+ std::vector<llvm::Type*> staticBody;
+
+ staticBody.push_back(loader()->vm()->typeJ3Object);
+ virtualBody->push_back(0);
+
+ fillFields(&staticBody, virtualBody, pFields8, i8);
+ fillFields(&staticBody, virtualBody, pFields4, i4);
+ fillFields(&staticBody, virtualBody, pFields2, i2);
+ fillFields(&staticBody, virtualBody, pFields1, i1);
+ fillFields(&staticBody, virtualBody, pFields0, i0);
+
+ staticLLVMType()->getContainedType(0);
+
+ llvm::cast<llvm::StructType>(staticLLVMType()->getContainedType(0))->setBody(staticBody);
+
+ //fprintf(stderr, "static part of %ls: ", name()->cStr());
+ //staticLayout.llvmType()->getContainedType(0)->dump();
+ //fprintf(stderr, "\n");
+
+ size_t nbVirtualMethods = 0, nbStaticMethods = 0;
+
+ n = reader.readU2();
+ J3Method** methodsTmp = (J3Method**)alloca(sizeof(J3Method*)*n);
+
+ for(size_t i=0; i<n; i++) {
+ uint16_t access = reader.readU2();
+ const vmkit::Name* name = nameAt(reader.readU2());
+ const vmkit::Name* sign = nameAt(reader.readU2());
+ J3Method* method = loader()->method(access, this, name, sign);
+ J3Attributes* attributes = readAttributes(&reader);
+
+ method->postInitialise(access, attributes);
+ methodsTmp[i] = method;
+
+ if(J3Cst::isStatic(access)) {
+ nbStaticMethods++;
+ method->setResolved(0);
+ } else
+ nbVirtualMethods++;
+ }
+
+ staticLayout._methods = (J3Method**)loader()->allocator()->allocate(sizeof(J3Method*)*nbStaticMethods);
+ _methods = (J3Method**)loader()->allocator()->allocate(sizeof(J3Method*)*nbVirtualMethods);
+
+ for(int i=0; i<n; i++) {
+ J3Layout* layout = J3Cst::isStatic(methodsTmp[i]->access()) ? &staticLayout : this;
+ layout->_methods[layout->_nbMethods++] = methodsTmp[i];
+ }
+
+ _attributes = readAttributes(&reader);
+}
+
+void J3Class::fillFields(std::vector<llvm::Type*>* staticBody, std::vector<llvm::Type*>* virtualBody, J3Field** fields, size_t n) {
+ for(size_t i=0; i<n; i++) {
+ J3Field* cur = fields[i];
+ J3Layout* layout;
+
+ if(J3Cst::isStatic(fields[i]->access())) {
+ //fprintf(stderr, " adding static field: %ls %ls::%ls\n", cur->type()->name()->cStr(), name()->cStr(), cur->name()->cStr());
+ cur->_num = staticBody->size();
+ layout = &staticLayout;
+ staticBody->push_back(cur->type()->llvmType());
+ } else {
+ cur->_num = virtualBody->size();
+ layout = this;
+ virtualBody->push_back(cur->type()->llvmType());
+ }
+ layout->fields[layout->nbFields++] = *fields[i];
+
+ }
+}
+
+J3Attributes* J3Class::readAttributes(J3Reader* reader) {
+ size_t nbAttributes = reader->readU2();
+ J3Attributes* res = new (loader()->allocator(), nbAttributes) J3Attributes(nbAttributes);
+
+ for(size_t i=0; i<nbAttributes; i++) {
+ res->attribute(i)->_id = nameAt(reader->readU2());
+ res->attribute(i)->_offset = reader->tell();
+ reader->seek(reader->readU4(), reader->SeekCur);
+ }
+
+ return res;
+}
+
+uint8_t J3Class::getCtpType(uint16_t idx) {
+ check(idx);
+ return ctpTypes[idx];
+}
+
+void* J3Class::getCtpResolved(uint16_t idx) {
+ check(idx);
+ return ctpResolved[idx];
+}
+
+J3ObjectHandle* J3Class::stringAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_String);
+ J3ObjectHandle* res = (J3ObjectHandle*)ctpResolved[idx];
+ if(!res) {
+ ctpResolved[idx] = res = loader()->vm()->nameToString(nameAt(ctpValues[idx]));
+ }
+ return (J3ObjectHandle*)res;
+}
+
+float J3Class::floatAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Float);
+ J3Value v;
+ v.valInteger = ctpValues[idx];
+ return v.valFloat;
+}
+
+double J3Class::doubleAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Double);
+ J3Value v;
+ v.valLong = ((uint64_t)ctpValues[idx] << 32) + (uint64_t)ctpValues[idx+1];
+ return v.valDouble;
+}
+
+uint32_t J3Class::integerAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Integer);
+ return ctpValues[idx];
+}
+
+uint64_t J3Class::longAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Long);
+ return ((uint64_t)ctpValues[idx] << 32) + (uint64_t)ctpValues[idx+1];
+}
+
+J3Method* J3Class::methodAt(uint16_t idx, uint16_t access) {
+ check(idx, J3Cst::CONSTANT_Methodref);
+ J3Method* res = (J3Method*)ctpResolved[idx];
+
+ if(res) {
+ if((res->access() & J3Cst::ACC_STATIC) != (access & J3Cst::ACC_STATIC))
+ J3::classFormatError(this, L"inconstitent use of virtual and static methods");
+ return res;
+ }
+
+ uint16_t ntIdx = ctpValues[idx] & 0xffff;
+ J3Class* cl = classAt(ctpValues[idx] >> 16);
+
+ check(ntIdx, J3Cst::CONSTANT_NameAndType);
+ const vmkit::Name* name = nameAt(ctpValues[ntIdx] >> 16);
+ const vmkit::Name* sign = nameAt(ctpValues[ntIdx] & 0xffff);
+
+ res = loader()->method(access, cl, name, sign);
+
+ return res;
+}
+
+J3Field* J3Class::fieldAt(uint16_t idx, uint16_t access) {
+ check(idx, J3Cst::CONSTANT_Fieldref);
+ J3Field* res = (J3Field*)ctpResolved[idx];
+
+ if(res) {
+ if((res->access() & J3Cst::ACC_STATIC) != (access & J3Cst::ACC_STATIC))
+ J3::classFormatError(this, L"inconstitent use of virtual and static field");
+ return res;
+ }
+
+ uint16_t ntIdx = ctpValues[idx] & 0xffff;
+ J3Class* cl = classAt(ctpValues[idx] >> 16);
+
+ check(ntIdx, J3Cst::CONSTANT_NameAndType);
+ const vmkit::Name* name = nameAt(ctpValues[ntIdx] >> 16);
+ const J3Type* type = loader()->getType(this, nameAt(ctpValues[ntIdx] & 0xffff));
+
+ res = J3Cst::isStatic(access) ? cl->findStaticField(name, type) : cl->findVirtualField(name, type);
+
+ return res;
+}
+
+J3Class* J3Class::classAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Class);
+ J3Class* res = (J3Class*)ctpResolved[idx];
+
+ if(res)
+ return res;
+
+ const vmkit::Name* name = nameAt(ctpValues[idx]);
+ if(name->cStr()[0] == J3Cst::ID_Array)
+ J3::internalError(L"implement me: classAt with array");
+ else
+ res = loader()->getClass(name);
+
+ ctpResolved[idx] = res;
+
+ return res;
+}
+
+const vmkit::Name* J3Class::nameAt(uint16_t idx) {
+ check(idx, J3Cst::CONSTANT_Utf8);
+ const vmkit::Name* res = (const vmkit::Name*)ctpResolved[idx];
+
+ if(res)
+ return res;
+
+ J3Reader reader(_bytes);
+
+ reader.seek(ctpValues[idx], reader.SeekSet);
+
+ uint16_t len = reader.readU2(), i=0, n=0;
+
+ res = loader()->vm()->names()->get((const char*)reader.pointer(), 0, len);
+
+ ctpResolved[idx] = (void*)res;
+
+ return res;
+}
+
+void J3Class::check(uint16_t idx, uint32_t id) {
+ if(idx > nbCtp || (id != -1 && ctpTypes[idx] != id))
+ J3::classFormatError(this, L"wrong constant pool type %d at index %d for %d", id, idx, nbCtp);
+}
+
+void J3Class::createLLVMTypes() {
+ J3Mangler mangler(this);
+
+ mangler.mangle("static_")->mangle(name());
+
+ staticLayout._llvmType =
+ llvm::PointerType::getUnqual(llvm::StructType::create(loader()->module()->getContext(), mangler.cStr()));
+ _llvmType = llvm::PointerType::getUnqual(llvm::StructType::create(loader()->module()->getContext(), mangler.cStr()+7));
+
+ mangler.mangle("_2");
+
+ _nativeNameLength = mangler.length() - 6;
+ _nativeName = (char*)loader()->allocator()->allocate(mangler.length() + 1);
+
+ _nativeName[0] = 'L';
+ memcpy(_nativeName + 1, mangler.cStr()+7, mangler.length());
+}
+
+llvm::Type* J3Class::staticLLVMType() {
+ llvm::Type* res = staticLayout._llvmType;
+
+ if(!res) {
+ createLLVMTypes();
+ res = staticLayout._llvmType;
+ }
+
+ return res;
+}
+
+llvm::Type* J3Class::virtualLLVMType() {
+ llvm::Type* res = _llvmType;
+
+ if(!res) {
+ createLLVMTypes();
+ res = _llvmType;
+ }
+
+ return res;
+}
+
+llvm::Type* J3Class::llvmType() {
+ return virtualLLVMType();
+}
+
+void J3Field::dump() {
+ printf("Field: %ls %ls::%ls (%d)\n", type()->name()->cStr(), cl()->name()->cStr(), name()->cStr(), access());
+}
+
+
+J3Attribute* J3Attributes::attribute(size_t n) {
+ if(n >= _nbAttributes)
+ J3::internalError(L"should not happen");
+ return _attributes + n;
+}
+
+J3Attribute* J3Attributes::lookup(const vmkit::Name* id) {
+ for(size_t i=0; i<_nbAttributes; i++) {
+ if(_attributes[i].id() == id)
+ return _attributes+i;
+ }
+
+ return 0;
+}
+
+/*
+ * ------------ J3ArrayClass ------------
+ */
+J3ArrayClass::J3ArrayClass(J3ClassLoader* loader, J3Type* component, const vmkit::Name* name) : J3ObjectType(loader, name) {
+ _component = component;
+
+ if(!name) {
+ const vmkit::Name* compName = component->name();
+ uint32_t len = compName->length();
+ wchar_t buf[len + 16];
+ uint32_t pos = 0;
+
+ //printf(" build array of %ls\n", component->name()->cStr());
+ buf[pos++] = J3Cst::ID_Array;
+
+ if(component->isClass())
+ buf[pos++] = J3Cst::ID_Classname;
+ memcpy(buf+pos, compName->cStr(), len * sizeof(wchar_t));
+ pos += len;
+ if(component->isClass())
+ buf[pos++] = J3Cst::ID_End;
+ buf[pos] = 0;
+
+ _name = loader->vm()->names()->get(buf);
+ }
+}
+
+void J3ArrayClass::doResolve(J3Field* hiddenFields, size_t nbHiddenFields) {
+ lock();
+ if(status < RESOLVED) {
+ status = RESOLVED;
+ J3Class* objectClass = loader()->vm()->objectClass;
+ objectClass->resolve();
+ _vt = J3VirtualTable::create(this);
+ }
+ unlock();
+}
+
+void J3ArrayClass::doInitialise() {
+ resolve();
+ status = INITED;
+}
+
+llvm::GlobalValue* J3ArrayClass::llvmDescriptor(llvm::Module* module) {
+ if(!_nomcjitDescriptor) {
+ _nomcjitDescriptor = llvm::cast<llvm::GlobalValue>(module->getOrInsertGlobal(nativeName(), loader()->vm()->typeJ3ArrayClass));
+ loader()->vm()->ee()->updateGlobalMapping(_nomcjitDescriptor, this);
+ }
+ return _nomcjitDescriptor;
+}
+
+llvm::Type* J3ArrayClass::llvmType() {
+ if(!_llvmType) {
+ llvm::Type* body[2] = {
+ loader()->vm()->typeJ3ArrayObject,
+ llvm::ArrayType::get(component()->llvmType(), 0) /* has to be called first */
+ };
+ uint32_t len = component()->nativeNameLength();
+
+ _nativeNameLength = len + 2;
+ _nativeName = (char*)loader()->allocator()->allocate(_nativeNameLength + 1);
+ _nativeName[0] = '_';
+ _nativeName[1] = '3';
+ memcpy(_nativeName+2, component()->nativeName(), len);
+ _nativeName[_nativeNameLength] = 0;
+
+ _llvmType = llvm::PointerType::getUnqual(llvm::StructType::create(loader()->module()->getContext(),
+ body,
+ _nativeName));
+ }
+ return _llvmType;
+}
+
+/*
+ * ------------ J3Primitive ------------
+ */
+J3Primitive::J3Primitive(J3ClassLoader* loader, char id, llvm::Type* type) : J3Type(loader, loader->vm()->names()->get(id)) {
+ _llvmType = type;
+ _nativeName = (char*)loader->allocator()->allocate(2);
+ _nativeName[0] = id;
+ _nativeName[1] = 0;
+ _nativeNameLength = 1;
+ _vt = J3VirtualTable::create(this);
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,288 @@
+#include <map>
+#include <dlfcn.h>
+
+#include "llvm/PassManager.h"
+#include "llvm/Linker.h"
+
+#include "llvm/ExecutionEngine/JIT.h"
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+
+#include "llvm/IR/Module.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/DIBuilder.h"
+
+#include "vmkit/allocator.h"
+
+#include "j3/j3classloader.h"
+#include "j3/j3.h"
+#include "j3/j3reader.h"
+#include "j3/j3zip.h"
+#include "j3/j3class.h"
+#include "j3/j3constants.h"
+#include "j3/j3method.h"
+#include "j3/j3lib.h"
+#include "j3/j3mangler.h"
+
+using namespace j3;
+
+J3ClassLoader::J3MethodLess J3ClassLoader::j3MethodLess;
+
+void J3ClassLoader::destroy(J3ClassLoader* loader) {
+ vmkit::BumpAllocator::destroy(loader->allocator());
+}
+
+void* J3ClassLoader::operator new(size_t n, vmkit::BumpAllocator* allocator) {
+ return allocator->allocate(n);
+}
+
+J3ClassLoader::J3ClassLoader(J3* v, J3ObjectHandle* javaClassLoader, vmkit::BumpAllocator* allocator)
+ : _fixedPoint(allocator),
+ classes(vmkit::Name::less, allocator),
+ types(vmkit::Name::less, allocator),
+ methodTypes(vmkit::Name::less, allocator),
+ methods(j3MethodLess, allocator),
+ nativeLibraries(allocator) {
+ _allocator = allocator;
+
+ _javaClassLoader = javaClassLoader;
+
+ // pthread_mutexattr_t attr;
+ // pthread_mutexattr_init(&attr);
+ // pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&_mutex, 0);//&attr);
+
+ _vm = v;
+
+ _module = new llvm::Module("j3", vm()->self()->getContext());
+ _dbgBuilder = new llvm::DIBuilder(*module());
+ _pm = vm()->preparePM(module());
+
+ vm()->ee()->addModule(module());
+}
+
+void* J3ClassLoader::lookupNativeFunctionPointer(J3Method* method, const char* symbol) {
+ for(std::vector<void*>::size_type i=0; i!=nativeLibraries.size(); i++) {
+ void* fnPtr = dlsym(nativeLibraries[i], symbol);
+ if(fnPtr)
+ return fnPtr;
+ }
+
+ return 0;
+}
+
+J3Class* J3ClassLoader::getClass(const vmkit::Name* name) {
+ lock();
+ J3Class* res = classes[name];
+ if(!res)
+ classes[name] = res = new(allocator()) J3Class(this, name);
+ unlock();
+ return res;
+}
+
+J3ClassBytes* J3ClassLoader::lookup(const vmkit::Name* name) {
+ J3::internalError(L"should not happen");
+}
+
+void J3ClassLoader::wrongType(J3Class* from, const vmkit::Name* type) {
+ J3::classFormatError(from, L"wrong type: %ls", type->cStr());
+}
+
+J3Type* J3ClassLoader::getTypeInternal(J3Class* from, const vmkit::Name* typeName, uint32_t start, uint32_t* pend) {
+ J3Type* res = 0;
+ const wchar_t* type = typeName->cStr();
+ uint32_t len = typeName->length();
+ uint32_t pos = start;
+ uint32_t prof = 0;
+
+ while(!res) {
+ if(pos >= len)
+ wrongType(from, typeName);
+
+ switch(type[pos]) {
+ case J3Cst::ID_Array: prof++; pos++; break;
+ case J3Cst::ID_Void: res = vm()->typeVoid; pos++; break;
+ case J3Cst::ID_Byte: res = vm()->typeByte; pos++; break;
+ case J3Cst::ID_Char: res = vm()->typeChar; pos++; break;
+ case J3Cst::ID_Double: res = vm()->typeDouble; pos++; break;
+ case J3Cst::ID_Float: res = vm()->typeFloat; pos++; break;
+ case J3Cst::ID_Integer: res = vm()->typeInteger; pos++; break;
+ case J3Cst::ID_Long: res = vm()->typeLong; pos++; break;
+ case J3Cst::ID_Short: res = vm()->typeShort; pos++; break;
+ case J3Cst::ID_Boolean: res = vm()->typeBoolean; pos++; break;
+ case J3Cst::ID_Classname:
+ {
+ uint32_t start = ++pos;
+ wchar_t buf[len + 1 - start], c;
+
+ memset(buf, 0, len + 1 - pos);
+
+ for(; pos < len && (c = type[pos]) != J3Cst::ID_End; pos++)
+ buf[pos - start] = c;
+
+ if(type[pos] != J3Cst::ID_End)
+ wrongType(from, typeName);
+
+ buf[pos++ - start] = 0;
+
+ res = getClass(vm()->names()->get(buf));
+ }
+ break;
+ case J3Cst::ID_Left:
+ case J3Cst::ID_Right:
+ default:
+ wrongType(from, typeName);
+ }
+ }
+
+ *pend = pos;
+
+ if(prof)
+ res = res->getArray(prof, start ? 0 : typeName);
+
+ return res;
+}
+
+J3Type* J3ClassLoader::getType(J3Class* from, const vmkit::Name* type) {
+ lock();
+ J3Type* res = types[type];
+ unlock();
+
+ if(!res) {
+ uint32_t end;
+ res = getTypeInternal(from, type, 0, &end);
+
+ if(end != type->length())
+ wrongType(from, type);
+
+ //printf("Analyse %ls => %ls\n", type->cStr(), res->name()->cStr());
+
+ lock();
+ types[type] = res;
+ unlock();
+ }
+
+ return res;
+}
+
+J3MethodType* J3ClassLoader::getMethodType(J3Class* from, const vmkit::Name* sign) {
+ lock();
+ J3MethodType* res = methodTypes[sign];
+ unlock();
+
+ if(!res) {
+ J3Type* args[sign->length()];
+ uint32_t nbArgs = 0;
+ uint32_t cur = 1;
+
+ if(sign->cStr()[0] != J3Cst::ID_Left)
+ wrongType(from, sign);
+
+ while(sign->cStr()[cur] != J3Cst::ID_Right) {
+ args[nbArgs++] = getTypeInternal(from, sign, cur, &cur);
+ }
+ args[nbArgs++] = getTypeInternal(from, sign, cur+1, &cur);
+ if(cur != sign->length())
+ wrongType(from, sign);
+
+ lock();
+ J3MethodType* tmp = methodTypes[sign];
+ if(tmp)
+ res = tmp;
+ else
+ res = new(allocator(), nbArgs - 1) J3MethodType(args, nbArgs);
+ unlock();
+ }
+
+ return res;
+}
+
+J3Method* J3ClassLoader::method(uint16_t access, J3Class* cl, const vmkit::Name* name, const vmkit::Name* sign) {
+ J3Method method(access, cl, name, sign), *res;
+
+ lock();
+ std::map<J3Method*, J3Method*>::iterator it = methods.find(&method);
+
+ if(it == methods.end()) {
+ res = J3Method::newMethod(allocator(), access, cl, name, sign);
+ methods[res] = res;
+ } else {
+ res = it->second;
+ }
+ unlock();
+
+ return res;
+}
+
+J3Method* J3ClassLoader::method(uint16_t access, const vmkit::Name* clName, const vmkit::Name* name, const vmkit::Name* sign) {
+ return method(access, getClass(clName), name, sign);
+}
+
+J3Method* J3ClassLoader::method(uint16_t access, const wchar_t* clName, const wchar_t* name, const wchar_t* sign) {
+ vmkit::Names* names = vm()->names();
+ return method(access, names->get(clName), names->get(name), names->get(sign));
+}
+
+bool J3ClassLoader::J3MethodLess::operator()(j3::J3Method const* lhs, j3::J3Method const* rhs) const {
+ return lhs->name() < rhs->name()
+ || (lhs->name() == rhs->name()
+ && (lhs->sign() < rhs->sign()
+ || (lhs->sign() == rhs->sign()
+ && (lhs->cl() < rhs->cl()
+ || (lhs->cl() == rhs->cl()
+ && ((lhs->access() & J3Cst::ACC_STATIC) < (rhs->access() & J3Cst::ACC_STATIC)))))));
+}
+
+J3InitialClassLoader::J3InitialClassLoader(J3* v, const char* rtjar, vmkit::BumpAllocator* _alloc)
+ : J3ClassLoader(v, 0, _alloc) {
+ llvm::llvm_start_multithreaded();
+
+ const char** archives = J3Lib::systemClassesArchives();
+ J3ClassBytes* bytes = J3Reader::openFile(allocator(), archives[0]);
+
+ //makeLLVMFunctions_j3();
+
+ if (bytes) {
+ archive = new(allocator()) J3ZipArchive(bytes, allocator());
+ if(!archive) {
+ J3::internalError(L"unable to find system archive");
+ }
+ } else
+ J3::internalError(L"unable to find system archive");
+
+ if(J3Lib::loadSystemLibraries(&nativeLibraries) == -1)
+ J3::internalError(L"unable to find java library");
+}
+
+J3ClassBytes* J3InitialClassLoader::lookup(const vmkit::Name* name) {
+ char tmp[name->length()+16];
+
+ //printf("L: %ls\n", name->cStr());
+ for(int i=0; i<name->length(); i++) {
+ char c = name->cStr()[i] & 0xff;
+ tmp[i] = c == '.' ? '/' : c;
+ }
+ strcpy(tmp + name->length(), ".class");
+ J3ZipFile* file = archive->getFile(tmp);
+
+ if(file) {
+ J3ClassBytes* res = new(allocator(), file->ucsize) J3ClassBytes(file->ucsize);
+
+ if(archive->readFile(res, file))
+ return res;
+ }
+
+ return 0;
+}
+
+bool char_ptr_less::operator()(const char* lhs, const char* rhs) const {
+ //printf("Compare: %ls - %ls - %d\n", lhs, rhs, wcscmp(lhs, rhs));
+ return strcmp(lhs, rhs) < 0;
+}
+
+void J3InitialClassLoader::registerCMangling(const char* mangled, const char* demangled) {
+ _cmangled[demangled] = mangled;
+}
+
+
+
Added: vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,1578 @@
+#include <stdio.h>
+
+#include "j3/j3.h"
+#include "j3/j3thread.h"
+#include "j3/j3reader.h"
+#include "j3/j3codegen.h"
+#include "j3/j3class.h"
+#include "j3/j3constants.h"
+#include "j3/j3classloader.h"
+#include "j3/j3method.h"
+#include "j3/j3mangler.h"
+#include "j3/j3jni.h"
+#include "j3/j3object.h"
+
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/Argument.h"
+#include "llvm/DebugInfo.h"
+#include "llvm/DIBuilder.h"
+
+using namespace j3;
+
+#define _onEndPoint() ({ if(onEndPoint()) return; })
+
+void J3ExceptionEntry::dump() {
+ fprintf(stderr, " exception entry:\n");
+ fprintf(stderr, " start_pc: %u\n", startPC);
+ fprintf(stderr, " end_pc: %u\n", endPC);
+ fprintf(stderr, " handler_pc: %u\n", handlerPC);
+ fprintf(stderr, " catchType: %u\n", catchType);
+}
+
+J3CodeGen::J3CodeGen(vmkit::BumpAllocator* _allocator, J3Method* m) {
+ allocator = _allocator;
+
+ method = m;
+ cl = method->cl();
+ methodType = method->methodType();
+ loader = cl->loader();
+ module = loader->module();
+ vm = loader->vm();
+
+ llvmFunction = method->llvmFunction(0, module);
+ llvmFunction->setGC("vmkit");
+
+ bbCheckCastFailed = 0;
+ bbNullCheckFailed = 0;
+ topPendingBranchs = 0;
+ isWide = 0;
+
+ funcJ3MethodIndex = vm->introspectFunction(module, "j3::J3Method::index()");
+ funcJ3TypeVT = vm->introspectFunction(module, "j3::J3Type::vt()");
+ funcJ3TypeInitialise = vm->introspectFunction(module, "j3::J3Type::initialise()");
+ funcJ3ClassSize = vm->introspectFunction(module, "j3::J3Class::size()");
+ funcJ3ClassStaticInstance = vm->introspectFunction(module, "j3::J3Class::staticInstance()");
+ funcJ3ClassStringAt = vm->introspectFunction(module, "j3::J3Class::stringAt(unsigned short)");
+ funcJ3ObjectTypeJavaClass = vm->introspectFunction(module, "j3::J3ObjectType::javaClass()");
+ funcJniEnv = vm->introspectFunction(module, "j3::J3::jniEnv()");
+ funcJ3ObjectAllocate = vm->introspectFunction(module, "j3::J3Object::allocate(j3::J3VirtualTable*, unsigned long)");
+
+ funcThrowException = vm->introspectFunction(module, "vmkit::VMKit::throwException(void*)");
+ funcClassCastException = vm->introspectFunction(module, "j3::J3::classCastException()");
+ funcNullPointerException = vm->introspectFunction(module, "j3::J3::nullPointerException()");
+
+ funcJ3ThreadPushHandle = vm->introspectFunction(module, "j3::J3Thread::push(j3::J3ObjectHandle*)");
+ funcJ3ThreadPush = vm->introspectFunction(module, "j3::J3Thread::push(j3::J3Object*)");
+ funcJ3ThreadTell = vm->introspectFunction(module, "j3::J3Thread::tell()");
+ funcJ3ThreadRestore = vm->introspectFunction(module, "j3::J3Thread::restore(j3::J3ObjectHandle*)");
+ funcJ3ThreadGet = vm->introspectFunction(module, "j3::J3Thread::get()");
+ funcEchoDebugEnter = vm->introspectFunction(module, "j3::J3CodeGen::echoDebugEnter(unsigned int, char const*, ...)");
+ funcEchoDebugExecute = vm->introspectFunction(module, "j3::J3CodeGen::echoDebugExecute(unsigned int, char const*, ...)");
+
+ funcSlowIsAssignableTo = vm->introspectFunction(module, "j3::J3VirtualTable::slowIsAssignableTo(j3::J3VirtualTable*)");
+ funcFastIsAssignableToPrimaryChecker =
+ vm->introspectFunction(module, "j3::J3VirtualTable::fastIsAssignableToPrimaryChecker(j3::J3VirtualTable*, unsigned int)");
+ funcFastIsAssignableToNonPrimaryChecker =
+ vm->introspectFunction(module, "j3::J3VirtualTable::fastIsAssignableToNonPrimaryChecker(j3::J3VirtualTable*)");
+
+ funcGXXPersonality = vm->introspectFunction(module, "__gxx_personality_v0");
+ funcCXABeginCatch = vm->introspectFunction(module, "__cxa_begin_catch");
+ funcCXAEndCatch = vm->introspectFunction(module, "__cxa_end_catch");
+
+ gvTypeInfo = vm->introspectGlobalValue(module, "typeinfo for void*");
+
+ gcRoot = vm->getGCRoot(module);
+
+ ziTry =
+ (llvm::Function*)module->getOrInsertFunction("vmkit.try",
+ llvm::FunctionType::get(llvm::Type::getVoidTy(module->getContext()), 0));
+}
+
+J3CodeGen::~J3CodeGen() {
+}
+
+void* J3CodeGen::operator new(size_t n, vmkit::BumpAllocator* _allocator) {
+ return _allocator->allocate(n);
+}
+
+void J3CodeGen::operator delete(void* ptr) {
+}
+
+J3CodeGen* J3CodeGen::create(J3Method* method) {
+ vmkit::BumpAllocator* allocator = vmkit::BumpAllocator::create();
+ return new(allocator) J3CodeGen(allocator, method);
+}
+
+void J3CodeGen::destroy(J3CodeGen* codeGen) {
+ vmkit::BumpAllocator* allocator = codeGen->allocator;
+ delete codeGen;
+ vmkit::BumpAllocator::destroy(allocator);
+}
+
+uint32_t J3CodeGen::wideReadU1() {
+ if(isWide) {
+ isWide = 0;
+ return codeReader->readU2();
+ } else
+ return codeReader->readU1();
+}
+
+uint32_t J3CodeGen::wideReadS1() {
+ if(isWide) {
+ isWide = 0;
+ return codeReader->readS2();
+ } else
+ return codeReader->readS1();
+}
+
+llvm::Value* J3CodeGen::flatten(llvm::Value* v, J3Type* type) {
+ if(type == vm->typeInteger || type == vm->typeLong || type == vm->typeFloat || type == vm->typeDouble)
+ return v;
+ else if(type->llvmType()->isPointerTy()) {
+ if(v->getType() == vm->typeJ3ObjectPtr)
+ return v;
+ else
+ return builder->CreateBitCast(v, vm->typeJ3ObjectPtr);
+ } else if(type == vm->typeBoolean || type == vm->typeByte || type == vm->typeShort)
+ return builder->CreateSExt(v, vm->typeInteger->llvmType());
+ else if(type == vm->typeChar)
+ return builder->CreateZExt(v, vm->typeInteger->llvmType());
+ else
+ J3::internalError(L"should not happen");
+}
+
+llvm::Value* J3CodeGen::unflatten(llvm::Value* v, J3Type* type) {
+ if(type == vm->typeInteger || type == vm->typeLong || type == vm->typeFloat || type == vm->typeDouble)
+ return v;
+ else if(type->llvmType()->isPointerTy() && v->getType() != type->llvmType())
+ return builder->CreateBitCast(v, type->llvmType());
+ else if(type == vm->typeBoolean || type == vm->typeByte || type == vm->typeShort)
+ return builder->CreateSExtOrTrunc(v, type->llvmType());
+ else if(type == vm->typeChar)
+ return builder->CreateZExtOrTrunc(v, type->llvmType());
+ else {
+ type->dump();
+ J3::internalError(L"should not happen");
+ }
+}
+
+void J3CodeGen::initialiseJ3Type(J3Type* cl) {
+ if(!cl->isInitialised())
+ builder->CreateCall(funcJ3TypeInitialise, builder->CreateBitCast(cl->llvmDescriptor(module), vm->typeJ3TypePtr));
+}
+
+llvm::Value* J3CodeGen::javaClass(J3ObjectType* type) {
+ return builder->CreateCall(funcJ3ObjectTypeJavaClass,
+ builder->CreateBitCast(type->llvmDescriptor(module), vm->typeJ3ObjectTypePtr));
+}
+
+llvm::Value* J3CodeGen::handleToObject(llvm::Value* obj) {
+ llvm::Value* gep[] = { builder->getInt32(0), builder->getInt32(J3ObjectHandle::gepObj) };
+ return builder->CreateLoad(builder->CreateGEP(obj, gep));
+}
+
+llvm::Value* J3CodeGen::staticInstance(J3Class* cl) {
+ initialiseJ3Type(cl);
+ return builder->CreateBitCast(handleToObject(builder->CreateCall(funcJ3ClassStaticInstance,
+ cl->llvmDescriptor(module))),
+ cl->staticLLVMType());
+}
+
+llvm::Value* J3CodeGen::vt(llvm::Value* obj) {
+ llvm::Value* gepVT[] = { builder->getInt32(0),
+ builder->getInt32(J3Object::gepVT) };
+ llvm::Instruction* res = builder->CreateLoad(builder->CreateGEP(obj, gepVT));
+ res->setDebugLoc(llvm::DebugLoc::get(javaPC, 1, dbgInfo));
+ return res;
+}
+
+llvm::Value* J3CodeGen::vt(J3Type* type) {
+ return builder->CreateCall(funcJ3TypeVT, builder->CreateBitCast(type->llvmDescriptor(module), vm->typeJ3TypePtr));
+}
+
+llvm::Value* J3CodeGen::nullCheck(llvm::Value* obj) {
+ if(exceptionNodes[curExceptionNode]->landingPad) {
+ llvm::BasicBlock* succeed = llvm::BasicBlock::Create(llvmFunction->getContext(), "nullcheck-succeed", llvmFunction);
+
+ if(!bbNullCheckFailed) {
+ bbNullCheckFailed = llvm::BasicBlock::Create(llvmFunction->getContext(), "nullcheck-failed", llvmFunction);
+ builder->SetInsertPoint(bbNullCheckFailed);
+ builder->CreateInvoke(funcNullPointerException, bbRet, exceptionNodes[curExceptionNode]->landingPad);
+ builder->SetInsertPoint(bb);
+ }
+
+ builder->CreateCondBr(builder->CreateIsNotNull(obj), succeed, bbNullCheckFailed);
+
+ bb = succeed;
+ builder->SetInsertPoint(bb);
+ }
+
+ return obj;
+}
+
+#define nyi() J3::internalError(L"not yet implemented: '%s' (%d)", J3Cst::opcodeNames[bc], bc);
+
+void J3CodeGen::invoke(J3Method* target, llvm::Value* func) {
+ J3MethodType* type = target->methodType(cl);
+ std::vector<llvm::Value*> args;
+
+ for(uint32_t i=0; i<type->nbIns(); i++)
+ args.push_back(unflatten(stack.top(type->nbIns() - i - 1), type->ins(i)));
+
+ stack.drop(type->nbIns());
+
+ llvm::Value* res;
+
+ if(exceptionNodes[curExceptionNode]->landingPad) {
+ llvm::BasicBlock* after = llvm::BasicBlock::Create(llvmFunction->getContext(), "invoke-after", llvmFunction);
+ res = builder->CreateInvoke(func, after, exceptionNodes[curExceptionNode]->landingPad, args);
+ bb = after;
+ builder->SetInsertPoint(bb);
+ } else
+ res = builder->CreateCall(func, args);
+
+ if(type->out() != vm->typeVoid) {
+ stack.push(flatten(res, type->out()));
+ }
+}
+
+void J3CodeGen::invokeVirtual(uint32_t idx) {
+ J3Method* target = cl->methodAt(idx, 0);
+ J3MethodType* type = target->methodType(cl);
+ llvm::Value* funcEntry;
+
+ if(target->isResolved())
+ funcEntry = builder->getInt32(target->index());
+ else
+ funcEntry = builder->CreateCall(funcJ3MethodIndex, target->llvmDescriptor(module));
+
+ llvm::Value* obj = nullCheck(stack.top(type->nbIns() - 1));
+ llvm::Value* gepFunc[] = { builder->getInt32(0),
+ builder->getInt32(J3VirtualTable::gepVirtualMethods),
+ funcEntry };
+ llvm::Value* func = builder->CreateBitCast(builder->CreateLoad(builder->CreateGEP(vt(obj), gepFunc)),
+ type->llvmType()->getPointerTo());
+
+ invoke(target, func);
+}
+
+void J3CodeGen::invokeStatic(uint32_t idx) {
+ J3Method* target = cl->methodAt(idx, J3Cst::ACC_STATIC);
+ initialiseJ3Type(target->cl());
+ invoke(target, target->llvmFunction(1, module, cl));
+}
+
+void J3CodeGen::invokeSpecial(uint32_t idx) {
+ J3Method* target = cl->methodAt(idx, 0);
+ invoke(target, target->llvmFunction(1, module, cl));
+}
+
+void J3CodeGen::get(llvm::Value* src, J3Field* f) {
+ llvm::Value* gep[2] = { builder->getInt32(0), builder->getInt32(f->num()) };
+ llvm::Value* res = flatten(builder->CreateLoad(builder->CreateGEP(src, gep)), f->type());
+ stack.push(res);
+}
+
+void J3CodeGen::getField(uint32_t idx) {
+ llvm::Value* obj = stack.pop();
+ J3Field* f = cl->fieldAt(idx, 0);
+ get(unflatten(nullCheck(obj), f->cl()), f);
+}
+
+void J3CodeGen::getStatic(uint32_t idx) {
+ J3Field* f = cl->fieldAt(idx, J3Cst::ACC_STATIC);
+ get(staticInstance(f->cl()), f);
+}
+
+void J3CodeGen::put(llvm::Value* dest, llvm::Value* val, J3Field* f) {
+ llvm::Value* gep[2] = { builder->getInt32(0), builder->getInt32(f->num()) };
+ builder->CreateStore(unflatten(val, f->type()), builder->CreateGEP(dest, gep));
+}
+
+void J3CodeGen::putStatic(uint32_t idx) {
+ J3Field* f = cl->fieldAt(idx, J3Cst::ACC_STATIC);
+ put(staticInstance(f->cl()), stack.pop(), f);
+}
+
+void J3CodeGen::putField(uint32_t idx) {
+ J3Field* f = cl->fieldAt(idx, 0);
+ llvm::Value* val = stack.pop();
+ llvm::Value* obj = nullCheck(stack.pop());
+ put(unflatten(obj, f->cl()), val, f);
+}
+
+void J3CodeGen::arrayBoundCheck(llvm::Value* obj, llvm::Value* idx) {
+}
+
+llvm::Value* J3CodeGen::arrayContent(J3Type* cType, llvm::Value* array, llvm::Value* idx) {
+ array = builder->CreateBitCast(array, vm->typeJ3ArrayObjectPtr);
+ return builder->CreateGEP(builder->CreateBitCast(builder->CreateGEP(array, builder->getInt32(1)), cType->llvmType()->getPointerTo()),
+ idx);
+}
+
+void J3CodeGen::arrayStore(J3Type* cType) {
+ llvm::Value* val = stack.pop();
+ llvm::Value* idx = stack.pop();
+ llvm::Value* array = stack.pop();
+
+ arrayBoundCheck(array, idx);
+ builder->CreateStore(unflatten(val, cType), arrayContent(cType, array, idx));
+}
+
+void J3CodeGen::arrayLoad(J3Type* cType) {
+ llvm::Value* idx = stack.pop();
+ llvm::Value* array = stack.pop();
+
+ arrayBoundCheck(array, idx);
+ stack.push(flatten(builder->CreateLoad(arrayContent(cType, array, idx)), cType));
+}
+
+llvm::Value* J3CodeGen::arrayLengthPtr(llvm::Value* obj) {
+ llvm::Value* gep[2] = { builder->getInt32(0), builder->getInt32(J3ArrayObject::gepLength) };
+ return builder->CreateGEP(builder->CreateBitCast(obj, vm->typeJ3ArrayObjectPtr), gep);
+}
+
+llvm::Value* J3CodeGen::arrayLength(llvm::Value* obj) {
+ return builder->CreateLoad(arrayLengthPtr(obj));
+}
+
+void J3CodeGen::newArray(uint8_t atype) {
+ J3Primitive* prim = 0;
+
+ switch(atype) {
+ case J3Cst::T_BOOLEAN: prim = vm->typeBoolean; break;
+ case J3Cst::T_CHAR: prim = vm->typeChar; break;
+ case J3Cst::T_FLOAT: prim = vm->typeFloat; break;
+ case J3Cst::T_DOUBLE: prim = vm->typeDouble; break;
+ case J3Cst::T_BYTE: prim = vm->typeByte; break;
+ case J3Cst::T_SHORT: prim = vm->typeShort; break;
+ case J3Cst::T_INT: prim = vm->typeInteger; break;
+ case J3Cst::T_LONG: prim = vm->typeLong; break;
+ default:
+ J3::classFormatError(cl, L"wrong atype: %d\n", atype);
+ }
+
+ newArray(prim->getArray());
+}
+
+void J3CodeGen::newArray(J3ArrayClass* array) {
+ initialiseJ3Type(array);
+ llvm::DataLayout* layout = vm->dataLayout();
+ llvm::Value* length = stack.pop();
+ llvm::Value* arraySize =
+ builder->CreateAdd(builder->getInt64(layout->getTypeAllocSize(array->llvmType()->getContainedType(0))),
+ builder->CreateMul(builder->getInt64(layout->getTypeAllocSize(array->component()->llvmType())),
+ builder->CreateZExtOrBitCast(length, builder->getInt64Ty())));
+
+ llvm::Value* res = builder->CreateCall2(funcJ3ObjectAllocate, vt(array), arraySize);
+
+ builder->CreateStore(length, arrayLengthPtr(res));
+
+ stack.push(res);
+}
+
+void J3CodeGen::newObject(J3Class* cl) {
+ initialiseJ3Type(cl);
+
+ llvm::Value* size;
+
+ if(!cl->isResolved()) {
+ size = builder->CreateCall(funcJ3ClassSize, cl->llvmDescriptor(module));
+ } else {
+ size = builder->getInt64(cl->size());
+ }
+
+ llvm::Value* res = builder->CreateCall2(funcJ3ObjectAllocate, vt(cl), size);
+
+ stack.push(res);
+}
+
+llvm::Value* J3CodeGen::isAssignableTo(llvm::Value* obj, J3Type* type) {
+ llvm::Value* vtType = vt(type);
+ llvm::Value* vtObj = vt(obj);
+ if(type->isResolved()) {
+ if(type->vt()->isPrimaryChecker())
+ return builder->CreateCall3(funcFastIsAssignableToPrimaryChecker,
+ vtObj,
+ vtType,
+ builder->getInt32(type->vt()->offset()));
+ else
+ return builder->CreateCall2(funcFastIsAssignableToNonPrimaryChecker, vtObj, vtType);
+ } else
+ return builder->CreateCall2(funcSlowIsAssignableTo, vtObj, vtType);
+}
+
+void J3CodeGen::instanceof(llvm::Value* obj, J3Type* type) {
+ llvm::BasicBlock* after = forwardBranch("instanceof-after", codeReader->tell(), 0, 0);
+ llvm::BasicBlock* ok = llvm::BasicBlock::Create(llvmFunction->getContext(), "instanceof-ok", llvmFunction);
+ llvm::BasicBlock* test = llvm::BasicBlock::Create(llvmFunction->getContext(), "instanceof", llvmFunction);
+
+ builder->CreateCondBr(builder->CreateIsNull(obj), ok, test);
+
+ builder->SetInsertPoint(ok);
+ stack.push(builder->getInt32(1));
+ builder->CreateBr(after);
+
+ stack.drop(1);
+ builder->SetInsertPoint(test);
+ stack.push(builder->CreateZExt(isAssignableTo(obj, type), builder->getInt32Ty()));
+ builder->CreateBr(after);
+}
+
+void J3CodeGen::checkCast(llvm::Value* obj, J3Type* type) {
+ llvm::BasicBlock* succeed = forwardBranch("checkcast-succeed", codeReader->tell(), 0, 0);
+ llvm::BasicBlock* test = llvm::BasicBlock::Create(llvmFunction->getContext(), "checkcast", llvmFunction);
+
+ builder->CreateCondBr(builder->CreateIsNull(obj), succeed, test);
+
+ if(!bbCheckCastFailed) {
+ bbCheckCastFailed = llvm::BasicBlock::Create(llvmFunction->getContext(), "checkcast-failed", llvmFunction);
+ builder->SetInsertPoint(bbCheckCastFailed);
+ builder->CreateCall(funcClassCastException);
+ builder->CreateBr(bbRet);
+ }
+
+ builder->SetInsertPoint(test);
+
+ llvm::Value* res = isAssignableTo(obj, type);
+ builder->CreateCondBr(res, succeed, bbCheckCastFailed);
+
+ builder->SetInsertPoint(bb);
+}
+
+void J3CodeGen::floatToInteger(J3Type* ftype, J3Type* itype) {
+ llvm::Value* min = llvm::ConstantFP::get(ftype->llvmType(),
+ llvm::APInt::getSignedMinValue(itype->llvmType()->getPrimitiveSizeInBits()).getSExtValue());
+ llvm::Value* max = llvm::ConstantFP::get(ftype->llvmType(),
+ llvm::APInt::getSignedMaxValue(itype->llvmType()->getPrimitiveSizeInBits()).getZExtValue());
+ llvm::Value* v = stack.pop();
+
+ llvm::Value* c = builder->CreateFCmpONE(v, v);
+ v = builder->CreateSelect(c, llvm::ConstantFP::get(ftype->llvmType(), 0), v); /* nan => 0 */
+
+ c = builder->CreateFCmpOGE(v, max);
+ v = builder->CreateSelect(c, max, v);
+ c = builder->CreateFCmpOLE(v, min);
+ v = builder->CreateSelect(c, min, v);
+
+ stack.push(builder->CreateFPToSI(v, itype->llvmType()));
+}
+
+void J3CodeGen::compareLong() {
+ llvm::Value* val2 = stack.pop();
+ llvm::Value* val1 = stack.pop();
+ llvm::Value* one = builder->getInt32(1);
+ llvm::Value* zero = builder->getInt32(0);
+ llvm::Value* minus = builder->getInt32(-1);
+
+ llvm::Value* c = builder->CreateICmpSGT(val1, val2);
+ llvm::Value* r = builder->CreateSelect(c, one, zero);
+ c = builder->CreateICmpSLT(val1, val2);
+ r = builder->CreateSelect(c, minus, r);
+
+ stack.push(r);
+}
+
+void J3CodeGen::compareFP(bool isL) {
+ llvm::Value* val2 = stack.pop();
+ llvm::Value* val1 = stack.pop();
+ llvm::Value* one = builder->getInt32(1);
+ llvm::Value* zero = builder->getInt32(0);
+ llvm::Value* minus = builder->getInt32(-1);
+
+ llvm::Value* c = builder->CreateFCmpUGT(val1, val2);
+ llvm::Value* r = builder->CreateSelect(c, one, zero);
+ c = builder->CreateFCmpULT(val1, val2);
+ r = builder->CreateSelect(c, minus, r);
+ c = builder->CreateFCmpUNO(val1, val2);
+ r = builder->CreateSelect(c, isL ? one : minus, r);
+
+ stack.push(r);
+}
+
+void J3CodeGen::ldc(uint32_t idx) {
+ llvm::Value* res;
+
+ switch(cl->getCtpType(idx)) {
+ case J3Cst::CONSTANT_Long: res = builder->getInt64(cl->longAt(idx)); break;
+ case J3Cst::CONSTANT_Integer: res = builder->getInt32(cl->integerAt(idx)); break;
+ case J3Cst::CONSTANT_Float: res = llvm::ConstantFP::get(builder->getFloatTy(), cl->floatAt(idx)); break;
+ case J3Cst::CONSTANT_Double: res = llvm::ConstantFP::get(builder->getDoubleTy(), cl->doubleAt(idx)); break;
+ case J3Cst::CONSTANT_Class: res = handleToObject(javaClass(cl->classAt(idx))); break;
+ case J3Cst::CONSTANT_String:
+ res = handleToObject(builder->CreateCall2(funcJ3ClassStringAt, cl->llvmDescriptor(module), builder->getInt16(idx)));
+ break;
+ default:
+ J3::classFormatError(cl, L"wrong ldc type: %d\n", cl->getCtpType(idx));
+ }
+ stack.push(res);
+}
+
+void J3CodeGen::condBr(llvm::Value* op) {
+ builder->CreateCondBr(op,
+ forwardBranch("if-true", javaPC + codeReader->readS2(), 1, 1),
+ forwardBranch("if-false", codeReader->tell(), 0, 0));
+}
+
+llvm::BasicBlock* J3CodeGen::forwardBranch(const char* id, uint32_t pc, bool doAlloc, bool doPush) {
+ llvm::BasicBlock* res = opInfos[pc].bb;
+
+ if(res)
+ return res;
+
+ if(opInfos[pc].insn) {
+ //printf("split at %d (%s)\n", pc, id);
+ llvm::Instruction* insn = opInfos[pc].insn;
+ if(!insn)
+ J3::classFormatError(cl, L"jmp: not to an instruction");
+ insn = insn->getNextNode();
+ //fprintf(stderr, "--- instruction ---\n");
+ //insn->dump();
+ llvm::BasicBlock* before = insn->getParent();
+ //fprintf(stderr, "--- basic block ---\n");
+ //before->dump();
+ llvm::BasicBlock* after = before->splitBasicBlock(insn);
+ //fprintf(stderr, "--- after split ---\n");
+ //before->dump();
+ //after->dump();
+ opInfos[pc].bb = after;
+ return after;
+ } else {
+ llvm::BasicBlock* res = llvm::BasicBlock::Create(llvmFunction->getContext(), id, llvmFunction);
+
+ if(doAlloc) {
+ opInfos[pc].metaStack = (llvm::Type**)allocator->allocate(sizeof(llvm::Type**)*stack.topStack);
+ memcpy(opInfos[pc].metaStack, stack.metaStack, sizeof(llvm::Type*)*stack.topStack);
+ }
+
+ opInfos[pc].bb = res;
+ opInfos[pc].topStack = stack.topStack;
+ if(doPush)
+ pendingBranchs[topPendingBranchs++] = pc;
+
+ return res;
+ }
+}
+
+bool J3CodeGen::onEndPoint() {
+ uint32_t pc;
+ do {
+ if(!topPendingBranchs)
+ return 1;
+ pc = pendingBranchs[--topPendingBranchs];
+ } while(opInfos[pc].insn);
+ closeBB = 0;
+ codeReader->seek(pc, codeReader->SeekSet);
+ return 0;
+}
+
+llvm::Value* J3CodeGen::buildString(const char* msg) {
+ std::vector<llvm::Constant*> elmts;
+ uint32_t n;
+
+ for(n=0; msg[n]; n++)
+ elmts.push_back(builder->getInt8(msg[n]));
+
+ elmts.push_back(builder->getInt8(0));
+
+ llvm::Constant* str = llvm::ConstantArray::get(llvm::ArrayType::get(builder->getInt8Ty(), n+1), elmts);
+ llvm::Value* var = new llvm::GlobalVariable(*module,
+ str->getType(),
+ 1,
+ llvm::GlobalVariable::InternalLinkage,
+ str);
+ llvm::Value* gep[] = { builder->getInt32(0), builder->getInt32(0) };
+
+ return builder->CreateGEP(var, gep);
+}
+
+void J3CodeGen::echoDebugEnter(uint32_t isLeave, const char* msg, ...) {
+ static __thread uint32_t prof = 0;
+ if(J3Thread::get()->vm()->options()->debugExecute >= 1) {
+ const char* enter = isLeave ? "leaving" : "entering";
+ va_list va;
+ va_start(va, msg);
+
+ if(!isLeave)
+ prof += J3Thread::get()->vm()->options()->debugEnterIndent;
+ fprintf(stderr, "%*s", prof, "");
+ if(isLeave)
+ prof -= J3Thread::get()->vm()->options()->debugEnterIndent;
+
+ fprintf(stderr, "%s ", enter);
+ vfprintf(stderr, msg, va);
+ va_end(va);
+ }
+}
+
+void J3CodeGen::echoDebugExecute(uint32_t level, const char* msg, ...) {
+ if(J3Thread::get()->vm()->options()->debugExecute >= level) {
+ va_list va;
+ va_start(va, msg);
+ vfprintf(stderr, msg, va);
+ va_end(va);
+ }
+}
+
+void J3CodeGen::translate() {
+ if(vm->options()->debugTranslate) {
+ fprintf(stderr, " translating bytecode of: %ls::%ls%ls\n", method->cl()->name()->cStr(), method->name()->cStr(), method->sign()->cStr());
+ if(vm->options()->debugTranslate > 1) {
+ fprintf(stderr, " exception table:\n");
+ for(uint32_t i=0; i<nbExceptionNodes; i++) {
+ fprintf(stderr, " [%4u] handle", exceptionNodes[i]->pc);
+ for(uint32_t j=0; j<exceptionNodes[i]->nbEntries; j++)
+ fprintf(stderr, " %u", exceptionNodes[i]->entries[j]->catchType);
+ fprintf(stderr, exceptionNodes[i]->nbEntries ? "\n" : " <none>\n");
+ }
+ }
+ }
+
+ curExceptionNode = 0;
+
+ stack.topStack = 0;
+ builder->SetInsertPoint(bb);
+ _onEndPoint();
+
+ if(vm->options()->genDebugExecute) {
+ char buf[256];
+ snprintf(buf, 256, "%ls::%ls", method->cl()->name()->cStr(), method->name()->cStr());
+ builder->CreateCall3(funcEchoDebugEnter,
+ builder->getInt32(0),
+ buildString("%s\n"),
+ buildString(buf));
+ }
+
+ while(codeReader->remaining()) {
+ llvm::Value* val1;
+ llvm::Value* val2;
+
+ javaPC = codeReader->tell();
+
+ if(javaPC < exceptionNodes[curExceptionNode]->pc || javaPC >= exceptionNodes[curExceptionNode+1]->pc) {
+ if(javaPC == exceptionNodes[curExceptionNode+1]->pc)
+ curExceptionNode++;
+ else
+ for(uint32_t i=0; i<nbExceptionNodes; i++)
+ if(exceptionNodes[i]->pc <= javaPC && javaPC < exceptionNodes[i+1]->pc) {
+ curExceptionNode = i;
+ break;
+ }
+ //printf("cur exception node: %d\n", curExceptionNode);
+ }
+
+ if(opInfos[javaPC].insn || opInfos[javaPC].bb) {
+ if(closeBB && !bb->getTerminator()) {
+ if(!opInfos[javaPC].bb)
+ J3::internalError(L"random split???");
+ builder->CreateBr(opInfos[javaPC].bb);
+ }
+ }
+
+ if(opInfos[javaPC].insn) {
+ _onEndPoint();
+ javaPC = codeReader->tell();
+ }
+
+ closeBB = 1;
+
+ if(opInfos[javaPC].bb) {
+ bb = opInfos[javaPC].bb;
+ builder->SetInsertPoint(bb);
+ //printf("Meta stack before: %p\n", metaStack);
+ if(opInfos[javaPC].metaStack) {
+ stack.metaStack = opInfos[javaPC].metaStack;
+ stack.topStack = opInfos[javaPC].topStack;
+ } else if(opInfos[javaPC].topStack == -1) { /* exception handling */
+ stack.metaStack[0] = vm->typeJ3ObjectPtr;
+ stack.topStack = 1;
+ }
+ //printf("Meta stack after: %p\n", metaStack);
+ }
+
+ if(opInfos[javaPC].bb)
+ opInfos[javaPC].insn = bb->begin();
+ else
+ opInfos[javaPC].insn = bb->end()->getPrevNode();
+
+ uint8_t bc = codeReader->readU1();
+
+ switch(vm->options()->debugTranslate) {
+ case 4:
+ fprintf(stderr, "--------------------------------------------\n");
+ llvmFunction->dump();
+ case 3:
+ fprintf(stderr, "stack:\n");
+ stack.dump();
+ case 2:
+ fprintf(stderr, " [%4d] decoding: %s\n", javaPC, J3Cst::opcodeNames[bc]);
+ break;
+ }
+
+ if(vm->options()->genDebugExecute) {
+ char buf[256];
+ snprintf(buf, 256, " [%4d] executing: %-20s in %ls::%ls", javaPC,
+ J3Cst::opcodeNames[bc], method->cl()->name()->cStr(), method->name()->cStr());
+ builder->CreateCall3(funcEchoDebugExecute,
+ builder->getInt32(2),
+ buildString("%s\n"),
+ buildString(buf));
+ }
+
+ switch(bc) {
+ case J3Cst::BC_nop: /* 0x00 */
+ break;
+
+ case J3Cst::BC_aconst_null: /* 0x01 */
+ stack.push(nullValue);
+ break;
+
+ case J3Cst::BC_iconst_m1: /* 0x02 */
+ case J3Cst::BC_iconst_0: /* 0x03 */
+ case J3Cst::BC_iconst_1: /* 0x04 */
+ case J3Cst::BC_iconst_2: /* 0x05 */
+ case J3Cst::BC_iconst_3: /* 0x06 */
+ case J3Cst::BC_iconst_4: /* 0x07 */
+ case J3Cst::BC_iconst_5: /* 0x08 */
+ stack.push(builder->getInt32(bc - J3Cst::BC_iconst_0));
+ break;
+
+ case J3Cst::BC_lconst_0: /* 0x09 */
+ case J3Cst::BC_lconst_1: /* 0x0a */
+ stack.push(builder->getInt64(bc - J3Cst::BC_lconst_0));
+ break;
+
+ case J3Cst::BC_fconst_0: /* 0x0b */
+ case J3Cst::BC_fconst_1: /* 0x0c */
+ case J3Cst::BC_fconst_2: /* 0x0d */
+ stack.push(llvm::ConstantFP::get(builder->getFloatTy(), (bc - J3Cst::BC_fconst_0)));
+ break;
+
+ case J3Cst::BC_dconst_0: /* 0x0e */
+ case J3Cst::BC_dconst_1: /* 0x0f */
+ stack.push(llvm::ConstantFP::get(builder->getDoubleTy(), (bc - J3Cst::BC_dconst_0)));
+ break;
+
+ case J3Cst::BC_bipush: /* 0x10 */
+ stack.push(builder->getInt32(codeReader->readS1()));
+ break;
+
+ case J3Cst::BC_sipush: /* 0x11 */
+ stack.push(builder->getInt32(codeReader->readS2()));
+ break;
+
+ case J3Cst::BC_ldc: /* 0x12 */
+ ldc(codeReader->readU1());
+ break;
+
+ case J3Cst::BC_ldc_w: /* 0x13 */
+ case J3Cst::BC_ldc2_w: /* 0x14 */
+ ldc(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_iload: /* 0x15 wide */
+ case J3Cst::BC_lload: /* 0x16 wide */
+ case J3Cst::BC_fload: /* 0x17 wide */
+ case J3Cst::BC_dload: /* 0x18 wide */
+ case J3Cst::BC_aload: /* 0x19 wide */
+ stack.push(locals.at(wideReadU1()));
+ break;
+
+ case J3Cst::BC_iload_0: /* 0x1a */
+ case J3Cst::BC_iload_1: /* 0x1b */
+ case J3Cst::BC_iload_2: /* 0x1c */
+ case J3Cst::BC_iload_3: /* 0x1d */
+ stack.push(locals.at(bc - J3Cst::BC_iload_0));
+ break;
+
+ case J3Cst::BC_lload_0: /* 0x1e */
+ case J3Cst::BC_lload_1: /* 0x1f */
+ case J3Cst::BC_lload_2: /* 0x20 */
+ case J3Cst::BC_lload_3: /* 0x21 */
+ stack.push(locals.at(bc - J3Cst::BC_lload_0));
+ break;
+
+ case J3Cst::BC_fload_0: /* 0x22 */
+ case J3Cst::BC_fload_1: /* 0x23 */
+ case J3Cst::BC_fload_2: /* 0x24 */
+ case J3Cst::BC_fload_3: /* 0x25 */
+ stack.push(locals.at(bc - J3Cst::BC_fload_0));
+ break;
+
+ case J3Cst::BC_dload_0: /* 0x26 */
+ case J3Cst::BC_dload_1: /* 0x27 */
+ case J3Cst::BC_dload_2: /* 0x28 */
+ case J3Cst::BC_dload_3: /* 0x29 */
+ stack.push(locals.at(bc - J3Cst::BC_dload_0));
+ break;
+
+ case J3Cst::BC_aload_0: /* 0x2a */
+ case J3Cst::BC_aload_1: /* 0x2b */
+ case J3Cst::BC_aload_2: /* 0x2c */
+ case J3Cst::BC_aload_3: /* 0x2d */
+ stack.push(locals.at(bc - J3Cst::BC_aload_0));
+ break;
+
+ case J3Cst::BC_iaload: /* 0x2e */
+ arrayLoad(vm->typeInteger);
+ break;
+
+ case J3Cst::BC_laload: /* 0x2f */
+ arrayLoad(vm->typeLong);
+ break;
+
+ case J3Cst::BC_faload: /* 0x30 */
+ arrayLoad(vm->typeFloat);
+ break;
+
+ case J3Cst::BC_daload: /* 0x31 */
+ arrayLoad(vm->typeDouble);
+ break;
+
+ case J3Cst::BC_aaload: /* 0x32 */
+ arrayLoad(vm->objectClass);
+ break;
+
+ case J3Cst::BC_baload: /* 0x33 */
+ arrayStore(vm->typeByte);
+ break;
+
+ case J3Cst::BC_caload: /* 0x34 */
+ arrayStore(vm->typeChar);
+ break;
+
+ case J3Cst::BC_saload: /* 0x35 */
+ arrayStore(vm->typeShort);
+ break;
+
+ case J3Cst::BC_istore: /* 0x36 wide */
+ case J3Cst::BC_lstore: /* 0x37 wide */
+ case J3Cst::BC_fstore: /* 0x38 wide */
+ case J3Cst::BC_dstore: /* 0x39 wide */
+ case J3Cst::BC_astore: /* 0x3a wide */
+ locals.setAt(stack.pop(), wideReadU1());
+ break;
+
+ case J3Cst::BC_istore_0: /* 0x3b */
+ case J3Cst::BC_istore_1: /* 0x3c */
+ case J3Cst::BC_istore_2: /* 0x3d */
+ case J3Cst::BC_istore_3: /* 0x3e */
+ locals.setAt(stack.pop(), bc - J3Cst::BC_istore_0);
+ break;
+
+ case J3Cst::BC_lstore_0: /* 0x3f */
+ case J3Cst::BC_lstore_1: /* 0x40 */
+ case J3Cst::BC_lstore_2: /* 0x41 */
+ case J3Cst::BC_lstore_3: /* 0x42 */
+ locals.setAt(stack.pop(), bc - J3Cst::BC_lstore_0);
+ break;
+
+ case J3Cst::BC_fstore_0: /* 0x43 */
+ case J3Cst::BC_fstore_1: /* 0x44 */
+ case J3Cst::BC_fstore_2: /* 0x45 */
+ case J3Cst::BC_fstore_3: /* 0x46 */
+ locals.setAt(stack.pop(), bc - J3Cst::BC_fstore_0);
+ break;
+
+ case J3Cst::BC_dstore_0: /* 0x47 */
+ case J3Cst::BC_dstore_1: /* 0x48 */
+ case J3Cst::BC_dstore_2: /* 0x49 */
+ case J3Cst::BC_dstore_3: /* 0x4a */
+ locals.setAt(stack.pop(), bc - J3Cst::BC_dstore_0);
+ break;
+
+ case J3Cst::BC_astore_0: /* 0x4b */
+ case J3Cst::BC_astore_1: /* 0x4c */
+ case J3Cst::BC_astore_2: /* 0x4d */
+ case J3Cst::BC_astore_3: /* 0x4e */
+ locals.setAt(stack.pop(), bc - J3Cst::BC_astore_0);
+ break;
+
+ case J3Cst::BC_iastore: /* 0x4f */
+ arrayStore(vm->typeInteger);
+ break;
+
+ case J3Cst::BC_lastore: /* 0x50 */
+ arrayStore(vm->typeLong);
+ break;
+
+ case J3Cst::BC_fastore: /* 0x51 */
+ arrayStore(vm->typeFloat);
+ break;
+
+ case J3Cst::BC_dastore: /* 0x52 */
+ arrayStore(vm->typeDouble);
+ break;
+
+ case J3Cst::BC_aastore: /* 0x53 */
+ arrayStore(vm->objectClass);
+ break;
+
+ case J3Cst::BC_bastore: /* 0x54 */
+ arrayStore(vm->typeByte);
+ break;
+
+ case J3Cst::BC_castore: /* 0x55 */
+ arrayStore(vm->typeChar);
+ break;
+
+ case J3Cst::BC_sastore: /* 0x56 */
+ arrayStore(vm->typeShort);
+ break;
+
+ case J3Cst::BC_pop: /* 0x57 */
+ stack.pop();
+ break;
+
+ case J3Cst::BC_pop2: nyi(); /* 0x58 */
+ case J3Cst::BC_dup: /* 0x59 */
+ stack.push(stack.top());
+ break;
+
+ case J3Cst::BC_dup_x1: nyi(); /* 0x5a */
+ case J3Cst::BC_dup_x2: nyi(); /* 0x5b */
+ case J3Cst::BC_dup2: nyi(); /* 0x5c */
+ case J3Cst::BC_dup2_x1: nyi(); /* 0x5d */
+ case J3Cst::BC_dup2_x2: nyi(); /* 0x5e */
+ case J3Cst::BC_swap: nyi(); /* 0x5f */
+
+ case J3Cst::BC_iadd: /* 0x60 */
+ case J3Cst::BC_ladd: /* 0x61 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateAdd(val1, val2));
+ break;
+
+ case J3Cst::BC_fadd: /* 0x62 */
+ case J3Cst::BC_dadd: /* 0x63 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateFAdd(val1, val2));
+ break;
+
+ case J3Cst::BC_isub: /* 0x64 */
+ case J3Cst::BC_lsub: /* 0x65 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateSub(val1, val2));
+ break;
+
+ case J3Cst::BC_fsub: /* 0x66 */
+ case J3Cst::BC_dsub: /* 0x67 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateFSub(val1, val2));
+ break;
+
+ case J3Cst::BC_imul: /* 0x68 */
+ case J3Cst::BC_lmul: /* 0x69 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateMul(val1, val2));
+ break;
+
+ case J3Cst::BC_fmul: /* 0x6a */
+ case J3Cst::BC_dmul: /* 0x6b */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateFMul(val1, val2));
+ break;
+
+ case J3Cst::BC_idiv: /* 0x6c */
+ case J3Cst::BC_ldiv: /* 0x6d */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateSDiv(val1, val2));
+ break;
+
+ case J3Cst::BC_fdiv: /* 0x6e */
+ case J3Cst::BC_ddiv: /* 0x6f */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateFDiv(val1, val2));
+ break;
+
+ case J3Cst::BC_irem: /* 0x70 */
+ case J3Cst::BC_lrem: /* 0x71 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateSRem(val1, val2));
+ break;
+
+ case J3Cst::BC_frem: /* 0x72 */
+ case J3Cst::BC_drem: /* 0x73 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateFRem(val1, val2));
+ break;
+
+ case J3Cst::BC_ineg: /* 0x74 */
+ case J3Cst::BC_lneg: /* 0x75 */
+ stack.push(builder->CreateNeg(stack.pop()));
+ break;
+
+ case J3Cst::BC_fneg: /* 0x76 */
+ case J3Cst::BC_dneg: /* 0x77 */
+ stack.push(builder->CreateFNeg(stack.pop()));
+ break;
+
+ case J3Cst::BC_ishl: /* 0x78 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateShl(val1, builder->CreateAnd(val2, 0x1f)));
+ break;
+
+ case J3Cst::BC_lshl: /* 0x79 */
+ val2 = stack.pop(); val1 = stack.pop();
+ stack.push(builder->CreateShl(val1, builder->CreateZExt(builder->CreateAnd(val2, 0x3f), builder->getInt64Ty())));
+ break;
+
+ case J3Cst::BC_ishr: /* 0x7a */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateAShr(val1, builder->CreateAnd(val2, 0x1f)));
+ break;
+
+ case J3Cst::BC_lshr: /* 0x7b */
+ val2 = stack.pop(); val1 = stack.pop();
+ stack.push(builder->CreateAShr(val1, builder->CreateZExt(builder->CreateAnd(val2, 0x3f), builder->getInt64Ty())));
+ break;
+
+ case J3Cst::BC_iushr: /* 0x7c */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateLShr(val1, builder->CreateAnd(val2, 0x1f)));
+ break;
+
+ case J3Cst::BC_lushr: /* 0x7d */
+ val2 = stack.pop(); val1 = stack.pop();
+ stack.push(builder->CreateLShr(val1, builder->CreateZExt(builder->CreateAnd(val2, 0x3f), builder->getInt64Ty())));
+ break;
+
+ case J3Cst::BC_iand: /* 0x7e */
+ case J3Cst::BC_land: /* 0x7f */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateAnd(val1, val2));
+ break;
+
+ case J3Cst::BC_ior: /* 0x80 */
+ case J3Cst::BC_lor: /* 0x81 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateOr(val1, val2));
+ break;
+
+ case J3Cst::BC_ixor: /* 0x82 */
+ case J3Cst::BC_lxor: /* 0x83 */
+ val2 = stack.pop(); val1 = stack.pop(); stack.push(builder->CreateXor(val1, val2));
+ break;
+
+ case J3Cst::BC_iinc: /* 0x84 wide */
+ { uint32_t idx = wideReadU1();
+ int32_t val = wideReadS1();
+ locals.setAt(builder->CreateAdd(locals.at(idx), builder->getInt32(val)), idx);
+ } break;
+
+ case J3Cst::BC_i2l: /* 0x85 */
+ stack.push(builder->CreateSExt(stack.pop(), vm->typeLong->llvmType()));
+ break;
+
+ case J3Cst::BC_i2f: /* 0x86 */
+ stack.push(builder->CreateSIToFP(stack.pop(), vm->typeFloat->llvmType()));
+ break;
+
+ case J3Cst::BC_i2d: /* 0x87 */
+ stack.push(builder->CreateSIToFP(stack.pop(), vm->typeDouble->llvmType()));
+ break;
+
+ case J3Cst::BC_l2i: nyi(); /* 0x88 */
+ case J3Cst::BC_l2f: nyi(); /* 0x89 */
+ case J3Cst::BC_l2d: nyi(); /* 0x8a */
+ case J3Cst::BC_f2i: /* 0x8b */
+ floatToInteger(vm->typeFloat, vm->typeInteger);
+ break;
+
+ case J3Cst::BC_f2l: nyi(); /* 0x8c */
+ case J3Cst::BC_f2d: nyi(); /* 0x8d */
+ case J3Cst::BC_d2i: nyi(); /* 0x8e */
+ case J3Cst::BC_d2l: nyi(); /* 0x8f */
+ case J3Cst::BC_d2f: nyi(); /* 0x90 */
+ case J3Cst::BC_i2b: nyi(); /* 0x91 */
+ case J3Cst::BC_i2c: nyi(); /* 0x92 */
+ case J3Cst::BC_i2s: nyi(); /* 0x93 */
+
+ case J3Cst::BC_lcmp: /* 0x94 */
+ compareLong();
+ break;
+
+ case J3Cst::BC_fcmpl: /* 0x95 */
+ compareFP(1);
+ break;
+
+ case J3Cst::BC_fcmpg: /* 0x96 */
+ compareFP(0);
+ break;
+
+ case J3Cst::BC_dcmpl: /* 0x97 */
+ compareFP(0);
+ break;
+
+ case J3Cst::BC_dcmpg: /* 0x98 */
+ compareFP(1);
+ break;
+
+ case J3Cst::BC_ifeq: /* 0x99 */
+ condBr(builder->CreateICmpEQ(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_ifne: /* 0x9a */
+ condBr(builder->CreateICmpNE(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_iflt: /* 0x9b */
+ condBr(builder->CreateICmpSLT(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_ifge: /* 0x9c */
+ condBr(builder->CreateICmpSGE(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_ifgt: /* 0x9d */
+ condBr(builder->CreateICmpSGT(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_ifle: /* 0x9e */
+ condBr(builder->CreateICmpSLE(stack.pop(), builder->getInt32(0)));
+ break;
+
+ case J3Cst::BC_if_icmpeq: /* 0x9f */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpEQ(val1, val2));
+ break;
+
+ case J3Cst::BC_if_icmpne: /* 0xa0 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpNE(val1, val2));
+ break;
+
+ case J3Cst::BC_if_icmplt: /* 0xa1 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpSLE(val1, val2));
+ break;
+
+ case J3Cst::BC_if_icmpge: /* 0xa2 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpSGE(val1, val2));
+ break;
+
+ case J3Cst::BC_if_icmpgt: /* 0xa3 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpSGT(val1, val2));
+ break;
+
+ case J3Cst::BC_if_icmple: /* 0xa4 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpSLE(val1, val2));
+ break;
+
+ case J3Cst::BC_if_acmpeq: /* 0xa5 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpEQ(val1, val2));
+ break;
+
+ case J3Cst::BC_if_acmpne: /* 0xa6 */
+ val2 = stack.pop(); val1 = stack.pop(); condBr(builder->CreateICmpNE(val1, val2));
+ break;
+
+ case J3Cst::BC_goto: /* 0xa7 */
+ builder->CreateBr(forwardBranch("goto", javaPC + codeReader->readS2(), 0, 1));
+ _onEndPoint();
+ break;
+
+ case J3Cst::BC_jsr: nyi(); /* 0xa8 */
+ case J3Cst::BC_ret: nyi(); /* 0xa9 wide */
+ case J3Cst::BC_tableswitch: nyi(); /* 0xaa */
+ case J3Cst::BC_lookupswitch: nyi(); /* 0xab */
+
+ case J3Cst::BC_ireturn: /* 0xac */
+ case J3Cst::BC_lreturn: /* 0xad */
+ case J3Cst::BC_freturn: /* 0xae */
+ case J3Cst::BC_dreturn: /* 0xaf */
+ case J3Cst::BC_areturn: /* 0xb0 */
+ ret.setAt(stack.pop(), 0);
+ builder->CreateBr(bbRet);
+ _onEndPoint();
+ break;
+
+ case J3Cst::BC_return: /* 0xb1 */
+ builder->CreateBr(bbRet);
+ _onEndPoint();
+ break;
+
+ case J3Cst::BC_getstatic: /* 0xb2 */
+ getStatic(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_putstatic: /* 0xb3 */
+ putStatic(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_getfield: /* 0xb4 */
+ getField(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_putfield: /* 0xb5 */
+ putField(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_invokevirtual: /* 0xb6 */
+ invokeVirtual(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_invokespecial: /* 0xb7 */
+ invokeSpecial(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_invokestatic: /* 0xb8 */
+ invokeStatic(codeReader->readU2());
+ break;
+
+ case J3Cst::BC_invokeinterface: nyi(); /* 0xb9 */
+ case J3Cst::BC_new: /* 0xbb */
+ newObject(cl->classAt(codeReader->readU2()));
+ break;
+
+ case J3Cst::BC_newarray: /* 0xbc */
+ newArray(codeReader->readU1());
+ break;
+
+ case J3Cst::BC_anewarray: /* 0xbd */
+ newArray(cl->classAt(codeReader->readU2())->getArray());
+ break;
+
+ case J3Cst::BC_arraylength: /* 0xbe */
+ stack.push(arrayLength(stack.pop()));
+ break;
+
+ case J3Cst::BC_athrow: /* 0xbf */
+ builder->CreateCall(funcThrowException,
+ builder->CreateBitCast(stack.pop(),
+ funcThrowException->getFunctionType()->getParamType(0)));
+ builder->CreateBr(bbRet);
+ _onEndPoint();
+ break;
+
+ case J3Cst::BC_checkcast: /* 0xc0 */
+ checkCast(stack.top(), cl->classAt(codeReader->readU2()));
+ break;
+
+ case J3Cst::BC_instanceof: /* 0xc1 */
+ instanceof(stack.pop(), cl->classAt(codeReader->readU2()));
+ break;
+
+ case J3Cst::BC_monitorenter: /* 0xc2 */
+ stack.pop();
+ break;
+
+ case J3Cst::BC_monitorexit: /* 0xc3 */
+ stack.pop();
+ break;
+
+ case J3Cst::BC_wide: nyi(); /* 0xc4 */
+ case J3Cst::BC_multianewarray: nyi(); /* 0xc5 */
+ case J3Cst::BC_ifnull: /* 0xc6 */
+ condBr(builder->CreateIsNull(stack.pop()));
+ break;
+
+ case J3Cst::BC_ifnonnull: /* 0xc7 */
+ condBr(builder->CreateIsNotNull(stack.pop()));
+ break;
+
+
+ case J3Cst::BC_goto_w: nyi(); /* 0xc8 */
+ case J3Cst::BC_jsr_w: nyi(); /* 0xc9 */
+
+ case J3Cst::BC_breakpoint: /* 0xca */
+ case J3Cst::BC_impdep1: /* 0xfe */
+ case J3Cst::BC_impdep2: /* 0xff */
+ case J3Cst::BC_xxxunusedxxx1: /* 0xba */
+ default:
+ J3::classFormatError(cl, L"unknow opcode '%s' (%d)", J3Cst::opcodeNames[bc], bc);
+ }
+ }
+ J3::classFormatError(cl, L"the last bytecode does not return");
+}
+
+#if 0
+void J3CodeGen::explore() {
+ printf(" exploring bytecode of: %ls::%ls%ls\n", method->cl()->name()->cStr(), method->name()->cStr(), method->sign()->cStr());
+ while(codeReader->remaining()) {
+ uint8_t bc = codeReader->readU1();
+
+ printf(" exploring: %s (%d)\n", J3Cst::opcodeNames[bc], bc);
+ switch(bc) {
+#define eat(n) codeReader->seek(n, codeReader->SeekCur);
+#define defOpcode(id, val, effect) \
+ case J3Cst::BC_##id: effect; break;
+#include "j3/j3bc.def"
+ default:
+ J3::internalError(L"unknow opcode '%s' (%d)", J3Cst::opcodeNames[bc], bc);
+ }
+ }
+}
+#endif
+
+void J3CodeGen::initExceptionNode(J3ExceptionNode** pnode, uint32_t pc, J3ExceptionNode* node) {
+ *pnode = node;
+ nbExceptionNodes++;
+ node->pc = pc;
+ node->nbEntries = 0;
+ node->landingPad = 0;
+ node->curCheck = 0;
+}
+
+void J3CodeGen::addToExceptionNode(J3ExceptionNode* node, J3ExceptionEntry* entry) {
+ if(!node->nbEntries) {
+ node->landingPad = llvm::BasicBlock::Create(llvmFunction->getContext(), "landing-pad", llvmFunction);
+ node->curCheck = node->landingPad;
+ builder->SetInsertPoint(node->landingPad);
+
+ llvm::LandingPadInst *caughtResult = builder->CreateLandingPad(vm->typeGXXException, funcGXXPersonality, 1, "landing-pad");
+ caughtResult->addClause(gvTypeInfo);
+ llvm::Value* excp = builder->CreateBitCast(builder->CreateCall(funcCXABeginCatch,
+ builder->CreateExtractValue(caughtResult, 0)),
+ vm->typeJ3ObjectPtr);
+
+ builder->CreateCall(funcCXAEndCatch);
+
+ builder->CreateCall2(funcEchoDebugExecute,
+ builder->getInt32(0), /* just to see my first exception :) */
+ buildString("entering launchpad!\n"));
+
+ stack.topStack = 0;
+ stack.push(excp);
+ }
+
+ node->entries[node->nbEntries++] = entry;
+
+ if(node->curCheck) { /* = 0 if I already have a finally */
+ builder->SetInsertPoint(node->curCheck);
+ node->curCheck = llvm::BasicBlock::Create(llvmFunction->getContext(), "next-exception-check", llvmFunction);
+
+ if(entry->catchType) {
+ stack.metaStack[0] = vm->typeJ3ObjectPtr;
+ stack.topStack = 1;
+ builder->CreateCondBr(isAssignableTo(stack.top(0), cl->classAt(entry->catchType)), entry->bb, node->curCheck);
+ } else {
+ builder->CreateBr(entry->bb);
+ node->curCheck = 0;
+ }
+ }
+}
+
+void J3CodeGen::closeExceptionNode(J3ExceptionNode* node) {
+ if(node->curCheck) {
+ builder->SetInsertPoint(node->curCheck);
+ builder->CreateBr(bbRet);
+ }
+}
+
+void J3CodeGen::generateJava() {
+ J3Attribute* attr = method->attributes()->lookup(vm->codeAttr);
+
+ if(!attr)
+ J3::classFormatError(cl, L"No Code attribute in %ls %ls", method->name()->cStr(), method->sign()->cStr());
+
+ J3Reader reader(cl->bytes());
+ reader.seek(attr->offset(), reader.SeekSet);
+
+ uint32_t length = reader.readU4();
+
+ if(!reader.adjustSize(length))
+ J3::classFormatError(cl, L"Code attribute of %ls %ls is too large (%d)", method->name()->cStr(), method->sign()->cStr(), length);
+
+ nullValue = builder
+ ->CreateIntToPtr(llvm::ConstantInt::get(vm->dataLayout()->getIntPtrType(module->getContext()), (uintptr_t)0),
+ vm->typeJ3ObjectPtr);
+
+ dbgInfo =
+ loader->dbgBuilder()->createFunction(llvm::DIDescriptor(), // Function scope
+ llvmFunction->getName(), // Function name
+ llvmFunction->getName(), // Mangled name
+ llvm::DIFile(), // File where this variable is defined
+ 0, // Line number
+ loader->dbgBuilder() // Function type.
+ ->createSubroutineType(llvm::DIFile(), // File in which this subroutine is defined
+ llvm::DIArray()), // An array of subroutine parameter types.
+ // This includes return type at 0th index.
+ false, // True if this function is not externally visible
+ false, // True if this is a function definition
+ 0 // Set to the beginning of the scope this starts
+ );
+
+ uint32_t maxStack = reader.readU2();
+ uint32_t nbLocals = reader.readU2();
+ uint32_t codeLength = reader.readU4();
+
+ locals.init(this, nbLocals, allocator->allocate(J3CodeGenVar::reservedSize(nbLocals)));
+ stack.init(this, maxStack, allocator->allocate(J3CodeGenVar::reservedSize(maxStack)));
+ ret.init(this, 1, allocator->allocate(J3CodeGenVar::reservedSize(1)));
+
+ uint32_t n=0;
+ for(llvm::Function::arg_iterator cur=llvmFunction->arg_begin(); cur!=llvmFunction->arg_end(); cur++, n++) {
+ locals.setAt(flatten(cur, methodType->ins(n)), n);
+ }
+
+ //builder->CreateCall(ziTry);
+
+ pendingBranchs = (uint32_t*)allocator->allocate(sizeof(uint32_t) * codeLength);
+ opInfos = (J3OpInfo*)allocator->allocate(sizeof(J3OpInfo) * codeLength);
+ memset(opInfos, 0, sizeof(J3OpInfo) * codeLength);
+
+ J3Reader codeReaderTmp(cl->bytes(), reader.tell(), codeLength);
+ codeReader = &codeReaderTmp;
+
+ bbRet = llvm::BasicBlock::Create(llvmFunction->getContext(), "ret", llvmFunction);
+ builder->SetInsertPoint(bbRet);
+ if(vm->options()->genDebugExecute) {
+ char buf[256];
+ snprintf(buf, 256, "%ls::%ls", method->cl()->name()->cStr(), method->name()->cStr());
+ builder->CreateCall3(funcEchoDebugEnter,
+ builder->getInt32(1),
+ buildString("%s\n"),
+ buildString(buf));
+ }
+ if(methodType->out() == vm->typeVoid) {
+ builder->CreateRetVoid();
+ } else {
+ ret.metaStack[0] = methodType->out()->llvmType();
+ builder->CreateRet(unflatten(ret.at(0), methodType->out()));
+ }
+
+ if(J3Cst::isSynchronized(method->access())) {
+ static bool echoDone = 0;
+ if(!echoDone) {
+ fprintf(stderr, "IMPLEMENT ME: synchronized java\n");
+ echoDone = 1;
+ }
+ }
+
+ reader.seek(codeLength, reader.SeekCur);
+ nbExceptionEntries = reader.readU2();
+ exceptionEntries = (J3ExceptionEntry*)allocator->allocate(sizeof(J3ExceptionEntry) * nbExceptionEntries);
+ exceptionNodes = (J3ExceptionNode**)allocator->allocate(sizeof(J3ExceptionNode*) * (nbExceptionEntries * 2 + 2));
+ nbExceptionNodes = 0;
+
+ initExceptionNode(exceptionNodes,
+ 0,
+ (J3ExceptionNode*)allocator->allocate(sizeof(J3ExceptionNode) -
+ sizeof(J3ExceptionEntry*) +
+ nbExceptionEntries * sizeof(J3ExceptionEntry*)));
+
+ for(uint32_t i=0; i<nbExceptionEntries; i++) {
+ exceptionEntries[i].startPC = reader.readU2();
+ exceptionEntries[i].endPC = reader.readU2();
+ exceptionEntries[i].handlerPC = reader.readU2();
+ exceptionEntries[i].catchType = reader.readU2();
+ exceptionEntries[i].bb = forwardBranch("exception-handler", exceptionEntries[i].handlerPC, 0, 1);
+ opInfos[exceptionEntries[i].handlerPC].topStack = -1;
+
+ /* basically, create an array of exception points where, at each point, we know the types that we have to handle (ordered) */
+ uint32_t cur, found=0, create=1;
+ for(cur=0; cur<nbExceptionNodes && !found; cur++) {
+ if(exceptionEntries[i].startPC == exceptionNodes[cur]->pc) {
+ create = 0;
+ found = 1;
+ } else if(exceptionNodes[cur]->pc > exceptionEntries[i].startPC) {
+ memmove(exceptionNodes + cur + 1, exceptionNodes + cur, (nbExceptionNodes - cur) * sizeof(J3ExceptionNode*));
+ found = 1;
+ }
+ }
+
+ if(create) {
+ initExceptionNode(exceptionNodes+cur,
+ exceptionEntries[i].startPC,
+ (J3ExceptionNode*)allocator->allocate(sizeof(J3ExceptionNode) + (nbExceptionEntries - 1)*sizeof(J3ExceptionEntry*)));
+ if(cur > 0)
+ for(uint32_t k=0; k<exceptionNodes[cur-1]->nbEntries; k++)
+ addToExceptionNode(exceptionNodes[cur], exceptionNodes[cur-1]->entries[k]);
+ }
+
+ found = 0; create = 1;
+ for(; cur<nbExceptionNodes && !found; cur++) {
+ //printf("%u %u %u %u\n", cur, exceptionNodes[cur].pc, exceptionEntries[i].startPC, exceptionEntries[i].endPC);
+ if(exceptionEntries[i].endPC == exceptionNodes[cur]->pc) {
+ create = 0;
+ found = 1;
+ } else if(exceptionEntries[i].endPC < exceptionNodes[cur]->pc) {
+ memmove(exceptionNodes + cur + 1, exceptionNodes + cur, (nbExceptionNodes - cur) * sizeof(J3ExceptionNode*));
+ found = 1;
+ } else
+ addToExceptionNode(exceptionNodes[cur], exceptionEntries + i);
+ }
+
+ if(create) {
+ initExceptionNode(exceptionNodes+cur,
+ exceptionEntries[i].endPC,
+ (J3ExceptionNode*)allocator->allocate(sizeof(J3ExceptionNode) + (nbExceptionEntries - 1)*sizeof(J3ExceptionEntry*)));
+ for(uint32_t k=0; k<exceptionNodes[cur-1]->nbEntries-1; k++)
+ addToExceptionNode(exceptionNodes[cur], exceptionNodes[cur-1]->entries[k]);
+ }
+ }
+
+ if(exceptionNodes[nbExceptionNodes-1]->pc != codeLength)
+ initExceptionNode(exceptionNodes + nbExceptionNodes,
+ codeLength,
+ (J3ExceptionNode*)allocator->allocate(sizeof(J3ExceptionNode) -
+ sizeof(J3ExceptionEntry*) +
+ nbExceptionEntries * sizeof(J3ExceptionEntry*)));
+
+ for(uint32_t i=0; i<nbExceptionNodes; i++)
+ closeExceptionNode(exceptionNodes[i]);
+
+ pendingBranchs[topPendingBranchs++] = codeReader->tell();
+ translate();
+
+ locals.killUnused();
+ stack.killUnused();
+ ret.killUnused();
+}
+
+void J3CodeGen::generateNative() {
+ std::vector<llvm::Value*> args;
+
+ llvm::Function* nat = method->nativeLLVMFunction(module);
+
+ llvm::Value* res;
+ llvm::Value* thread = builder->CreateCall(funcJ3ThreadGet);
+ llvm::Value* frame = builder->CreateCall(funcJ3ThreadTell, thread);
+
+ if(J3Cst::isSynchronized(method->access())) {
+ static bool echoDone = 0;
+ if(!echoDone) {
+ fprintf(stderr, "IMPLEMENT ME: synchronized java\n");
+ echoDone = 1;
+ }
+ }
+
+ args.push_back(builder->CreateCall(funcJniEnv));
+ if(J3Cst::isStatic(method->access()))
+ args.push_back(builder->CreateCall2(funcJ3ThreadPushHandle, thread, javaClass(cl))); /* avoid harakiri */
+
+ if(methodType->nbIns()) {
+ uint32_t i = 0;
+
+ for(llvm::Function::arg_iterator cur=llvmFunction->arg_begin(); cur!=llvmFunction->arg_end(); cur++, i++) {
+ llvm::Value* a;
+ if(methodType->ins(i)->llvmType()->isPointerTy())
+ a = builder->CreateCall2(funcJ3ThreadPush, thread, flatten(cur, methodType->ins(i)));
+ else
+ a = cur;
+ args.push_back(a);
+ }
+ }
+
+ res = builder->CreateCall(nat, args);
+
+ if(methodType->out() == vm->typeVoid) {
+ builder->CreateCall2(funcJ3ThreadRestore, thread, frame);
+ builder->CreateRetVoid();
+ } else {
+ builder->CreateCall2(funcJ3ThreadRestore, thread, frame);
+
+ if(methodType->out()->llvmType()->isPointerTy()) {
+ llvm::BasicBlock* ifnull = llvm::BasicBlock::Create(llvmFunction->getContext(), "ifnull", llvmFunction);
+ llvm::BasicBlock* ifnotnull = llvm::BasicBlock::Create(llvmFunction->getContext(), "ifnotnull", llvmFunction);
+ builder->CreateCondBr(builder->CreateIsNull(res), ifnull, ifnotnull);
+
+ builder->SetInsertPoint(bb = ifnull);
+ builder->CreateRet(unflatten(res, methodType->out()));
+
+ builder->SetInsertPoint(bb = ifnotnull);
+ res = unflatten(handleToObject(res), methodType->out());
+ }
+ builder->CreateRet(res);
+ }
+}
+
+llvm::Function* J3CodeGen::generate() {
+ bb = llvm::BasicBlock::Create(llvmFunction->getContext(), "entry", llvmFunction);
+ llvm::IRBuilder<> _builder(bb);
+
+ builder = &_builder;
+
+ if(J3Cst::isNative(method->access()))
+ generateNative();
+ else
+ generateJava();
+
+ //llvmFunction->dump();
+ //module->dump();
+
+ return llvmFunction;
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3codegenvar.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3codegenvar.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegenvar.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegenvar.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,177 @@
+#include "j3/j3codegenvar.h"
+#include "j3/j3codegen.h"
+#include "j3/j3.h"
+#include "j3/j3classloader.h"
+
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/Function.h"
+
+using namespace j3;
+
+void J3CodeGenVar::killUnused(llvm::AllocaInst** stack, bool isObj) {
+ llvm::Type* i8ptr = codeGen->builder->getInt8Ty()->getPointerTo();
+ llvm::Value* meta = codeGen->builder->CreateBitCast(codeGen->nullValue, i8ptr);
+ llvm::Type* i8ptrptr = i8ptr->getPointerTo();
+
+ for(uint32_t i=0; i<maxStack; i++) {
+ llvm::AllocaInst* cur = stack[i];
+
+ unsigned uses = cur->getNumUses();
+ if (!uses) {
+ cur->eraseFromParent();
+ } else if (uses == 1 && llvm::dyn_cast<llvm::StoreInst>(*(cur->use_begin()))) {
+ llvm::dyn_cast<llvm::StoreInst>(*(cur->use_begin()))->eraseFromParent();
+ cur->eraseFromParent();
+ } else if(isObj) {
+ codeGen->builder->SetInsertPoint(cur->getNextNode());
+ codeGen->builder->CreateCall2(codeGen->gcRoot, codeGen->builder->CreateBitCast(refStack[i], i8ptrptr), meta);
+ //codeGen->builder->CreateStore(codeGen->nullValue, cur);
+ //
+ }
+ }
+}
+
+void J3CodeGenVar::killUnused() {
+ killUnused(intStack, 0);
+ killUnused(longStack, 0);
+ killUnused(floatStack, 0);
+ killUnused(doubleStack, 0);
+ killUnused(refStack, 1);
+}
+
+uint32_t J3CodeGenVar::reservedSize(uint32_t max) {
+ return max*5*sizeof(llvm::AllocaInst*) + max*sizeof(llvm::Type*);
+}
+
+uint32_t J3CodeGenVar::metaStackSize() {
+ return topStack*sizeof(llvm::Type*);
+}
+
+void J3CodeGenVar::init(J3CodeGen* _codeGen, uint32_t max, void* space) {
+ codeGen = _codeGen;
+ maxStack = max;
+ intStack = (llvm::AllocaInst**)space;
+ longStack = intStack + max;
+ floatStack = longStack + max;
+ doubleStack = floatStack + max;
+ refStack = doubleStack + max;
+ metaStack = (llvm::Type**)(refStack + max);
+ topStack = 0;
+
+ for(uint32_t i=0; i<max; i++) {
+ intStack[i] = codeGen->builder->CreateAlloca(codeGen->builder->getInt32Ty());
+ longStack[i] = codeGen->builder->CreateAlloca(codeGen->builder->getInt64Ty());
+ floatStack[i] = codeGen->builder->CreateAlloca(codeGen->builder->getFloatTy());
+ doubleStack[i] = codeGen->builder->CreateAlloca(codeGen->builder->getDoubleTy());
+ refStack[i] = codeGen->builder->CreateAlloca(codeGen->vm->typeJ3ObjectPtr);
+ }
+}
+
+void J3CodeGenVar::dump() {
+ for(uint32_t i=0; i<topStack; i++) {
+ fprintf(stderr, " [%u]: ", i);
+ llvm::Type* t = metaStack[i];
+ llvm::Value* v;
+
+ if(t->isIntegerTy(64))
+ v = doubleStack[i];
+ else if(t->isIntegerTy())
+ v = intStack[i];
+ else if(t->isFloatTy())
+ v = floatStack[i];
+ else if(t->isDoubleTy())
+ v = doubleStack[i];
+ else if(t->isPointerTy())
+ v = refStack[i];
+ else {
+ t->dump();
+ J3::internalError(L"should not happen");
+ }
+
+ v->dump();
+ //fprintf(stderr, "\n");
+ }
+}
+
+void J3CodeGenVar::drop(uint32_t n) {
+ topStack -= n;
+}
+
+void J3CodeGenVar::setAt(llvm::Value* value, uint32_t idx) {
+ //if(idx >= nbLocals + maxStack)
+ //J3::classFormatError(cl, L"bad index %lu", idx);
+ llvm::Type* t = value->getType();
+ llvm::AllocaInst** stack;
+
+ if(t->isIntegerTy(64)) {
+ stack = longStack;
+ } else if(t->isIntegerTy()) {
+ stack = intStack;
+ } else if(t->isFloatTy()) {
+ stack = floatStack;
+ } else if(t->isDoubleTy()) {
+ stack = doubleStack;
+ } else if(t->isPointerTy()) {
+ stack = refStack;
+ } else
+ J3::internalError(L"should not happen");
+
+ // fprintf(stderr, "setAt[%u]: ", idx);
+ // value->dump();
+ // fprintf(stderr, "\n");
+
+ metaStack[idx] = t;
+
+ codeGen->builder->CreateStore(value, stack[idx]);
+}
+
+llvm::Value* J3CodeGenVar::at(uint32_t idx) {
+ //if(idx >= nbLocals + maxStack)
+ //vm->classFormatError(cl, L"bad index %lu", idx);
+ llvm::Type* t = metaStack[idx];
+ llvm::Value* res;
+
+ if(t->isIntegerTy(64)) {
+ res = codeGen->builder->CreateLoad(longStack[idx]);
+ } else if(t->isIntegerTy()) {
+ res = codeGen->builder->CreateLoad(intStack[idx]);
+ } else if(t->isFloatTy()) {
+ res = codeGen->builder->CreateLoad(floatStack[idx]);
+ } else if(t->isDoubleTy()) {
+ res = codeGen->builder->CreateLoad(doubleStack[idx]);
+ } else if(t->isPointerTy()) {
+ res = codeGen->builder->CreateLoad(refStack[idx]);
+ } else
+ J3::internalError(L"should not happen");
+
+ // fprintf(stderr, "top: ");
+ // res->dump();
+ // fprintf(stderr, "\n");
+
+ return res;
+}
+
+void J3CodeGenVar::push(llvm::Value* value) {
+ // fprintf(stderr, "push: ");
+ // value->dump();
+ // fprintf(stderr, "\n");
+ if(topStack >= maxStack)
+ J3::classFormatError(codeGen->cl, L"too many push in... ");
+
+ setAt(value, topStack++);
+}
+
+llvm::Value* J3CodeGenVar::pop() {
+ if(!topStack)
+ J3::classFormatError(codeGen->cl, L"too many pop in... ");
+
+ llvm::Value* res = at(--topStack);
+ return res;
+}
+
+llvm::Value* J3CodeGenVar::top(uint32_t idx) {
+ if(topStack <= idx)
+ J3::classFormatError(codeGen->cl, L"too large top in... ");
+
+ return at(topStack - idx - 1);
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3constants.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3constants.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3constants.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3constants.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,37 @@
+#include "j3/j3.h"
+#include "j3/j3constants.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3method.h"
+
+#include "llvm/IR/DerivedTypes.h"
+
+using namespace j3;
+
+wchar_t J3Cst::codeAttr[] = L"Code";
+wchar_t J3Cst::constantValueAttr[] = L"ConstantValue";
+
+wchar_t J3Cst::clinitName[] = L"<clinit>";
+wchar_t J3Cst::clinitSign[] = L"()V";
+wchar_t J3Cst::initName[] = L"<init>";
+char J3Cst::nativePrefix[] = "Java_";
+
+const vmkit::Name* J3Cst::rewrite(J3* vm, const vmkit::Name* clName, const vmkit::Name* orig) {
+ wchar_t res[clName->length() + orig->length() + 3];
+
+ res[0] = ID_Left;
+ res[1] = ID_Classname;
+ memcpy(res+2, clName->cStr(), sizeof(wchar_t)*clName->length());
+ res[2 + clName->length()] = ID_End;
+ memcpy(res+3+clName->length(), orig->cStr()+1, sizeof(wchar_t)*(orig->length()-1));
+ res[2 + clName->length() + orig->length()] = 0;
+
+ return vm->names()->get(res);
+}
+
+#define defOpcode(ID, val, effect) \
+ #ID,
+const char* J3Cst::opcodeNames[] = {
+#include "j3/j3bc.def"
+};
+#undef defOpcode
Added: vmkit/branches/mcjit/lib/j3/vm/j3jni.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3jni.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3jni.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3jni.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,655 @@
+#include "j3/j3jni.h"
+#include "j3/j3.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3object.h"
+#include "j3/j3method.h"
+#include "j3/j3thread.h"
+#include <stdlib.h>
+
+#define enterJVM() try {
+#define leaveJVM() } catch(void* e) { J3Thread::get()->setPendingException(J3Thread::get()->push((J3Object*)e)); }
+
+#define NYI() { fprintf(stderr, "-- not yet implemented: %s --\n", __PRETTY_FUNCTION__); abort(); }
+
+namespace j3 {
+
+jint JNICALL GetVersion(JNIEnv* env) { enterJVM(); leaveJVM(); NYI(); }
+
+jclass JNICALL DefineClass(JNIEnv* env, const char* name, jobject loader, const jbyte* buf, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jclass JNICALL FindClass(JNIEnv* env, const char* name) {
+ //jclass res;
+ enterJVM();
+ //J3Class* cl =
+ leaveJVM();
+ NYI();
+}
+
+jmethodID JNICALL FromReflectedMethod(JNIEnv* env, jobject method) { enterJVM(); leaveJVM(); NYI(); }
+jfieldID JNICALL FromReflectedField(JNIEnv* env, jobject field) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL ToReflectedMethod(JNIEnv* env, jclass cls, jmethodID methodID, jboolean isStatic) { enterJVM(); leaveJVM(); NYI(); }
+
+jclass JNICALL GetSuperclass(JNIEnv* env, jclass sub) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL IsAssignableFrom(JNIEnv* env, jclass sub, jclass sup) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL ToReflectedField(JNIEnv* env, jclass cls, jfieldID fieldID, jboolean isStatic) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL Throw(JNIEnv* env, jthrowable obj) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL ThrowNew(JNIEnv* env, jclass clazz, const char* msg) { enterJVM(); leaveJVM(); NYI(); }
+
+jthrowable JNICALL ExceptionOccurred(JNIEnv* env) {
+ return J3Thread::get()->pendingException();
+}
+
+void JNICALL ExceptionDescribe(JNIEnv* env) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ExceptionClear(JNIEnv* env) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL FatalError(JNIEnv* env, const char* msg) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL PushLocalFrame(JNIEnv* env, jint capacity) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL PopLocalFrame(JNIEnv* env, jobject result) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL NewGlobalRef(JNIEnv* env, jobject lobj) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL DeleteGlobalRef(JNIEnv* env, jobject gref) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL DeleteLocalRef(JNIEnv* env, jobject obj) {
+ enterJVM();
+ if(obj) obj->harakiri();
+ leaveJVM();
+}
+
+jboolean JNICALL IsSameObject(JNIEnv* env, jobject obj1, jobject obj2) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL NewLocalRef(JNIEnv* env, jobject ref) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL EnsureLocalCapacity(JNIEnv* env, jint capacity) {
+ enterJVM();
+ J3Thread::get()->ensureCapacity(capacity);
+ leaveJVM();
+ return JNI_OK;
+}
+
+jobject JNICALL AllocObject(JNIEnv* env, jclass clazz) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL NewObject(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL NewObjectV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL NewObjectA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jclass JNICALL GetObjectClass(JNIEnv* env, jobject obj) {
+ jclass res;
+
+ enterJVM();
+ res = obj->vt()->type()->asObjectType()->javaClass();
+ leaveJVM();
+
+ return res;
+}
+
+jboolean JNICALL IsInstanceOf(JNIEnv* env, jobject obj, jclass clazz) { enterJVM(); leaveJVM(); NYI(); }
+
+jmethodID JNICALL GetMethodID(JNIEnv* env, jclass clazz, const char* name, const char* sig) {
+ jmethodID res;
+
+ enterJVM();
+ J3ObjectType* cl = J3ObjectType::nativeClass(clazz);
+ cl->initialise();
+ vmkit::Names* n = cl->loader()->vm()->names();
+ res = cl->findVirtualMethod(n->get(name), n->get(sig));
+ leaveJVM();
+ return res;
+}
+
+#define doInvoke(jtype, id, j3type) \
+ jtype JNICALL Call##id##Method(JNIEnv* env, jobject obj, jmethodID methodID, ...) { \
+ va_list va; \
+ va_start(va, methodID); \
+ jobject res = env->Call##id##MethodV(obj, methodID, va); \
+ va_end(va); \
+ return res; \
+ } \
+ \
+ jtype JNICALL Call##id##MethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { \
+ jvalue res; \
+ \
+ enterJVM(); \
+ res = methodID->invokeVirtual(obj, args); \
+ leaveJVM(); \
+ \
+ return res.val##j3type; \
+ }
+
+ doInvoke(jobject, Object, Object);
+
+
+jobject JNICALL CallObjectMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jboolean JNICALL CallBooleanMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallBooleanMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallBooleanMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jbyte JNICALL CallByteMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallByteMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallByteMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jchar JNICALL CallCharMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL CallCharMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL CallCharMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jshort JNICALL CallShortMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallShortMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallShortMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL CallIntMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallIntMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallIntMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jlong JNICALL CallLongMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallLongMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallLongMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jfloat JNICALL CallFloatMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallFloatMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallFloatMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jdouble JNICALL CallDoubleMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallDoubleMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallDoubleMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL CallVoidMethod(JNIEnv* env, jobject obj, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallVoidMethodV(JNIEnv* env, jobject obj, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallVoidMethodA(JNIEnv* env, jobject obj, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL CallNonvirtualObjectMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL CallNonvirtualObjectMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL CallNonvirtualObjectMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jboolean JNICALL CallNonvirtualBooleanMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallNonvirtualBooleanMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallNonvirtualBooleanMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jbyte JNICALL CallNonvirtualByteMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallNonvirtualByteMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallNonvirtualByteMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jchar JNICALL CallNonvirtualCharMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL CallNonvirtualCharMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jchar CallNonvirtualCharMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jshort JNICALL CallNonvirtualShortMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallNonvirtualShortMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallNonvirtualShortMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL CallNonvirtualIntMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallNonvirtualIntMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallNonvirtualIntMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jlong JNICALL CallNonvirtualLongMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallNonvirtualLongMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallNonvirtualLongMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jfloat JNICALL CallNonvirtualFloatMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallNonvirtualFloatMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallNonvirtualFloatMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jdouble JNICALL CallNonvirtualDoubleMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallNonvirtualDoubleMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallNonvirtualDoubleMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL CallNonvirtualVoidMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallNonvirtualVoidMethodV(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallNonvirtualVoidMethodA(JNIEnv* env, jobject obj, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jfieldID JNICALL GetFieldID(JNIEnv* env, jclass clazz, const char* name, const char* sig) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL GetObjectField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL GetBooleanField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL GetByteField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL GetCharField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL GetShortField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL GetIntField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL GetLongField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL GetFloatField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL GetDoubleField(JNIEnv* env, jobject obj, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL SetObjectField(JNIEnv* env, jobject obj, jfieldID fieldID, jobject val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetBooleanField(JNIEnv* env, jobject obj, jfieldID fieldID, jboolean val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetByteField(JNIEnv* env, jobject obj, jfieldID fieldID, jbyte val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetCharField(JNIEnv* env, jobject obj, jfieldID fieldID, jchar val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetShortField(JNIEnv* env, jobject obj, jfieldID fieldID, jshort val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetIntField(JNIEnv* env, jobject obj, jfieldID fieldID, jint val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetLongField(JNIEnv* env, jobject obj, jfieldID fieldID, jlong val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetFloatField(JNIEnv* env, jobject obj, jfieldID fieldID, jfloat val) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetDoubleField(JNIEnv* env, jobject obj, jfieldID fieldID, jdouble val) { enterJVM(); leaveJVM(); NYI(); }
+
+jmethodID JNICALL GetStaticMethodID(JNIEnv* env, jclass clazz, const char* name, const char* sig) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL CallStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL CallStaticObjectMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL CallStaticObjectMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jboolean JNICALL CallStaticBooleanMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallStaticBooleanMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL CallStaticBooleanMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jbyte JNICALL CallStaticByteMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallStaticByteMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL CallStaticByteMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jchar JNICALL CallStaticCharMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL CallStaticCharMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL CallStaticCharMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jshort JNICALL CallStaticShortMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallStaticShortMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL CallStaticShortMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL CallStaticIntMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallStaticIntMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL CallStaticIntMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jlong JNICALL CallStaticLongMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallStaticLongMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL CallStaticLongMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jfloat JNICALL CallStaticFloatMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallStaticFloatMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL CallStaticFloatMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jdouble JNICALL CallStaticDoubleMethod(JNIEnv* env, jclass clazz, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallStaticDoubleMethodV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL CallStaticDoubleMethodA(JNIEnv* env, jclass clazz, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL CallStaticVoidMethod(JNIEnv* env, jclass cls, jmethodID methodID, ...) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallStaticVoidMethodV(JNIEnv* env, jclass cls, jmethodID methodID, va_list args) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL CallStaticVoidMethodA(JNIEnv* env, jclass cls, jmethodID methodID, const jvalue* args) { enterJVM(); leaveJVM(); NYI(); }
+
+jfieldID JNICALL GetStaticFieldID(JNIEnv* env, jclass clazz, const char* name, const char* sig) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL GetStaticObjectField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jboolean JNICALL GetStaticBooleanField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jbyte JNICALL GetStaticByteField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jchar JNICALL GetStaticCharField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jshort JNICALL GetStaticShortField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL GetStaticIntField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL GetStaticLongField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jfloat JNICALL GetStaticFloatField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+jdouble JNICALL GetStaticDoubleField(JNIEnv* env, jclass clazz, jfieldID fieldID) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL SetStaticObjectField(JNIEnv* env, jclass clazz, jfieldID fieldID, jobject value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticBooleanField(JNIEnv* env, jclass clazz, jfieldID fieldID, jboolean value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticByteField(JNIEnv* env, jclass clazz, jfieldID fieldID, jbyte value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticCharField(JNIEnv* env, jclass clazz, jfieldID fieldID, jchar value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticShortField(JNIEnv* env, jclass clazz, jfieldID fieldID, jshort value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticIntField(JNIEnv* env, jclass clazz, jfieldID fieldID, jint value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticLongField(JNIEnv* env, jclass clazz, jfieldID fieldID, jlong value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticFloatField(JNIEnv* env, jclass clazz, jfieldID fieldID, jfloat value) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetStaticDoubleField(JNIEnv* env, jclass clazz, jfieldID fieldID, jdouble value) { enterJVM(); leaveJVM(); NYI(); }
+
+jstring JNICALL NewString(JNIEnv* env, const jchar* unicode, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jsize JNICALL GetStringLength(JNIEnv* env, jstring str) { enterJVM(); leaveJVM(); NYI(); }
+const jchar* JNICALL GetStringChars(JNIEnv* env, jstring str, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseStringChars(JNIEnv* env, jstring str, const jchar* chars) { enterJVM(); leaveJVM(); NYI(); }
+
+jstring JNICALL NewStringUTF(JNIEnv* env, const char* utf) {
+ jstring res;
+
+ enterJVM();
+ res = J3Thread::get()->push(J3Thread::get()->vm()->utfToString(utf)); /* harakiri want to kill me */
+ leaveJVM();
+
+ return res;
+}
+
+jsize JNICALL GetStringUTFLength(JNIEnv* env, jstring str) { enterJVM(); leaveJVM(); NYI(); }
+
+const char* JNICALL GetStringUTFChars(JNIEnv* env, jstring str, jboolean* isCopy) {
+ char* res;
+
+ enterJVM();
+ J3* vm = str->vt()->type()->loader()->vm();
+ jobject content = str->getObject(vm->stringValue);
+ uint32_t length = content->arrayLength();
+ res = new char[length+1];
+
+ for(uint32_t i=0; i<length; i++)
+ res[i] = content->getCharAt(i);
+
+ res[length] = 0;
+
+ if(isCopy)
+ *isCopy = 1;
+
+ leaveJVM();
+
+ return res;
+}
+
+void JNICALL ReleaseStringUTFChars(JNIEnv* env, jstring str, const char* chars) {
+ enterJVM();
+ delete[] chars;
+ leaveJVM();
+}
+
+
+jsize JNICALL GetArrayLength(JNIEnv* env, jarray array) { enterJVM(); leaveJVM(); NYI(); }
+
+jobjectArray JNICALL NewObjectArray(JNIEnv* env, jsize len, jclass clazz, jobject init) { enterJVM(); leaveJVM(); NYI(); }
+jobject JNICALL GetObjectArrayElement(JNIEnv* env, jobjectArray array, jsize index) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetObjectArrayElement(JNIEnv* env, jobjectArray array, jsize index, jobject val) { enterJVM(); leaveJVM(); NYI(); }
+
+jbooleanArray JNICALL NewBooleanArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jbyteArray JNICALL NewByteArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jcharArray JNICALL NewCharArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jshortArray JNICALL NewShortArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jintArray JNICALL NewIntArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jlongArray JNICALL NewLongArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jfloatArray JNICALL NewFloatArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+jdoubleArray JNICALL NewDoubleArray(JNIEnv* env, jsize len) { enterJVM(); leaveJVM(); NYI(); }
+
+jboolean* JNICALL GetBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jbyte* JNICALL GetByteArrayElements(JNIEnv* env, jbyteArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jchar* JNICALL GetCharArrayElements(JNIEnv* env, jcharArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jshort* JNICALL GetShortArrayElements(JNIEnv* env, jshortArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jint* JNICALL GetIntArrayElements(JNIEnv* env, jintArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jlong* JNICALL GetLongArrayElements(JNIEnv* env, jlongArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jfloat* JNICALL GetFloatArrayElements(JNIEnv* env, jfloatArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+jdouble* JNICALL GetDoubleArrayElements(JNIEnv* env, jdoubleArray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL ReleaseBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseByteArrayElements(JNIEnv* env, jbyteArray array, jbyte* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseCharArrayElements(JNIEnv* env, jcharArray array, jchar* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseShortArrayElements(JNIEnv* env, jshortArray array, jshort* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseIntArrayElements(JNIEnv* env, jintArray array, jint* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseLongArrayElements(JNIEnv* env, jlongArray array, jlong* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseFloatArrayElements(JNIEnv* env, jfloatArray array, jfloat* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseDoubleArrayElements(JNIEnv* env, jdoubleArray array, jdouble* elems, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL GetBooleanArrayRegion(JNIEnv* env, jbooleanArray array, jsize start, jsize l, jboolean* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetByteArrayRegion(JNIEnv* env, jbyteArray array, jsize start, jsize len, jbyte* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetCharArrayRegion(JNIEnv* env, jcharArray array, jsize start, jsize len, jchar* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetShortArrayRegion(JNIEnv* env, jshortArray array, jsize start, jsize len, jshort* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetIntArrayRegion(JNIEnv* env, jintArray array, jsize start, jsize len, jint* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetLongArrayRegion(JNIEnv* env, jlongArray array, jsize start, jsize len, jlong* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetFloatArrayRegion(JNIEnv* env, jfloatArray array, jsize start, jsize len, jfloat* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetDoubleArrayRegion(JNIEnv* env, jdoubleArray array, jsize start, jsize len, jdouble* buf) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL SetBooleanArrayRegion(JNIEnv* env, jbooleanArray array, jsize start, jsize l, const jboolean* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetByteArrayRegion(JNIEnv* env, jbyteArray array, jsize start, jsize len, const jbyte* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetCharArrayRegion(JNIEnv* env, jcharArray array, jsize start, jsize len, const jchar* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetShortArrayRegion(JNIEnv* env, jshortArray array, jsize start, jsize len, const jshort* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetIntArrayRegion(JNIEnv* env, jintArray array, jsize start, jsize len, const jint* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetLongArrayRegion(JNIEnv* env, jlongArray array, jsize start, jsize len, const jlong* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetFloatArrayRegion(JNIEnv* env, jfloatArray array, jsize start, jsize len, const jfloat* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL SetDoubleArrayRegion(JNIEnv* env, jdoubleArray array, jsize start, jsize len, const jdouble* buf) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL RegisterNatives(JNIEnv* env, jclass clazz, const JNINativeMethod* methods, jint nMethods) {
+ enterJVM();
+ J3Class* cl = J3Class::nativeClass(clazz)->asClass();
+ J3* j3 = cl->loader()->vm();
+
+ for(jint i=0; i<nMethods; i++)
+ cl->registerNative(j3->names()->get(methods[i].name), j3->names()->get(methods[i].signature), methods[i].fnPtr);
+
+ leaveJVM();
+ return 0;
+}
+
+jint JNICALL UnregisterNatives(JNIEnv* env, jclass clazz) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL MonitorEnter(JNIEnv* env, jobject obj) { enterJVM(); leaveJVM(); NYI(); }
+jint JNICALL MonitorExit(JNIEnv* env, jobject obj) { enterJVM(); leaveJVM(); NYI(); }
+
+jint JNICALL GetJavaVM(JNIEnv* env, JavaVM** vm) { enterJVM(); leaveJVM(); NYI(); }
+
+void JNICALL GetStringRegion(JNIEnv* env, jstring str, jsize start, jsize len, jchar* buf) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL GetStringUTFRegion(JNIEnv* env, jstring str, jsize start, jsize len, char* buf) { enterJVM(); leaveJVM(); NYI(); }
+
+void* JNICALL GetPrimitiveArrayCritical(JNIEnv* env, jarray array, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleasePrimitiveArrayCritical(JNIEnv* env, jarray array, void* carray, jint mode) { enterJVM(); leaveJVM(); NYI(); }
+
+const jchar* JNICALL GetStringCritical(JNIEnv* env, jstring string, jboolean* isCopy) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL ReleaseStringCritical(JNIEnv* env, jstring string, const jchar* cstring) { enterJVM(); leaveJVM(); NYI(); }
+
+jweak JNICALL NewWeakGlobalRef(JNIEnv* env, jobject obj) { enterJVM(); leaveJVM(); NYI(); }
+void JNICALL DeleteWeakGlobalRef(JNIEnv* env, jweak ref) { enterJVM(); leaveJVM(); NYI(); }
+
+jboolean JNICALL ExceptionCheck(JNIEnv* env) { enterJVM(); leaveJVM(); NYI(); }
+
+jobject JNICALL NewDirectByteBuffer(JNIEnv* env, void* address, jlong capacity) { enterJVM(); leaveJVM(); NYI(); }
+void* JNICALL GetDirectBufferAddress(JNIEnv* env, jobject buf) { enterJVM(); leaveJVM(); NYI(); }
+jlong JNICALL GetDirectBufferCapacity(JNIEnv* env, jobject buf) { enterJVM(); leaveJVM(); NYI(); }
+
+jobjectRefType JNICALL GetObjectRefType(JNIEnv* env, jobject obj) { enterJVM(); leaveJVM(); NYI(); }
+
+struct JNINativeInterface_ jniEnvTable = {
+ 0,
+ 0,
+ 0,
+ 0,
+ GetVersion,
+ DefineClass,
+ FindClass,
+ FromReflectedMethod,
+ FromReflectedField,
+ ToReflectedMethod,
+ GetSuperclass,
+ IsAssignableFrom,
+ ToReflectedField,
+ Throw,
+ ThrowNew,
+ ExceptionOccurred,
+ ExceptionDescribe,
+ ExceptionClear,
+ FatalError,
+ PushLocalFrame,
+ PopLocalFrame,
+ NewGlobalRef,
+ DeleteGlobalRef,
+ DeleteLocalRef,
+ IsSameObject,
+ NewLocalRef,
+ EnsureLocalCapacity,
+ AllocObject,
+ NewObject,
+ NewObjectV,
+ NewObjectA,
+ GetObjectClass,
+ IsInstanceOf,
+ GetMethodID,
+ CallObjectMethod,
+ CallObjectMethodV,
+ CallObjectMethodA,
+ CallBooleanMethod,
+ CallBooleanMethodV,
+ CallBooleanMethodA,
+ CallByteMethod,
+ CallByteMethodV,
+ CallByteMethodA,
+ CallCharMethod,
+ CallCharMethodV,
+ CallCharMethodA,
+ CallShortMethod,
+ CallShortMethodV,
+ CallShortMethodA,
+ CallIntMethod,
+ CallIntMethodV,
+ CallIntMethodA,
+ CallLongMethod,
+ CallLongMethodV,
+ CallLongMethodA,
+ CallFloatMethod,
+ CallFloatMethodV,
+ CallFloatMethodA,
+ CallDoubleMethod,
+ CallDoubleMethodV,
+ CallDoubleMethodA,
+ CallVoidMethod,
+ CallVoidMethodV,
+ CallVoidMethodA,
+ CallNonvirtualObjectMethod,
+ CallNonvirtualObjectMethodV,
+ CallNonvirtualObjectMethodA,
+ CallNonvirtualBooleanMethod,
+ CallNonvirtualBooleanMethodV,
+ CallNonvirtualBooleanMethodA,
+ CallNonvirtualByteMethod,
+ CallNonvirtualByteMethodV,
+ CallNonvirtualByteMethodA,
+ CallNonvirtualCharMethod,
+ CallNonvirtualCharMethodV,
+ CallNonvirtualCharMethodA,
+ CallNonvirtualShortMethod,
+ CallNonvirtualShortMethodV,
+ CallNonvirtualShortMethodA,
+ CallNonvirtualIntMethod,
+ CallNonvirtualIntMethodV,
+ CallNonvirtualIntMethodA,
+ CallNonvirtualLongMethod,
+ CallNonvirtualLongMethodV,
+ CallNonvirtualLongMethodA,
+ CallNonvirtualFloatMethod,
+ CallNonvirtualFloatMethodV,
+ CallNonvirtualFloatMethodA,
+ CallNonvirtualDoubleMethod,
+ CallNonvirtualDoubleMethodV,
+ CallNonvirtualDoubleMethodA,
+ CallNonvirtualVoidMethod,
+ CallNonvirtualVoidMethodV,
+ CallNonvirtualVoidMethodA,
+ GetFieldID,
+ GetObjectField,
+ GetBooleanField,
+ GetByteField,
+ GetCharField,
+ GetShortField,
+ GetIntField,
+ GetLongField,
+ GetFloatField,
+ GetDoubleField,
+ SetObjectField,
+ SetBooleanField,
+ SetByteField,
+ SetCharField,
+ SetShortField,
+ SetIntField,
+ SetLongField,
+ SetFloatField,
+ SetDoubleField,
+ GetStaticMethodID,
+ CallStaticObjectMethod,
+ CallStaticObjectMethodV,
+ CallStaticObjectMethodA,
+ CallStaticBooleanMethod,
+ CallStaticBooleanMethodV,
+ CallStaticBooleanMethodA,
+ CallStaticByteMethod,
+ CallStaticByteMethodV,
+ CallStaticByteMethodA,
+ CallStaticCharMethod,
+ CallStaticCharMethodV,
+ CallStaticCharMethodA,
+ CallStaticShortMethod,
+ CallStaticShortMethodV,
+ CallStaticShortMethodA,
+ CallStaticIntMethod,
+ CallStaticIntMethodV,
+ CallStaticIntMethodA,
+ CallStaticLongMethod,
+ CallStaticLongMethodV,
+ CallStaticLongMethodA,
+ CallStaticFloatMethod,
+ CallStaticFloatMethodV,
+ CallStaticFloatMethodA,
+ CallStaticDoubleMethod,
+ CallStaticDoubleMethodV,
+ CallStaticDoubleMethodA,
+ CallStaticVoidMethod,
+ CallStaticVoidMethodV,
+ CallStaticVoidMethodA,
+ GetStaticFieldID,
+ GetStaticObjectField,
+ GetStaticBooleanField,
+ GetStaticByteField,
+ GetStaticCharField,
+ GetStaticShortField,
+ GetStaticIntField,
+ GetStaticLongField,
+ GetStaticFloatField,
+ GetStaticDoubleField,
+ SetStaticObjectField,
+ SetStaticBooleanField,
+ SetStaticByteField,
+ SetStaticCharField,
+ SetStaticShortField,
+ SetStaticIntField,
+ SetStaticLongField,
+ SetStaticFloatField,
+ SetStaticDoubleField,
+ NewString,
+ GetStringLength,
+ GetStringChars,
+ ReleaseStringChars,
+ NewStringUTF,
+ GetStringUTFLength,
+ GetStringUTFChars,
+ ReleaseStringUTFChars,
+ GetArrayLength,
+ NewObjectArray,
+ GetObjectArrayElement,
+ SetObjectArrayElement,
+ NewBooleanArray,
+ NewByteArray,
+ NewCharArray,
+ NewShortArray,
+ NewIntArray,
+ NewLongArray,
+ NewFloatArray,
+ NewDoubleArray,
+ GetBooleanArrayElements,
+ GetByteArrayElements,
+ GetCharArrayElements,
+ GetShortArrayElements,
+ GetIntArrayElements,
+ GetLongArrayElements,
+ GetFloatArrayElements,
+ GetDoubleArrayElements,
+ ReleaseBooleanArrayElements,
+ ReleaseByteArrayElements,
+ ReleaseCharArrayElements,
+ ReleaseShortArrayElements,
+ ReleaseIntArrayElements,
+ ReleaseLongArrayElements,
+ ReleaseFloatArrayElements,
+ ReleaseDoubleArrayElements,
+ GetBooleanArrayRegion,
+ GetByteArrayRegion,
+ GetCharArrayRegion,
+ GetShortArrayRegion,
+ GetIntArrayRegion,
+ GetLongArrayRegion,
+ GetFloatArrayRegion,
+ GetDoubleArrayRegion,
+ SetBooleanArrayRegion,
+ SetByteArrayRegion,
+ SetCharArrayRegion,
+ SetShortArrayRegion,
+ SetIntArrayRegion,
+ SetLongArrayRegion,
+ SetFloatArrayRegion,
+ SetDoubleArrayRegion,
+ RegisterNatives,
+ UnregisterNatives,
+ MonitorEnter,
+ MonitorExit,
+ GetJavaVM,
+ GetStringRegion,
+ GetStringUTFRegion,
+ GetPrimitiveArrayCritical,
+ ReleasePrimitiveArrayCritical,
+ GetStringCritical,
+ ReleaseStringCritical,
+ NewWeakGlobalRef,
+ DeleteWeakGlobalRef,
+ ExceptionCheck,
+ NewDirectByteBuffer,
+ GetDirectBufferAddress,
+ GetDirectBufferCapacity,
+ GetObjectRefType
+};
+
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3mangler.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3mangler.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3mangler.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3mangler.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,121 @@
+#include "j3/j3mangler.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3method.h"
+#include "j3/j3.h"
+
+using namespace j3;
+
+const char* J3Mangler::j3Id = "j3_";
+const char* J3Mangler::javaId = "Java_";
+
+
+J3Mangler::J3Mangler(J3Class* _from) {
+ from = _from;
+ cur = buf;
+}
+
+void J3Mangler::check(uint32_t n) {
+ next = cur + n;
+ if((next+1) >= (buf + max))
+ J3::internalError(L"unable to mangle: not enough space");
+}
+
+J3Mangler* J3Mangler::mangleType(J3Method* method) {
+ J3MethodType* type = method->methodType(from);
+
+ if(type->nbIns()) {
+ check(2);
+ cur[0] = '_';
+ cur[1] = '_';
+ cur = next;
+
+ for(uint32_t i=0; i<type->nbIns(); i++) {
+ check(type->ins(i)->nativeNameLength());
+ memcpy(cur, type->ins(i)->nativeName(), type->ins(i)->nativeNameLength());
+ cur = next;
+ }
+
+#if 0
+ check(type->out()->nativeNameLength());
+ memcpy(cur, type->out()->nativeName(), type->out()->nativeNameLength());
+ cur = next;
+#endif
+ }
+ check(1);
+ *cur = 0;
+
+ return this;
+}
+
+J3Mangler* J3Mangler::mangle(J3Method* method) {
+ check(method->cl()->nativeNameLength() - 3);
+ memcpy(cur, method->cl()->nativeName() + 1, method->cl()->nativeNameLength() - 3);
+ *next = '_';
+ cur = next+1;
+ mangle(method->name());
+
+ return this;
+}
+
+J3Mangler* J3Mangler::mangle(const char* prefix) {
+ uint32_t length = strlen(prefix);
+
+ check(length);
+ memcpy(cur, prefix, length);
+ *next = 0;
+ cur = next;
+
+ return this;
+}
+
+J3Mangler* J3Mangler::mangle(const vmkit::Name* name) {
+ next = cur;
+ for(size_t i=0; i<name->length(); i++) {
+ wchar_t c = name->cStr()[i];
+
+ if(c > 256) {
+ check(6);
+ *cur++ = '_';
+ *cur++ = '0';
+ *cur++ = (c >> 24 & 0xf) + '0';
+ *cur++ = (c >> 16 & 0xf) + '0';
+ *cur++ = (c >> 8 & 0xf) + '0';
+ *cur++ = (c >> 0 & 0xf) + '0';
+ } else {
+ switch(c) {
+ case '<':
+ case '>':
+ case '(':
+ case ')':
+ break;
+ case '_':
+ check(2);
+ *cur++ = '_';
+ *cur++ = '1';
+ break;
+ case ';':
+ check(2);
+ *cur++ = '_';
+ *cur++ = '2';
+ break;
+ case '[':
+ check(2);
+ *cur++ = '_';
+ *cur++ = '3';
+ break;
+ case '/':
+ c = '_';
+ default:
+ check(1);
+ *cur++ = c;
+ }
+ }
+ cur = next;
+ }
+
+ *cur = 0;
+
+ return this;
+}
+
Added: vmkit/branches/mcjit/lib/j3/vm/j3method.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3method.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3method.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3method.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,436 @@
+#include "j3/j3method.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3constants.h"
+#include "j3/j3.h"
+#include "j3/j3mangler.h"
+#include "j3/j3thread.h"
+#include "j3/j3codegen.h"
+
+#include "llvm/PassManager.h"
+
+#include "llvm/IR/Type.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/Function.h"
+
+#include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+
+#include <vector>
+
+using namespace j3;
+
+J3MethodType::J3MethodType(J3Type** args, size_t nbArgs) {
+ _out = args[nbArgs-1];
+ _nbIns = nbArgs-1;
+ memcpy(_ins, args, (nbArgs-1)*sizeof(J3Type*));
+
+ std::vector<llvm::Type*> in;
+ for(uint32_t i=0; i<nbIns(); i++)
+ in.push_back(ins(i)->llvmType());
+ _llvmType = llvm::FunctionType::get(out()->llvmType(), in, 0);
+}
+
+J3Method::J3Method(uint16_t access, J3Class* cl, const vmkit::Name* name, const vmkit::Name* sign) {
+ _access = access;
+ _cl = cl;
+ _name = name;
+ _sign = sign;
+ _index = -1;
+}
+
+uint32_t J3Method::index() {
+ return _index;
+}
+
+void* J3Method::fnPtr() {
+ void* res;
+
+ if(!_compiledFunction) {
+ //fprintf(stderr, "materializing: %ls::%ls%ls\n", cl()->name()->cStr(), name()->cStr(), sign()->cStr());
+ if(!isResolved()) {
+ if(cl()->loader()->vm()->options()->debugLinking)
+ fprintf(stderr, "linking %ls::%ls\n", cl()->name()->cStr(), name()->cStr());
+
+ cl()->initialise();
+ if(!isResolved())
+ J3::noSuchMethodError(L"unable to find method", cl(), name(), sign());
+ }
+
+ J3CodeGen* codeGen = J3CodeGen::create(this);
+ _compiledFunction = codeGen->generate();
+ J3CodeGen::destroy(codeGen);
+
+ cl()->loader()->pm()->run(*_compiledFunction);
+
+ //_compiledFunction->dump();
+
+ res = cl()->loader()->vm()->ee()->recompileAndRelinkFunction(_compiledFunction);
+ } else
+ res = cl()->loader()->vm()->ee()->getPointerToFunction(_compiledFunction);
+
+ return res;
+}
+
+void* J3Method::functionPointerOrTrampoline() {
+ return _compiledFunction ? fnPtr() : _trampoline;
+}
+
+void J3Method::setResolved(uint32_t index) {
+ if(isResolved())
+ J3::internalError(L"trying to re-resolve a resolved method, should not happen");
+ _index = index;
+}
+
+void J3Method::postInitialise(uint32_t access, J3Attributes* attributes) {
+ if((access & J3Cst::ACC_STATIC) != (_access & J3Cst::ACC_STATIC))
+ J3::classFormatError(cl(), L"trying to modify the static flag of %ls", cl()->name()->cStr());
+ _access = access;
+ _attributes = attributes;
+}
+
+J3Method* J3Method::resolve(J3ObjectHandle* obj) {
+ if(cl()->loader()->vm()->options()->debugLinking)
+ fprintf(stderr, "virtual linking %ls::%ls\n", cl()->name()->cStr(), name()->cStr());
+ vmkit::Names* n = cl()->loader()->vm()->names();
+ return cl()->findVirtualMethod(name(), sign());
+}
+
+void* J3Method::operator new(size_t size, vmkit::BumpAllocator* allocator, size_t trampolineSize) {
+ return allocator->allocate(size + (trampolineSize - 1)*sizeof(uint8_t));
+}
+
+J3Method* J3Method::newMethod(vmkit::BumpAllocator* allocator,
+ uint16_t access,
+ J3Class* cl,
+ const vmkit::Name* name,
+ const vmkit::Name* sign) {
+ size_t trampolineSize = 48;
+
+ void* tra = (void*)J3ObjectHandle::trampoline;
+ J3Method* res = new(allocator, trampolineSize) J3Method(access, cl, name, sign);
+
+#define dd(p, n) ((((uintptr_t)p) >> n) & 0xff)
+ uint8_t code[] = {
+ 0x57, // 0: push %rdi
+ 0x56, // 1: push %rsi
+ 0x52, // 2: push %rdx
+ 0x51, // 3: push %rcx
+ 0x41, 0x50, // 4: push %r8
+ 0x41, 0x51, // 6: push %r9
+ 0x48, 0x83, 0xc4, 0x08, // 8: sub %esp, 8
+ 0x48, 0xbe, dd(res, 0), dd(res, 8), dd(res, 16), dd(res, 24), dd(res, 32), dd(res, 40), dd(res, 48), dd(res, 56), // 12: mov -> %rsi
+ 0x48, 0xb8, dd(tra, 0), dd(tra, 8), dd(tra, 16), dd(tra, 24), dd(tra, 32), dd(tra, 40), dd(tra, 48), dd(tra, 56), // 22: mov -> %rax
+ 0xff, 0xd0, // 32: call %rax
+ 0x48, 0x83, 0xec, 0x08, // 34: add %esp, 8
+ 0x41, 0x59, // 38: pop %r9
+ 0x41, 0x58, // 40: pop %r8
+ 0x59, // 42: pop %rcx
+ 0x5a, // 43: pop %rdx
+ 0x5e, // 44: pop %rsi
+ 0x5f, // 45: pop %rdi
+ 0xff, 0xe0 // 46: jmp %rax
+ // total: 48
+ };
+#undef dd
+
+ memcpy(res->_trampoline, code, trampolineSize);
+
+ return res;
+}
+
+J3Value J3Method::internalInvoke(bool statically, std::vector<llvm::GenericValue>* args) {
+ J3Method* target;
+
+ if(statically)
+ target = this;
+ else {
+ /* can not use trampoline here */
+ J3ObjectHandle* self = (J3ObjectHandle*)(*args)[0].PointerVal;
+ target = resolve(self);
+ }
+
+ if(!_compiledFunction)
+ fnPtr(); /* ensure that the function is fully compiled */
+ llvm::GenericValue res = cl()->loader()->vm()->ee()->runFunction(_compiledFunction, *args);
+
+ J3Value holder;
+ J3* vm = cl()->loader()->vm();
+ J3Type* cur = methodType()->out();
+
+ if(cur == vm->typeBoolean)
+ holder.valBoolean = (bool)res.IntVal.getZExtValue();
+ else if(cur == vm->typeByte)
+ holder.valByte = (int8_t)res.IntVal.getZExtValue();
+ else if(cur == vm->typeShort)
+ holder.valShort = (int16_t)res.IntVal.getZExtValue();
+ else if(cur == vm->typeChar)
+ holder.valChar = (uint16_t)res.IntVal.getZExtValue();
+ else if(cur == vm->typeInteger)
+ holder.valInteger = (int32_t)res.IntVal.getZExtValue();
+ else if(cur == vm->typeLong)
+ holder.valLong = res.IntVal.getZExtValue();
+ else if(cur == vm->typeFloat)
+ holder.valFloat = res.FloatVal;
+ else if(cur == vm->typeDouble)
+ holder.valDouble = res.FloatVal;
+ else if(cur != vm->typeVoid)
+ holder.valObject = J3Thread::get()->push((J3Object*)res.PointerVal);
+
+ return holder;
+}
+
+J3Value J3Method::internalInvoke(bool statically, J3ObjectHandle* handle, va_list va) {
+ std::vector<llvm::GenericValue> args(methodType()->nbIns());
+ J3* vm = cl()->loader()->vm();
+ J3Type* cur;
+ uint32_t i = 0;
+
+ if(handle)
+ args[i++].PointerVal = handle->obj();
+
+ for(; i<methodType()->nbIns(); i++) { /* have to avoid collection at this point */
+ cur = methodType()->ins(i);
+
+ if(cur == vm->typeBoolean)
+ args[i].IntVal = va_arg(va, bool);
+ else if(cur == vm->typeByte)
+ args[i].IntVal = va_arg(va, int8_t);
+ else if(cur == vm->typeShort)
+ args[i].IntVal = va_arg(va, int16_t);
+ else if(cur == vm->typeChar)
+ args[i].IntVal = va_arg(va, uint16_t);
+ else if(cur == vm->typeInteger)
+ args[i].IntVal = va_arg(va, int32_t);
+ else if(cur == vm->typeLong)
+ args[i].IntVal = va_arg(va, int64_t);
+ else if(cur == vm->typeFloat)
+ args[i].FloatVal = va_arg(va, float);
+ else if(cur == vm->typeDouble)
+ args[i].FloatVal = va_arg(va, double);
+ else
+ args[i].PointerVal = va_arg(va, J3ObjectHandle*)->obj();
+ }
+
+ return internalInvoke(statically, &args);
+}
+
+J3Value J3Method::internalInvoke(bool statically, J3ObjectHandle* handle, J3Value* inArgs) {
+ std::vector<llvm::GenericValue> args(methodType()->nbIns());
+ J3* vm = cl()->loader()->vm();
+ J3Type* cur;
+ uint32_t i = 0;
+
+ if(handle)
+ args[i++].PointerVal = handle->obj();
+
+ for(; i<methodType()->nbIns(); i++) { /* have to avoid collection at this point */
+ cur = methodType()->ins(i);
+
+ if(cur == vm->typeBoolean)
+ args[i].IntVal = inArgs[i].valBoolean;
+ else if(cur == vm->typeByte)
+ args[i].IntVal = inArgs[i].valByte;
+ else if(cur == vm->typeShort)
+ args[i].IntVal = inArgs[i].valShort;
+ else if(cur == vm->typeChar)
+ args[i].IntVal = inArgs[i].valChar;
+ else if(cur == vm->typeInteger)
+ args[i].IntVal = inArgs[i].valInteger;
+ else if(cur == vm->typeLong)
+ args[i].IntVal = inArgs[i].valLong;
+ else if(cur == vm->typeFloat)
+ args[i].FloatVal = inArgs[i].valFloat;
+ else if(cur == vm->typeDouble)
+ args[i].FloatVal = inArgs[i].valDouble;
+ else
+ args[i].PointerVal = inArgs[i].valObject->obj();
+ }
+
+ return internalInvoke(statically, &args);
+}
+
+J3Value J3Method::invokeStatic(J3Value* args) {
+ return internalInvoke(1, 0, args);
+}
+
+J3Value J3Method::invokeSpecial(J3ObjectHandle* handle, J3Value* args) {
+ return internalInvoke(1, handle, args);
+}
+
+J3Value J3Method::invokeVirtual(J3ObjectHandle* handle, J3Value* args) {
+ return internalInvoke(0, handle, args);
+}
+
+J3Value J3Method::invokeStatic(va_list va) {
+ return internalInvoke(1, 0, va);
+}
+
+J3Value J3Method::invokeSpecial(J3ObjectHandle* handle, va_list va) {
+ return internalInvoke(1, handle, va);
+}
+
+J3Value J3Method::invokeVirtual(J3ObjectHandle* handle, va_list va) {
+ return internalInvoke(0, handle, va);
+}
+
+J3Value J3Method::invokeStatic(...) {
+ va_list va;
+ va_start(va, this);
+ J3Value res = invokeStatic(va);
+ va_end(va);
+ return res;
+}
+
+J3Value J3Method::invokeSpecial(J3ObjectHandle* handle, ...) {
+ va_list va;
+ va_start(va, this);
+ J3Value res = invokeSpecial(handle, va);
+ va_end(va);
+ return res;
+}
+
+J3Value J3Method::invokeVirtual(J3ObjectHandle* handle, ...) {
+ va_list va;
+ va_start(va, this);
+ J3Value res = invokeVirtual(handle, va);
+ va_end(va);
+ return res;
+}
+
+J3MethodType* J3Method::methodType(J3Class* from) {
+ if(!_methodType) {
+ const vmkit::Name* realSign = sign();
+ J3ClassLoader* loader = cl()->loader();
+
+ if(!J3Cst::isStatic(access()))
+ realSign = J3Cst::rewrite(loader->vm(), cl()->name(), sign());
+
+ _methodType = loader->getMethodType(from ? from : cl(), realSign);
+ }
+
+ return _methodType;
+}
+
+void J3Method::buildLLVMNames(J3Class* from) {
+ J3Mangler mangler(from);
+
+ mangler.mangle(mangler.j3Id)->mangle(this)->mangleType(this);
+
+ _llvmAllNamesLength = mangler.length() + 18;
+ _llvmAllNames = (char*)cl()->loader()->allocator()->allocate(_llvmAllNamesLength + 1);
+ memcpy(_llvmAllNames, "method_descriptor_", 18);
+ memcpy(_llvmAllNames+18, mangler.cStr(), mangler.length());
+ _llvmAllNames[_llvmAllNamesLength] = 0;
+}
+
+size_t J3Method::llvmFunctionNameLength(J3Class* from) {
+ llvmFunctionName(from);
+ return _llvmAllNamesLength - 18;
+}
+
+char* J3Method::llvmFunctionName(J3Class* from) {
+ if(!_llvmAllNames)
+ buildLLVMNames(from ? from : cl());
+ return _llvmAllNames + 18;
+}
+
+char* J3Method::llvmDescriptorName(J3Class* from) {
+ if(!_llvmAllNames)
+ buildLLVMNames(from ? from : cl());
+ return _llvmAllNames;
+}
+
+llvm::GlobalValue* J3Method::llvmDescriptor(llvm::Module* module) {
+ if(!_nomcjitDescriptor) {
+ J3ClassLoader* loader = cl()->loader();
+ _nomcjitDescriptor = llvm::cast<llvm::GlobalValue>(module->getOrInsertGlobal(llvmDescriptorName(), loader->vm()->typeJ3Method));
+ loader->vm()->ee()->addGlobalMapping(_nomcjitDescriptor, this);
+ }
+
+ return _nomcjitDescriptor;
+}
+
+llvm::Function* J3Method::llvmFunction(bool isStub, llvm::Module* module, J3Class* from) {
+ if(!_nomcjitFunction) {
+ llvm::Function* res;
+
+ if(isStub && !_compiledFunction) {
+ char id[llvmFunctionNameLength() + 16];
+ memcpy(id, llvmFunctionName(), llvmFunctionNameLength());
+ memcpy(id + llvmFunctionNameLength(), "_stub", 6);
+ res = (llvm::Function*)module->getOrInsertFunction(id, methodType(from ? from : cl())->llvmType());
+ } else
+ res = (llvm::Function*)module->getOrInsertFunction(llvmFunctionName(from), methodType(from ? from : cl())->llvmType());
+
+ _nomcjitFunction = res;
+ cl()->loader()->vm()->ee()->addGlobalMapping(_nomcjitFunction, functionPointerOrTrampoline());
+ }
+
+ return _nomcjitFunction;
+}
+
+void J3Method::dump() {
+ printf("Method: %ls %ls::%ls\n", sign()->cStr(), cl()->name()->cStr(), name()->cStr());
+}
+
+void J3Method::registerNative(void* fnPtr) {
+ if(_nativeFnPtr)
+ J3::noSuchMethodError(L"unable to dynamically modify a native function", cl(), name(), sign());
+ _nativeFnPtr = fnPtr;
+}
+
+llvm::Type* J3Method::doNativeType(J3Type* type) {
+ llvm::Type* t = type->llvmType();
+
+ if(t->isPointerTy())
+ return cl()->loader()->vm()->typeJ3ObjectHandlePtr;
+ else
+ return t;
+}
+
+llvm::Function* J3Method::nativeLLVMFunction(llvm::Module* module) {
+ J3ClassLoader* loader = cl()->loader();
+ J3Mangler mangler(cl());
+
+ mangler.mangle(mangler.javaId)->mangle(this);
+ uint32_t length = mangler.length();
+ mangler.mangleType(this);
+
+ void* fnPtr = _nativeFnPtr;
+
+ if(!fnPtr)
+ fnPtr = loader->lookupNativeFunctionPointer(this, mangler.cStr());
+
+ if(!fnPtr) {
+ mangler.cStr()[length] = 0;
+ fnPtr = loader->lookupNativeFunctionPointer(this, mangler.mangleType(this)->cStr());
+ }
+
+ if(!fnPtr)
+ J3::linkageError(this);
+
+ J3MethodType* type = methodType();
+ std::vector<llvm::Type*> nativeIns;
+ llvm::Type* nativeOut;
+
+ nativeIns.push_back(loader->vm()->typeJNIEnvPtr);
+
+ if(J3Cst::isStatic(access()))
+ nativeIns.push_back(doNativeType(loader->vm()->classClass));
+
+ for(int i=0; i<type->nbIns(); i++)
+ nativeIns.push_back(doNativeType(type->ins(i)));
+
+ nativeOut = doNativeType(type->out());
+
+ llvm::FunctionType* fType = llvm::FunctionType::get(nativeOut, nativeIns, 0);
+ llvm::Function* res = llvm::Function::Create(fType,
+ llvm::GlobalValue::ExternalLinkage,
+ mangler.cStr(),
+ module);
+
+ loader->vm()->ee()->addGlobalMapping(res, fnPtr);
+
+ return res;
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3object.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3object.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3object.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3object.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,473 @@
+#include <stdint.h>
+
+#include "llvm/IR/DataLayout.h"
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+
+#include "vmkit/allocator.h"
+#include "vmkit/gc.h"
+#include "j3/j3object.h"
+#include "j3/j3method.h"
+#include "j3/j3class.h"
+#include "j3/j3classloader.h"
+#include "j3/j3.h"
+#include "j3/j3constants.h"
+#include "j3/j3thread.h"
+
+using namespace j3;
+
+/*
+ * --- J3TypeChecker ---
+ */
+void J3TypeChecker::dump() {
+ fprintf(stderr, " offset: %u\n", offset);
+ for(uint32_t i=0; i<cacheOffset; i++) {
+ if(display[i])
+ fprintf(stderr, " display[%u]: %ls\n", i, display[i]->type()->name()->cStr());
+ }
+ for(uint32_t i=0; i<nbSecondaryTypes; i++) {
+ fprintf(stderr, " secondary[%u]: %ls\n", i, secondaryTypes[i]->type()->name()->cStr());
+ }
+ if(display[cacheOffset])
+ fprintf(stderr, " cache: %ls\n", display[cacheOffset]->type()->name()->cStr());
+}
+
+/*
+ * --- J3VirtualTable ---
+ */
+J3VirtualTable* J3VirtualTable::create(J3Layout* layout) {
+ return new(layout->loader()->allocator(), 0) J3VirtualTable(layout, layout, 0, 0, 0);
+}
+
+J3VirtualTable* J3VirtualTable::create(J3Class* cl) {
+ J3Class* super = cl->super();
+ uint32_t base = cl == super ? 0 : super->vt()->nbVirtualMethods();
+ uint32_t n = base;
+
+ super->resolve();
+
+ J3Method* pm[cl->nbMethods()];
+
+ for(uint32_t i=0; i<cl->nbMethods(); i++) {
+ J3Method* meth = cl->methods()[i];
+ J3Method* parent = cl == super ? 0 : super->findVirtualMethod(meth->name(), meth->sign(), 0);
+
+ if(parent) {
+ pm[i] = parent;
+ meth->setResolved(parent->index());
+ } else {
+ pm[i] = meth;
+ meth->setResolved(n);
+ n++;
+ }
+ }
+
+ J3VirtualTable* res = new(cl->loader()->allocator(), n)
+ J3VirtualTable(cl, cl->super(), (J3Type**)cl->interfaces(), cl->nbInterfaces(), J3Cst::isInterface(cl->access()) ? 1 : 0);
+
+
+ /* virtual table */
+ res->_nbVirtualMethods = n;
+ if(super != cl) /* super->vt() is not yet allocated for Object */
+ memcpy(res->_virtualMethods, super->vt()->_virtualMethods, sizeof(void*)*super->vt()->nbVirtualMethods());
+
+ for(uint32_t i=0; i<cl->nbMethods(); i++)
+ res->_virtualMethods[pm[i]->index()] = pm[i]->functionPointerOrTrampoline();
+
+ return res;
+}
+
+J3VirtualTable* J3VirtualTable::create(J3ArrayClass* cl) {
+ J3Class* objClass = cl->loader()->vm()->objectClass;
+ J3Type* super = cl->component();
+ J3Type* base = super;
+ uint32_t dim = 1;
+ J3Type** secondaries = 0;
+ uint32_t nbSecondaries = 0;
+ bool isSecondary = 0;
+
+ // for objects for primitives
+ // Integer[][]
+ // Number[][] + ifces[][] int[][][]
+ // Object[][] Object[][]
+ // Object[] int[] Object[]
+ // Object + Serializable/Cloneable
+
+ while(base->isArrayClass()) {
+ base = base->asArrayClass()->component();
+ dim++;
+ }
+
+ if(base->isPrimitive()) {
+ super = objClass->getArray(dim-1);
+ nbSecondaries = cl->loader()->vm()->nbArrayInterfaces;
+ secondaries = (J3Type**)cl->loader()->allocator()->allocate(nbSecondaries*sizeof(J3Type*));
+ for(uint32_t i=0; i<nbSecondaries; i++) {
+ secondaries[i] = cl->loader()->vm()->arrayInterfaces[i];
+ if(dim > 1)
+ secondaries[i] = secondaries[i]->getArray(dim-1);
+ }
+ } else if(base == objClass) {
+ nbSecondaries = cl->loader()->vm()->nbArrayInterfaces;
+ secondaries = (J3Type**)alloca(nbSecondaries*sizeof(J3Type*));
+ for(uint32_t i=0; i<nbSecondaries; i++) {
+ secondaries[i] = cl->loader()->vm()->arrayInterfaces[i];
+ if(dim > 1)
+ secondaries[i] = secondaries[i]->getArray(dim - 1);
+ }
+ } else {
+ J3Class* baseClass = base->asClass();
+ baseClass->resolve();
+ if(J3Cst::isInterface(baseClass->access()))
+ isSecondary = 1;
+ super = baseClass->super()->getArray(dim);
+ super->resolve();
+ //printf("%ls super is %ls (%d)\n", cl->name()->cStr(), super->name()->cStr(), isSecondary);
+
+ uint32_t n = baseClass->vt()->checker.nbSecondaryTypes;
+ secondaries = (J3Type**)alloca(n*sizeof(J3Type*));
+
+ for(uint32_t i=0; i<n; i++) {
+ secondaries[nbSecondaries] = baseClass->vt()->checker.secondaryTypes[i]->type();
+ if(secondaries[i] != baseClass) { /* don't add myself */
+ secondaries[nbSecondaries] = secondaries[nbSecondaries]->getArray(dim);
+ nbSecondaries++;
+ }
+ }
+ }
+
+ super->resolve();
+
+ J3VirtualTable* res = new(cl->loader()->allocator(), 0) J3VirtualTable(cl, super, secondaries, nbSecondaries, isSecondary);
+ //memcpy(_virtualMethods, objClass->vt()->virtualMethods(), sizeof(void*)*objClass->nbVt());
+
+ return res;
+}
+
+J3VirtualTable* J3VirtualTable::create(J3Primitive* prim) {
+ return new(prim->loader()->allocator(), 0) J3VirtualTable(prim, prim, 0, 0, 0);
+}
+
+void* J3VirtualTable::operator new(size_t unused, vmkit::BumpAllocator* allocator, size_t n) {
+ return allocator->allocate(sizeof(J3VirtualTable) + n*sizeof(void*) - sizeof(void*));
+}
+
+J3VirtualTable::J3VirtualTable(J3Type* type, J3Type* super, J3Type** interfaces, uint32_t nbInterfaces, bool isSecondary) {
+ _type = type;
+
+ //printf("*** Building the vt of %ls based on %ls\n", type->name()->cStr(), super->name()->cStr());
+
+ if(super == type) {
+ checker.offset = 0;
+ checker.display[checker.offset] = this;
+ if(nbInterfaces)
+ J3::internalError(L"a root J3VirtualTable should not have interfaces");
+ } else {
+ uint32_t parentDisplayLength = super->vt()->checker.offset + 1;
+
+ //printf("%ls (%p) secondary: %p %p (%d)\n", type->name()->cStr(), this, checker.secondaryTypes, checker.display[6], parentDisplayLength);
+
+ if(parentDisplayLength >= J3TypeChecker::cacheOffset)
+ isSecondary = 1;
+
+ memcpy(checker.display, super->vt()->checker.display, parentDisplayLength*sizeof(J3VirtualTable*));
+
+ checker.nbSecondaryTypes = super->vt()->checker.nbSecondaryTypes + nbInterfaces + isSecondary;
+ checker.secondaryTypes = (J3VirtualTable**)super->loader()->allocator()->allocate(checker.nbSecondaryTypes*sizeof(J3VirtualTable*));
+
+ //printf("%ls: %d - %d %d\n", type->name()->cStr(), isSecondary, parentDisplayLength, J3TypeChecker::displayLength);
+ if(isSecondary) {
+ checker.offset = J3TypeChecker::cacheOffset;
+ checker.secondaryTypes[0] = this;
+ } else {
+ checker.offset = parentDisplayLength;
+ checker.display[checker.offset] = this;
+ }
+
+ for(uint32_t i=0; i<nbInterfaces; i++) {
+ J3Type* sec = interfaces[i];
+ //printf("In %ls - adding %ls at %d\n", type->name()->cStr(), sec->name()->cStr(), isSecondary+i);
+ sec->resolve();
+ checker.secondaryTypes[isSecondary+i] = sec->vt();
+ }
+
+ memcpy(checker.secondaryTypes + nbInterfaces + isSecondary,
+ super->vt()->checker.secondaryTypes,
+ super->vt()->checker.nbSecondaryTypes*sizeof(J3VirtualTable*));
+ }
+
+ //dump();
+}
+
+bool J3VirtualTable::slowIsAssignableTo(J3VirtualTable* parent) {
+ for(uint32_t i=0; i<checker.nbSecondaryTypes; i++)
+ if(checker.secondaryTypes[i] == parent) {
+ checker.display[J3TypeChecker::cacheOffset] = parent;
+ return true;
+ }
+ return false;
+}
+
+bool J3VirtualTable::fastIsAssignableToPrimaryChecker(J3VirtualTable* parent, uint32_t parentOffset) {
+ return checker.display[parentOffset] == parent;
+}
+
+bool J3VirtualTable::fastIsAssignableToNonPrimaryChecker(J3VirtualTable* parent) {
+ if(checker.display[J3TypeChecker::cacheOffset] == parent)
+ return true;
+ else if(parent == this)
+ return true;
+ else
+ return slowIsAssignableTo(parent);
+}
+
+bool J3VirtualTable::isAssignableTo(J3VirtualTable* parent) {
+ uint32_t parentOffset = parent->checker.offset;
+ if(checker.display[parentOffset] == parent)
+ return true;
+ else if(parentOffset != J3TypeChecker::cacheOffset)
+ return false;
+ else if(parent == this)
+ return true;
+ else
+ return slowIsAssignableTo(parent);
+}
+
+void J3VirtualTable::dump() {
+ fprintf(stderr, "VirtualTable: %s%ls (%p)\n",
+ type()->isLayout() && !type()->isClass() ? "static_" : "",
+ type()->name()->cStr(), this);
+ checker.dump();
+
+}
+
+/*
+ * --- J3Object ---
+ */
+J3VirtualTable* J3Object::vt() {
+ return _vt;
+}
+
+uintptr_t* J3Object::header() {
+ return &_header;
+}
+
+J3Object* J3Object::allocate(J3VirtualTable* vt, size_t n) {
+ J3Object* res = (J3Object*)vmkit::GC::allocate(n);
+ res->_vt = vt;
+ return res;
+}
+
+J3Object* J3Object::doNewNoInit(J3Class* cl) {
+ return allocate(cl->vt(), cl->size());
+}
+
+J3Object* J3Object::doNew(J3Class* cl) {
+ cl->initialise();
+ return doNewNoInit(cl);
+}
+
+/*
+ * --- J3ArrayObject ---
+ */
+J3Object* J3ArrayObject::doNew(J3ArrayClass* cl, uint32_t length) {
+ llvm::DataLayout* layout = cl->loader()->vm()->dataLayout();
+ J3ArrayObject* res =
+ (J3ArrayObject*)allocate(cl->vt(),
+ layout->getTypeAllocSize(cl->llvmType()->getContainedType(0))
+ + layout->getTypeAllocSize(cl->component()->llvmType()) * length);
+
+ res->_length = length;
+
+ return res;
+}
+
+/*
+ * J3ObjectHandle
+ */
+uint32_t J3ObjectHandle::hashCode() {
+ do {
+ uintptr_t oh = *obj()->header();
+ uintptr_t res = oh;
+ if(res)
+ return res;
+ uintptr_t nh = oh + 256;
+ __sync_val_compare_and_swap(obj()->header(), oh, nh);
+ } while(1);
+}
+
+J3ObjectHandle* J3ObjectHandle::allocate(J3VirtualTable* vt, size_t n) {
+ J3Object* res = J3Object::allocate(vt, n);
+ return J3Thread::get()->push(res);
+}
+
+J3ObjectHandle* J3ObjectHandle::doNewObject(J3Class* cl) {
+ J3Object* res = J3Object::doNew(cl);
+ return J3Thread::get()->push(res);
+}
+
+J3ObjectHandle* J3ObjectHandle::doNewArray(J3ArrayClass* cl, uint32_t length) {
+ J3Object* res = J3ArrayObject::doNew(cl, length);
+ return J3Thread::get()->push(res);
+}
+
+
+
+#define defAccessor(name, ctype, llvmtype) \
+ void J3ObjectHandle::rawSet##name(uint32_t offset, ctype value) { \
+ *((ctype*)((uintptr_t)obj() + offset)) = value; \
+ } \
+ \
+ ctype J3ObjectHandle::rawGet##name(uint32_t offset) { \
+ return *((ctype*)((uintptr_t)obj() + offset)); \
+ } \
+ \
+ void J3ObjectHandle::set##name(J3Field* field, ctype value) { \
+ const llvm::StructLayout* layout = \
+ obj()->vt()->type()->loader()->vm()->dataLayout()-> \
+ getStructLayout((llvm::StructType*)(obj()->vt()->type()->llvmType()->getContainedType(0))); \
+ uint32_t offset = layout->getElementOffset(field->num()); \
+ rawSet##name(offset, value); \
+ } \
+ \
+ ctype J3ObjectHandle::get##name(J3Field* field) { \
+ const llvm::StructLayout* layout = \
+ obj()->vt()->type()->loader()->vm()->dataLayout()-> \
+ getStructLayout((llvm::StructType*)(obj()->vt()->type()->llvmType()->getContainedType(0))); \
+ uint32_t offset = layout->getElementOffset(field->num()); \
+ return rawGet##name(offset); \
+ } \
+ \
+ void J3ObjectHandle::set##name##At(uint32_t idx, ctype value) { \
+ rawSet##name(sizeof(J3ArrayObject) + idx*sizeof(ctype), value); \
+ } \
+ \
+ ctype J3ObjectHandle::get##name##At(uint32_t idx) { \
+ return rawGet##name(sizeof(J3ArrayObject) + idx*sizeof(ctype)); \
+ }
+
+onJavaPrimitives(defAccessor)
+
+#undef defAccessor
+
+void J3ObjectHandle::rawSetObject(uint32_t offset, J3ObjectHandle* value) {
+ *((J3Object**)((uintptr_t)obj() + offset)) = value->obj();
+}
+
+J3ObjectHandle* J3ObjectHandle::rawGetObject(uint32_t offset) {
+ return J3Thread::get()->push(*((J3Object**)((uintptr_t)obj() + offset)));
+}
+
+void J3ObjectHandle::setObject(J3Field* field, J3ObjectHandle* value) {
+ const llvm::StructLayout* layout =
+ obj()->vt()->type()->loader()->vm()->dataLayout()->
+ getStructLayout((llvm::StructType*)(obj()->vt()->type()->llvmType()->getContainedType(0)));
+ uint32_t offset = layout->getElementOffset(field->num());
+ rawSetObject(offset, value);
+}
+
+J3ObjectHandle* J3ObjectHandle::getObject(J3Field* field) {
+ const llvm::StructLayout* layout =
+ obj()->vt()->type()->loader()->vm()->dataLayout()->
+ getStructLayout((llvm::StructType*)(obj()->vt()->type()->llvmType()->getContainedType(0)));
+ return rawGetObject(layout->getElementOffset(field->num()));
+}
+
+void J3ObjectHandle::setObjectAt(uint32_t idx, J3ObjectHandle* value) {
+ rawSetObject(sizeof(J3ArrayObject) + idx*sizeof(J3Object*), value);
+}
+
+J3ObjectHandle* J3ObjectHandle::getObjectAt(uint32_t idx) {
+ return rawGetObject(sizeof(J3ArrayObject) + idx*sizeof(J3Object*));
+}
+
+void* J3ObjectHandle::trampoline(J3Object* obj, J3Method* target) {
+ J3ObjectHandle* prev = J3Thread::get()->tell();
+ J3ObjectHandle* handle = J3Thread::get()->push(obj);
+
+ void* res = target->fnPtr();
+
+ if(!J3Cst::isStatic(target->access()))
+ handle->vt()->virtualMethods()[target->index()] = res;
+
+ return res;
+}
+
+/*
+ * J3FixedPoint
+ */
+J3FixedPoint::J3FixedPoint(vmkit::BumpAllocator* _allocator) {
+ pthread_mutex_init(&mutex, 0);
+ allocator = _allocator;
+ head = 0;
+ createNode();
+}
+
+void J3FixedPoint::unsyncEnsureCapacity(uint32_t capacity) {
+ J3ObjectHandle* reserve = head->top + capacity;
+ if(reserve > head->max)
+ createNode(capacity);
+}
+
+void J3FixedPoint::createNode(uint32_t capacity) {
+ uint64_t size = capacity * sizeof(J3Object*) + sizeof(J3FixedPointNode);
+ J3FixedPointNode* nn = (J3FixedPointNode*)allocator->allocate(size);
+ nn->top = (J3ObjectHandle*)(nn + 1);
+ nn->max = (J3ObjectHandle*)((uintptr_t)nn + size);
+ nn->nextFree = 0;
+ nn->nextBusy = head;
+ if(head)
+ head->nextFree = nn;
+ head = nn;
+}
+
+J3ObjectHandle* J3FixedPoint::syncPush(J3Object* obj) {
+ J3FixedPointNode* cur = head;
+ J3ObjectHandle* res = (J3ObjectHandle*)__sync_fetch_and_add((uintptr_t*)&cur->top, (uintptr_t)sizeof(J3ObjectHandle));
+
+ if(res >= cur->max) {
+ pthread_mutex_lock(&mutex);
+ if(cur->nextFree)
+ head = cur->nextFree;
+ else
+ createNode();
+ pthread_mutex_unlock(&mutex);
+ return syncPush(obj);
+ } else {
+ res->_obj = obj;
+ return res;
+ }
+}
+
+J3ObjectHandle* J3FixedPoint::unsyncPush(J3Object* obj) {
+ J3ObjectHandle* res = head->top++;
+
+ if(res >= head->max) {
+ if(head->nextFree)
+ head = head->nextFree;
+ else
+ createNode();
+ return unsyncPush(obj);
+ } else {
+ res->_obj = obj;
+ return res;
+ }
+}
+
+void J3FixedPoint::unsyncPop() {
+ J3ObjectHandle* res = head->top - 1;
+ if(res < (J3ObjectHandle*)(head + 1)) {
+ head = head->nextBusy;
+ head->top = (J3ObjectHandle*)(head+1);
+ } else
+ head->top = res;
+}
+
+void J3FixedPoint::unsyncRestore(J3ObjectHandle* obj) {
+ while(obj <= (J3ObjectHandle*)head || obj > head->max) {
+ head = head->nextBusy;
+ head->top = (J3ObjectHandle*)(head+1);
+ }
+ head->top = obj;
+}
+
+
Added: vmkit/branches/mcjit/lib/j3/vm/j3options.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3options.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3options.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3options.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,160 @@
+#include "j3/j3options.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+using namespace j3;
+
+J3Options::J3Options() {
+ assertionsEnabled = 1;
+ selfBitCodePath = "/Users/gthomas/research/vmkit4/vmkit/Debug+Asserts/lib/libjvm.bc";
+ rtJar = "/Users/gthomas/research/vmkit4/jdk8/build/macosx-x86_64-normal-server-release/images/lib/rt.jar";
+
+ debugEnterIndent = 1;
+
+ genDebugExecute = 1;
+ debugExecute = 0;
+ debugLoad = 0;
+ debugResolve = 0;
+ debugIniting = 0;
+ debugTranslate = 1;
+ debugLinking = 1;
+}
+
+#define nyi(cmd) ({ fprintf(stderr, "option '%s' not yet implemented\n", cmd); })
+
+J3CmdLineParser::J3CmdLineParser(J3Options* _options, int _argc, char** _argv) {
+ options = _options;
+ argc = _argc;
+ argv = _argv;
+}
+
+#define opteq(opt) (!strcmp(argv[cur], opt))
+#define optbeg(opt) (!memcmp(argv[cur], opt, strlen(opt)))
+
+void J3CmdLineParser::process() {
+ cur = 1;
+
+ while(cur < argc) {
+ if(opteq("-jar")) {
+ nyi("-jar");
+ return;
+ } else if(opteq("-cp") || opteq("-classpath"))
+ nyi("-cp/-classpath");
+ else if(optbeg("-D"))
+ nyi("-D<name>=<value>");
+ else if(opteq("-verbose:class"))
+ nyi("-versbose:class");
+ else if(opteq("-verbose:gc"))
+ nyi("-versbose:gc");
+ else if(opteq("-verbose:jni"))
+ nyi("-versbose:jni");
+ else if(opteq("-verbose"))
+ nyi("-versbose");
+ else if(optbeg("-version:"))
+ nyi("-version:<value>");
+ else if(opteq("-version"))
+ nyi("-version");
+ else if(opteq("-showversion"))
+ nyi("showversion");
+ else if(opteq("-jre-restrict-search"))
+ nyi("-jre-restrict-search");
+ else if(opteq("-no-jre-restrict-search"))
+ nyi("-no-jre-restrict-search");
+ else if(opteq("-?") || opteq("-help"))
+ help();
+ else if(optbeg("-X"))
+ nyi("-X");
+ else if(optbeg("-ea:") || optbeg("-enableassertions:"))
+ nyi("-ea:/-enableassertions:");
+ else if(opteq("-ea") || opteq("-enableassertions"))
+ options->assertionsEnabled = 1;
+ else if(optbeg("-da:") || optbeg("-disableassertions:"))
+ nyi("-da:/-disableassertions:");
+ else if(opteq("-da") || opteq("-disableassertions"))
+ options->assertionsEnabled = 0;
+ else if(opteq("-esa") || opteq("-enablesystemassertions"))
+ nyi("-esa/-enablesystemassertions");
+ else if(opteq("-dsa") || opteq("-disablesystemassertions"))
+ nyi("-dsa/-disablesystemassertions");
+ else if(optbeg("-agentlib:"))
+ nyi("-agentlib:");
+ else if(optbeg("-agentpath:"))
+ nyi("-agentpath:");
+ else if(optbeg("-javaagent:"))
+ nyi("-javaagent:");
+ else if(optbeg("-"))
+ help();
+ else {
+ nyi("class args");
+ return;
+ }
+ cur++;
+ }
+
+ help();
+}
+
+void J3CmdLineParser::help() {
+ const char* cmd = "j3";
+ fprintf(stdout,
+ "Usage: %s [-options] class [args...]\n"
+ " (to execute a class)\n"
+ " or %s [-options] -jar jarfile [args...]\n"
+ " (to execute a jar file)\n"
+ "where options include:\n"
+ // " -d32 use a 32-bit data model if available\n"
+ // " -d64 use a 64-bit data model if available\n"
+ // " -server to select the \"server\" VM\n"
+ // " -zero to select the \"zero\" VM\n"
+ // " -jamvm to select the \"jamvm\" VM\n"
+ // " -avian to select the \"avian\" VM\n"
+ // " The default VM is server,\n"
+ // " because you are running on a server-class machine.\n"
+ " -cp <class search path of directories and zip/jar files>\n"
+ " -classpath <class search path of directories and zip/jar files>\n"
+ " separated list of directories, JAR archives,\n"
+ " and ZIP archives to search for class files.\n"
+ " -D<name>=<value>\n"
+ " set a system property\n"
+ // " -verbose:[class|gc|jni]\n"
+ // " enable verbose output\n"
+ " -version print product version and exit\n"
+ // " -version:<value>\n"
+ // " require the specified version to run\n"
+ // " -showversion print product version and continue\n"
+ // " -jre-restrict-search | -no-jre-restrict-search\n"
+ // " include/exclude user private JREs in the version search\n"
+ " -? -help print this help message\n"
+ // " -X print help on non-standard options\n"
+ " -ea[:<packagename>...|:<classname>]\n"
+ " -enableassertions[:<packagename>...|:<classname>]\n"
+ " enable assertions with specified granularity\n"
+ " -da[:<packagename>...|:<classname>]\n"
+ " -disableassertions[:<packagename>...|:<classname>]\n"
+ " disable assertions with specified granularity\n"
+ // " -esa | -enablesystemassertions\n"
+ // " enable system assertions\n"
+ // " -dsa | -disablesystemassertions\n"
+ // " disable system assertions\n"
+ // " -agentlib:<libname>[=<options>]\n"
+ // " load native agent library <libname>, e.g. -agentlib:hprof\n"
+ // " see also, -agentlib:jdwp=help and -agentlib:hprof=help\n"
+ // " -agentpath:<pathname>[=<options>]\n"
+ // " load native agent library by full pathname\n"
+ // " -javaagent:<jarpath>[=<options>]\n"
+ // " load Java programming language agent, see java.lang.instrument\n"
+ // " -splash:<imagepath>\n"
+ // " show splash screen with specified image\n"
+ , cmd, cmd
+ );
+ exit(0);
+}
+
+void J3Options::process(int argc, char** argv) {
+ J3CmdLineParser* p = new J3CmdLineParser(this, argc, argv);
+ p->process();
+ delete p;
+}
+
Added: vmkit/branches/mcjit/lib/j3/vm/j3reader.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3reader.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3reader.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3reader.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,72 @@
+//===--------------- J3Reader.cpp - Open and read files ---------------------===//
+//
+// The VMKit project
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+#include <cstring>
+#include <assert.h>
+
+#include "j3/j3reader.h"
+#include "j3/j3zip.h"
+
+using namespace j3;
+
+const int J3Reader::SeekSet = SEEK_SET;
+const int J3Reader::SeekCur = SEEK_CUR;
+const int J3Reader::SeekEnd = SEEK_END;
+
+J3ClassBytes* J3Reader::openFile(vmkit::BumpAllocator* a, const char* path) {
+ J3ClassBytes* res = NULL;
+ FILE* fp = fopen(path, "r");
+ if (fp != 0) {
+ fseek(fp, 0, SeekEnd);
+ long nbb = ftell(fp);
+ fseek(fp, 0, SeekSet);
+ res = new (a, nbb) J3ClassBytes(nbb);
+ if (fread(res->elements, nbb, 1, fp) == 0) {
+ fprintf(stderr, "fread error\n");
+ abort();
+ }
+ fclose(fp);
+ }
+ return res;
+}
+
+J3ClassBytes* J3Reader::openZip(vmkit::BumpAllocator* allocator, J3ZipArchive* archive,
+ const char* filename) {
+ J3ClassBytes* res = 0;
+ J3ZipFile* file = archive->getFile(filename);
+ if (file != 0) {
+ res = new (allocator, file->ucsize) J3ClassBytes(file->ucsize);
+ if (archive->readFile(res, file) != 0) {
+ return res;
+ }
+ }
+ return NULL;
+}
+
+void J3Reader::seek(uint32_t pos, int from) {
+ uint32_t n = 0;
+ uint32_t start = min;
+ uint32_t end = max;
+
+ if (from == SeekCur) n = cursor + pos;
+ else if (from == SeekSet) n = start + pos;
+ else if (from == SeekEnd) n = end + pos;
+
+
+ assert(n >= start && n <= end && "out of range");
+
+ cursor = n;
+}
+
+bool J3Reader::adjustSize(uint32_t length) {
+ if(cursor + length >= max)
+ return 0;
+
+ max = cursor + length;
+
+ return 1;
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3thread.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3thread.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3thread.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,39 @@
+#include "j3/j3thread.h"
+#include "j3/j3.h"
+
+using namespace j3;
+
+J3Thread::J3Thread(J3* vm, vmkit::BumpAllocator* allocator) :
+ Thread(vm, allocator),
+ _fixedPoint(allocator) {
+ _jniEnv.functions = &jniEnvTable;
+}
+
+J3Thread* J3Thread::create(J3* j3) {
+ vmkit::BumpAllocator* allocator = vmkit::BumpAllocator::create();
+ return new(allocator) J3Thread(j3, allocator);
+}
+
+void J3Thread::ensureCapacity(uint32_t capacity) {
+ _fixedPoint.unsyncEnsureCapacity(capacity);
+}
+
+J3ObjectHandle* J3Thread::push(J3ObjectHandle* handle) {
+ return _fixedPoint.unsyncPush(handle);
+}
+
+J3ObjectHandle* J3Thread::push(J3Object* obj) {
+ return _fixedPoint.unsyncPush(obj);
+}
+
+J3ObjectHandle* J3Thread::tell() {
+ return _fixedPoint.unsyncTell();
+}
+
+void J3Thread::restore(J3ObjectHandle* obj) {
+ _fixedPoint.unsyncRestore(obj);
+}
+
+J3Thread* J3Thread::get() {
+ return (J3Thread*)Thread::get();
+}
Added: vmkit/branches/mcjit/lib/j3/vm/j3zip.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3zip.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3zip.cc (added)
+++ vmkit/branches/mcjit/lib/j3/vm/j3zip.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,235 @@
+//===----------------- Zip.cpp - Interface with zlib ----------------------===//
+//
+// The VMKit project
+//
+//===----------------------------------------------------------------------===//
+
+#include <zlib.h>
+
+#include "j3/j3reader.h"
+#include "j3/j3zip.h"
+
+using namespace j3;
+
+J3ZipArchive::J3ZipArchive(J3ClassBytes* bytes, vmkit::BumpAllocator* a) :
+ allocator(a), filetable(vmkit::Util::char_less, a) {
+ this->bytes = bytes;
+ findOfscd();
+ if (ofscd > -1) addFiles();
+}
+
+J3ZipFile* J3ZipArchive::getFile(const char* filename) {
+ table_iterator End = filetable.end();
+ table_iterator I = filetable.find(filename);
+ return I != End ? I->second : 0;
+}
+
+
+#define END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE 18
+#define CENTRAL_DIRECTORY_FILE_HEADER_SIZE 42
+#define LOCAL_FILE_HEADER_SIZE 26
+
+#define C_FILENAME_LENGTH 24
+#define C_UCSIZE 20
+#define C_CSIZE 16
+#define C_EXTRA_FIELD_LENGTH 26
+#define C_FILE_COMMENT_LENGTH 28
+#define C_ROLH 38
+#define C_COMPRESSION_METHOD 6
+
+#define L_FILENAME_LENGTH 22
+#define L_EXTRA_FIELD_LENGTH 24
+
+#define E_OFFSET_START_CENTRAL_DIRECTORY 12
+#define HDR_ENDCENTRAL "PK\005\006"
+#define HDR_CENTRAL "PK\001\002"
+#define HDR_LOCAL "PK\003\004"
+#define PATH_SEPARATOR '/'
+#define ZIP_STORE 0
+#define ZIP_DEFLATE 8
+#define DEF_WBITS 15
+
+static uint32_t readEndianDep4(J3Reader& reader) {
+ uint8_t one = reader.readU1();
+ uint8_t two = reader.readU1();
+ uint8_t three = reader.readU1();
+ uint8_t four = reader.readU1();
+ return (one + (two << 8) + (three << 16) + (four << 24));
+}
+
+static uint16_t readEndianDep2(J3Reader& reader) {
+ uint8_t one = reader.readU1();
+ uint8_t two = reader.readU1();
+ return (one + (two << 8));
+}
+
+void J3ZipArchive::findOfscd() {
+ int32_t curOffs = 0;
+ int32_t minOffs = 0;
+ int32_t st = END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4;
+
+ J3Reader reader(bytes);
+ curOffs = reader.max;
+ if (curOffs >= (65535 + END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4)) {
+ minOffs = curOffs - (65535 + END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4);
+ } else {
+ minOffs = 0;
+ }
+
+ while (curOffs > minOffs) {
+ int32_t searchPos = 0;
+ if (curOffs >= (1024 - st)) {
+ curOffs = curOffs - (1024 - st);
+ } else {
+ curOffs = 0;
+ }
+ reader.cursor += curOffs;
+
+ int32_t diff = reader.max - reader.cursor;
+ int32_t temp = reader.cursor;
+ if (diff > 1024) {
+ searchPos = 1024;
+ reader.cursor += 1024;
+ } else {
+ searchPos = diff;
+ reader.cursor = reader.max;
+ }
+
+ if (searchPos >= st) {
+ int32_t searchPtr = temp + (searchPos - st);
+ while (searchPtr > temp) {
+ if (bytes->elements[searchPtr] == 'P' &&
+ !(memcmp(bytes->elements + searchPtr, HDR_ENDCENTRAL, 4))) {
+ int32_t offset = searchPtr + 4 + E_OFFSET_START_CENTRAL_DIRECTORY;
+ reader.cursor = offset;
+ this->ofscd = readEndianDep4(reader);
+ return;
+ }
+ searchPtr--;
+ }
+ }
+ }
+ this->ofscd = -1;
+}
+
+void J3ZipArchive::addFiles() {
+ int32_t temp = ofscd;
+
+ J3Reader reader(bytes);
+ reader.cursor = temp;
+
+ while (true) {
+ if (memcmp(bytes->elements + temp, HDR_CENTRAL, 4)) return;
+ J3ZipFile* ptr = new(allocator) J3ZipFile();
+ reader.cursor = temp + 4 + C_COMPRESSION_METHOD;
+ ptr->compressionMethod = readEndianDep2(reader);
+
+ reader.cursor = temp + 4 + C_CSIZE;
+
+ ptr->csize = readEndianDep4(reader);
+ ptr->ucsize = readEndianDep4(reader);
+ ptr->filenameLength = readEndianDep2(reader);
+ ptr->extraFieldLength = readEndianDep2(reader);
+ ptr->fileCommentLength = readEndianDep2(reader);
+
+ reader.cursor = temp + 4 + C_ROLH;
+ ptr->rolh = readEndianDep4(reader);
+
+ temp = temp + 4 + CENTRAL_DIRECTORY_FILE_HEADER_SIZE;
+
+ if ((ptr->filenameLength > 1024) ||
+ (reader.max - temp) < ptr->filenameLength)
+ return;
+
+ ptr->filename = (char*)allocator->allocate(ptr->filenameLength + 1);
+ memcpy(ptr->filename, bytes->elements + temp,
+ ptr->filenameLength);
+ ptr->filename[ptr->filenameLength] = 0;
+
+ if (ptr->filename[ptr->filenameLength - 1] != PATH_SEPARATOR) {
+ filetable.insert(std::make_pair(ptr->filename, ptr));
+ }
+
+ temp = temp + ptr->filenameLength + ptr->extraFieldLength +
+ ptr->fileCommentLength;
+ }
+}
+
+int32_t J3ZipArchive::readFile(J3ClassBytes* array, const J3ZipFile* file) {
+ uint32_t bytesLeft = 0;
+ uint32_t filenameLength = 0;
+ uint32_t extraFieldLength = 0;
+ uint32_t temp = 0;
+
+ J3Reader reader(bytes);
+ reader.cursor = file->rolh;
+
+ if (!(memcmp(bytes->elements + file->rolh, HDR_LOCAL, 4))) {
+ reader.cursor += 4;
+ temp = reader.cursor;
+ reader.cursor += L_FILENAME_LENGTH;
+ filenameLength = readEndianDep2(reader);
+ extraFieldLength = readEndianDep2(reader);
+
+ reader.cursor =
+ temp + extraFieldLength + filenameLength + LOCAL_FILE_HEADER_SIZE;
+
+ if (file->compressionMethod == ZIP_STORE) {
+ memcpy(array->elements, bytes->elements + reader.cursor, file->ucsize);
+ return 1;
+ } else if (file->compressionMethod == ZIP_DEFLATE) {
+ z_stream stre;
+ int32_t err = 0;
+
+ bytesLeft = file->csize;
+ stre.next_out = (Bytef*)array->elements;
+ stre.avail_out = file->ucsize;
+ stre.zalloc = 0;
+ stre.zfree = 0;
+
+ err = inflateInit2_(&stre, - DEF_WBITS, zlib_version, sizeof(z_stream));
+
+ if (err != Z_OK) {
+ return 0;
+ }
+
+ while (bytesLeft) {
+ uint32_t size = 0;
+ stre.next_in = bytes->elements + reader.cursor;
+ if (bytesLeft > 1024) size = 1024;
+ else size = bytesLeft;
+
+ uint32_t diff = reader.max - reader.cursor;
+ if (diff < size) {
+ stre.avail_in = diff;
+ reader.cursor = reader.max;
+ } else {
+ stre.avail_in = size;
+ reader.cursor += size;
+ }
+
+ if (bytesLeft > size) {
+ err = inflate(&stre, Z_PARTIAL_FLUSH);
+ } else {
+ err = inflate(&stre, Z_FINISH);
+ }
+
+ bytesLeft = bytesLeft - size;
+ }
+
+ inflateEnd(&stre);
+
+ if ((err != Z_STREAM_END) &&
+ (bytesLeft || err != Z_BUF_ERROR || stre.avail_out)) {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ return 0;
+}
Added: vmkit/branches/mcjit/lib/vmkit/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/Makefile (added)
+++ vmkit/branches/mcjit/lib/vmkit/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ../..
+
+MODULE=vmkit
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/lib/vmkit/allocator.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/allocator.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/allocator.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/allocator.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,92 @@
+#include "vmkit/allocator.h"
+#include "vmkit/thread.h"
+#include "vmkit/vmkit.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/mman.h>
+
+using namespace vmkit;
+
+void* BumpAllocator::operator new(size_t n) {
+ return (void*)((uintptr_t)map(bucketSize) + sizeof(BumpAllocatorNode));
+}
+
+BumpAllocator::BumpAllocator() {
+ pthread_mutex_init(&mutex, 0);
+ current = (BumpAllocatorNode*)((uintptr_t)this - sizeof(BumpAllocatorNode));
+ current->next = 0;
+ current->top = (uint8_t*)round((uintptr_t)(this + 1), 64);
+}
+
+BumpAllocator* BumpAllocator::create() {
+ return new BumpAllocator();
+}
+
+BumpAllocator::~BumpAllocator() {
+ while(current->next) {
+ BumpAllocatorNode* tmp = current->next;
+ unmap(current, (uintptr_t)current->top - (uintptr_t)current);
+ }
+}
+
+void BumpAllocator::operator delete(void* p) {
+ unmap(p, bucketSize);
+}
+
+void BumpAllocator::destroy(BumpAllocator* allocator) {
+ delete allocator;
+}
+
+void* BumpAllocator::allocate(size_t size) {
+ if(size > (bucketSize - sizeof(BumpAllocatorNode))) {
+ pthread_mutex_lock(&mutex);
+ size_t total = round((uintptr_t)size + sizeof(BumpAllocatorNode), 4096);
+ BumpAllocatorNode* newBucket = (BumpAllocatorNode*)map(total);
+ //memset(newBucket, 0, total);
+ newBucket->next = current->next;
+ current->next = newBucket;
+ newBucket->top = (uint8_t*)((uintptr_t)newBucket + bucketSize);
+ pthread_mutex_unlock(&mutex);
+ return newBucket + 1;
+ }
+
+ while(1) {
+ BumpAllocatorNode* node = current;
+ uint8_t* res = __sync_fetch_and_add(&node->top, (uint8_t*)round(size, 8));
+ uint8_t* end = res + size;
+
+ if(res >= (uint8_t*)node && (res + size) < ((uint8_t*)node) + bucketSize) {
+ //printf("%p -> %lu %lu (%p -> %p)\n", res, size, round((uintptr_t)size, 64), node, ((uint8_t*)node) + bucketSize);
+ //memset(res, 0, size);
+ return res;
+ }
+
+ pthread_mutex_lock(&mutex);
+ BumpAllocatorNode* newBucket = (BumpAllocatorNode*)map(bucketSize);
+ newBucket->next = current;
+ newBucket->top = (uint8_t*)(newBucket + 1);
+ current = newBucket;
+ pthread_mutex_unlock(&mutex);
+ }
+}
+
+void* BumpAllocator::map(size_t n) {
+ void* res = mmap(0, n, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0);
+ if(res == MAP_FAILED)
+ Thread::get()->vm()->internalError(L"unable to map %ld bytes", n);
+ //memset(res, 0, n);
+ return res;
+}
+
+void BumpAllocator::unmap(void* p, size_t n) {
+ munmap(0, n);
+}
+
+void PermanentObject::operator delete(void* ptr) {
+ Thread::get()->vm()->internalError(L"should not happen");
+}
+
+void PermanentObject::operator delete[](void* ptr) {
+ Thread::get()->vm()->internalError(L"should not happen");
+}
Added: vmkit/branches/mcjit/lib/vmkit/gc.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/gc.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/gc.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/gc.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,8 @@
+#include "vmkit/gc.h"
+#include <stdlib.h>
+
+using namespace vmkit;
+
+void* GC::allocate(size_t sz) {
+ return calloc(sz, 1);
+}
Added: vmkit/branches/mcjit/lib/vmkit/gcrootpass.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/gcrootpass.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/gcrootpass.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/gcrootpass.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,58 @@
+#include "llvm/CodeGen/GCs.h"
+#include "llvm/CodeGen/GCStrategy.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineInstrBuilder.h"
+
+#include "llvm/MC/MCContext.h"
+
+#include "llvm/Support/Compiler.h"
+
+#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetMachine.h"
+
+using namespace llvm;
+
+namespace vmkit {
+ class VmkitGCPass : public GCStrategy {
+ public:
+ VmkitGCPass();
+ bool findCustomSafePoints(GCFunctionInfo& FI, MachineFunction &MF);
+ };
+
+ void linkVmkitGC() { }
+
+ static GCRegistry::Add<VmkitGCPass> X("vmkit", "VMKit GC for JIT-generated functions");
+
+ VmkitGCPass::VmkitGCPass() {
+ CustomSafePoints = true;
+ InitRoots = 1;
+ }
+
+ static MCSymbol *InsertLabel(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI,
+ DebugLoc DL) {
+ const TargetInstrInfo* TII = MBB.getParent()->getTarget().getInstrInfo();
+ MCSymbol *Label = MBB.getParent()->getContext().CreateTempSymbol();
+ BuildMI(MBB, MI, DL, TII->get(TargetOpcode::GC_LABEL)).addSym(Label);
+ return Label;
+ }
+
+ bool VmkitGCPass::findCustomSafePoints(GCFunctionInfo& FI, MachineFunction &MF) {
+ for (MachineFunction::iterator BBI = MF.begin(),
+ BBE = MF.end(); BBI != BBE; ++BBI) {
+ for (MachineBasicBlock::iterator MI = BBI->begin(),
+ ME = BBI->end(); MI != ME; ++MI) {
+ if (MI->getDesc().isCall()) {
+ MachineBasicBlock::iterator RAI = MI; ++RAI;
+ MCSymbol* Label = InsertLabel(*MI->getParent(), RAI, MI->getDebugLoc());
+ FI.addSafePoint(GC::PostCall, Label, MI->getDebugLoc());
+ } else if (MI->getDebugLoc().getCol() == 1) {
+ MCSymbol* Label = InsertLabel(*MI->getParent(), MI, MI->getDebugLoc());
+ FI.addSafePoint(GC::Loop, Label, MI->getDebugLoc());
+ }
+ }
+ }
+
+ return false;
+ }
+}
Added: vmkit/branches/mcjit/lib/vmkit/names.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/names.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/names.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/names.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,79 @@
+#include <string.h>
+
+#include "vmkit/names.h"
+
+using namespace vmkit;
+
+T_ptr_less_t<const Name*> Name::less;
+
+Name::Name(uint32_t length, const wchar_t* content) {
+ _length = length;
+ memcpy(_content, content, sizeof(wchar_t)*(length+1));
+}
+
+void* Name::operator new(size_t unused, BumpAllocator* allocator, size_t n) {
+ return PermanentObject::operator new(sizeof(Name) + n * sizeof(wchar_t), allocator);
+}
+
+Names::Names(BumpAllocator* _allocator) : names(Util::wchar_t_less, _allocator) {
+ pthread_mutex_init(&mutex, 0);
+ allocator = _allocator;
+}
+
+const Name* Names::get(const wchar_t* str) {
+ pthread_mutex_lock(&mutex);
+ //printf("---- internalize %ls\n", str);
+
+ const Name* res;
+ std::map<const wchar_t*, const Name*>::iterator it = names.find(str);
+
+ if(it == names.end()) {
+ size_t len = wcslen(str);
+ Name* tmp = new(allocator, len) Name(len, str);
+
+ names[tmp->cStr()] = tmp;
+
+ res = tmp;
+ } else {
+ res = it->second;
+ }
+ pthread_mutex_unlock(&mutex);
+ return res;
+}
+
+const Name* Names::get(const char* str, size_t start, size_t length) {
+ //printf("%s %lu %lu\n", str, start, length);
+ if(length == -1)
+ length = strlen(str);
+ wchar_t buf[length + 1];
+ size_t n = 0;
+ size_t i = 0;
+
+ while (i < length) {
+ wchar_t x = str[i++];
+ if(x & 0x80) {
+ wchar_t y = str[i++];
+ if (x & 0x20) {
+ wchar_t z = str[i++];
+ x = ((x & 0x0F) << 12) +
+ ((y & 0x3F) << 6) +
+ (z & 0x3F);
+ } else {
+ x = ((x & 0x1F) << 6) +
+ (y & 0x3F);
+ }
+ }
+ buf[n++] = x;
+ }
+
+ buf[n] = 0;
+
+ return get(buf);
+}
+
+const Name* Names::get(char c) {
+ wchar_t buf[2];
+ buf[0] = c;
+ buf[1] = 0;
+ return get(buf);
+}
Added: vmkit/branches/mcjit/lib/vmkit/thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/thread.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/thread.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/thread.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,15 @@
+#include "vmkit/thread.h"
+
+using namespace vmkit;
+
+__thread Thread* Thread::_thread = 0;
+
+Thread::Thread(VMKit* vm, BumpAllocator* allocator) {
+ _allocator = allocator;
+ _vm = vm;
+}
+
+void Thread::destroy(Thread* thread) {
+ BumpAllocator::destroy(thread->allocator());
+}
+
Added: vmkit/branches/mcjit/lib/vmkit/util.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/util.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/util.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/util.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,18 @@
+#include "vmkit/util.h"
+
+#include <string.h>
+#include <wchar.h>
+
+using namespace vmkit;
+
+struct Util::char_less_t Util::char_less;
+struct Util::wchar_t_less_t Util::wchar_t_less;
+
+bool Util::char_less_t::operator()(const char* s1, const char* s2) const {
+ return strcmp(s1, s2) < 0;
+}
+
+bool Util::wchar_t_less_t::operator()(const wchar_t* lhs, const wchar_t* rhs) const {
+ //printf("Compare: %ls - %ls - %d\n", lhs, rhs, wcscmp(lhs, rhs));
+ return wcscmp(lhs, rhs) < 0;
+}
Added: vmkit/branches/mcjit/lib/vmkit/vmkit.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/vmkit.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/vmkit.cc (added)
+++ vmkit/branches/mcjit/lib/vmkit/vmkit.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,282 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <wchar.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <cxxabi.h>
+
+#include "vmkit/vmkit.h"
+#include "vmkit/thread.h"
+
+#include "llvm/LinkAllPasses.h"
+#include "llvm/PassManager.h"
+
+#include "llvm/IR/Module.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Intrinsics.h"
+
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/MemoryBuffer.h"
+
+#include "llvm/Bitcode/ReaderWriter.h"
+
+#include "llvm/CodeGen/MachineCodeEmitter.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/GCStrategy.h"
+
+using namespace vmkit;
+
+VMKit::VMKit(vmkit::BumpAllocator* allocator) :
+ mangleMap(Util::char_less, allocator) {
+ llvm::InitializeNativeTarget();
+ _allocator = allocator;
+}
+
+void* VMKit::operator new(size_t n, vmkit::BumpAllocator* allocator) {
+ return allocator->allocate(n);
+}
+
+void VMKit::destroy(VMKit* vm) {
+ vmkit::BumpAllocator::destroy(vm->allocator());
+}
+
+
+llvm::Type* VMKit::introspectType(const char* name) {
+ llvm::Type* res = self()->getTypeByName(name);
+ if(!res)
+ internalError(L"unable to find internal type: %s", name);
+ return res;
+}
+
+llvm::Function* VMKit::introspectFunction(llvm::Module* dest, const char* name) {
+ llvm::Function* orig = (llvm::Function*)mangleMap[name];
+ if(!orig)
+ internalError(L"unable to find internal function: %s", name);
+
+ return orig;
+ // return (llvm::Function*)dest->getOrInsertFunction(orig->getName(), orig->getFunctionType());
+}
+
+llvm::GlobalValue* VMKit::introspectGlobalValue(llvm::Module* dest, const char* name) {
+ llvm::GlobalValue* res = mangleMap[name];
+ if(!res)
+ internalError(L"unable to find internal global value: %s", name);
+ return res;
+}
+
+uintptr_t VMKit::addSymbol(llvm::GlobalValue* gv) {
+ const char* id = gv->getName().data();
+ void* ptr = dlsym(RTLD_SELF, id);
+
+ if(ptr) {
+ ee()->updateGlobalMapping(gv, ptr);
+ int status;
+ char* realname;
+ realname = abi::__cxa_demangle(id, 0, 0, &status);
+ const char* tmp = realname ? realname : id;
+ uint32_t length = strlen(tmp);
+ char* mangled = (char*)allocator()->allocate(length+1);
+ strcpy(mangled, tmp);
+ mangleMap[mangled] = gv;
+ free(realname);
+ return (uintptr_t)ptr;
+ } else
+ return 0;
+}
+
+void VMKit::vmkitBootstrap(Thread* initialThread, const char* selfBitCodePath) {
+ Thread::set(initialThread);
+
+ std::string err;
+ llvm::OwningPtr<llvm::MemoryBuffer> buf;
+ if (llvm::MemoryBuffer::getFile(selfBitCodePath, buf))
+ VMKit::internalError(L"Error while opening bitcode file %s\n", selfBitCodePath);
+ _self = llvm::getLazyBitcodeModule(buf.take(), llvm::getGlobalContext(), &err);
+
+ if(!self())
+ VMKit::internalError(L"Error while reading bitcode file %s: %s\n", selfBitCodePath, err.c_str());
+
+ _ee = llvm::EngineBuilder(self()).setErrorStr(&err).create();
+ if (!ee())
+ VMKit::internalError(L"Error while creating execution engine: %s\n", err.c_str());
+
+ ee()->DisableLazyCompilation(0);
+ ee()->RegisterJITEventListener(this);
+
+ for(llvm::Module::iterator cur=self()->begin(); cur!=self()->end(); cur++)
+ addSymbol(cur);
+
+ for(llvm::Module::global_iterator cur=self()->global_begin(); cur!=self()->global_end(); cur++)
+ addSymbol(cur);
+
+ _dataLayout = new llvm::DataLayout(self());
+
+ ptrTypeInfo = ee()->getPointerToGlobal(introspectGlobalValue(self(), "typeinfo for void*"));
+
+ if(!ptrTypeInfo)
+ internalError(L"unable to find typeinfo for void*");
+
+#if 0
+ llvm::Linker* linker = new llvm::Linker(new llvm::Module("linker", vm()->self()->getContext()));
+ std::string err;
+ if(linker->linkInModule(vm()->self(), llvm::Linker::PreserveSource, &err))
+ J3::internalError(L"unable to add self to linker: %s", err.c_str());
+ if(linker->linkInModule(module(), llvm::Linker::PreserveSource, &err))
+ J3::internalError(L"unable to add module to linker: %s", err.c_str());
+#endif
+}
+
+
+llvm::Function* VMKit::getGCRoot(llvm::Module* mod) {
+ return llvm::Intrinsic::getDeclaration(mod, llvm::Intrinsic::gcroot);
+}
+
+llvm::FunctionPassManager* VMKit::preparePM(llvm::Module* mod) {
+ llvm::FunctionPassManager* pm = new llvm::FunctionPassManager(mod);
+ //pm->add(new llvm::TargetData(*ee->getTargetData()));
+
+ pm->add(llvm::createBasicAliasAnalysisPass());
+
+ pm->add(llvm::createCFGSimplificationPass()); // Clean up disgusting code
+ pm->add(llvm::createPromoteMemoryToRegisterPass());// Kill useless allocas
+ pm->add(llvm::createInstructionCombiningPass()); // Cleanup for scalarrepl.
+ pm->add(llvm::createScalarReplAggregatesPass()); // Break up aggregate allocas
+ pm->add(llvm::createInstructionCombiningPass()); // Cleanup for scalarrepl.
+ pm->add(llvm::createJumpThreadingPass()); // Thread jumps.
+ pm->add(llvm::createCFGSimplificationPass()); // Merge & remove BBs
+ pm->add(llvm::createInstructionCombiningPass()); // Combine silly seq's
+ pm->add(llvm::createCFGSimplificationPass()); // Merge & remove BBs
+
+ pm->add(llvm::createReassociatePass()); // Reassociate expressions
+ pm->add(llvm::createLoopRotatePass()); // Rotate loops.
+ pm->add(llvm::createLICMPass()); // Hoist loop invariants
+ pm->add(llvm::createLoopUnswitchPass()); // Unswitch loops.
+ pm->add(llvm::createInstructionCombiningPass());
+ pm->add(llvm::createIndVarSimplifyPass()); // Canonicalize indvars
+ pm->add(llvm::createLoopDeletionPass()); // Delete dead loops
+ pm->add(llvm::createLoopUnrollPass()); // Unroll small loops*/
+ pm->add(llvm::createInstructionCombiningPass()); // Clean up after the unroller
+ pm->add(llvm::createGVNPass()); // Remove redundancies
+ pm->add(llvm::createMemCpyOptPass()); // Remove memcpy / form memset
+ pm->add(llvm::createSCCPPass()); // Constant prop with SCCP
+
+ // Run instcombine after redundancy elimination to exploit opportunities
+ // opened up by them.
+ pm->add(llvm::createInstructionCombiningPass());
+ pm->add(llvm::createJumpThreadingPass()); // Thread jumps
+ pm->add(llvm::createDeadStoreEliminationPass()); // Delete dead stores
+ pm->add(llvm::createAggressiveDCEPass()); // Delete dead instructions
+ pm->add(llvm::createCFGSimplificationPass()); // Merge & remove BBs
+
+ pm->doInitialization();
+
+ return pm;
+}
+
+void VMKit::NotifyFunctionEmitted(const llvm::Function &F,
+ void *Code,
+ size_t Size,
+ const llvm::JITEventListener::EmittedFunctionDetails &Details) {
+ const llvm::MachineFunction* mf = Details.MF;
+ const std::vector<llvm::LandingPadInfo>& landingPads = mf->getMMI().getLandingPads();
+ const llvm::MachineCodeEmitter* mce = Details.MCE;
+
+ for(std::vector<llvm::LandingPadInfo>::const_iterator i=landingPads.begin(); i!=landingPads.end(); i++) {
+ uintptr_t dest = mce->getLabelAddress(i->LandingPadLabel);
+
+ for(uint32_t j=0; j<i->BeginLabels.size(); j++) {
+ uintptr_t point = mce->getLabelAddress(i->EndLabels[j]);
+ ExceptionDescriptor* e = new ExceptionDescriptor(&F, point, dest);
+ exceptionTable[point] = e;
+ fprintf(stderr, " exceptionpoint at 0x%lx goes to 0x%lx\n", point, dest);
+ }
+ }
+
+ if(F.hasGC()) {
+ llvm::GCFunctionInfo* gcInfo = &mf->getGMI()->getFunctionInfo(F);
+ uintptr_t start = (uintptr_t)Code;
+ uintptr_t end = start + Size;
+
+ for(llvm::GCFunctionInfo::iterator safepoint=gcInfo->begin(); safepoint!=gcInfo->end(); safepoint++) {
+ uint32_t kind = safepoint->Kind;
+ llvm::MCSymbol* label = safepoint->Label;
+ uintptr_t addr = mce->getLabelAddress(label);
+
+ if(addr < start || addr > end)
+ internalError(L"safe point is not inside the function (%p %p %p)", start, addr, end);
+
+ Safepoint* sf = Safepoint::create(&F, addr, gcInfo->live_size(safepoint));
+ uint32_t i=0;
+
+ //fprintf(stderr, " safepoint at 0x%lx\n", addr);
+ for(llvm::GCFunctionInfo::live_iterator live=gcInfo->live_begin(safepoint); live!=gcInfo->live_end(safepoint); live++, i++) {
+ sf->setAt(i, live->StackOffset);
+ //fprintf(stderr, " offset: %d\n", live->StackOffset);
+ }
+ safepointMap[addr] = sf;
+ }
+ }
+}
+
+void VMKit::log(const wchar_t* msg, ...) {
+ va_list va;
+ va_start(va, msg);
+ fprintf(stderr, "[vmkit]: ");
+ vfwprintf(stderr, msg, va);
+ fprintf(stderr, "\n");
+ va_end(va);
+}
+
+void VMKit::internalError(const wchar_t* msg, va_list va) {
+ defaultInternalError(msg, va);
+}
+
+void VMKit::defaultInternalError(const wchar_t* msg, va_list va) {
+ fprintf(stderr, "Fatal error: ");
+ vfwprintf(stderr, msg, va);
+ fprintf(stderr, "\n");
+ abort();
+}
+
+void VMKit::internalError(const wchar_t* msg, ...) {
+ va_list va;
+ va_start(va, msg);
+ if(Thread::get() && Thread::get()->vm())
+ Thread::get()->vm()->internalError(msg, va);
+ else
+ defaultInternalError(msg, va);
+ va_end(va);
+ fprintf(stderr, "SHOULD NOT BE THERE\n");
+ abort();
+}
+
+void VMKit::throwException(void* obj) {
+ void** exception = (void**)abi::__cxa_allocate_exception(sizeof(void*));
+ *exception = obj;
+ abi::__cxa_throw(exception, (std::type_info*)Thread::get()->vm()->ptrTypeInfo, 0);
+ abort();
+}
+
+
+void* Safepoint::operator new(size_t unused, size_t nbSlots) {
+ return ::operator new(sizeof(Safepoint) + nbSlots*sizeof(uintptr_t) - sizeof(uintptr_t));
+}
+
+Safepoint::Safepoint(const llvm::Function* llvmFunction, uintptr_t address, size_t nbSlots) {
+ _llvmFunction = llvmFunction;
+ _address = address;
+ _nbSlots = nbSlots;
+}
+
+Safepoint* Safepoint::create(const llvm::Function* llvmFunction, uintptr_t address, size_t nbSlots) {
+ return new(nbSlots) Safepoint(llvmFunction, address, nbSlots);
+}
+
+ExceptionDescriptor::ExceptionDescriptor(const llvm::Function* llvmFunction, uintptr_t point, uintptr_t landingPad) {
+ _llvmFunction = llvmFunction;
+ _point = point;
+ _landingPad = landingPad;
+}
Added: vmkit/branches/mcjit/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/tools/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/tools/Makefile (added)
+++ vmkit/branches/mcjit/tools/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,10 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ..
+
+DIRS := j3
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/tools/j3/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/tools/j3/Makefile?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/tools/j3/Makefile (added)
+++ vmkit/branches/mcjit/tools/j3/Makefile Mon Nov 25 03:27:09 2013
@@ -0,0 +1,11 @@
+#===- ./Makefile -------------------------------------------*- Makefile -*--===#
+#
+# The vmkit project
+#===------------------------------------------------------------------------===#
+
+LEVEL := ../..
+
+LIBS := vmkit j3 openjdk
+TOOL := j3
+
+include $(LEVEL)/Makefile.rules
Added: vmkit/branches/mcjit/tools/j3/main.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/tools/j3/main.cc?rev=195628&view=auto
==============================================================================
--- vmkit/branches/mcjit/tools/j3/main.cc (added)
+++ vmkit/branches/mcjit/tools/j3/main.cc Mon Nov 25 03:27:09 2013
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include "j3/j3.h"
+
+int main(int argc, char** argv) {
+ j3::J3* vm = j3::J3::create();
+
+ vm->start(argc, argv);
+}
More information about the vmkit-commits
mailing list