[vmkit-commits] [vmkit] r197865 - Port on Linux

Gael Thomas gael.thomas at lip6.fr
Sat Dec 21 09:13:09 PST 2013


Author: gthomas
Date: Sat Dec 21 11:13:08 2013
New Revision: 197865

URL: http://llvm.org/viewvc/llvm-project?rev=197865&view=rev
Log:
Port on Linux

Added:
    vmkit/branches/mcjit/include/vmkit/config.h.in
    vmkit/branches/mcjit/include/vmkit/system.h
Modified:
    vmkit/branches/mcjit/Makefile.config.in
    vmkit/branches/mcjit/Makefile.rules
    vmkit/branches/mcjit/autoconf/configure.ac
    vmkit/branches/mcjit/configure
    vmkit/branches/mcjit/include/j3/j3config.h.in
    vmkit/branches/mcjit/include/j3/j3lib.h
    vmkit/branches/mcjit/include/vmkit/   (props changed)
    vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
    vmkit/branches/mcjit/lib/j3/vm/j3.cc
    vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
    vmkit/branches/mcjit/lib/j3/vm/j3options.cc
    vmkit/branches/mcjit/lib/j3/vm/j3zip.cc
    vmkit/branches/mcjit/lib/vmkit/compiler.cc
    vmkit/branches/mcjit/lib/vmkit/names.cc
    vmkit/branches/mcjit/lib/vmkit/safpoint.cc
    vmkit/branches/mcjit/lib/vmkit/thread.cc
    vmkit/branches/mcjit/lib/vmkit/util.cc
    vmkit/branches/mcjit/lib/vmkit/vmkit.cc

Modified: vmkit/branches/mcjit/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.config.in?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/Makefile.config.in (original)
+++ vmkit/branches/mcjit/Makefile.config.in Sat Dec 21 11:13:08 2013
@@ -1,5 +1,6 @@
 
-SHOPT=@SHOPT@ 
+SHALL=@SHALL@
+SHNOALL=@SHNOALL@
 EXEEXT=@EXEEXT@
 SHLIBEXT=@SHLIBEXT@
 

Modified: vmkit/branches/mcjit/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.rules?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/Makefile.rules (original)
+++ vmkit/branches/mcjit/Makefile.rules Sat Dec 21 11:13:08 2013
@@ -35,7 +35,7 @@ endif
 ###############################################################################
 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
+		-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 
 ifeq ($(OPTIMIZED),1)
 	COMMON_FLAGS+=-O3
@@ -52,11 +52,8 @@ 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
+CXXFLAGS=$(LLVM_CXXFLAGS) $(COMMON_FLAGS) -std=gnu++98 -fPIC
+SHFLAGS=-lpthread -ldl -lz -lncurses -fno-common -Wl,-flat_namespace -Wl,-undefined,suppress
 
 ###############################################################################
 #   Targets
@@ -93,7 +90,7 @@ RECURSIVE_TARGETS=all clean
 define do_sub_target
 $1::
   #$(Echo) "Entering directory $$(PROF)/$2"
