From 7bc49143a0a57d062487731a934f4bad1f004574 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 3 Jul 2016 18:52:32 +0000 Subject: Sync newer patches (mostly the time handling fixes) from base smlnj package. --- .../patches/patch-base_runtime_gc_gc-stats.h | 44 ++++++++++++++++++++++ .../patches/patch-base_runtime_gc_init-gc.c | 27 +++++++++++++ .../patch-base_runtime_kernel_unix-timers.c | 17 +++++++++ .../patch-base_runtime_mach-dep_unix-prof.c | 15 ++++++++ .../patches/patch-base_runtime_objs_mk.x86-netbsd | 24 ++++++++++++ .../patches/patch-src_runtime_gc_gc-stats.h | 44 ++++++++++++++++++++++ .../patches/patch-src_runtime_gc_init-gc.c | 27 +++++++++++++ .../patches/patch-src_runtime_kernel_unix-timers.c | 17 +++++++++ .../patches/patch-src_runtime_mach-dep_unix-prof.c | 15 ++++++++ .../patches/patch-src_runtime_objs_mk.x86-netbsd | 24 ++++++++++++ 10 files changed, 254 insertions(+) create mode 100644 lang/smlnj11072/patches/patch-base_runtime_gc_gc-stats.h create mode 100644 lang/smlnj11072/patches/patch-base_runtime_gc_init-gc.c create mode 100644 lang/smlnj11072/patches/patch-base_runtime_kernel_unix-timers.c create mode 100644 lang/smlnj11072/patches/patch-base_runtime_mach-dep_unix-prof.c create mode 100644 lang/smlnj11072/patches/patch-base_runtime_objs_mk.x86-netbsd create mode 100644 lang/smlnj11072/patches/patch-src_runtime_gc_gc-stats.h create mode 100644 lang/smlnj11072/patches/patch-src_runtime_gc_init-gc.c create mode 100644 lang/smlnj11072/patches/patch-src_runtime_kernel_unix-timers.c create mode 100644 lang/smlnj11072/patches/patch-src_runtime_mach-dep_unix-prof.c create mode 100644 lang/smlnj11072/patches/patch-src_runtime_objs_mk.x86-netbsd (limited to 'lang/smlnj11072/patches') diff --git a/lang/smlnj11072/patches/patch-base_runtime_gc_gc-stats.h b/lang/smlnj11072/patches/patch-base_runtime_gc_gc-stats.h new file mode 100644 index 00000000000..c6526ca9cef --- /dev/null +++ b/lang/smlnj11072/patches/patch-base_runtime_gc_gc-stats.h @@ -0,0 +1,44 @@ +$NetBSD: patch-base_runtime_gc_gc-stats.h,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use struct timeval instead of blithely assuming that some private +struct declaration is always bit compatible with it. (Because it +isn't.) From PR 40954. + +--- base/runtime/gc/gc-stats.h.orig 2009-03-03 18:23:38.000000000 -0500 ++++ base/runtime/gc/gc-stats.h 2009-03-03 18:25:04.000000000 -0500 +@@ -16,6 +16,7 @@ extern void ReportVM (ml_state_t *msp, i + + #define START_GC_PAUSE(HEAP) { \ + if (StatsOn) { \ ++ struct timeval tv; \ + heap_t *__heap = (HEAP); \ + stat_rec_t *__p = &(StatsBuf[NStatsRecs]); \ + Unsigned32_t __n = (Addr_t)(msp->ml_allocPtr) - \ +@@ -23,7 +24,10 @@ extern void ReportVM (ml_state_t *msp, i + CNTR_INCR(&(__heap->numAlloc), __n); \ + __p->allocCnt = __heap->numAlloc; \ + __p->numGens = 0; \ +- gettimeofday(&(__p->startTime), NIL(struct timezone *)); \ ++ gettimeofday(&tv, NIL(struct timezone *)); \ ++ /* XXX breaks in 2038 */ \ ++ __p->startTime.seconds = tv.tv_sec; \ ++ __p->startTime.uSeconds = tv.tv_usec; \ + } \ + } + +@@ -34,8 +38,11 @@ extern void ReportVM (ml_state_t *msp, i + + #define STOP_GC_PAUSE() { \ + if (StatsOn) { \ +- gettimeofday(&(StatsBuf[NStatsRecs].stopTime), \ +- NIL(struct timezone *)); \ ++ struct timeval tv; \ ++ gettimeofday(&tv, NIL(struct timezone *)); \ ++ /* XXX breaks in 2038 */ \ ++ StatsBuf[NStatsRecs].stopTime.seconds = tv.tv_sec; \ ++ StatsBuf[NStatsRecs].stopTime.uSeconds = tv.tv_usec; \ + STATS_FINISH(); \ + } \ + } + + diff --git a/lang/smlnj11072/patches/patch-base_runtime_gc_init-gc.c b/lang/smlnj11072/patches/patch-base_runtime_gc_init-gc.c new file mode 100644 index 00000000000..fb6cfa2e4e5 --- /dev/null +++ b/lang/smlnj11072/patches/patch-base_runtime_gc_init-gc.c @@ -0,0 +1,27 @@ +$NetBSD: patch-base_runtime_gc_init-gc.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use struct timeval instead of blithely assuming that some private +struct declaration is always bit compatible with it. (Because it +isn't.) From PR 40954. + +--- base/runtime/gc/init-gc.c.orig 2009-03-03 18:15:36.000000000 -0500 ++++ base/runtime/gc/init-gc.c 2009-03-03 18:17:03.000000000 -0500 +@@ -218,12 +218,16 @@ void InitHeap (ml_state_t *msp, bool_t i + #if defined(COLLECT_STATS) + if (StatsFD > 0) { + stat_hdr_t hdr; ++ struct timeval tv; + CNTR_ZERO(&(heap->numAlloc)); + hdr.mask = STATMASK_ALLOC|STATMASK_NGENS|STATMASK_START|STATMASK_STOP; + hdr.isNewRuntime = 1; + hdr.allocSzB = params->allocSz; + hdr.numGens = params->numGens; +- gettimeofday (&(hdr.startTime), NIL(struct timezone *)); ++ gettimeofday (&tv, NIL(struct timezone *)); ++ /* XXX breaks in 2038 */ ++ hdr.startTime.seconds = tv.tv_sec; ++ hdr.startTime.uSeconds = tv.tv_usec; + write (StatsFD, (char *)&hdr, sizeof(stat_hdr_t)); + } + #endif + diff --git a/lang/smlnj11072/patches/patch-base_runtime_kernel_unix-timers.c b/lang/smlnj11072/patches/patch-base_runtime_kernel_unix-timers.c new file mode 100644 index 00000000000..443e2a2cb75 --- /dev/null +++ b/lang/smlnj11072/patches/patch-base_runtime_kernel_unix-timers.c @@ -0,0 +1,17 @@ +$NetBSD: patch-base_runtime_kernel_unix-timers.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Don't blithely assume that some internal type has the same layout as a +system type. It doesn't. Same issue as PR 40954, but a new case that I +either didn't find at the time or has appeared since. + +--- base/runtime/kernel/unix-timers.c~ 2000-06-01 18:34:03.000000000 +0000 ++++ base/runtime/kernel/unix-timers.c +@@ -18,7 +18,7 @@ typedef struct rusage time_struct_t; + #define GET_TIME(t) getrusage(RUSAGE_SELF, &(t)) + #define SYS_TIME(t) ((t).ru_stime) + #define USR_TIME(t) ((t).ru_utime) +-#define SET_TIME(tp, t) { *((struct timeval *)(tp)) = (t); } ++#define SET_TIME(tp, t) { (tp)->seconds = (t).tv_sec; (tp)->uSeconds = (t).tv_usec; } + + #else /* !HAS_GETRUSAGE */ + diff --git a/lang/smlnj11072/patches/patch-base_runtime_mach-dep_unix-prof.c b/lang/smlnj11072/patches/patch-base_runtime_mach-dep_unix-prof.c new file mode 100644 index 00000000000..a834799213b --- /dev/null +++ b/lang/smlnj11072/patches/patch-base_runtime_mach-dep_unix-prof.c @@ -0,0 +1,15 @@ +$NetBSD: patch-base_runtime_mach-dep_unix-prof.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use own abstractions correctly. + +--- base/runtime/mach-dep/unix-prof.c~ 2005-01-18 17:58:39.000000000 +0000 ++++ base/runtime/mach-dep/unix-prof.c +@@ -34,7 +34,7 @@ void EnableProfSignals () + */ + void DisableProfSignals () + { +- SIG_SetHandler (SIGVTALRM, SIG_DFL); ++ SIG_SetDefault (SIGVTALRM); + + } /* end of DisableProfSignals */ + diff --git a/lang/smlnj11072/patches/patch-base_runtime_objs_mk.x86-netbsd b/lang/smlnj11072/patches/patch-base_runtime_objs_mk.x86-netbsd new file mode 100644 index 00000000000..20f313d468f --- /dev/null +++ b/lang/smlnj11072/patches/patch-base_runtime_objs_mk.x86-netbsd @@ -0,0 +1,24 @@ +$NetBSD: patch-base_runtime_objs_mk.x86-netbsd,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Configure for pkgsrc. Build as 32-bit. + +--- base/runtime/objs/mk.x86-netbsd.orig 2015-04-22 07:11:37.000000000 +0000 ++++ base/runtime/objs/mk.x86-netbsd +@@ -7,9 +7,10 @@ SHELL = /bin/sh + + MAKE = gmake + ++AS = as --32 + ARFLAGS = Trcv + CC = gcc -ansi +-CFLAGS = -O2 ++CFLAGS = -O2 -m32 + CPP = gcc -x assembler-with-cpp -E -P + #CPP = /usr/bin/cpp -P + +@@ -23,4 +24,4 @@ VERSION = v-x86-netbsd + RUNTIME = run.x86-netbsd + + all: +- ($(MAKE) RUNTIME="$(RUNTIME)" VERSION="$(VERSION)" MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME)) ++ ($(MAKE) RUNTIME="$(RUNTIME)" VERSION="$(VERSION)" MAKE="$(MAKE)" AS="$(AS)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME)) diff --git a/lang/smlnj11072/patches/patch-src_runtime_gc_gc-stats.h b/lang/smlnj11072/patches/patch-src_runtime_gc_gc-stats.h new file mode 100644 index 00000000000..cb6fc41bd74 --- /dev/null +++ b/lang/smlnj11072/patches/patch-src_runtime_gc_gc-stats.h @@ -0,0 +1,44 @@ +$NetBSD: patch-src_runtime_gc_gc-stats.h,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use struct timeval instead of blithely assuming that some private +struct declaration is always bit compatible with it. (Because it +isn't.) From PR 40954. + +--- src/runtime/gc/gc-stats.h.orig 2009-03-03 18:23:38.000000000 -0500 ++++ src/runtime/gc/gc-stats.h 2009-03-03 18:25:04.000000000 -0500 +@@ -16,6 +16,7 @@ extern void ReportVM (ml_state_t *msp, i + + #define START_GC_PAUSE(HEAP) { \ + if (StatsOn) { \ ++ struct timeval tv; \ + heap_t *__heap = (HEAP); \ + stat_rec_t *__p = &(StatsBuf[NStatsRecs]); \ + Unsigned32_t __n = (Addr_t)(msp->ml_allocPtr) - \ +@@ -23,7 +24,10 @@ extern void ReportVM (ml_state_t *msp, i + CNTR_INCR(&(__heap->numAlloc), __n); \ + __p->allocCnt = __heap->numAlloc; \ + __p->numGens = 0; \ +- gettimeofday(&(__p->startTime), NIL(struct timezone *)); \ ++ gettimeofday(&tv, NIL(struct timezone *)); \ ++ /* XXX breaks in 2038 */ \ ++ __p->startTime.seconds = tv.tv_sec; \ ++ __p->startTime.uSeconds = tv.tv_usec; \ + } \ + } + +@@ -34,8 +38,11 @@ extern void ReportVM (ml_state_t *msp, i + + #define STOP_GC_PAUSE() { \ + if (StatsOn) { \ +- gettimeofday(&(StatsBuf[NStatsRecs].stopTime), \ +- NIL(struct timezone *)); \ ++ struct timeval tv; \ ++ gettimeofday(&tv, NIL(struct timezone *)); \ ++ /* XXX breaks in 2038 */ \ ++ StatsBuf[NStatsRecs].stopTime.seconds = tv.tv_sec; \ ++ StatsBuf[NStatsRecs].stopTime.uSeconds = tv.tv_usec; \ + STATS_FINISH(); \ + } \ + } + + diff --git a/lang/smlnj11072/patches/patch-src_runtime_gc_init-gc.c b/lang/smlnj11072/patches/patch-src_runtime_gc_init-gc.c new file mode 100644 index 00000000000..4bc98941bba --- /dev/null +++ b/lang/smlnj11072/patches/patch-src_runtime_gc_init-gc.c @@ -0,0 +1,27 @@ +$NetBSD: patch-src_runtime_gc_init-gc.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use struct timeval instead of blithely assuming that some private +struct declaration is always bit compatible with it. (Because it +isn't.) From PR 40954. + +--- src/runtime/gc/init-gc.c.orig 2009-03-03 18:15:36.000000000 -0500 ++++ src/runtime/gc/init-gc.c 2009-03-03 18:17:03.000000000 -0500 +@@ -218,12 +218,16 @@ void InitHeap (ml_state_t *msp, bool_t i + #if defined(COLLECT_STATS) + if (StatsFD > 0) { + stat_hdr_t hdr; ++ struct timeval tv; + CNTR_ZERO(&(heap->numAlloc)); + hdr.mask = STATMASK_ALLOC|STATMASK_NGENS|STATMASK_START|STATMASK_STOP; + hdr.isNewRuntime = 1; + hdr.allocSzB = params->allocSz; + hdr.numGens = params->numGens; +- gettimeofday (&(hdr.startTime), NIL(struct timezone *)); ++ gettimeofday (&tv, NIL(struct timezone *)); ++ /* XXX breaks in 2038 */ ++ hdr.startTime.seconds = tv.tv_sec; ++ hdr.startTime.uSeconds = tv.tv_usec; + write (StatsFD, (char *)&hdr, sizeof(stat_hdr_t)); + } + #endif + diff --git a/lang/smlnj11072/patches/patch-src_runtime_kernel_unix-timers.c b/lang/smlnj11072/patches/patch-src_runtime_kernel_unix-timers.c new file mode 100644 index 00000000000..5735dd686ca --- /dev/null +++ b/lang/smlnj11072/patches/patch-src_runtime_kernel_unix-timers.c @@ -0,0 +1,17 @@ +$NetBSD: patch-src_runtime_kernel_unix-timers.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Don't blithely assume that some internal type has the same layout as a +system type. It doesn't. Same issue as PR 40954, but a new case that I +either didn't find at the time or has appeared since. + +--- src/runtime/kernel/unix-timers.c~ 2000-06-01 18:34:03.000000000 +0000 ++++ src/runtime/kernel/unix-timers.c +@@ -18,7 +18,7 @@ typedef struct rusage time_struct_t; + #define GET_TIME(t) getrusage(RUSAGE_SELF, &(t)) + #define SYS_TIME(t) ((t).ru_stime) + #define USR_TIME(t) ((t).ru_utime) +-#define SET_TIME(tp, t) { *((struct timeval *)(tp)) = (t); } ++#define SET_TIME(tp, t) { (tp)->seconds = (t).tv_sec; (tp)->uSeconds = (t).tv_usec; } + + #else /* !HAS_GETRUSAGE */ + diff --git a/lang/smlnj11072/patches/patch-src_runtime_mach-dep_unix-prof.c b/lang/smlnj11072/patches/patch-src_runtime_mach-dep_unix-prof.c new file mode 100644 index 00000000000..96de4abf271 --- /dev/null +++ b/lang/smlnj11072/patches/patch-src_runtime_mach-dep_unix-prof.c @@ -0,0 +1,15 @@ +$NetBSD: patch-src_runtime_mach-dep_unix-prof.c,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Use own abstractions correctly. + +--- src/runtime/mach-dep/unix-prof.c~ 2005-01-18 17:58:39.000000000 +0000 ++++ src/runtime/mach-dep/unix-prof.c +@@ -34,7 +34,7 @@ void EnableProfSignals () + */ + void DisableProfSignals () + { +- SIG_SetHandler (SIGVTALRM, SIG_DFL); ++ SIG_SetDefault (SIGVTALRM); + + } /* end of DisableProfSignals */ + diff --git a/lang/smlnj11072/patches/patch-src_runtime_objs_mk.x86-netbsd b/lang/smlnj11072/patches/patch-src_runtime_objs_mk.x86-netbsd new file mode 100644 index 00000000000..8757c54c578 --- /dev/null +++ b/lang/smlnj11072/patches/patch-src_runtime_objs_mk.x86-netbsd @@ -0,0 +1,24 @@ +$NetBSD: patch-src_runtime_objs_mk.x86-netbsd,v 1.1 2016/07/03 18:52:32 dholland Exp $ + +Configure for pkgsrc. Build as 32-bit. + +--- src/runtime/objs/mk.x86-netbsd.orig 2015-04-22 07:11:37.000000000 +0000 ++++ src/runtime/objs/mk.x86-netbsd +@@ -7,9 +7,10 @@ SHELL = /bin/sh + + MAKE = gmake + ++AS = as --32 + ARFLAGS = Trcv + CC = gcc -ansi +-CFLAGS = -O2 ++CFLAGS = -O2 -m32 + CPP = gcc -x assembler-with-cpp -E -P + #CPP = /usr/bin/cpp -P + +@@ -23,4 +24,4 @@ VERSION = v-x86-netbsd + RUNTIME = run.x86-netbsd + + all: +- ($(MAKE) RUNTIME="$(RUNTIME)" VERSION="$(VERSION)" MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME)) ++ ($(MAKE) RUNTIME="$(RUNTIME)" VERSION="$(VERSION)" MAKE="$(MAKE)" AS="$(AS)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME)) -- cgit v1.2.3