dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] libjit ChangeLog configure.in include/jit/Makef...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ChangeLog configure.in include/jit/Makef...
Date: Sun, 13 Apr 2008 16:14:16 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Aleksey Demakov <avd>   08/04/13 16:14:16

Modified files:
        .              : ChangeLog configure.in 
        include/jit    : Makefile.am jit-walk.h 
Added files:
        include/jit    : jit-arch-x86-64.h 

Log message:
        use architecture-specific macros for x86-64 stack walking instead of 
gcc's builtins

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.359&r2=1.360
http://cvs.savannah.gnu.org/viewcvs/libjit/configure.in?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/libjit/include/jit/Makefile.am?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libjit/include/jit/jit-walk.h?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/libjit/include/jit/jit-arch-x86-64.h?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.359
retrieving revision 1.360
diff -u -b -r1.359 -r1.360
--- ChangeLog   31 Mar 2008 19:31:41 -0000      1.359
+++ ChangeLog   13 Apr 2008 16:14:15 -0000      1.360
@@ -1,3 +1,15 @@
+2008-04-13  Klaus Treichel  <address@hidden>
+
+       * include/jit/Makefile.am:
+       * include/jit/jit-arch-x86-64.h: new file with x86-64 architecture
+       specific macros for stack frame inspection.
+
+       * configure.in: check for x86-64 arch, add -fno-omit-frame-pointer
+       flag.
+
+       * include/jit/jit-walk.h: use _JIT_ARCH_GET_RETURN_ADDRESS and
+       _JIT_ARCH_GET_CURRENT_RETURN if available.
+
 2008-03-31  Klaus Treichel  <address@hidden>
 
        * jit/jit-rules-x86.ins: Fix the sign opcode for integers and the

Index: configure.in
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/configure.in,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- configure.in        16 Dec 2007 11:46:53 -0000      1.28
+++ configure.in        13 Apr 2008 16:14:15 -0000      1.29
@@ -19,6 +19,9 @@
        i[[3456789]]86-*-*)
                JIT_ARCH=x86
                ;;
+       x86_64-*-*)
+               JIT_ARCH=x86-64
+               ;;
        *)
                JIT_ARCH=generic
                ;;
@@ -333,6 +336,13 @@
        *)      ;;
 esac
 
+dnl Add "-fno-omit-frame-pointer" to the CFLAGS because current gcc versions
+dnl have no frame pointers by default on some archs.
+if test x$GCC = xyes ; then
+       CFLAGS="$CFLAGS -fno-omit-frame-pointer"
+       CXXFLAGS="$CXXFLAGS -fno-omit-frame-pointer"
+fi
+
 dnl Find the option to use to turn on C++ exception handling.
 AC_CACHE_CHECK(for C++ exception handling option, ac_cv_prog_cxx_exceptions,
 [echo 'int main(int argc, char **argv){try { throw 1; } catch(int i) { return 
i; } return 0;}' > conftest.c

Index: include/jit/Makefile.am
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/include/jit/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- include/jit/Makefile.am     3 Mar 2007 18:00:10 -0000       1.6
+++ include/jit/Makefile.am     13 Apr 2008 16:14:15 -0000      1.7
@@ -29,7 +29,7 @@
                                                jit-value.h \
                                                jit-walk.h
 
-noinst_HEADERS = jit-arch-generic.h jit-arch-x86.h
+noinst_HEADERS = jit-arch-generic.h jit-arch-x86.h jit-arch-x86-64.h
 
 DISTCLEANFILES = jit-arch.h jit-defs.h
 

Index: include/jit/jit-walk.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/include/jit/jit-walk.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- include/jit/jit-walk.h      24 Jan 2008 20:12:50 -0000      1.3
+++ include/jit/jit-walk.h      13 Apr 2008 16:14:15 -0000      1.4
@@ -71,6 +71,14 @@
  * Get the return address for a specific frame.
  */
 void *_jit_get_return_address(void *frame, void *frame0, void *return0);