-	$(Verb) $(MAKE) $(SUB_OPT) -C $2 $1 PROF=$(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
 
@@ -141,8 +138,6 @@ 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
@@ -279,7 +274,7 @@ DOM=then mv -f "$(BUILD_DIR)/$$*.d.tmp"
 
 $(SONAME)$(SHLIBEXT): $(SO_FILES)
 	$(Echo) "Linking shared library '$(notdir $@)'"
-	$(Verb) $(CLANGXX) -shared $(LLVM_LDFLAGS) $(SHFLAGS) -o $@ $(SHFLAGS) $^ $(SO_LIBS)
+	$(Verb) $(CLANGXX) -shared $(LLVM_LDFLAGS) $(SHFLAGS) -o $@ $(SHALL) $^ $(SHNOALL) $(SO_LIBS)
 
 $(GEN_MODULE).bc: $(BC_FILES)
 	$(Echo) "Linking bc module '$(notdir $@)'"
@@ -287,7 +282,7 @@ $(GEN_MODULE).bc: $(BC_FILES)
 
 $(GEN_MODULE).a: $(GC_OBJ_FILES)
 	$(Echo) "Linking module '$(notdir $@)'"
-	$(Verb) libtool -static -o $@ $^
+	$(Verb) ar cru $@ $^ && ranlib $@
 
 %.o: %.bc
 	$(Echo) "Assembling '$(notdir $<)'"

Modified: vmkit/branches/mcjit/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/autoconf/configure.ac?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/autoconf/configure.ac (original)
+++ vmkit/branches/mcjit/autoconf/configure.ac Sat Dec 21 11:13:08 2013
@@ -44,6 +44,7 @@ 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.
+dnl Make sure we aren't attempting to configure for an unknown system
 AC_CACHE_CHECK([type of operating system we're going to host on],
                [vmkit_cv_os_type],
 [case $host in
@@ -56,8 +57,8 @@ AC_CACHE_CHECK([type of operating system
   *-*-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"
+ 	  SHALL="-Wl,-all_load -Wl,-compatibility_version,1 -Wl,-current_version,1"
+		SHNOALL=""
 		EXEEXT="" ;;
   *-*-freebsd*)
     AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
@@ -70,7 +71,11 @@ AC_CACHE_CHECK([type of operating system
   *-*-interix*)
     AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
   *-*-linux*)
-    AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
+		OS="linux"
+		SHLIBEXT=".so"
+		SHALL="-Wl,--whole-archive"
+		SHNOALL="-Wl,--no-whole-archive"
+		EXEEXT="" ;;
   *-*-solaris*)
     AC_MSG_ERROR([Good luck porting vmkit to your host!]) ;;
   *-*-win32*)
@@ -81,10 +86,10 @@ AC_CACHE_CHECK([type of operating system
     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([SHALL])
+AC_SUBST([SHNOALL])
 AC_SUBST([EXEEXT])
 
 dnl===-----------------------------------------------------------------------===
@@ -222,10 +227,7 @@ 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)
@@ -233,7 +235,7 @@ dnl AC_SUBST(SHLIBEXT,$libltdl_cv_shlibe
 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]) 
+      AC_MSG_ERROR([Unable to find $2, please install it]) 
 		fi
   AC_SUBST([$1])
 ]) 
@@ -252,6 +254,8 @@ dnl=== SECTION 5: Check for libraries
 dnl===
 dnl===-----------------------------------------------------------------------===
 
+dnl have to check: zlib, ncurses
+
 dnl===-----------------------------------------------------------------------===
 dnl===
 dnl=== SECTION 6: Check for header files
@@ -283,7 +287,7 @@ dnl===
 dnl===-----------------------------------------------------------------------===
 
 dnl Configure header files
-AC_CONFIG_FILES([Makefile.config include/j3/j3config.h])
+AC_CONFIG_FILES([Makefile.config include/vmkit/config.h include/j3/j3config.h])
 
 AC_SUBST([ac_config_files])
 AC_SUBST([ac_config_headers])

Modified: vmkit/branches/mcjit/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/configure?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/configure (original)
+++ vmkit/branches/mcjit/configure Sat Dec 21 11:13:08 2013
@@ -1,11 +1,13 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for vmkit 0.1.
+# Generated by GNU Autoconf 2.68 for vmkit 0.1.
 #
 # Report bugs to <gael.thomas at lip6.fr>.
 #
 #
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -136,31 +138,6 @@ 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
@@ -194,8 +171,7 @@ if ( set x; as_fn_ret_success y && test
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
+test x\$exitcode = x0 || 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'\" &&
@@ -239,25 +215,21 @@ 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
+  # 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
+	export CONFIG_SHELL
+	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+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -360,14 +332,6 @@ $as_echo X"$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
@@ -489,10 +453,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   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).
@@ -527,16 +487,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... 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'.
+    # In both cases, we have to default to `cp -p'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
+      as_ln_s='cp -p'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -pR'
+    as_ln_s='cp -p'
   fi
 else
-  as_ln_s='cp -pR'
+  as_ln_s='cp -p'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -548,8 +508,28 @@ else
   as_mkdir_p=false
 fi
 
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # 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'"
@@ -617,7 +597,8 @@ ASSERT
 DEBUG
 OPTIMIZED
 EXEEXT
-SHOPT
+SHNOALL
+SHALL
 SHLIBEXT
 OS
 target_os
@@ -1145,6 +1126,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1398,9 +1381,9 @@ test -n "$ac_init_help" && exit $ac_stat
 if $ac_init_version; then
   cat <<\_ACEOF
 vmkit configure 0.1
-generated by GNU Autoconf 2.69
+generated by GNU Autoconf 2.68
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
@@ -1492,7 +1475,7 @@ This file contains any messages produced
 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
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2002,8 +1985,8 @@ else
   *-*-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"
+ 	  SHALL="-Wl,-all_load -Wl,-compatibility_version,1 -Wl,-current_version,1"
+		SHNOALL=""
 		EXEEXT="" ;;
   *-*-freebsd*)
     as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
