1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
|
From 46ea925ea1044851f6b7560feeb2ef5f49ff2af4 Mon Sep 17 00:00:00 2001
From: Rob Browning <rlb@defaultvalue.org>
Date: Sat, 27 Jun 2015 11:00:55 -0500
Subject: misc.diff
---
build | 25 +++---
include/stalin-architecture-name | 12 +++
include/stalin.architectures | 128 ++++++++++++++++++++++++++++++-
makefile | 63 ++++-----------
4 files changed, 169 insertions(+), 59 deletions(-)
diff --git a/build b/build
index a678cd9..576ce69 100755
--- a/build
+++ b/build
@@ -1,5 +1,7 @@
#!/bin/sh
+set -e
+
# On SPARCv9 under Solaris you need to use cc since gcc doesn't support
# SPARCv9 under Solaris.
@@ -17,11 +19,6 @@ then
DEBIAN_SYSTEM=t
fi
-#if [ x"${DEBIAN_SYSTEM}" != x ]
-#then
-# ARCH_OPTS="${ARCH_OPTS} -g -I/usr/include/gc"
-#fi
-
if [ x"${CC}" = x ]
then
CC=gcc
@@ -39,14 +36,22 @@ case `uname -s`/`uname -r` in
# Might also try -DSILENT and either
# -DUSE_I686_PREFETCH or -DUSE_3DNOW_PREFETCH
-# The Debian conditionalization has been removed since the Debian package for
-# the Boehm GC doesn't make the mods from gc-Makefile.sed.
-#if [ x"${DEBIAN_SYSTEM}" = x ]
+# For now we use the internal libgc, even on Debian, because the
+# Debian package for the Boehm GC doesn't make the mods in
+# gc-Makefile.sed and runs out of RAM during a bootstrap build.
+
+#if [ x"${DEBIAN_SYSTEM}" != x ]
#then
+# ARCH_OPTS="${ARCH_OPTS} -g -I/usr/include/gc"
+#fi
+
+if false
+then
# Under Debian, we have libgc, but otherwise, don't assume we have the Boehm
# GC available.
rm -rf gc6.8
gunzip -c gc6.8.tar.gz | tar xf -
+ (cd gc6.8 && patch -p1 < ../debian/patches/libgc-amd64.diff)
rm -f gc6.8/Makefile.new
sed -f gc-Makefile.sed gc6.8/Makefile >gc6.8/Makefile.new
mv -f gc6.8/Makefile.new gc6.8/Makefile
@@ -58,7 +63,7 @@ case `uname -s`/`uname -r` in
cp -f gc6.8/include/gc_config_macros.h include/.
$RANLIB include/libgc.a
rm -rf gc6.8
-#fi
+fi
cd include
rm -f libstalin.a
@@ -73,7 +78,7 @@ case `./include/stalin-architecture-name` in
echo "Cannot (yet) run Stalin on this architecture"
exit 1;;
*)
- cp -f stalin-`./include/stalin-architecture-name`.c stalin.c;;
+ cp -f stalin-arch-`./include/stalin-architecture-name`.c stalin.c;;
esac
# Stalin can be compiled with -freg-struct-return on most platforms. But gcc
diff --git a/include/stalin-architecture-name b/include/stalin-architecture-name
index 45d8b41..b82b0ff 100755
--- a/include/stalin-architecture-name
+++ b/include/stalin-architecture-name
@@ -1,4 +1,16 @@
#!/bin/sh
+
+if test -e /etc/debian_version
+then
+ if test -z `which dpkg-architecture`
+ then
+ echo "Please install the dpkg-dev package."
+ exit 1
+ fi
+ echo `dpkg-architecture -qDEB_HOST_ARCH_CPU`
+ exit 0
+fi
+
case `uname -m`/`uname -s` in
i[3456]86/*)
echo "IA32";;
diff --git a/include/stalin.architectures b/include/stalin.architectures
index 64e6f98..5d5d6b3 100644
--- a/include/stalin.architectures
+++ b/include/stalin.architectures
@@ -1,3 +1,5 @@
+;;; -*-scheme-*-
+
;;; There are the following equivalence classes of architectures:
;;; IA32, ARM, M68K, PowerPC
;;; IA32-align-double, SPARC64, S390
@@ -410,4 +412,128 @@
4 ;*length-size*
4 ;*tag-size*
8 ;*squished-size*
- #t)) ;*include-malloc-for-alloca?*
+ #t) ;*include-malloc-for-alloca?*
+ ("amd64"
+ ;; Debian amd64
+ "char" ;*char*
+ "int" ;*fixnum*
+ "float" ;*flonum* when float
+ "double" ;*flonum* when double
+ "unsigned" ;*length*
+ "unsigned" ;*tag*
+ "unsigned long" ;*squished*
+ "long" ;*signed-squished*
+ "FILE" ;*file*
+ "jmp_buf" ;*jmpbuf*
+ 0 ;*char-alignment*
+ 2 ;*fixnum-alignment*
+ 2 ;*flonum-alignment* when float
+ 3 ;*flonum-alignment* when double
+ 3 ;*pointer-alignment*
+ 2 ;*length-alignment*
+ 2 ;*tag-alignment*
+ 3 ;*squished-alignment*
+ 3 ;*file-alignment*
+ 3 ;*jmpbuf-alignment*
+ 1 ;*char-size*
+ 4 ;*fixnum-size*
+ 4 ;*flonum-size* when float
+ 8 ;*flonum-size* when double
+ 8 ;*pointer-size*
+ 4 ;*length-size*
+ 4 ;*tag-size*
+ 8 ;*squished-size*
+ #f) ;*include-malloc-for-alloca?*
+ ("ia64"
+ ;; Debian ia64
+ "char" ;*char*
+ "int" ;*fixnum*
+ "float" ;*flonum* when float
+ "double" ;*flonum* when double
+ "unsigned" ;*length*
+ "unsigned" ;*tag*
+ "unsigned long" ;*squished*
+ "long" ;*signed-squished*
+ "FILE" ;*file*
+ "jmp_buf" ;*jmpbuf*
+ 0 ;*char-alignment*
+ 2 ;*fixnum-alignment*
+ 2 ;*flonum-alignment* when float
+ 3 ;*flonum-alignment* when double
+ 3 ;*pointer-alignment*
+ 2 ;*length-alignment*
+ 2 ;*tag-alignment*
+ 3 ;*squished-alignment*
+ 3 ;*file-alignment*
+ 4 ;*jmpbuf-alignment*
+ 1 ;*char-size*
+ 4 ;*fixnum-size*
+ 4 ;*flonum-size* when float
+ 8 ;*flonum-size* when double
+ 8 ;*pointer-size*
+ 4 ;*length-size*
+ 4 ;*tag-size*
+ 8 ;*squished-size*
+ #f) ;*include-malloc-for-alloca?*
+ ("i386"
+ ;; Debian i386
+ "char" ;*char*
+ "int" ;*fixnum*
+ "float" ;*flonum* when float
+ "double" ;*flonum* when double
+ "unsigned" ;*length*
+ "unsigned" ;*tag*
+ "unsigned" ;*squished*
+ "int" ;*signed-squished*
+ "FILE" ;*file*
+ "jmp_buf" ;*jmpbuf*
+ 0 ;*char-alignment*
+ 2 ;*fixnum-alignment*
+ 2 ;*flonum-alignment* when float
+ 2 ;*flonum-alignment* when double
+ 2 ;*pointer-alignment*
+ 2 ;*length-alignment*
+ 2 ;*tag-alignment*
+ 2 ;*squished-alignment*
+ 2 ;*file-alignment*
+ 2 ;*jmpbuf-alignment*
+ 1 ;*char-size*
+ 4 ;*fixnum-size*
+ 4 ;*flonum-size* when float
+ 8 ;*flonum-size* when double
+ 4 ;*pointer-size*
+ 4 ;*length-size*
+ 4 ;*tag-size*
+ 4 ;*squished-size*
+ #f) ;*include-malloc-for-alloca?*
+ ("sparc"
+ "char" ;*char*
+ "int" ;*fixnum*
+ "float" ;*flonum* when float
+ "double" ;*flonum* when double
+ "unsigned" ;*length*
+ "unsigned" ;*tag*
+ "unsigned" ;*squished*
+ "int" ;*signed-squished*
+ "FILE" ;*file*
+ "jmp_buf" ;*jmpbuf*
+ 0 ;*char-alignment*
+ 2 ;*fixnum-alignment*
+ 2 ;*flonum-alignment* when float
+ 3 ;*flonum-alignment* when double
+ 2 ;*pointer-alignment*
+ 2 ;*length-alignment*
+ 2 ;*tag-alignment*
+ 2 ;*squished-alignment*
+ 3 ;*file-alignment*
+ 2 ;*jmpbuf-alignment*
+ 1 ;*char-size*
+ 4 ;*fixnum-size*
+ 4 ;*flonum-size* when float
+ 8 ;*flonum-size* when double
+ 4 ;*pointer-size*
+ 4 ;*length-size*
+ 4 ;*tag-size*
+ 4 ;*squished-size*
+ #f) ;*include-malloc-for-alloca?*
+ )
diff --git a/makefile b/makefile
index 4563307..44c7d6b 100644
--- a/makefile
+++ b/makefile
@@ -2,19 +2,25 @@
stalin ?= ./stalin
OPTIONS = -d1 -d5 -d6 -On -t -c -db\
- -clone-size-limit 4 -split-even-if-no-widening\
+ -clone-size-limit 0 -split-even-if-no-widening\
-do-not-align-strings\
-treat-all-symbols-as-external\
-do-not-index-constant-structure-types-by-expression\
-do-not-index-allocated-structure-types-by-expression
+architectures := amd64 i386 ia64 sparc
+
+arch_c_files := $(addprefix stalin-arch-,$(addsuffix .c,$(architectures)))
+
# Stalin can be compiled with -freg-struct-return on most platforms. But gcc
# and egcs have a bug on Linux/Alpha that causes them to crash when given
# -freg-struct-return. ARCH_OPTS is set up apprpriately by ./build to handle
# this.
+CC_OPTIMIZATION ?= -O2
+
stalin: stalin.c
- $(CC) -o stalin -I./include -O3 -fomit-frame-pointer\
+ $(CC) -o stalin -I./include $(CC_OPTIMIZATION) -fomit-frame-pointer\
-fno-strict-aliasing ${ARCH_OPTS}\
stalin.c -L./include -lm -lgc
./post-make
@@ -25,53 +31,12 @@ stalin-architecture: stalin-architecture.c
stalin.c: stalin.sc
$(stalin) $(OPTIONS) stalin
-stalin-IA32.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture IA32 stalin
- mv -f stalin.c stalin-IA32.c
-
-stalin-IA32-align-double.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture IA32-align-double stalin
- mv -f stalin.c stalin-IA32-align-double.c
-
-stalin-SPARC.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture SPARC stalin
- mv -f stalin.c stalin-SPARC.c
-
-stalin-SPARCv9.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture SPARCv9 stalin
- mv -f stalin.c stalin-SPARCv9.c
-
-stalin-SPARC64.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture SPARC64 stalin
- mv -f stalin.c stalin-SPARC64.c
-
-stalin-MIPS.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture MIPS stalin
- mv -f stalin.c stalin-MIPS.c
-
-stalin-Alpha.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture Alpha stalin
- mv -f stalin.c stalin-Alpha.c
-
-stalin-ARM.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture ARM stalin
- mv -f stalin.c stalin-ARM.c
-
-stalin-M68K.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture M68K stalin
- mv -f stalin.c stalin-M68K.c
-
-stalin-PowerPC.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture PowerPC stalin
- mv -f stalin.c stalin-PowerPC.c
-
-stalin-S390.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture S390 stalin
- mv -f stalin.c stalin-S390.c
+stalin-arch-%.c: stalin.sc
+ $(stalin) $(OPTIONS) -architecture $(patsubst stalin-arch-%.c,%,$@) \
+ $(patsubst %.sc,%,$<)
+ mv -f stalin.c $@
-stalin-PowerPC64.c: stalin.sc
- $(stalin) $(OPTIONS) -architecture PowerPC64 stalin
- mv -f stalin.c stalin-PowerPC64.c
+all-precompiled-srcs: $(arch_c_files)
# Should ./include/stalin, ./stalin.c, and ./stalin only be deleted in a
# "distclean" target?
@@ -84,3 +49,5 @@ clean:
rm -f ./include/stalin
rm -f ./stalin.c
rm -f ./stalin
+ rm -f ./stalin-architecture
+ cd benchmarks && ./make-clean
\ No newline at end of file
|