[vmkit-commits] [vmkit] r198077 - Use libunwind to inspect the stack.

Gael Thomas gael.thomas at lip6.fr
Fri Dec 27 09:39:52 PST 2013


Author: gthomas
Date: Fri Dec 27 11:39:52 2013
New Revision: 198077

URL: http://llvm.org/viewvc/llvm-project?rev=198077&view=rev
Log:
Use libunwind to inspect the stack.

Modified:
    vmkit/branches/mcjit/Makefile.rules
    vmkit/branches/mcjit/autoconf/configure.ac
    vmkit/branches/mcjit/configure
    vmkit/branches/mcjit/include/vmkit/system.h
    vmkit/branches/mcjit/include/vmkit/thread.h
    vmkit/branches/mcjit/lib/j3/vm/j3.cc
    vmkit/branches/mcjit/lib/vmkit/thread.cc

Modified: vmkit/branches/mcjit/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.rules?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/Makefile.rules (original)
+++ vmkit/branches/mcjit/Makefile.rules Fri Dec 27 11:39:52 2013
@@ -34,8 +34,7 @@ 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 -mno-omit-leaf-frame-pointer
+		-I$(PROJ_SRC_ROOT)/include -I$(OPENJDK_HOME)/include -I$(OPENJDK_HOME)/include/$(OS) $(COMMON_FLAGS)
 
 ifeq ($(OPTIMIZED),1)
 	COMMON_FLAGS+=-O3
@@ -49,8 +48,11 @@ ifneq ($(DEBUG),0)
 	COMMON_FLAGS+=-g
 endif
 
-LLCFLAGS+=-disable-cfi -disable-fp-elim -relocation-model=pic 
-OPTFLAGS+=-disable-cfi -disable-fp-elim -disable-opt
+#LLCFLAGS+=-disable-cfi -disable-fp-elim -relocation-model=pic 
+#OPTFLAGS+=-disable-cfi -disable-fp-elim -disable-opt
+
+LLCFLAGS+=-relocation-model=pic 
+OPTFLAGS+=-disable-opt
 
 CXXFLAGS=$(LLVM_CXXFLAGS) $(COMMON_FLAGS) -std=gnu++98 -fPIC
 SHFLAGS=-lpthread -ldl -lz -lncurses -fno-common -Wl,-flat_namespace -Wl,-undefined,suppress

Modified: vmkit/branches/mcjit/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/autoconf/configure.ac?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/autoconf/configure.ac (original)
+++ vmkit/branches/mcjit/autoconf/configure.ac Fri Dec 27 11:39:52 2013
@@ -181,11 +181,7 @@ LLVM_PATH="`$LLVM_CONFIG --bindir`"
 llvm_cfg=`$LLVM_RUNTIME_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 REQUIRES_FRAME_POINTER=1'])
-fi
-
-if ! test -z "`echo $llvm_cfg | grep -- -fomit-frame-pointer`"; then
-	 		AC_MSG_ERROR([You have to compile LLVM with frame pointers, please compile it with 'make REQUIRES_EH=1 REQUIRES_FRAME_POINTER=1'])
+	 		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_RUNTIME_CONFIG --src-root`/include])

Modified: vmkit/branches/mcjit/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/configure?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/configure (original)
+++ vmkit/branches/mcjit/configure Fri Dec 27 11:39:52 2013
@@ -1,13 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for vmkit 0.1.
+# Generated by GNU Autoconf 2.69 for vmkit 0.1.
 #
 # Report bugs to <gael.thomas at lip6.fr>.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -138,6 +136,31 @@ 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
@@ -171,7 +194,8 @@ 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\$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'\" &&
@@ -215,21 +239,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # 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+"$@"}
+  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 :
@@ -332,6 +360,14 @@ $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
@@ -453,6 +489,10 @@ 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).
@@ -487,16 +527,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 -p'.
+    # 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 -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -508,28 +548,8 @@ else
   as_mkdir_p=false
 fi
 
-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
+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'"
@@ -1126,8 +1146,6 @@ 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
@@ -1381,9 +1399,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.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+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.
 
@@ -1475,7 +1493,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.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2123,11 +2141,7 @@ LLVM_PATH="`$LLVM_CONFIG --bindir`"
 llvm_cfg=`$LLVM_RUNTIME_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 REQUIRES_FRAME_POINTER=1'" "$LINENO" 5
-fi
-
-if ! test -z "`echo $llvm_cfg | grep -- -fomit-frame-pointer`"; then
-	 		as_fn_error $? "You have to compile LLVM with frame pointers, please compile it with 'make REQUIRES_EH=1 REQUIRES_FRAME_POINTER=1'" "$LINENO" 5
+	 		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_RUNTIME_CONFIG --src-root`/include
@@ -2192,7 +2206,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2232,7 +2246,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2285,7 +2299,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2326,7 +2340,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2384,7 +2398,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2428,7 +2442,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -2874,8 +2888,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.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);
@@ -3134,7 +3147,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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	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.
@@ -3214,7 +3227,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3262,7 +3275,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3310,7 +3323,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3358,7 +3371,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3406,7 +3419,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3454,7 +3467,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3502,7 +3515,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  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
@@ -3987,16 +4000,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 -p'.
+    # 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 -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -4056,28 +4069,16 @@ else
   as_mkdir_p=false
 fi
 