@@ -2016,7 +1999,11 @@ else
   *-*-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 ;;
+		OS="linux"
+		SHLIBEXT=".so"
+		SHALL="-Wl,--whole-archive"
+		SHNOALL="-Wl,--no-whole-archive"
+		EXEEXT="" ;;
   *-*-solaris*)
     as_fn_error $? "Good luck porting vmkit to your host!" "$LINENO" 5 ;;
   *-*-win32*)
@@ -2036,6 +2023,7 @@ $as_echo "$vmkit_cv_os_type" >&6; }
 
 
 
+
 # Check whether --enable-optimized was given.
 if test "${enable_optimized+set}" = set; then :
   enableval=$enable_optimized;
@@ -2200,7 +2188,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2240,7 +2228,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2293,7 +2281,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2334,7 +2322,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2392,7 +2380,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2436,7 +2424,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -2882,7 +2870,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-struct stat;
+#include <sys/types.h>
+#include <sys/stat.h>
 /* 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);
@@ -3104,7 +3093,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS con
 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:
@@ -3142,7 +3130,7 @@ case $as_dir/ in #((
     # 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 -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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.
@@ -3222,7 +3210,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3246,7 +3234,7 @@ fi
 
 
 	  if test x"${LLC}" == x"no"; then
-      as_fn_error $? "Unable to find llc, please install llc" "$LINENO" 5
+      as_fn_error $? "Unable to find llc, please install it" "$LINENO" 5
 		fi
 
 
@@ -3270,7 +3258,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3294,7 +3282,7 @@ fi
 
 
 	  if test x"${LLOPT}" == x"no"; then
-      as_fn_error $? "Unable to find opt, please install opt" "$LINENO" 5
+      as_fn_error $? "Unable to find opt, please install it" "$LINENO" 5
 		fi
 
 
@@ -3318,7 +3306,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3342,7 +3330,7 @@ fi
 
 
 	  if test x"${LLLINK}" == x"no"; then
-      as_fn_error $? "Unable to find llvm-link, please install llvm-link" "$LINENO" 5
+      as_fn_error $? "Unable to find llvm-link, please install it" "$LINENO" 5
 		fi
 
 
@@ -3366,7 +3354,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3390,7 +3378,7 @@ fi
 
 
 	  if test x"${LLNM}" == x"no"; then
-      as_fn_error $? "Unable to find llvm-nm, please install llvm-nm" "$LINENO" 5
+      as_fn_error $? "Unable to find llvm-nm, please install it" "$LINENO" 5
 		fi
 
 
@@ -3414,7 +3402,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3438,7 +3426,7 @@ fi
 
 
 	  if test x"${CLANG}" == x"no"; then
-      as_fn_error $? "Unable to find clang, please install clang" "$LINENO" 5
+      as_fn_error $? "Unable to find clang, please install it" "$LINENO" 5
 		fi
 
 
@@ -3462,7 +3450,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3486,7 +3474,7 @@ fi
 
 
 	  if test x"${CLANGXX}" == x"no"; then
-      as_fn_error $? "Unable to find clang++, please install clang++" "$LINENO" 5
+      as_fn_error $? "Unable to find clang++, please install it" "$LINENO" 5
 		fi
 
 
@@ -3510,7 +3498,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
@@ -3534,7 +3522,7 @@ fi
 
 
 	  if test x"${GAWK}" == x"no"; then
-      as_fn_error $? "Unable to find gawk, please install gawk" "$LINENO" 5
+      as_fn_error $? "Unable to find gawk, please install it" "$LINENO" 5
 		fi
 
 
@@ -3545,7 +3533,8 @@ fi
 
 
 
-ac_config_files="$ac_config_files Makefile.config include/j3/j3config.h"
+
+ac_config_files="$ac_config_files Makefile.config include/vmkit/config.h include/j3/j3config.h"
 
 
 
@@ -3994,16 +3983,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... 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'.
+    # In both cases, we have to default to `cp -p'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
+      as_ln_s='cp -p'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -pR'
+    as_ln_s='cp -p'
   fi
 else
-  as_ln_s='cp -pR'
+  as_ln_s='cp -p'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -4063,16 +4052,28 @@ else
   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
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # 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'"
@@ -4094,7 +4095,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # 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
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4147,10 +4148,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ
 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,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -4228,7 +4229,7 @@ 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
+  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'
@@ -4258,6 +4259,7 @@ for ac_config_target in $ac_config_targe
 do
   case $ac_config_target in
     "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
+    "include/vmkit/config.h") CONFIG_FILES="$CONFIG_FILES include/vmkit/config.h" ;;
     "include/j3/j3config.h") CONFIG_FILES="$CONFIG_FILES include/j3/j3config.h" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

Modified: vmkit/branches/mcjit/include/j3/j3config.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3config.h.in?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3config.h.in (original)
+++ vmkit/branches/mcjit/include/j3/j3config.h.in Sat Dec 21 11:13:08 2013
@@ -1,6 +1,7 @@
 
-#define SHLIBEXT      "@SHLIBEXT@"
-#define OPENJDK_HOME  "@jdkhome@"
+#define SELF_LIBJVM   "@abs_top_builddir@/@BUILD_NAME@/lib/libjvm at SHLIBEXT@"
+#define SELF_BITCODE  "@abs_top_builddir@/@BUILD_NAME@/lib/libjvm.bc"
+#define OPENJDK_HOME  "@jdkhome@/"
 
 
 

Modified: vmkit/branches/mcjit/include/j3/j3lib.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3lib.h?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3lib.h (original)
+++ vmkit/branches/mcjit/include/j3/j3lib.h Sat Dec 21 11:13:08 2013
@@ -9,7 +9,7 @@ namespace j3 {
 
 	class J3Lib {
 	public:
-		static const char** systemClassesArchives();
+		static const char*  systemClassesArchives();
 		static int          loadSystemLibraries(std::vector<void*, vmkit::StdAllocator<void*> >* handles);
 	};
 }

Propchange: vmkit/branches/mcjit/include/vmkit/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec 21 11:13:08 2013
@@ -0,0 +1 @@
+config.h

Added: vmkit/branches/mcjit/include/vmkit/config.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/config.h.in?rev=197865&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/config.h.in (added)
+++ vmkit/branches/mcjit/include/vmkit/config.h.in Sat Dec 21 11:13:08 2013
@@ -0,0 +1,3 @@
+
+
+#define SHLIBEXT      "@SHLIBEXT@"
\ No newline at end of file

Added: vmkit/branches/mcjit/include/vmkit/system.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/system.h?rev=197865&view=auto
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/system.h (added)
+++ vmkit/branches/mcjit/include/vmkit/system.h Sat Dec 21 11:13:08 2013
@@ -0,0 +1,51 @@
+#ifndef _SYSTEM_H_
+#define _SYSTEM_H_
+
+#include <string>
+
+#if defined(__linux__) || defined(__FreeBSD__)
+#define LINUX_OS 1
+#elif defined(__APPLE__)
+#define MACOS_OS 1
+#else
+#error OS detection failed.
+#endif
+
+#include <cxxabi.h>
+
+#if defined(MACOS_OS)
+#define SELF_HANDLE RTLD_SELF
+#elif defined(LINUX_OS)
+#define SELF_HANDLE 0
+#else
+#error Please define constants for your OS.
+#endif
+
+namespace vmkit {
+	class System {
+	public:
+		static const char* mcjitSymbol(const std::string &Name) {
+#if defined(MACOS_OS)
+			return Name.c_str() + 1;
+#elif defined(LINUX_OS)
+			return Name.c_str();
+#else
+#error "what is the correct symbol for your os?"
+#endif
+		}
+
+		static void** current_fp() __attribute__((always_inline)) {
+			return (void**)__builtin_frame_address(0);
+		}
+
+		static void** fp_to_next_fp(void** fp) {
+			return (void**)fp[0];
+		}
+
+		static void* fp_to_ip(void**fp) {
+			return fp[1];
+		}
+	};
+}
+
+#endif

Modified: vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc (original)
+++ vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc Sat Dec 21 11:13:08 2013
@@ -1,3 +1,5 @@
+#include "vmkit/config.h"
+#include "vmkit/system.h"
 #include "j3/j3object.h"
 #include "j3/j3lib.h"
 #include "j3/j3config.h"
@@ -14,19 +16,17 @@ using namespace j3;
 #define enterJVM()
 #define leaveJVM()
 
-#define NYI() { fprintf(stderr, "++ not yet implemented: %s ++\n", __PRETTY_FUNCTION__); abort(); }
+#define NYI() { J3Thread::get()->vm()->internalError(L"not yet implemented: '%s'", __PRETTY_FUNCTION__); }
 
-#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
-};
+#ifdef LINUX_OS
+#define OPENJDK_LIBPATH OPENJDK_HOME"jre/lib/amd64"
+#else
+#define OPENJDK_LIBPATH OPENJDK_HOME"jre/lib"
+#endif
 
-const char** J3Lib::systemClassesArchives() {
+static const char* rtjar = OPENJDK_HOME"jre/lib/rt.jar";
+
+const char* J3Lib::systemClassesArchives() {
 	return rtjar;
 }
 

Modified: vmkit/branches/mcjit/lib/j3/vm/j3.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3.cc Sat Dec 21 11:13:08 2013
@@ -178,10 +178,11 @@ void J3::linkageError(J3Method* method)
 void J3::vinternalError(const wchar_t* msg, va_list va) {
 	vmkit::Safepoint* sf = 0;
 	vmkit::StackWalker walker;
+	wchar_t buf[65536];
 
-	fprintf(stderr, "Internal error: ");
-	vfwprintf(stderr, msg, va);
-	fprintf(stderr, "\n");
+	vswprintf(buf, 65536, msg, va);
+
+	fprintf(stderr, "Internal error: %ls\n", buf);
 
 	while(walker.next()) {
 		vmkit::Safepoint* sf = getSafepoint(walker.ip());

Modified: vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3classloader.cc Sat Dec 21 11:13:08 2013
@@ -210,8 +210,8 @@ bool J3ClassLoader::J3MethodLess::operat
 
 J3InitialClassLoader::J3InitialClassLoader(J3* v, const char* rtjar, vmkit::BumpAllocator* _alloc) 
 	: J3ClassLoader(v, 0, _alloc) {
-	const char** archives = J3Lib::systemClassesArchives();
-	J3ClassBytes* bytes = J3Reader::openFile(allocator(), archives[0]);
+	const char* archives = vm()->options()->rtJar;
+	J3ClassBytes* bytes = J3Reader::openFile(allocator(), archives);
 
 	//makeLLVMFunctions_j3();
 

Modified: vmkit/branches/mcjit/lib/j3/vm/j3options.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3options.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3options.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3options.cc Sat Dec 21 11:13:08 2013
@@ -1,4 +1,6 @@
 #include "j3/j3options.h"
+#include "j3/j3config.h"
+#include "j3/j3lib.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -8,12 +10,12 @@ 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";
+	selfBitCodePath = SELF_BITCODE;
+	rtJar = J3Lib::systemClassesArchives();
 
 	debugEnterIndent = 1;
 
-	debugExecute = 0;
+	debugExecute = 2;
 	debugLoad = 0;
 	debugResolve = 0;
 	debugIniting = 0;

Modified: vmkit/branches/mcjit/lib/j3/vm/j3zip.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3zip.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3zip.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3zip.cc Sat Dec 21 11:13:08 2013
@@ -5,6 +5,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <zlib.h>
+#include <string.h>
 
 #include "j3/j3reader.h"
 #include "j3/j3zip.h"

Modified: vmkit/branches/mcjit/lib/vmkit/compiler.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/compiler.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/compiler.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/compiler.cc Sat Dec 21 11:13:08 2013
@@ -1,5 +1,6 @@
 #include <dlfcn.h>
 
+#include "vmkit/system.h"
 #include "vmkit/compiler.h"
 #include "vmkit/thread.h"
 #include "vmkit/vmkit.h"
@@ -9,6 +10,8 @@
 #include "llvm/PassManager.h"
 
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/MCJIT.h"
+#include "llvm/ExecutionEngine/JIT.h"
 
 #include "llvm/IR/Module.h"
 
@@ -114,7 +117,7 @@ Symbol* CompilationUnit::getSymbol(const
 	vmkit::Symbol* res;
 
 	if(it == _symbolTable.end()) {
-		uint8_t* addr = (uint8_t*)dlsym(RTLD_SELF, id);
+		uint8_t* addr = (uint8_t*)dlsym(SELF_HANDLE, id);
 		if(!addr)
 			Thread::get()->vm()->internalError(L"unable to resolve native symbol: %s", id);
 		res = new(allocator()) vmkit::NativeSymbol(addr);
@@ -130,7 +133,7 @@ Symbol* CompilationUnit::getSymbol(const
 }
 
 uint64_t CompilationUnit::getSymbolAddress(const std::string &Name) {
-	return (uint64_t)(uintptr_t)getSymbol(Name.c_str() + 1)->getSymbolAddress();
+	return (uint64_t)(uintptr_t)getSymbol(System::mcjitSymbol(Name))->getSymbolAddress();
 }
 
 void CompilationUnit::compileModule(llvm::Module* module) {

Modified: vmkit/branches/mcjit/lib/vmkit/names.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/names.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/names.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/names.cc Sat Dec 21 11:13:08 2013
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <wchar.h>
 
 #include "vmkit/names.h"
 

Modified: vmkit/branches/mcjit/lib/vmkit/safpoint.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/safpoint.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/safpoint.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/safpoint.cc Sat Dec 21 11:13:08 2013
@@ -1,5 +1,6 @@
 #include "vmkit/safepoint.h"
 #include "vmkit/compiler.h"
+#include "vmkit/system.h"
 
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Constants.h"
@@ -184,10 +185,11 @@ Safepoint* Safepoint::getNext() {
 }
 
 Safepoint* Safepoint::get(CompilationUnit* unit, llvm::Module* module) {
-	llvm::SmallString<256> symName;
+	std::string symName;
+	symName += '_';
 	symName += module->getModuleIdentifier();
 	symName += "__frametable";
-	return (vmkit::Safepoint*)unit->ee()->getGlobalValueAddress(symName.c_str());
+	return (vmkit::Safepoint*)unit->ee()->getGlobalValueAddress(System::mcjitSymbol(symName));
 }
 
 void Safepoint::dump() {

Modified: vmkit/branches/mcjit/lib/vmkit/thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/thread.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/thread.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/thread.cc Sat Dec 21 11:13:08 2013
@@ -1,4 +1,5 @@
 #include "vmkit/thread.h"
+#include "vmkit/system.h"
 
 using namespace vmkit;
 
@@ -14,14 +15,14 @@ void Thread::destroy(Thread* thread) {
 }
 
 StackWalker::StackWalker(uint32_t initialPop) {
-	framePointer = (void**)__builtin_frame_address(1);
-	next(initialPop);
+	framePointer = System::current_fp();
+	next(initialPop+1);
 }
 
 bool StackWalker::next(uint32_t nbPop) {
 	while(nbPop--) {
-		void** next = (void**)framePointer[0];
-		if(!next || !next[0])
+		void** next = (void**)System::fp_to_next_fp(framePointer);
+		if(!next || !System::fp_to_next_fp(next))
 			return 0;
 		framePointer = next;
 	}
@@ -29,5 +30,5 @@ bool StackWalker::next(uint32_t nbPop) {
 }
 	
 void* StackWalker::ip() {
-	return framePointer[1];
+	return System::fp_to_ip(framePointer);
 }

Modified: vmkit/branches/mcjit/lib/vmkit/util.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/util.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/util.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/util.cc Sat Dec 21 11:13:08 2013
@@ -1,5 +1,6 @@
 #include "vmkit/util.h"
 
+#include <stdio.h>
 #include <string.h>
 #include <wchar.h>
 

Modified: vmkit/branches/mcjit/lib/vmkit/vmkit.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/vmkit.cc?rev=197865&r1=197864&r2=197865&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/vmkit.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/vmkit.cc Sat Dec 21 11:13:08 2013
@@ -3,8 +3,8 @@
 #include <wchar.h>
 #include <stdlib.h>
 #include <dlfcn.h>
-#include <cxxabi.h>
 
+#include "vmkit/system.h"
 #include "vmkit/vmkit.h"
 #include "vmkit/thread.h"
 #include "vmkit/safepoint.h"
@@ -105,11 +105,11 @@ void VMKit::vmkitBootstrap(Thread* initi
 	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);
+		VMKit::internalError(L"Error while opening bitcode file %s", 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());
+		VMKit::internalError(L"Error while reading bitcode file %s: %s", selfBitCodePath, err.c_str());
 
 	for(llvm::Module::iterator cur=self()->begin(); cur!=self()->end(); cur++)
 		addSymbol(cur);
@@ -120,7 +120,7 @@ void VMKit::vmkitBootstrap(Thread* initi
 	_dataLayout = new llvm::DataLayout(self());
 
 	llvm::GlobalValue* typeInfoGV = mangleMap["typeinfo for void*"];
-	ptrTypeInfo = typeInfoGV ? dlsym(RTLD_SELF, typeInfoGV->getName().data()) : 0;
+	ptrTypeInfo = typeInfoGV ? dlsym(SELF_HANDLE, typeInfoGV->getName().data()) : 0;
 
 	if(!ptrTypeInfo)
 		internalError(L"unable to find typeinfo for void*"); 
@@ -164,9 +164,12 @@ void VMKit::internalError(const wchar_t*
 }
 
 void VMKit::throwException(void* obj) {
+#if 0
 	void** exception = (void**)abi::__cxa_allocate_exception(sizeof(void*));
 	*exception = obj;
 	abi::__cxa_throw(exception, (std::type_info*)Thread::get()->vm()->ptrTypeInfo, 0);
+#endif
+	fprintf(stderr, " throw exception...\n");
 	abort();
 }
 





More information about the vmkit-commits mailing list