+#if defined(_JIT_ARCH_GET_RETURN_ADDRESS)
+#define jit_get_return_address(frame)                          \
+       ({                                                      \
+               void *address;                                  \
+               _JIT_ARCH_GET_RETURN_ADDRESS(address, (frame)); \
+               address;                                        \
+       })
+#else
 #if defined(__GNUC__)
 #define        jit_get_return_address(frame)   \
                (_jit_get_return_address        \
@@ -79,17 +87,27 @@
 #define        jit_get_return_address(frame)   \
                (_jit_get_return_address((frame), 0, 0))
 #endif
+#endif
 
 /*
  * Get the return address for the current frame.  May be more efficient
  * than using "jit_get_return_address(0)".
  */
+#if defined(_JIT_ARCH_GET_CURRENT_RETURN)
+#define        jit_get_current_return()                        \
+       ({                                              \
+               void *address;                          \
+               _JIT_ARCH_GET_CURRENT_RETURN(address);  \
+               address;                                \
+       })
+#else
 #if defined(__GNUC__)
 #define        jit_get_current_return()        (__builtin_return_address(0))
 #else
 #define        jit_get_current_return()        \
                        (jit_get_return_address(jit_get_current_frame()))
 #endif
+#endif
 
 /*
  * Declare a stack crawl mark variable.  The address of this variable

Index: include/jit/jit-arch-x86-64.h
===================================================================
RCS file: include/jit/jit-arch-x86-64.h
diff -N include/jit/jit-arch-x86-64.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ include/jit/jit-arch-x86-64.h       13 Apr 2008 16:14:15 -0000      1.1
@@ -0,0 +1,81 @@
+/*
+ * jit-arch-x86.h - Architecture-specific definitions.
+ *
+ * Copyright (C) 2008  Southern Storm Software, Pty Ltd.
+ *
+ * The libjit library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * The libjit library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the libjit library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef        _JIT_ARCH_X86_64_H
+#define        _JIT_ARCH_X86_64_H
+
+/*
+ * The frame header structure for X86_64
+ */
+typedef struct _jit_arch_frame _jit_arch_frame_t;
+struct _jit_arch_frame
+{
+       _jit_arch_frame_t *next_frame;
+       void *return_address;
+};
+
+/*
+ * If defined _JIT_ARCH_GET_CURRENT_FRAME() macro assigns the current frame
+ * pointer to the supplied argument that has to be a void pointer.
+ */
+#if defined(__GNUC__)
+#define _JIT_ARCH_GET_CURRENT_FRAME(f)         \
+       do {                                    \
+               register void *__f asm("rbp");  \
+               f = __f;                        \
+       } while(0)
+#elif defined(_MSC_VER) && defined(_M_IX86)
+#define        _JIT_ARCH_GET_CURRENT_FRAME(f)          \
+       do {                                    \
+               __asm                           \
+               {                               \
+                       mov qword ptr f, rbp    \
+               }                               \
+       } while(0)
+#else
+#undef _JIT_ARCH_GET_CURRENT_FRAME
+#endif
+
+/*
+ * If defined _JIT_ARCH_GET_NEXT_FRAME assigns the frame address following
+ * the frame supplied as second arg to the value supplied as first argument.
+ */
+#define _JIT_ARCH_GET_NEXT_FRAME(n, f)                                         
        \
+       do {                                                                    
        \
+               (n) = (void *)((f) ? ((_jit_arch_frame_t *)(f))->next_frame : 
0);       \
+       } while(0)
+
+/*
+ * If defined _JIT_ARCH_GET_RETURN_ADDRESS assigns the return address of the 
frame
+ * supplied as second arg to the value supplied as first argument.
+ */
+#define _JIT_ARCH_GET_RETURN_ADDRESS(r, f)                                     
        \
+       do {                                                                    
        \
+               (r) = (void *)((f) ? ((_jit_arch_frame_t *)(f))->return_address 
: 0);   \
+       } while(0)
+
+#define _JIT_ARCH_GET_CURRENT_RETURN(r)                                \
+       do {                                                    \
+               void *__frame;                                  \
+               _JIT_ARCH_GET_CURRENT_FRAME(__frame);           \
+               _JIT_ARCH_GET_RETURN_ADDRESS((r), __frame);     \
+       } while(0)
+
+#endif /* _JIT_ARCH_X86_64_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]