|
|
385abae |
Description: <short summary of the patch>
|
|
|
385abae |
TODO: Put a short summary on the line above and replace this paragraph
|
|
|
385abae |
with a longer explanation of this change. Complete the meta-information
|
|
|
385abae |
with other relevant fields (see below for details). To make it easier, the
|
|
|
385abae |
information below has been extracted from the changelog. Adjust it or drop
|
|
|
385abae |
it.
|
|
|
385abae |
.
|
|
|
385abae |
gcl (2.6.12-59) unstable; urgency=medium
|
|
|
385abae |
.
|
|
|
385abae |
* list_order.16
|
|
|
385abae |
Author: Camm Maguire <camm@debian.org>
|
|
|
385abae |
|
|
|
385abae |
---
|
|
|
385abae |
The information above should follow the Patch Tagging Guidelines, please
|
|
|
385abae |
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
|
|
|
385abae |
are templates for supplementary fields that you might want to add:
|
|
|
385abae |
|
|
|
385abae |
Origin: <vendor|upstream|other>, <url of original patch>
|
|
|
385abae |
Bug: <url in upstream bugtracker>
|
|
|
385abae |
Bug-Debian: https://bugs.debian.org/<bugnumber>
|
|
|
385abae |
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
|
|
|
385abae |
Forwarded: <no|not-needed|url proving that it has been forwarded>
|
|
|
385abae |
Reviewed-By: <name and email of someone who approved the patch>
|
|
|
385abae |
Last-Update: 2018-01-23
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/cmpnew/gcl_cmpmain.lsp
|
|
|
385abae |
+++ gcl-2.6.12/cmpnew/gcl_cmpmain.lsp
|
|
|
385abae |
@@ -98,7 +98,9 @@
|
|
|
385abae |
(defvar *default-c-file* nil)
|
|
|
385abae |
(defvar *default-h-file* nil)
|
|
|
385abae |
(defvar *default-data-file* nil)
|
|
|
385abae |
+(defvar *default-prof-p* nil)
|
|
|
385abae |
(defvar *keep-gaz* nil)
|
|
|
385abae |
+(defvar *prof-p* nil)
|
|
|
385abae |
|
|
|
385abae |
;; (list section-length split-file-names next-section-start-file-position)
|
|
|
385abae |
;; Many c compilers cannot handle the large C files resulting from large lisp files.
|
|
|
385abae |
@@ -167,10 +169,12 @@
|
|
|
385abae |
(data-file *default-data-file*)
|
|
|
385abae |
(c-debug nil)
|
|
|
385abae |
(system-p *default-system-p*)
|
|
|
385abae |
+ (prof-p *default-prof-p*)
|
|
|
385abae |
(print nil)
|
|
|
385abae |
(load nil)
|
|
|
385abae |
&aux (*standard-output* *standard-output*)
|
|
|
385abae |
- (*error-output* *error-output*)
|
|
|
385abae |
+ (*prof-p* prof-p)
|
|
|
385abae |
+ (*error-output* *error-output*)
|
|
|
385abae |
(*compiler-in-use* *compiler-in-use*)
|
|
|
385abae |
(*c-debug* c-debug)
|
|
|
385abae |
(*compile-print* (or print *compile-print*))
|
|
|
385abae |
@@ -488,8 +492,9 @@ Cannot compile ~a.~%"
|
|
|
385abae |
(t (setq dir ".")))
|
|
|
385abae |
(setq na (namestring
|
|
|
385abae |
(make-pathname :name name :type (pathname-type(first args)))))
|
|
|
385abae |
- (format nil "~a -I~a ~a ~a -c ~a -o ~a ~a"
|
|
|
385abae |
+ (format nil "~a ~a -I~a ~a ~a -c ~a -o ~a ~a"
|
|
|
385abae |
*cc*
|
|
|
385abae |
+ (if *prof-p* " -pg " "")
|
|
|
385abae |
(concatenate 'string si::*system-directory* "../h")
|
|
|
385abae |
(if (and (boundp '*c-debug*) *c-debug*) " -g " "")
|
|
|
385abae |
(case *speed*
|
|
|
385abae |
--- gcl-2.6.12.orig/cmpnew/gcl_cmpwt.lsp
|
|
|
385abae |
+++ gcl-2.6.12/cmpnew/gcl_cmpwt.lsp
|
|
|
385abae |
@@ -124,6 +124,7 @@
|
|
|
385abae |
x))
|
|
|
385abae |
|
|
|
385abae |
(defun wt-data-file ()
|
|
|
385abae |
+ (when *prof-p* (add-init `(si::mark-memory-as-profiling)))
|
|
|
385abae |
(verify-data-vector (data-vector))
|
|
|
385abae |
(let* ((vec (coerce (nreverse (data-inits)) 'vector)))
|
|
|
385abae |
(verify-data-vector vec)
|
|
|
385abae |
--- gcl-2.6.12.orig/configure
|
|
|
385abae |
+++ gcl-2.6.12/configure
|
|
|
385abae |
@@ -4131,30 +4131,11 @@ $as_echo "disabled" >&6; }
|
|
|
385abae |
else
|
|
|
385abae |
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
|
|
|
385abae |
$as_echo "ok" >&6; }
|
|
|
385abae |
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text start" >&5
|
|
|
385abae |
-$as_echo_n "checking for text start... " >&6; }
|
|
|
385abae |
- echo 'int main () {return(0);}' >foo.c
|
|
|
385abae |
- $CC foo.c -o foo
|
|
|
385abae |
- GCL_GPROF_START=`nm foo | $AWK '/ *[TD] *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
|
|
|
385abae |
- rm -f foo.c foo
|
|
|
385abae |
- if test "$GCL_GPROF_START" != "" ; then
|
|
|
385abae |
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCL_GPROF_START" >&5
|
|
|
385abae |
-$as_echo "$GCL_GPROF_START" >&6; }
|
|
|
385abae |
-
|
|
|
385abae |
-cat >>confdefs.h <<_ACEOF
|
|
|
385abae |
-#define GCL_GPROF_START $GCL_GPROF_START
|
|
|
385abae |
-_ACEOF
|
|
|
385abae |
-
|
|
|
385abae |
- assert_arg_to_cflags -pg
|
|
|
385abae |
- case $use in
|
|
|
385abae |
- s390*) ;; # relocation truncation bug in gcc
|
|
|
385abae |
- *) TLIBS="$TLIBS -pg";;
|
|
|
385abae |
- esac
|
|
|
385abae |
- TFPFLAG=""
|
|
|
385abae |
+ assert_arg_to_cflags -pg
|
|
|
385abae |
+ TFPFLAG=""
|
|
|
385abae |
|
|
|
385abae |
$as_echo "#define GCL_GPROF 1" >>confdefs.h
|
|
|
385abae |
|
|
|
385abae |
- fi
|
|
|
385abae |
fi
|
|
|
385abae |
fi
|
|
|
385abae |
fi
|
|
|
385abae |
--- gcl-2.6.12.orig/configure.in
|
|
|
385abae |
+++ gcl-2.6.12/configure.in
|
|
|
385abae |
@@ -342,22 +342,25 @@ AC_ARG_ENABLE([gprof],[ --enable-gprof
|
|
|
385abae |
AC_MSG_RESULT([disabled])
|
|
|
385abae |
else
|
|
|
385abae |
AC_MSG_RESULT([ok])
|
|
|
385abae |
- AC_MSG_CHECKING([for text start])
|
|
|
385abae |
- echo 'int main () {return(0);}' >foo.c
|
|
|
385abae |
- $CC foo.c -o foo
|
|
|
385abae |
- GCL_GPROF_START=`nm foo | $AWK '/ *[[TD]] *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
|
|
|
385abae |
- rm -f foo.c foo
|
|
|
385abae |
- if test "$GCL_GPROF_START" != "" ; then
|
|
|
385abae |
- AC_MSG_RESULT($GCL_GPROF_START)
|
|
|
385abae |
- AC_DEFINE_UNQUOTED(GCL_GPROF_START,$GCL_GPROF_START,[starting address for gprof])
|
|
|
385abae |
- assert_arg_to_cflags -pg
|
|
|
385abae |
- case $use in
|
|
|
385abae |
- s390*) ;; # relocation truncation bug in gcc
|
|
|
385abae |
- *) TLIBS="$TLIBS -pg";;
|
|
|
385abae |
- esac
|
|
|
385abae |
- TFPFLAG=""
|
|
|
385abae |
- AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
|
|
|
385abae |
- fi
|
|
|
385abae |
+ assert_arg_to_cflags -pg
|
|
|
385abae |
+ TFPFLAG=""
|
|
|
385abae |
+ AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
|
|
|
385abae |
+dnl AC_MSG_CHECKING([for text start])
|
|
|
385abae |
+dnl echo 'int main () {return(0);}' >foo.c
|
|
|
385abae |
+dnl $CC foo.c -o foo
|
|
|
385abae |
+dnl GCL_GPROF_START=`nm foo | $AWK '/ *[[TD]] *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
|
|
|
385abae |
+dnl rm -f foo.c foo
|
|
|
385abae |
+dnl if test "$GCL_GPROF_START" != "" ; then
|
|
|
385abae |
+dnl AC_MSG_RESULT($GCL_GPROF_START)
|
|
|
385abae |
+dnl AC_DEFINE_UNQUOTED(GCL_GPROF_START,$GCL_GPROF_START,[starting address for gprof])
|
|
|
385abae |
+dnl assert_arg_to_cflags -pg
|
|
|
385abae |
+dnl # case $use in
|
|
|
385abae |
+dnl # s390*) ;; # relocation truncation bug in gcc
|
|
|
385abae |
+dnl # *) TLIBS="$TLIBS -pg";;
|
|
|
385abae |
+dnl # esac
|
|
|
385abae |
+dnl TFPFLAG=""
|
|
|
385abae |
+dnl AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
|
|
|
385abae |
+dnl fi
|
|
|
385abae |
fi
|
|
|
385abae |
fi])
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/h/gclincl.h.in
|
|
|
385abae |
+++ gcl-2.6.12/h/gclincl.h.in
|
|
|
385abae |
@@ -53,9 +53,6 @@
|
|
|
385abae |
/* use gprof profiling */
|
|
|
385abae |
#undef GCL_GPROF
|
|
|
385abae |
|
|
|
385abae |
-/* starting address for gprof */
|
|
|
385abae |
-#undef GCL_GPROF_START
|
|
|
385abae |
-
|
|
|
385abae |
/* No gettimeofday call -- fixme */
|
|
|
385abae |
#undef GETTOD_NOT_DECLARED
|
|
|
385abae |
|
|
|
385abae |
@@ -153,6 +150,9 @@
|
|
|
385abae |
/* use libbfd */
|
|
|
385abae |
#undef HAVE_LIBBFD
|
|
|
385abae |
|
|
|
385abae |
+/* Define to 1 if you have the `dl' library (-ldl). */
|
|
|
385abae |
+#undef HAVE_LIBDL
|
|
|
385abae |
+
|
|
|
385abae |
/* Define to 1 if you have the `opcodes' library (-lopcodes). */
|
|
|
385abae |
#undef HAVE_LIBOPCODES
|
|
|
385abae |
|
|
|
385abae |
@@ -255,9 +255,6 @@
|
|
|
385abae |
/* using xgcl */
|
|
|
385abae |
#undef HAVE_XGCL
|
|
|
385abae |
|
|
|
385abae |
-/* number of pages to use for hole */
|
|
|
385abae |
-#undef HOLEPAGE
|
|
|
385abae |
-
|
|
|
385abae |
/* Host cpu */
|
|
|
385abae |
#undef HOST_CPU
|
|
|
385abae |
|
|
|
385abae |
@@ -267,9 +264,6 @@
|
|
|
385abae |
/* Host system */
|
|
|
385abae |
#undef HOST_SYSTEM
|
|
|
385abae |
|
|
|
385abae |
-/* time system constant */
|
|
|
385abae |
-#undef HZ
|
|
|
385abae |
-
|
|
|
385abae |
/* invocation history stack size */
|
|
|
385abae |
#undef IHSSIZE
|
|
|
385abae |
|
|
|
385abae |
@@ -321,7 +315,7 @@
|
|
|
385abae |
/* can use C extension for object alignment */
|
|
|
385abae |
#undef OBJ_ALIGN
|
|
|
385abae |
|
|
|
385abae |
-/* needed object alignment in bytes */
|
|
|
385abae |
+/* needed object alignment bytes */
|
|
|
385abae |
#undef OBJ_ALIGNMENT
|
|
|
385abae |
|
|
|
385abae |
/* Define to the address where bug reports for this package should be sent. */
|
|
|
385abae |
@@ -345,7 +339,7 @@
|
|
|
385abae |
/* system pagewidth */
|
|
|
385abae |
#undef PAGEWIDTH
|
|
|
385abae |
|
|
|
385abae |
-/* have sigcontext in signal.h */
|
|
|
385abae |
+/* have sigcontext of signal.h */
|
|
|
385abae |
#undef SIGNAL_H_HAS_SIGCONTEXT
|
|
|
385abae |
|
|
|
385abae |
/* sizeof linked list for contiguous pages */
|
|
|
385abae |
--- gcl-2.6.12.orig/h/lu.h
|
|
|
385abae |
+++ gcl-2.6.12/h/lu.h
|
|
|
385abae |
@@ -355,7 +355,8 @@ struct cfdata {
|
|
|
385abae |
FIRSTWORD;
|
|
|
385abae |
char *cfd_start;
|
|
|
385abae |
int cfd_size;
|
|
|
385abae |
- int cfd_fillp;
|
|
|
385abae |
+ int cfd_fillp:31;
|
|
|
385abae |
+ int cfd_prof:1;
|
|
|
385abae |
object *cfd_self;
|
|
|
385abae |
SPAD;
|
|
|
385abae |
};
|
|
|
385abae |
--- gcl-2.6.12.orig/h/protoize.h
|
|
|
385abae |
+++ gcl-2.6.12/h/protoize.h
|
|
|
385abae |
@@ -1788,10 +1788,8 @@ int sigprocmask ( int how, const sigset_
|
|
|
385abae |
void recreate_heap1 ( void );
|
|
|
385abae |
#endif
|
|
|
385abae |
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
void
|
|
|
385abae |
gprof_cleanup(void);
|
|
|
385abae |
-#endif
|
|
|
385abae |
|
|
|
385abae |
int
|
|
|
385abae |
msystem(const char *);
|
|
|
385abae |
@@ -1970,3 +1968,6 @@ seek_to_end_ofile(FILE *);
|
|
|
385abae |
|
|
|
385abae |
void
|
|
|
385abae |
travel_find_sharing(object,object);
|
|
|
385abae |
+
|
|
|
385abae |
+object
|
|
|
385abae |
+new_cfdata(void);
|
|
|
385abae |
--- gcl-2.6.12.orig/h/ptable.h
|
|
|
385abae |
+++ gcl-2.6.12/h/ptable.h
|
|
|
385abae |
@@ -38,6 +38,8 @@ typedef struct node TABL[];
|
|
|
385abae |
struct string_address_table
|
|
|
385abae |
{ struct node *ptable;
|
|
|
385abae |
unsigned int length;
|
|
|
385abae |
+ struct node *local_ptable;
|
|
|
385abae |
+ unsigned int local_length;
|
|
|
385abae |
unsigned int alloc_length;
|
|
|
385abae |
};
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/lsp/gcl_mislib.lsp
|
|
|
385abae |
+++ gcl-2.6.12/lsp/gcl_mislib.lsp
|
|
|
385abae |
@@ -165,3 +165,27 @@
|
|
|
385abae |
(push (string-concatenate s l) nl))
|
|
|
385abae |
(setq *load-path* nl))
|
|
|
385abae |
nil)
|
|
|
385abae |
+
|
|
|
385abae |
+(defun default-symtab nil (concatenate 'string *tmp-dir* "gcl_symtab"))
|
|
|
385abae |
+
|
|
|
385abae |
+(defun gprof-output (symtab gmon)
|
|
|
385abae |
+ (with-open-file
|
|
|
385abae |
+ (s (format nil "|gprof -S '~a' '~a' '~a'" symtab (kcl-self) gmon))
|
|
|
385abae |
+ (copy-stream s *standard-output*)))
|
|
|
385abae |
+
|
|
|
385abae |
+
|
|
|
385abae |
+(defun gprof-start (&optional (start 0 start-p) (end 0 end-p) (symtab (default-symtab)))
|
|
|
385abae |
+ (unless end-p
|
|
|
385abae |
+ (multiple-value-bind
|
|
|
385abae |
+ (s e)
|
|
|
385abae |
+ (gprof-addresses)
|
|
|
385abae |
+ (setq start (if start-p start s) end e)))
|
|
|
385abae |
+ (when (monstartup start end)
|
|
|
385abae |
+ (write-symtab symtab start end)))
|
|
|
385abae |
+
|
|
|
385abae |
+(defun gprof-quit (&optional (symtab (default-symtab)) &aux (gmon (mcleanup)))
|
|
|
385abae |
+ (when gmon
|
|
|
385abae |
+ (gprof-output symtab gmon)))
|
|
|
385abae |
+
|
|
|
385abae |
+
|
|
|
385abae |
+
|
|
|
385abae |
--- gcl-2.6.12.orig/o/alloc.c
|
|
|
385abae |
+++ gcl-2.6.12/o/alloc.c
|
|
|
385abae |
@@ -1177,24 +1177,6 @@ init_tm(enum type t, char *name, int els
|
|
|
385abae |
call is too fragile. 20050115 CM*/
|
|
|
385abae |
static int gcl_alloc_initialized;
|
|
|
385abae |
|
|
|
385abae |
-
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
-static unsigned long textstart,textend,textpage;
|
|
|
385abae |
-static void init_textpage() {
|
|
|
385abae |
-
|
|
|
385abae |
- extern void *GCL_GPROF_START;
|
|
|
385abae |
- unsigned long s=(unsigned long)GCL_GPROF_START;
|
|
|
385abae |
-
|
|
|
385abae |
- textstart=(unsigned long)&GCL_GPROF_START;
|
|
|
385abae |
- textend=(unsigned long)&etext;
|
|
|
385abae |
- if (s<textend && (textstart>textend || s>textstart))
|
|
|
385abae |
- textstart=s;
|
|
|
385abae |
-
|
|
|
385abae |
- textpage=2*(textend-textstart)/PAGESIZE;
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-#endif
|
|
|
385abae |
-
|
|
|
385abae |
object malloc_list=Cnil;
|
|
|
385abae |
|
|
|
385abae |
#include <signal.h>
|
|
|
385abae |
@@ -1220,10 +1202,6 @@ gcl_init_alloc(void *cs_start) {
|
|
|
385abae |
init_darwin_zone_compat ();
|
|
|
385abae |
#endif
|
|
|
385abae |
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
- init_textpage();
|
|
|
385abae |
-#endif
|
|
|
385abae |
-
|
|
|
385abae |
#if defined(BSD) && defined(RLIMIT_STACK)
|
|
|
385abae |
{
|
|
|
385abae |
struct rlimit rl;
|
|
|
385abae |
@@ -1301,11 +1279,6 @@ gcl_init_alloc(void *cs_start) {
|
|
|
385abae |
initial_sbrk=data_start=heap_end;
|
|
|
385abae |
first_data_page=page(data_start);
|
|
|
385abae |
|
|
|
385abae |
-/* #ifdef GCL_GPROF */
|
|
|
385abae |
-/* if (new_holepage
|
|
|
385abae |
-/* new_holepage=textpage; */
|
|
|
385abae |
-/* #endif */
|
|
|
385abae |
-
|
|
|
385abae |
/* Unused (at present) tm_distinct flag added. Note that if cons
|
|
|
385abae |
and fixnum share page types, errors will be introduced.
|
|
|
385abae |
|
|
|
385abae |
@@ -1348,10 +1321,6 @@ gcl_init_alloc(void *cs_start) {
|
|
|
385abae |
ncbpage = 0;
|
|
|
385abae |
tm_table[t_contiguous].tm_min_grow=256;
|
|
|
385abae |
set_tm_maxpage(tm_table+t_contiguous,1);
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
- if (maxcbpage
|
|
|
385abae |
- set_tm_maxpage(tm_table+t_contiguous,textpage);
|
|
|
385abae |
-#endif
|
|
|
385abae |
|
|
|
385abae |
set_tm_maxpage(tm_table+t_relocatable,1);
|
|
|
385abae |
nrbpage=0;
|
|
|
385abae |
@@ -1563,113 +1532,6 @@ DEFUN_NEW("GET-HOLE-SIZE",object,fSget_h
|
|
|
385abae |
RETURN1(make_fixnum((rb_start-heap_end)>>PAGEWIDTH));
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
-
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
-
|
|
|
385abae |
-static unsigned long start,end,gprof_on;
|
|
|
385abae |
-static void *initial_monstartup_pointer;
|
|
|
385abae |
-
|
|
|
385abae |
-void
|
|
|
385abae |
-gprof_cleanup(void) {
|
|
|
385abae |
-
|
|
|
385abae |
- extern void _mcleanup(void);
|
|
|
385abae |
-
|
|
|
385abae |
- if (initial_monstartup_pointer) {
|
|
|
385abae |
- _mcleanup();
|
|
|
385abae |
- gprof_on=0;
|
|
|
385abae |
- }
|
|
|
385abae |
-
|
|
|
385abae |
- if (gprof_on) {
|
|
|
385abae |
-
|
|
|
385abae |
- char b[PATH_MAX],b1[PATH_MAX];
|
|
|
385abae |
-
|
|
|
385abae |
- if (!getcwd(b,sizeof(b)))
|
|
|
385abae |
- FEerror("Cannot get working directory", 0);
|
|
|
385abae |
- if (chdir(P_tmpdir))
|
|
|
385abae |
- FEerror("Cannot change directory to tmpdir", 0);
|
|
|
385abae |
- _mcleanup();
|
|
|
385abae |
- if (snprintf(b1,sizeof(b1),"gmon.out.%u",getpid())<=0)
|
|
|
385abae |
- FEerror("Cannot write temporary gmon filename", 0);
|
|
|
385abae |
- if (rename("gmon.out",b1))
|
|
|
385abae |
- FEerror("Cannot rename gmon.out",0);
|
|
|
385abae |
- if (chdir(b))
|
|
|
385abae |
- FEerror("Cannot restore working directory", 0);
|
|
|
385abae |
- gprof_on=0;
|
|
|
385abae |
-
|
|
|
385abae |
- }
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-
|
|
|
385abae |
-static inline int
|
|
|
385abae |
-my_monstartup(unsigned long start,unsigned long end) {
|
|
|
385abae |
-
|
|
|
385abae |
- extern void monstartup(unsigned long,unsigned long);
|
|
|
385abae |
-
|
|
|
385abae |
- monstartup(start,end);
|
|
|
385abae |
-
|
|
|
385abae |
- return 0;
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-
|
|
|
385abae |
-DEFUN_NEW("GPROF-START",object,fSgprof_start,SI,0,0,NONE,OO,OO,OO,OO,(void),"") {
|
|
|
385abae |
-
|
|
|
385abae |
- extern void *GCL_GPROF_START;
|
|
|
385abae |
- static int n;
|
|
|
385abae |
-
|
|
|
385abae |
- if (!gprof_on) {
|
|
|
385abae |
- start=start ? start : textstart;
|
|
|
385abae |
- end=end ? end : textend;
|
|
|
385abae |
- writable_malloc_wrap(my_monstartup,int,start,end);
|
|
|
385abae |
- gprof_on=1;
|
|
|
385abae |
- if (!n && atexit(gprof_cleanup)) {
|
|
|
385abae |
- FEerror("Cannot setup gprof_cleanup on exit", 0);
|
|
|
385abae |
- n=1;
|
|
|
385abae |
- }
|
|
|
385abae |
- }
|
|
|
385abae |
-
|
|
|
385abae |
- return Cnil;
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-
|
|
|
385abae |
-DEFUN_NEW("GPROF-SET",object,fSgprof_set,SI
|
|
|
385abae |
- ,2,2,NONE,OI,IO,OO,OO,(fixnum dstart,fixnum dend),"")
|
|
|
385abae |
-{
|
|
|
385abae |
-
|
|
|
385abae |
- start=dstart;
|
|
|
385abae |
- end=dend;
|
|
|
385abae |
-
|
|
|
385abae |
- return Cnil;
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-
|
|
|
385abae |
-DEFUN_NEW("GPROF-QUIT",object,fSgprof_quit,SI
|
|
|
385abae |
- ,0,0,NONE,OO,OO,OO,OO,(void),"")
|
|
|
385abae |
-{
|
|
|
385abae |
- extern void _mcleanup(void);
|
|
|
385abae |
- char b[PATH_MAX],b1[PATH_MAX];
|
|
|
385abae |
- FILE *pp;
|
|
|
385abae |
- unsigned n;
|
|
|
385abae |
-
|
|
|
385abae |
- if (!gprof_on)
|
|
|
385abae |
- return Cnil;
|
|
|
385abae |
-
|
|
|
385abae |
- massert(getcwd(b,sizeof(b)));
|
|
|
385abae |
- massert(!chdir(P_tmpdir));
|
|
|
385abae |
- _mcleanup();
|
|
|
385abae |
- massert(snprintf(b1,sizeof(b1),"gprof '%s'",kcl_self)>0);
|
|
|
385abae |
- massert((pp=popen(b1,"r")));
|
|
|
385abae |
- while ((n=fread(b1,1,sizeof(b1),pp)))
|
|
|
385abae |
- massert(fwrite(b1,1,n,stdout));
|
|
|
385abae |
- massert(pclose(pp)>=0);
|
|
|
385abae |
- massert(!chdir(b));
|
|
|
385abae |
- gprof_on=0;
|
|
|
385abae |
-
|
|
|
385abae |
- return Cnil;
|
|
|
385abae |
-
|
|
|
385abae |
-}
|
|
|
385abae |
-
|
|
|
385abae |
-#endif
|
|
|
385abae |
-
|
|
|
385abae |
DEFUN_NEW("SET-STARTING-HOLE-DIVISOR",object,fSset_starting_hole_divisor,SI,1,1,NONE,II,OO,OO,OO,(fixnum div),"") {
|
|
|
385abae |
if (div>0 && div <100)
|
|
|
385abae |
starting_hole_div=div;
|
|
|
385abae |
@@ -1808,20 +1670,7 @@ malloc_internal(size_t size) {
|
|
|
385abae |
void *
|
|
|
385abae |
malloc(size_t size) {
|
|
|
385abae |
|
|
|
385abae |
- void *v=malloc_internal(size);;
|
|
|
385abae |
-
|
|
|
385abae |
- /* FIXME: this is just to handle clean freeing of the
|
|
|
385abae |
- monstartup memory allocated automatically on raw image
|
|
|
385abae |
- startup. In saved images, monstartup memory is only
|
|
|
385abae |
- allocated with gprof-start. 20040804 CM*/
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
- if (raw_image && size>(textend-textstart) && !initial_monstartup_pointer) {
|
|
|
385abae |
- massert(!atexit(gprof_cleanup));
|
|
|
385abae |
- initial_monstartup_pointer=v;
|
|
|
385abae |
- }
|
|
|
385abae |
-#endif
|
|
|
385abae |
-
|
|
|
385abae |
- return v;
|
|
|
385abae |
+ return malloc_internal(size);
|
|
|
385abae |
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
@@ -1830,7 +1679,6 @@ void
|
|
|
385abae |
free(void *ptr) {
|
|
|
385abae |
|
|
|
385abae |
object *p,pp;
|
|
|
385abae |
- static void *initial_monstartup_pointer_echo;
|
|
|
385abae |
|
|
|
385abae |
if (ptr == 0)
|
|
|
385abae |
return;
|
|
|
385abae |
@@ -1839,15 +1687,9 @@ free(void *ptr) {
|
|
|
385abae |
if ((pp)->c.c_car->st.st_self == ptr) {
|
|
|
385abae |
(pp)->c.c_car->st.st_self = NULL;
|
|
|
385abae |
*p = pp->c.c_cdr;
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
- if (initial_monstartup_pointer==ptr) {
|
|
|
385abae |
- initial_monstartup_pointer_echo=ptr;
|
|
|
385abae |
- initial_monstartup_pointer=NULL;
|
|
|
385abae |
- }
|
|
|
385abae |
-#endif
|
|
|
385abae |
return;
|
|
|
385abae |
}
|
|
|
385abae |
- if (ptr!=initial_monstartup_pointer_echo) {
|
|
|
385abae |
+ {
|
|
|
385abae |
static void *old_ptr;
|
|
|
385abae |
if (old_ptr==ptr) return;
|
|
|
385abae |
old_ptr=ptr;
|
|
|
385abae |
@@ -1855,7 +1697,6 @@ free(void *ptr) {
|
|
|
385abae |
FEerror("free(3) error.",0);
|
|
|
385abae |
#endif
|
|
|
385abae |
}
|
|
|
385abae |
- initial_monstartup_pointer_echo=NULL;
|
|
|
385abae |
return;
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/cmpaux.c
|
|
|
385abae |
+++ gcl-2.6.12/o/cmpaux.c
|
|
|
385abae |
@@ -393,6 +393,15 @@ call_init(int init_address, object memor
|
|
|
385abae |
|
|
|
385abae |
*/
|
|
|
385abae |
|
|
|
385abae |
+DEFUN_NEW("MARK-MEMORY-AS-PROFILING",object,fSmark_memory_as_profiling,SI,0,0,
|
|
|
385abae |
+ NONE,OO,OO,OO,OO,(void),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ sSPmemory->s.s_dbind->cfd.cfd_prof=1;
|
|
|
385abae |
+
|
|
|
385abae |
+ return Cnil;
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
void
|
|
|
385abae |
do_init(object *statVV)
|
|
|
385abae |
{object fasl_vec=sSPinit->s.s_dbind;
|
|
|
385abae |
@@ -467,6 +476,22 @@ char *s;
|
|
|
385abae |
|
|
|
385abae |
#endif
|
|
|
385abae |
|
|
|
385abae |
+object
|
|
|
385abae |
+new_cfdata(void) {
|
|
|
385abae |
+
|
|
|
385abae |
+ object memory=alloc_object(t_cfdata);
|
|
|
385abae |
+
|
|
|
385abae |
+ memory->cfd.cfd_size=0;
|
|
|
385abae |
+ memory->cfd.cfd_fillp=0;
|
|
|
385abae |
+ memory->cfd.cfd_prof=0;
|
|
|
385abae |
+ memory->cfd.cfd_self=0;
|
|
|
385abae |
+ memory->cfd.cfd_start=0;
|
|
|
385abae |
+
|
|
|
385abae |
+ return memory;
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+
|
|
|
385abae |
void
|
|
|
385abae |
gcl_init_or_load1(void (*fn)(void),const char *file) {
|
|
|
385abae |
|
|
|
385abae |
@@ -476,10 +501,7 @@ gcl_init_or_load1(void (*fn)(void),const
|
|
|
385abae |
object fasl_data;
|
|
|
385abae |
file=FIX_PATH_STRING(file);
|
|
|
385abae |
|
|
|
385abae |
- memory=alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self=0;
|
|
|
385abae |
- memory->cfd.cfd_fillp=0;
|
|
|
385abae |
- memory->cfd.cfd_size = 0;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_start= (char *)fn;
|
|
|
385abae |
printf("Initializing %s\n",file); fflush(stdout);
|
|
|
385abae |
fasl_data = read_fasl_data(file);
|
|
|
385abae |
--- gcl-2.6.12.orig/o/fasldlsym.c
|
|
|
385abae |
+++ gcl-2.6.12/o/fasldlsym.c
|
|
|
385abae |
@@ -101,10 +101,7 @@ fasload(object faslfile) {
|
|
|
385abae |
SEEK_TO_END_OFILE(faslstream->sm.sm_fp);
|
|
|
385abae |
|
|
|
385abae |
data = read_fasl_vector(faslstream);
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self = NULL;
|
|
|
385abae |
- memory->cfd.cfd_start = NULL;
|
|
|
385abae |
- memory->cfd.cfd_size = 0;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
|
|
|
385abae |
if(symbol_value(sLAload_verboseA)!=Cnil)
|
|
|
385abae |
printf(" start address (dynamic) %p ",fptr);
|
|
|
385abae |
--- /dev/null
|
|
|
385abae |
+++ gcl-2.6.12/o/gprof.c
|
|
|
385abae |
@@ -0,0 +1,137 @@
|
|
|
385abae |
+#include "include.h"
|
|
|
385abae |
+#include "page.h"
|
|
|
385abae |
+#include "ptable.h"
|
|
|
385abae |
+
|
|
|
385abae |
+
|
|
|
385abae |
+static unsigned long gprof_on;
|
|
|
385abae |
+
|
|
|
385abae |
+DEFUN_NEW("MCLEANUP",object,fSmcleanup,SI,0,0,NONE,OO,OO,OO,OO,(void),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ extern void _mcleanup(void);
|
|
|
385abae |
+
|
|
|
385abae |
+ if (!gprof_on)
|
|
|
385abae |
+ return Cnil;
|
|
|
385abae |
+
|
|
|
385abae |
+ massert(getcwd(FN1,sizeof(FN1)));
|
|
|
385abae |
+ massert(!chdir(P_tmpdir));
|
|
|
385abae |
+ _mcleanup();
|
|
|
385abae |
+ massert(!chdir(FN1));
|
|
|
385abae |
+ gprof_on=0;
|
|
|
385abae |
+ massert(snprintf(FN1,sizeof(FN1),"%s/gmon.out",P_tmpdir)>0);
|
|
|
385abae |
+ return make_simple_string(FN1);
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+static inline int
|
|
|
385abae |
+my_monstartup(unsigned long start,unsigned long end) {
|
|
|
385abae |
+
|
|
|
385abae |
+ extern void monstartup(unsigned long,unsigned long);
|
|
|
385abae |
+
|
|
|
385abae |
+ monstartup(start,end);
|
|
|
385abae |
+
|
|
|
385abae |
+ return 0;
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+DEFUN_NEW("MONSTARTUP",object,fSmonstartup,SI,2,2,NONE,OI,IO,OO,OO,(ufixnum start,ufixnum end),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ if (gprof_on)
|
|
|
385abae |
+ return Cnil;
|
|
|
385abae |
+
|
|
|
385abae |
+ writable_malloc_wrap(my_monstartup,int,start,end);
|
|
|
385abae |
+ gprof_on=1;
|
|
|
385abae |
+
|
|
|
385abae |
+ return Ct;
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+void
|
|
|
385abae |
+gprof_cleanup(void) {
|
|
|
385abae |
+
|
|
|
385abae |
+ FFN(fSmcleanup)();
|
|
|
385abae |
+ /*rename gmon?*/
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+DEFUNM_NEW("GPROF-ADDRESSES",object,fSgprof_addresses,SI,0,0,NONE,OO,OO,OO,OO,(void),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ void *min=heap_end,*max=data_start,*c;
|
|
|
385abae |
+ static void *mintext;
|
|
|
385abae |
+ struct pageinfo *v;
|
|
|
385abae |
+ object x;
|
|
|
385abae |
+ fixnum i;
|
|
|
385abae |
+ struct typemanager *tm=tm_of(t_cfdata);
|
|
|
385abae |
+
|
|
|
385abae |
+ for (v=cell_list_head;v;v=v->next)
|
|
|
385abae |
+ if (v->type==tm->tm_type)
|
|
|
385abae |
+ for (c=pagetochar(page(v)),i=0;i<tm->tm_nppage;i++,c+=tm->tm_size)
|
|
|
385abae |
+ if (!is_free((x=c)) && type_of(x)==t_cfdata && x->cfd.cfd_prof) {
|
|
|
385abae |
+ min=(void *)x->cfd.cfd_start<min ? x->cfd.cfd_start : min;
|
|
|
385abae |
+ max=(void *)x->cfd.cfd_start+x->cfd.cfd_size>max ? x->cfd.cfd_start+x->cfd.cfd_size : max;
|
|
|
385abae |
+ }
|
|
|
385abae |
+
|
|
|
385abae |
+ if (max
|
|
|
385abae |
+ min=max;
|
|
|
385abae |
+
|
|
|
385abae |
+ if (!mintext) {
|
|
|
385abae |
+
|
|
|
385abae |
+ mintext=data_start;
|
|
|
385abae |
+
|
|
|
385abae |
+#ifdef GCL_GPROF
|
|
|
385abae |
+ for (i=0;i
|
|
|
385abae |
+ mintext=(void *)c_table.ptable[i].address
|
|
|
385abae |
+ for (i=0;i
|
|
|
385abae |
+ mintext=(void *)c_table.local_ptable[i].address
|
|
|
385abae |
+#endif
|
|
|
385abae |
+
|
|
|
385abae |
+ }
|
|
|
385abae |
+
|
|
|
385abae |
+ if (mintext
|
|
|
385abae |
+ min=mintext;
|
|
|
385abae |
+
|
|
|
385abae |
+ RETURN2(make_fixnum((fixnum)min),make_fixnum((fixnum)max));
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+DEFUN_NEW("KCL-SELF",object,fSkcl_self,SI,0,0,NONE,OO,OO,OO,OO,(void),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ return make_simple_string(kcl_self);
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
+
|
|
|
385abae |
+DEFUN_NEW("WRITE-SYMTAB",object,fSwrite_symtab,SI,3,3,NONE,OO,II,OO,OO,
|
|
|
385abae |
+ (object symtab,ufixnum start,ufixnum end),"") {
|
|
|
385abae |
+
|
|
|
385abae |
+ struct package *p;
|
|
|
385abae |
+ object l,s,f,*b,*be;
|
|
|
385abae |
+ FILE *pp;
|
|
|
385abae |
+ ufixnum i;
|
|
|
385abae |
+
|
|
|
385abae |
+ coerce_to_filename(symtab,FN1);
|
|
|
385abae |
+ pp=fopen(FN1,"w");
|
|
|
385abae |
+ fprintf(pp,"%016lx T GCL_MONSTART\n",start);
|
|
|
385abae |
+ for (p=pack_pointer;p;p=p->p_link)
|
|
|
385abae |
+ for (i=0,b=p->p_internal,be=b+p->p_internal_size;b;
|
|
|
385abae |
+ b=i ? NULL : p->p_external,be=b+p->p_external_size,i=1)
|
|
|
385abae |
+ for (;b
|
|
|
385abae |
+ for (l=*b;consp(l);l=l->c.c_cdr)
|
|
|
385abae |
+ if ((f=(s=l->c.c_car)->s.s_gfdef)!=OBJNULL && s->s.s_hpack==(object)p)
|
|
|
385abae |
+ switch(type_of(f)) {
|
|
|
385abae |
+ case t_cfun:case t_sfun:case t_vfun:case t_afun:case t_gfun:
|
|
|
385abae |
+ if ((ufixnum)f->cf.cf_self>=start && (ufixnum)f->cf.cf_self
|
|
|
385abae |
+ fprintf(pp,"%016lx T %-.*s::%-.*s\n",
|
|
|
385abae |
+ (ufixnum)f->cf.cf_self,
|
|
|
385abae |
+ p->p_name->st.st_fillp,p->p_name->st.st_self,
|
|
|
385abae |
+ s->st.st_fillp,s->st.st_self);
|
|
|
385abae |
+ break;
|
|
|
385abae |
+ }
|
|
|
385abae |
+ fprintf(pp,"%016lx T GCL_MONEND\n",end);
|
|
|
385abae |
+
|
|
|
385abae |
+ for (i=0;i
|
|
|
385abae |
+ fprintf(pp,"%016lx T %s\n",c_table.ptable[i].address,c_table.ptable[i].string);
|
|
|
385abae |
+ for (i=0;i
|
|
|
385abae |
+ fprintf(pp,"%016lx t %s\n",c_table.local_ptable[i].address,c_table.local_ptable[i].string);
|
|
|
385abae |
+ fclose(pp);
|
|
|
385abae |
+
|
|
|
385abae |
+ return symtab;
|
|
|
385abae |
+
|
|
|
385abae |
+}
|
|
|
385abae |
--- gcl-2.6.12.orig/o/main.c
|
|
|
385abae |
+++ gcl-2.6.12/o/main.c
|
|
|
385abae |
@@ -334,9 +334,7 @@ minimize_image(void) {
|
|
|
385abae |
nrbpage=0;
|
|
|
385abae |
resize_hole(0,t_relocatable,0);
|
|
|
385abae |
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
gprof_cleanup();
|
|
|
385abae |
-#endif
|
|
|
385abae |
|
|
|
385abae |
#if defined(BSD) || defined(ATT)
|
|
|
385abae |
mbrk(core_end=heap_end);
|
|
|
385abae |
@@ -425,9 +423,7 @@ gcl_cleanup(int gc) {
|
|
|
385abae |
{extern void _cleanup(void);_cleanup();}
|
|
|
385abae |
#endif
|
|
|
385abae |
|
|
|
385abae |
-#ifdef GCL_GPROF
|
|
|
385abae |
gprof_cleanup();
|
|
|
385abae |
-#endif
|
|
|
385abae |
|
|
|
385abae |
if (gc) {
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/makefile
|
|
|
385abae |
+++ gcl-2.6.12/o/makefile
|
|
|
385abae |
@@ -20,7 +20,7 @@ OBJS:=$(addsuffix .o,typespec main alloc
|
|
|
385abae |
num_pred num_comp num_arith num_sfun num_co num_log num_rand earith character sequence list hash\
|
|
|
385abae |
array string regexpr structure toplevel file read backq print format pathname unixfsys unixfasl\
|
|
|
385abae |
error unixtime unixsys unixsave funlink fat_string run_process nfunlink usig usig2 utils makefun\
|
|
|
385abae |
- sockets clxsocket init_pari nsocket sfasl prelink)
|
|
|
385abae |
+ sockets clxsocket init_pari nsocket sfasl prelink gprof)
|
|
|
385abae |
OBJS:=$(OBJS) $(RL_OBJS) $(EXTRAS)
|
|
|
385abae |
|
|
|
385abae |
INI_FILES=$(patsubst %.o,%.ini,${OBJS})
|
|
|
385abae |
@@ -33,6 +33,9 @@ all: $(OBJECTS)
|
|
|
385abae |
boot.o: boot.c $(DECL) boot.h
|
|
|
385abae |
$(CC) -c $(CFLAGS) $(DEFS) -fPIC $*.c $(AUX_INFO)
|
|
|
385abae |
|
|
|
385abae |
+gprof.o: gprof.c $(DECL)
|
|
|
385abae |
+ $(CC) -c $(CFLAGS) $(DEFS) -pg $*.c $(AUX_INFO)
|
|
|
385abae |
+
|
|
|
385abae |
prelink.o: prelink.c $(DECL)
|
|
|
385abae |
$(CC) -c $(filter-out -pg,$(CFLAGS)) -fPIE $(DEFS) $*.c $(AUX_INFO)
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfasl.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfasl.c
|
|
|
385abae |
@@ -273,17 +273,15 @@ SEEK_TO_END_OFILE(fp);
|
|
|
385abae |
/* allocate some memory */
|
|
|
385abae |
#ifndef STAND
|
|
|
385abae |
{BEGIN_NO_INTERRUPT;
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self = 0;
|
|
|
385abae |
- memory->cfd.cfd_start = 0;
|
|
|
385abae |
- memory->cfd.cfd_size = datasize+textsize+bsssize + extra_bss;
|
|
|
385abae |
- vs_push(memory);
|
|
|
385abae |
- the_start=start_address=
|
|
|
385abae |
- memory->cfd.cfd_start =
|
|
|
385abae |
- alloc_contblock(memory->cfd.cfd_size);
|
|
|
385abae |
- sfaslp->s_start_data = start_address + textsize;
|
|
|
385abae |
- sfaslp->s_start_bss = start_address + textsize + datasize;
|
|
|
385abae |
- END_NO_INTERRUPT;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
+ memory->cfd.cfd_size = datasize+textsize+bsssize + extra_bss;
|
|
|
385abae |
+ vs_push(memory);
|
|
|
385abae |
+ the_start=start_address=
|
|
|
385abae |
+ memory->cfd.cfd_start=
|
|
|
385abae |
+ alloc_contblock(memory->cfd.cfd_size);
|
|
|
385abae |
+ sfaslp->s_start_data = start_address + textsize;
|
|
|
385abae |
+ sfaslp->s_start_bss = start_address + textsize + datasize;
|
|
|
385abae |
+ END_NO_INTERRUPT;
|
|
|
385abae |
}
|
|
|
385abae |
#else
|
|
|
385abae |
the_start = start_address
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfaslbfd.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfaslbfd.c
|
|
|
385abae |
@@ -269,9 +269,7 @@ fasload(object faslfile) {
|
|
|
385abae |
curr_size=(unsigned long)current;
|
|
|
385abae |
max_align=1<
|
|
|
385abae |
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self = 0;
|
|
|
385abae |
- memory->cfd.cfd_start = 0;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_size = curr_size + (max_align > sizeof(char *) ? max_align :0);
|
|
|
385abae |
|
|
|
385abae |
memory->cfd.cfd_start=alloc_contblock(memory->cfd.cfd_size);
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfaslcoff.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfaslcoff.c
|
|
|
385abae |
@@ -207,10 +207,8 @@ load_memory(struct scnhdr *sec1,struct s
|
|
|
385abae |
if (ALLOC_SEC(sec))
|
|
|
385abae |
sec->s_paddr=sz;
|
|
|
385abae |
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_size=sz;
|
|
|
385abae |
- memory->cfd.cfd_self=0;
|
|
|
385abae |
- memory->cfd.cfd_start=0;
|
|
|
385abae |
memory->cfd.cfd_start=alloc_code_space(sz);
|
|
|
385abae |
|
|
|
385abae |
for (sec=sec1;sec
|
|
|
385abae |
@@ -259,7 +257,7 @@ load_self_symbols() {
|
|
|
385abae |
|
|
|
385abae |
for (ns=sl=0,sym=sy1;sym
|
|
|
385abae |
|
|
|
385abae |
- if (sym->n_sclass!=2 || sym->n_scnum<1)
|
|
|
385abae |
+ if (sym->n_sclass<2 || sym->n_sclass>3 || sym->n_scnum<1)
|
|
|
385abae |
continue;
|
|
|
385abae |
|
|
|
385abae |
ns++;
|
|
|
385abae |
@@ -270,7 +268,7 @@ load_self_symbols() {
|
|
|
385abae |
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
- c_table.alloc_length=c_table.length=ns;
|
|
|
385abae |
+ c_table.alloc_length=ns;
|
|
|
385abae |
assert(c_table.ptable=malloc(sizeof(*c_table.ptable)*c_table.alloc_length));
|
|
|
385abae |
assert(st=malloc(sl));
|
|
|
385abae |
|
|
|
385abae |
@@ -296,9 +294,36 @@ load_self_symbols() {
|
|
|
385abae |
sym+=sym->n_numaux;
|
|
|
385abae |
|
|
|
385abae |
}
|
|
|
385abae |
-
|
|
|
385abae |
+ c_table.length=a-c_table.ptable;
|
|
|
385abae |
qsort(c_table.ptable,c_table.length,sizeof(*c_table.ptable),node_compare);
|
|
|
385abae |
|
|
|
385abae |
+ for (c_table.local_ptable=a,sym=sy1;sym
|
|
|
385abae |
+
|
|
|
385abae |
+ if (sym->n_sclass!=3 || sym->n_scnum<1)
|
|
|
385abae |
+ continue;
|
|
|
385abae |
+
|
|
|
385abae |
+ NM(sym,st1,s,strcpy(st,s));
|
|
|
385abae |
+
|
|
|
385abae |
+ sec=sec1+sym->n_scnum-1;
|
|
|
385abae |
+ jj=sym->n_value+sec->s_vaddr+h->h_ibase;
|
|
|
385abae |
+
|
|
|
385abae |
+#ifdef FIX_ADDRESS
|
|
|
385abae |
+ FIX_ADDRESS(jj);
|
|
|
385abae |
+#endif
|
|
|
385abae |
+
|
|
|
385abae |
+ a->address=jj;
|
|
|
385abae |
+ a->string=st;
|
|
|
385abae |
+
|
|
|
385abae |
+ a++;
|
|
|
385abae |
+ st+=strlen(st)+1;
|
|
|
385abae |
+ sym+=sym->n_numaux;
|
|
|
385abae |
+
|
|
|
385abae |
+ }
|
|
|
385abae |
+ c_table.local_length=a-c_table.local_ptable;
|
|
|
385abae |
+ qsort(c_table.local_ptable,c_table.local_length,sizeof(*c_table.local_ptable),node_compare);
|
|
|
385abae |
+
|
|
|
385abae |
+ massert(c_table.alloc_length==c_table.length+c_table.local_length);
|
|
|
385abae |
+
|
|
|
385abae |
massert(!un_mmap(v1,ve));
|
|
|
385abae |
massert(!fclose(f));
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfaslelf.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfaslelf.c
|
|
|
385abae |
@@ -55,9 +55,12 @@ License for more details.
|
|
|
385abae |
#define ulmax(a_,b_) ({ul _a=a_,_b=b_;_a<_b ? _b : _a;})
|
|
|
385abae |
#define ALLOC_SEC(sec) (sec->sh_flags&SHF_ALLOC && (sec->sh_type==SHT_PROGBITS || sec->sh_type==SHT_NOBITS))
|
|
|
385abae |
#define LOAD_SEC(sec) (sec->sh_flags&SHF_ALLOC && sec->sh_type==SHT_PROGBITS)
|
|
|
385abae |
-#define LOAD_SYM_BY_BIND(sym) ({ul _b=ELF_ST_BIND(sym->st_info); sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK);})
|
|
|
385abae |
-#define LOAD_SYM_BY_NAME(sym,st1) 0
|
|
|
385abae |
-#define LOAD_SYM(sym,st1) (LOAD_SYM_BY_BIND(sym)||LOAD_SYM_BY_NAME(sym,st1))
|
|
|
385abae |
+#define EXT_SYM(sym) ({ul _b=ELF_ST_BIND(sym->st_info); \
|
|
|
385abae |
+ sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK);})
|
|
|
385abae |
+#define LOCAL_SYM(sym) (sym->st_value && \
|
|
|
385abae |
+ ELF_ST_BIND(sym->st_info)==STB_LOCAL)
|
|
|
385abae |
+ /* && ELF_ST_TYPE(sym->st_info)==STT_FUNC) */
|
|
|
385abae |
+#define LOAD_SYM(sym) (EXT_SYM(sym)||LOCAL_SYM(sym))
|
|
|
385abae |
|
|
|
385abae |
#define MASK(n) (~(~0ULL << (n)))
|
|
|
385abae |
|
|
|
385abae |
@@ -271,10 +274,8 @@ load_memory(Shdr *sec1,Shdr *sece,void *
|
|
|
385abae |
sz+=gsz;
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
- memory=alloc_object(t_cfdata);
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_size=sz;
|
|
|
385abae |
- memory->cfd.cfd_self=0;
|
|
|
385abae |
- memory->cfd.cfd_start=0;
|
|
|
385abae |
memory->cfd.cfd_start=alloc_code_space(sz);
|
|
|
385abae |
|
|
|
385abae |
a=(ul)memory->cfd.cfd_start;
|
|
|
385abae |
@@ -411,7 +412,7 @@ calc_space(ul *ns,ul *sl,Sym *sym1,Sym *
|
|
|
385abae |
|
|
|
385abae |
for (sym=sym1;sym
|
|
|
385abae |
|
|
|
385abae |
- if (!LOAD_SYM(sym,st1))
|
|
|
385abae |
+ if (!LOAD_SYM(sym))
|
|
|
385abae |
continue;
|
|
|
385abae |
|
|
|
385abae |
if (d1) {
|
|
|
385abae |
@@ -431,13 +432,13 @@ calc_space(ul *ns,ul *sl,Sym *sym1,Sym *
|
|
|
385abae |
|
|
|
385abae |
static int
|
|
|
385abae |
load_ptable(struct node **a,char **s,Sym *sym1,Sym *syme,const char *st1,
|
|
|
385abae |
- Sym *d1,Sym *de,const char *ds1) {
|
|
|
385abae |
+ Sym *d1,Sym *de,const char *ds1,ufixnum lp) {
|
|
|
385abae |
|
|
|
385abae |
Sym *sym,*d;
|
|
|
385abae |
|
|
|
385abae |
for (sym=sym1;sym
|
|
|
385abae |
|
|
|
385abae |
- if (!LOAD_SYM(sym,st1))
|
|
|
385abae |
+ if (!LOAD_SYM(sym) || (LOCAL_SYM(sym) ? !lp : lp))
|
|
|
385abae |
continue;
|
|
|
385abae |
|
|
|
385abae |
if (d1) {
|
|
|
385abae |
@@ -488,16 +489,23 @@ load_self_symbols() {
|
|
|
385abae |
massert(!calc_space(&ns,&sl,dsym1,dsyme,dst1,NULL,NULL,NULL));
|
|
|
385abae |
massert(!calc_space(&ns,&sl,sym1,syme,st1,dsym1,dsyme,dst1));
|
|
|
385abae |
|
|
|
385abae |
- c_table.alloc_length=c_table.length=ns;
|
|
|
385abae |
+ c_table.alloc_length=ns;
|
|
|
385abae |
massert(c_table.ptable=malloc(sizeof(*c_table.ptable)*c_table.alloc_length));
|
|
|
385abae |
massert(s=malloc(sl));
|
|
|
385abae |
|
|
|
385abae |
a=c_table.ptable;
|
|
|
385abae |
- massert(!load_ptable(&a,&s,dsym1,dsyme,dst1,NULL,NULL,NULL));
|
|
|
385abae |
- massert(!load_ptable(&a,&s,sym1,syme,st1,dsym1,dsyme,dst1));
|
|
|
385abae |
-
|
|
|
385abae |
+ massert(!load_ptable(&a,&s,dsym1,dsyme,dst1,NULL,NULL,NULL,0));
|
|
|
385abae |
+ massert(!load_ptable(&a,&s,sym1,syme,st1,dsym1,dsyme,dst1,0));
|
|
|
385abae |
+ c_table.length=a-c_table.ptable;
|
|
|
385abae |
qsort(c_table.ptable,c_table.length,sizeof(*c_table.ptable),node_compare);
|
|
|
385abae |
|
|
|
385abae |
+ c_table.local_ptable=a;
|
|
|
385abae |
+ massert(!load_ptable(&a,&s,sym1,syme,st1,dsym1,dsyme,dst1,1));
|
|
|
385abae |
+ c_table.local_length=a-c_table.local_ptable;
|
|
|
385abae |
+ qsort(c_table.local_ptable,c_table.local_length,sizeof(*c_table.local_ptable),node_compare);
|
|
|
385abae |
+
|
|
|
385abae |
+ massert(c_table.alloc_length==c_table.length+c_table.local_length);
|
|
|
385abae |
+
|
|
|
385abae |
massert(!un_mmap(v1,ve));
|
|
|
385abae |
massert(!fclose(f));
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfaslmacho.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfaslmacho.c
|
|
|
385abae |
@@ -203,10 +203,8 @@ load_memory(struct section *sec1,struct
|
|
|
385abae |
sz+=gsz;
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
- memory=alloc_object(t_cfdata);
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_size=sz;
|
|
|
385abae |
- memory->cfd.cfd_self=0;
|
|
|
385abae |
- memory->cfd.cfd_start=0;
|
|
|
385abae |
memory->cfd.cfd_start=alloc_code_space(sz);
|
|
|
385abae |
|
|
|
385abae |
a=(ul)memory->cfd.cfd_start;
|
|
|
385abae |
@@ -411,23 +409,19 @@ load_self_symbols() {
|
|
|
385abae |
|
|
|
385abae |
if (sym->n_type & N_STAB)
|
|
|
385abae |
continue;
|
|
|
385abae |
- if (!(sym->n_type & N_EXT))
|
|
|
385abae |
- continue;
|
|
|
385abae |
|
|
|
385abae |
ns++;
|
|
|
385abae |
sl+=strlen(sym->n_un.n_strx+strtab)+1;
|
|
|
385abae |
|
|
|
385abae |
}
|
|
|
385abae |
|
|
|
385abae |
- c_table.alloc_length=c_table.length=ns;
|
|
|
385abae |
+ c_table.alloc_length=ns;
|
|
|
385abae |
assert(c_table.ptable=malloc(sizeof(*c_table.ptable)*c_table.alloc_length));
|
|
|
385abae |
assert(s=malloc(sl));
|
|
|
385abae |
|
|
|
385abae |
for (a=c_table.ptable,sym=sym1;sym
|
|
|
385abae |
|
|
|
385abae |
- if (sym->n_type & N_STAB)
|
|
|
385abae |
- continue;
|
|
|
385abae |
- if (!(sym->n_type & N_EXT))
|
|
|
385abae |
+ if (sym->n_type & N_STAB || !(sym->n_type & N_EXT))
|
|
|
385abae |
continue;
|
|
|
385abae |
|
|
|
385abae |
a->address=sym->n_value;
|
|
|
385abae |
@@ -438,9 +432,28 @@ load_self_symbols() {
|
|
|
385abae |
s+=strlen(s)+1;
|
|
|
385abae |
|
|
|
385abae |
}
|
|
|
385abae |
-
|
|
|
385abae |
+ c_table.length=a-c_table.ptable;
|
|
|
385abae |
qsort(c_table.ptable,c_table.length,sizeof(*c_table.ptable),node_compare);
|
|
|
385abae |
|
|
|
385abae |
+ c_table.local_ptable=a;
|
|
|
385abae |
+ for (a=c_table.ptable,sym=sym1;sym
|
|
|
385abae |
+
|
|
|
385abae |
+ if (sym->n_type & N_STAB || sym->n_type & N_EXT)
|
|
|
385abae |
+ continue;
|
|
|
385abae |
+
|
|
|
385abae |
+ a->address=sym->n_value;
|
|
|
385abae |
+ a->string=s;
|
|
|
385abae |
+ strcpy(s,sym->n_un.n_strx+strtab);
|
|
|
385abae |
+
|
|
|
385abae |
+ a++;
|
|
|
385abae |
+ s+=strlen(s)+1;
|
|
|
385abae |
+
|
|
|
385abae |
+ }
|
|
|
385abae |
+ c_table.local_length=a-c_table.local_ptable;
|
|
|
385abae |
+ qsort(c_table.local_ptable,c_table.local_length,sizeof(*c_table.local_ptable),node_compare);
|
|
|
385abae |
+
|
|
|
385abae |
+ massert(c_table.alloc_length==c_table.length+c_table.local_length);
|
|
|
385abae |
+
|
|
|
385abae |
massert(!un_mmap(addr,addre));
|
|
|
385abae |
massert(!fclose(f));
|
|
|
385abae |
|
|
|
385abae |
--- gcl-2.6.12.orig/o/sfaslmacosx.c
|
|
|
385abae |
+++ gcl-2.6.12/o/sfaslmacosx.c
|
|
|
385abae |
@@ -232,10 +232,7 @@ int fasload (object faslfile)
|
|
|
385abae |
|
|
|
385abae |
close_stream (faslstream);
|
|
|
385abae |
|
|
|
385abae |
- memory = alloc_object (t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self = NULL;
|
|
|
385abae |
- memory->cfd.cfd_start = NULL;
|
|
|
385abae |
- memory->cfd.cfd_size = 0;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
|
|
|
385abae |
if (symbol_value (sLAload_verboseA) != Cnil)
|
|
|
385abae |
printf (" start address (dynamic) %p ", fptr);
|
|
|
385abae |
--- gcl-2.6.12.orig/o/unixfasl.c
|
|
|
385abae |
+++ gcl-2.6.12/o/unixfasl.c
|
|
|
385abae |
@@ -146,9 +146,7 @@ object faslfile;
|
|
|
385abae |
fread(&header, sizeof(header), 1, fp);
|
|
|
385abae |
#endif
|
|
|
385abae |
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self = NULL;
|
|
|
385abae |
- memory->cfd.cfd_start = NULL;
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
memory->cfd.cfd_size = textsize + datasize + bsssize;
|
|
|
385abae |
vs_push(memory);
|
|
|
385abae |
/* If the file is smaller than the space asked for, typically the file
|
|
|
385abae |
@@ -314,12 +312,10 @@ DEFUN_NEW("FASLINK-INT",object,fSfaslink
|
|
|
385abae |
setbuf(fp, buf);
|
|
|
385abae |
fread(&header, sizeof(header), 1, fp);
|
|
|
385abae |
{BEGIN_NO_INTERRUPT;
|
|
|
385abae |
- memory = alloc_object(t_cfdata);
|
|
|
385abae |
- memory->cfd.cfd_self=0;
|
|
|
385abae |
- memory->cfd.cfd_start = NULL;
|
|
|
385abae |
- memory->cfd.cfd_size = textsize + datasize + bsssize;
|
|
|
385abae |
- vs_push(memory);
|
|
|
385abae |
- memory->cfd.cfd_start = ALLOC_ALIGNED(alloc_contblock,
|
|
|
385abae |
+ memory=new_cfdata();
|
|
|
385abae |
+ memory->cfd.cfd_size = textsize + datasize + bsssize;
|
|
|
385abae |
+ vs_push(memory);
|
|
|
385abae |
+ memory->cfd.cfd_start = ALLOC_ALIGNED(alloc_contblock,
|
|
|
385abae |
memory->cfd.cfd_size,
|
|
|
385abae |
sizeof(double));
|
|
|
385abae |
END_NO_INTERRUPT;}
|
|
|
385abae |
--- gcl-2.6.12.orig/unixport/makefile
|
|
|
385abae |
+++ gcl-2.6.12/unixport/makefile
|
|
|
385abae |
@@ -69,28 +69,26 @@ $(LSPDIR)/auto_new.lsp: $(LSPDIR)/auto.l
|
|
|
385abae |
[ "$(RL_OBJS)" = "" ] || \
|
|
|
385abae |
echo "(AUTOLOAD 'init-readline '|readline|)" >>$@
|
|
|
385abae |
|
|
|
385abae |
-sys_init.lsp: sys_init.lsp.in
|
|
|
385abae |
+saved_%:raw_% $(RSYM) sys_init.lsp.in raw_%_map msys \
|
|
|
385abae |
+ $(CMPDIR)/gcl_cmpmain.lsp \
|
|
|
385abae |
+ $(CMPDIR)/gcl_lfun_list.lsp \
|
|
|
385abae |
+ $(CMPDIR)/gcl_cmpopt.lsp $(HDIR)/cmpinclude.h \
|
|
|
385abae |
+ $(LSPDIR)/gcl_auto_new.lsp
|
|
|
385abae |
|
|
|
385abae |
- cat $< | sed \
|
|
|
385abae |
+ cat sys_init.lsp.in | sed \
|
|
|
385abae |
-e "s#@LI-VERS@#(`cat ../majvers`.`cat ../minvers`) `cat ../release`#1" \
|
|
|
385abae |
-e "s#@LI-EXTVERS@#`cat ../minvers | cut -f2 -d.`#1" \
|
|
|
385abae |
-e "s#@LI-MINVERS@#`cat ../minvers | cut -f1 -d.`#1" \
|
|
|
385abae |
-e "s#@LI-MAJVERS@#`cat ../majvers`#1" \
|
|
|
385abae |
-e "s#@LI-RELEASE@#`cat ../release`#1" \
|
|
|
385abae |
- -e "s#@LI-CC@#\"$(GCL_CC) -c $(FINAL_CFLAGS)\"#1" \
|
|
|
385abae |
+ -e "s#@LI-CC@#\"$(GCL_CC) -c $(filter-out -pg,$(FINAL_CFLAGS))\"#1" \
|
|
|
385abae |
+ -e "s#@LI-DFP@#\"$(filter -pg,$(FINAL_CFLAGS))\"#1" \
|
|
|
385abae |
-e "s#@LI-LD@#\"$(GCL_CC) $(LD_FLAGS) -o \"#1" \
|
|
|
385abae |
- -e "s#@LI-LD-LIBS@#\" $(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)\"#1" \
|
|
|
385abae |
+ -e "s#@LI-LD-LIBS@#\" $(LD_LIBS_POST)\"#1" \
|
|
|
385abae |
-e "s#@LI-OPT-THREE@#\"$(O3FLAGS)\"#1" \
|
|
|
385abae |
-e "s#@LI-OPT-TWO@#\"$(O2FLAGS)\"#1" \
|
|
|
385abae |
- -e "s#@LI-INIT-LSP@#\"$@\"#1" >$@
|
|
|
385abae |
-
|
|
|
385abae |
-saved_%:raw_% $(RSYM) sys_init.lsp raw_%_map msys \
|
|
|
385abae |
- $(CMPDIR)/gcl_cmpmain.lsp \
|
|
|
385abae |
- $(CMPDIR)/gcl_lfun_list.lsp \
|
|
|
385abae |
- $(CMPDIR)/gcl_cmpopt.lsp $(HDIR)/cmpinclude.h \
|
|
|
385abae |
- $(LSPDIR)/gcl_auto_new.lsp
|
|
|
385abae |
+ -e "s#@LI-INIT-LSP@#\"$@\"#1" >foo
|
|
|
385abae |
|
|
|
385abae |
- cp sys_init.lsp foo
|
|
|
385abae |
echo "(unless si::*quit-tags* (in-package \"USER\")(system:save-system \"$@\"))" >>foo
|
|
|
385abae |
j=$$(ar t lib$*.a |grep ^gcl_);[ "$$j" = "" ] || ar x lib$*.a $$j #accelerator
|
|
|
385abae |
$(PORTDIR)/raw_$*$(EXE) $(PORTDIR)/ -libdir $(GCLDIR)/ < foo
|
|
|
385abae |
@@ -160,7 +158,7 @@ map_%:
|
|
|
385abae |
clean:
|
|
|
385abae |
rm -rf saved_*$(EXE) raw_*$(EXE) *.o core a.out $(RSYM) \
|
|
|
385abae |
$(LSPDIR)/auto_new.lsp foo *maxima* init_*.lsp lib*.a gmp* bfd* *.lsp.tmp \
|
|
|
385abae |
- gazonk*.lsp plt*h *_map saved_* lib* raw_* msys out* log* tmp* gcl.script sys_init.lsp
|
|
|
385abae |
+ gazonk*.lsp plt*h *_map saved_* lib* raw_* msys out* log* tmp* gcl.script
|
|
|
385abae |
|
|
|
385abae |
.INTERMEDIATE: init_ansi_gcl.lsp.tmp init_gcl.lsp.tmp raw_gcl raw_ansi_gcl
|
|
|
385abae |
.PRECIOUS: init_pre_gcl.lsp init_gcl.lsp init_ansi_gcl.lsp
|
|
|
385abae |
--- gcl-2.6.12.orig/unixport/sys_init.lsp.in
|
|
|
385abae |
+++ gcl-2.6.12/unixport/sys_init.lsp.in
|
|
|
385abae |
@@ -59,8 +59,10 @@
|
|
|
385abae |
|
|
|
385abae |
(in-package :compiler)
|
|
|
385abae |
(setq *cc* @LI-CC@
|
|
|
385abae |
+ *default-prof-p* (> (length @LI-DFP@) 0)
|
|
|
385abae |
*ld* @LI-LD@
|
|
|
385abae |
*ld-libs* @LI-LD-LIBS@
|
|
|
385abae |
+ *ld-libs* (concatenate 'string "-l" #+ansi-cl "ansi_" "gcl " *ld-libs*)
|
|
|
385abae |
*opt-three* @LI-OPT-THREE@
|
|
|
385abae |
*opt-two* @LI-OPT-TWO@
|
|
|
385abae |
*init-lsp* @LI-INIT-LSP@)
|