-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
+
+# 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'"
@@ -4099,7 +4100,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.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4152,10 +4153,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.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+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."
 
@@ -4233,7 +4234,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'

Modified: vmkit/branches/mcjit/include/vmkit/system.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/system.h?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/system.h (original)
+++ vmkit/branches/mcjit/include/vmkit/system.h Fri Dec 27 11:39:52 2013
@@ -33,18 +33,6 @@ namespace vmkit {
 #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];
-		}
 	};
 }
 

Modified: vmkit/branches/mcjit/include/vmkit/thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/thread.h?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/thread.h (original)
+++ vmkit/branches/mcjit/include/vmkit/thread.h Fri Dec 27 11:39:52 2013
@@ -1,6 +1,9 @@
 #ifndef _THREAD_H_
 #define _THREAD_H_
 
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
 #include "vmkit/allocator.h"
 
 namespace vmkit {
@@ -11,7 +14,6 @@ namespace vmkit {
 
 		BumpAllocator*       _allocator;
 		VMKit*               _vm;
-		void*                _baseFramePointer;
 		entryPoint_t         _entryPoint;
 
 		static void* doRun(void* thread);
@@ -22,9 +24,6 @@ namespace vmkit {
 	public:
 		static void destroy(Thread* thread);
 
-		void  setBaseFramePointer(void* fp) { _baseFramePointer = fp; }
-		void* baseFramePointer() { return _baseFramePointer; }
-
 		VMKit* vm() { return _vm; }
 		BumpAllocator* allocator() { return _allocator; }
 
@@ -37,14 +36,15 @@ namespace vmkit {
 	};
 
 	class StackWalker {
-		void** framePointer;
+		unw_cursor_t  cursor; 
+		unw_context_t uc;
 
 	public:
 		StackWalker(uint32_t initialPop=0) __attribute__((noinline));
 
 		bool  next(uint32_t nbPop=1);
 		void* ip();
-		void* fp() { return framePointer; }
+		void* sp();
 	};
 }
 

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=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3.cc Fri Dec 27 11:39:52 2013
@@ -66,8 +66,6 @@ void J3::start(int argc, char** argv) {
 
 	J3Thread* thread = J3Thread::create(this);
 
-	thread->setBaseFramePointer(vmkit::System::current_fp()); 
-
 	vmkitBootstrap(thread, options()->selfBitCodePath);
 
 	introspect();

Modified: vmkit/branches/mcjit/lib/vmkit/thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/thread.cc?rev=198077&r1=198076&r2=198077&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/thread.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/thread.cc Fri Dec 27 11:39:52 2013
@@ -1,5 +1,6 @@
 #include "vmkit/thread.h"
 #include "vmkit/system.h"
+#include "vmkit/vmkit.h"
 
 using namespace vmkit;
 
@@ -8,7 +9,6 @@ __thread Thread* Thread::_thread = 0;
 Thread::Thread(VMKit* vm, BumpAllocator* allocator) { 
 	_allocator = allocator;
 	_vm = vm; 
-	_baseFramePointer = 0;
 }
 
 void Thread::destroy(Thread* thread) {
@@ -29,19 +29,27 @@ void Thread::start(entryPoint_t entryPoi
 }
 
 StackWalker::StackWalker(uint32_t initialPop) {
-	framePointer = System::current_fp();
+	unw_getcontext(&uc);
+  unw_init_local(&cursor, &uc);
 	next(initialPop+1);
 }
 
 bool StackWalker::next(uint32_t nbPop) {
 	while(nbPop--) {
-		if(framePointer == Thread::get()->baseFramePointer())
+		if(unw_step(&cursor) <= 0)
 			return 0;
-		framePointer = (void**)System::fp_to_next_fp(framePointer);
 	}
-	return framePointer != Thread::get()->baseFramePointer();
+	return 1;
 }
 	
 void* StackWalker::ip() {
-	return System::fp_to_ip(framePointer);
+	unw_word_t ip;
+	unw_get_reg(&cursor, UNW_REG_IP, &ip);
+	return (void*)ip;
+}
+
+void* StackWalker::sp() {
+	unw_word_t sp;
+	unw_get_reg(&cursor, UNW_REG_SP, &sp);
+	return (void*)sp;
 }





More information about the vmkit-commits mailing list