add pb (portable bytecode) backend

This commit does four things:

 * Adds "pb.ss" and "pb.c", which implement a portable bytecode
   backend and interpreter that is intended for bootstrapping. A
   single set of pb bootfiles can support bootstrapping on all
   platforms --- as long as the C compiler supports a 64-bit integer
   type. The pb machine supports foreign calls for only a small set of
   recognized prototypes, and it does not support foriegn callables.
   Use `./configure --pb` to build the pb variant.

 * Changes the kernel's casts between `ptr` and `void*` types. In a pb
   build, the `ptr` type can be a 64-bit integer type while `void*` is
   a 32-bit pointer type, so casts must go through an intermediate
   integer type.

 * Adjusts the compiler to accomodate run-time-determined endianness.
   Making the compiler agnostic to word size is not practical, but
   only a few pieces depend on the target machine's endianness, and
   those can generally be deferred to a run-time choice of byte-based
   operations. The one exception is that ftype bit fields are not
   allowed unless accompanied by an explicit endianness declaration.

 * Start reducing duplication among platform-specific makefiles. For
   example, `Mf-ta6osx` chains to `Mf-a6osx` to avoid repeating most
   of it. A lot more can be done here.

original commit: 97533fa9d8b8400b0dc1a890768c7d30c91257e0
This commit is contained in:
Matthew Flatt 2020-07-17 20:31:51 -06:00
parent e9d01f1e4d
commit f78dc5724e
131 changed files with 5362 additions and 2629 deletions

28
.gitignore vendored
View File

@ -3,24 +3,17 @@
.sw? .sw?
/Makefile /Makefile
/TAGS /TAGS
/a6le/
/a6nt/
/a6osx/
/bin/ /bin/
/i3le/ /boot/
/i3nt/ /pb/
/i3osx/ /a6*/
/ta6le/ /i3*/
/ta6nt/ /ta6*/
/ta6osx/ /ti3*/
/ti3le/ /arm*/
/ti3nt/ /tarm*/
/ti3osx/ /ppc*/
/arm32le/ /tppc*/
/tarm32le/
/tarm64le/
/ppc32le/
/tppc32le/
/xc-*/ /xc-*/
*.*run *.*run
/csug/math/csug/ /csug/math/csug/
@ -55,4 +48,3 @@
/release_notes/*.htoc /release_notes/*.htoc
/release_notes/*.log /release_notes/*.log
/release_notes/release_notes.pdf /release_notes/release_notes.pdf
/boot/

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6fb m ?= a6fb
Cpu = X86_64 Cpu ?= X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} ${threadLibs} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -41,7 +41,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6le m ?= a6le
Cpu = X86_64 Cpu ?= X86_64
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid mdclib = -lm -ldl ${ncursesLib} ${threadLibs} -lrt -luuid
C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 -msse2 ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6nb m ?= a6nb
Cpu = X86_64 Cpu ?= X86_64
mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/local/include -I/usr/X11R6/include
mdclib = /usr/lib/i18n/libiconv_std.a -lm /usr/pkg/lib/libncurses.a mdclib = /usr/lib/i18n/libiconv_std.a -lm /usr/pkg/lib/libncurses.a ${threadLibs}
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wextra -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 ${warningFlags} ${optFlags} -O ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -42,7 +42,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
paxctl +m ${Scheme} paxctl +m ${Scheme}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6nt m ?= a6nt
Cpu = X86_64 Cpu ?= X86_64
clib= clib=
o = obj o = obj
@ -39,7 +39,7 @@ make.bat: vs.bat
# ------------------------------------------------------- # -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o # For cross-compilation, triggered by setting cross=t o=o
C = ${CC} ${CPPFLAGS} -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${CFLAGS}
${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps} ${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid $C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6ob m ?= a6ob
Cpu = X86_64 Cpu ?= X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} ${threadLibs} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -41,7 +41,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6osx m ?= a6osx
Cpu = X86_64 Cpu ?= X86_64
mdclib = -liconv -lm ${ncursesLib} mdclib = -liconv -lm ${ncursesLib}
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough -Werror -O2 -I/opt/X11/include/ ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 ${warningFlags} ${optFlags} -I/opt/X11/include/ ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6s2 m ?= a6s2
Cpu = X86_64 Cpu ?= X86_64
mdclib = -lnsl -ldl -lm ${cursesLib} -lrt mdclib = -lnsl -ldl -lm ${threadLibs} ${cursesLib} -lrt
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wextra -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m64" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = arm32le m ?= arm32le
Cpu = ARMV6 Cpu ?= ARMV6
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid mdclib = -lm -ldl ${ncursesLib} {$threadLibs} -lrt -luuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${CFLAGS}
o = o o = o
mdsrc = arm32le.c mdsrc ?= arm32le.c
mdobj = arm32le.o mdobj ?= arm32le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags}" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags}" ${MAKE} liblz4.a)

46
c/Mf-arm64le Normal file
View File

@ -0,0 +1,46 @@
# Mf-arm64le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m ?= tarm64le
Cpu ?= AARCH64
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid ${threadLibs}
C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${CFLAGS}
o = o
mdsrc ?= arm32le.c
mdobj ?= arm32le.o
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags}" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags}" ${MAKE} liblz4.a)

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3fb m ?= i3fb
Cpu = I386 Cpu ?= I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} ${threadLibs} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -41,7 +41,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3le m ?= i3le
Cpu = I386 Cpu ?= I386
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid mdclib = -lm -ldl ${ncursesLib} ${threadLibs} -lrt -luuid
C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -fno-stack-protector ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -msse2 ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3nb m ?= i3nb
Cpu = I386 Cpu ?= I386
mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/X11R6/include mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/X11R6/include
mdclib = /usr/lib/i18n/libiconv_std.a -lm /usr/pkg/lib/libncurses.a mdclib = /usr/lib/i18n/libiconv_std.a -lm ${threadLibs} /usr/pkg/lib/libncurses.a
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -32,7 +32,7 @@ mdobj = i3le.o
include Mf-base include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep} ${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib} ${LD} -m elf_i386 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj} ${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj} ${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
@ -42,7 +42,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
paxctl +m ${Scheme} paxctl +m ${Scheme}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3nt m ?= i3nt
Cpu = I386 Cpu ?= I386
clib= clib=
o = obj o = obj
@ -39,7 +39,7 @@ make.bat: vs.bat
# ------------------------------------------------------- # -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o # For cross-compilation, triggered by setting cross=t o=o
C = ${CC} ${CPPFLAGS} -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${CFLAGS} -D__MINGW_USE_VC2005_COMPAT
${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps} ${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid $C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3ob m ?= i3ob
Cpu = I386 Cpu ?= I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} ${threadLibs} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O ${CFLAGS} C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -41,7 +41,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3osx m ?= i3osx
Cpu = I386 Cpu ?= I386
mdclib = -liconv -lm ${ncursesLib} mdclib = -liconv -lm ${ncursesLib}
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough -Werror -O2 -msse2 -I/opt/X11/include/ ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -msse2 ${warningFlags} ${optFlags} -I/opt/X11/include/ ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3qnx m ?= i3qnx
Cpu = I386 Cpu ?= I386
mdclib = -lm /usr/local/lib/libiconv.so -lsocket ${ncursesLib} mdclib = -lm /usr/local/lib/libiconv.so -lsocket ${ncursesLib}
C = qcc ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -O2 -N2048K ${CFLAGS} C = qcc ${CPPFLAGS} -m32 -N2048K ${warningFlags} ${optFlags} ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
LocalInclude = /usr/local/include LocalInclude = /usr/local/include
.SUFFIXES: .SUFFIXES:

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3s2 m ?= i3s2
Cpu = I386 Cpu ?= I386
mdclib = -lnsl -ldl -lm ${cursesLib} -lrt mdclib = -lnsl -ldl -lm ${cursesLib} ${threadLibs} -lrt
C = ${CC} ${CFLAGS} -m32 -Wpointer-arith -Wextra -Werror -O ${CPPFLAGS} C = ${CC} ${CFLAGS} -m32 ${warningFlags} ${optFlags} ${threadFlags} ${CPPFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc ?= i3le.c
mdobj = i3le.o mdobj ?= i3le.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o

9
c/Mf-pb Normal file
View File

@ -0,0 +1,9 @@
# Mf-pb
# Override definitions in `Mf-pbhost`
m = pb
Cpu = PORTABLE_BYTECODE
mdsrc = pb.c
mdobj = pb.o
include Mf-pbhost

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = ppc32le m ?= ppc32le
Cpu = PPC32 Cpu ?= PPC32
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid mdclib = -lm -ldl ${ncursesLib} -lrt -luuid ${threadLibs}
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 ${warningFlags} ${optFlags} ${threadFlags} ${CFLAGS}
o = o o = o
mdsrc = ppc32.c mdsrc ?= ppc32.c
mdobj = ppc32.o mdobj ?= ppc32.o
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .SUFFIXES: .c .o
@ -40,7 +40,7 @@ ${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} $C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log: ../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure) (cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources} ../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a) (cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} ${optFlags} -m32" ${MAKE} liblz4.a)

View File

@ -1,47 +1,8 @@
# Mf-ta6fb # Mf-ta6fb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6fb m = ta6fb
Cpu = X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include threadLibs = -lpthread
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lpthread -lossp-uuid threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-a6fb
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,46 +1,8 @@
# Mf-ta6le # Mf-ta6le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6le m = ta6le
Cpu = X86_64
mdclib = -lm -ldl ${ncursesLib} -lpthread -lrt -luuid threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} threadFlags = -D_REENTRANT -pthread
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-a6le
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -melf_x86_64 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,48 +1,8 @@
# Mf-ta6nb # Mf-ta6nb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6nb m = ta6nb
Cpu = X86_64
mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/X11R6/include threadLibs = -lpthread
mdclib = /usr/lib/i18n/libiconv_std.a -lm /usr/pkg/lib/libncurses.a -lpthread threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-a6nb
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
paxctl +m ${Scheme}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,62 +1,5 @@
# Mf-ta6nt # Mf-ta6nt
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6nt m = ta6nt
Cpu = X86_64
clib= include Mf-a6nt
o = obj
mdobj=windows.$o
mdsrc=windows.c Makefile.$m cs.ico scheme.rc make.bat
mdclean=vs.bat make.bat scheme.res ../bin/$m/*.exp mtscheme.exe* mdscheme.exe*
cross=f
include Mf-base
${Scheme}${cross:f=}: make.bat
cmd.exe /c make.bat
cp ../bin/$m/scheme.exe ../bin/$m/petite.exe
cp ../bin/$m/scheme.pdb ../bin/$m/petite.pdb
make.bat: vs.bat
echo '@echo off' > $@
echo 'set MAKEFLAGS=' >> $@
echo 'vs.bat amd64 && nmake /f Makefile.$m /nologo %*' >> $@
chmod +x $@
# -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o
C = ${CC} ${CPPFLAGS} -O2 ${CFLAGS}
${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid
.c.$o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
../zlib/configure.log:
echo "all:" >> ../zlib/Makefile
echo ' $$(MAKE) -f win32/Makefile.gcc CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" RC="$(WINDRES)"' >> ../zlib/Makefile
touch ../zlib/configure.log
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" ${MAKE} liblz4.a)

View File

@ -1,47 +1,8 @@
# Mf-ta6ob # Mf-ta6ob
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6ob m = ta6ob
Cpu = X86_64
mdinclude = -I/usr/local/include -I/usr/X11R6/include threadLibs = -lpthread
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lpthread -lossp-uuid threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-a6ob
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,46 +1,5 @@
# Mf-ta6osx # Mf-ta6osx
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6osx m = ta6osx
Cpu = X86_64
mdclib = -liconv -lm ${ncursesLib} include Mf-a6osx
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough -Werror -g -O2 -I/opt/X11/include/ ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,46 +1,8 @@
# Mf-ta6s2 # Mf-ta6s2
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6s2 m = ta6s2
Cpu = X86_64
mdclib = -lnsl -ldl -lm -lpthread ${cursesLib} -lrt threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -m64 -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT ${CFLAGS} threadFlags = -D_REENTRANT
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-a6s2
.SUFFIXES: .c .o
.c.o:
$C -c -DSOLARIS -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -melf_x86_64 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ./configure --64)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m64" ${MAKE} liblz4.a)

View File

@ -1,46 +1,7 @@
# Mf-arm32le # Mf-tarm32le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = tarm32le m = tarm32le
Cpu = ARMV6
mdclib = -lm -ldl ${ncursesLib} -lpthread -lrt -luuid threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o
mdsrc = arm32le.c
mdobj = arm32le.o
.SUFFIXES: include Mf-arm32le
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${MAKE} liblz4.a)

View File

@ -1,46 +1,7 @@
# Mf-arm64le # Mf-tarm64le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = tarm64le m = tarm64le
Cpu = AARCH64
mdclib = -lm -ldl ${ncursesLib} -lpthread -lrt -luuid threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o
mdsrc = arm32le.c
mdobj = arm32le.o
.SUFFIXES: include Mf-arm64le
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${MAKE} liblz4.a)

View File

@ -1,47 +1,8 @@
# Mf-ti3fb # Mf-ti3fb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3fb m = ti3fb
Cpu = I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include threadLibs = -lpthread
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lpthread -lossp-uuid threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-i3fb
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,46 +1,8 @@
# Mf-ti3le # Mf-ti3le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3le m = ti3le
Cpu = I386
mdclib = -lm -ldl ${ncursesLib} -lpthread -lrt -luuid threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} threadFlags = -D_REENTRANT -pthread
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-i3le
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -melf_i386 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,48 +1,8 @@
# Mf-ti3nb # Mf-ti3nb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3nb m = ti3nb
Cpu = I386
mdinclude = -I/usr/X11R7/include -I/usr/pkg/include -I/usr/pkg/include/ncurses -I/usr/X11R6/include threadLibs = -lpthread
mdclib = /usr/lib/i18n/libiconv_std.a -lm /usr/pkg/lib/libncurses.a -lpthread threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-i3nb
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -m elf_i386 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
paxctl +m ${Scheme}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,62 +1,5 @@
# Mf-ti3nt # Mf-ti3nt
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3nt m = ti3nt
Cpu = I386
clib= include Mf-i3nt
o = obj
mdobj=windows.$o
mdsrc=windows.c Makefile.$m cs.ico scheme.rc make.bat
mdclean=vs.bat make.bat scheme.res ../bin/$m/*.exp mtscheme.exe* mdscheme.exe*
cross=f
include Mf-base
${Scheme}${cross:f=}: make.bat
cmd.exe /c make.bat
cp ../bin/$m/scheme.exe ../bin/$m/petite.exe
cp ../bin/$m/scheme.pdb ../bin/$m/petite.pdb
make.bat: vs.bat
echo '@echo off' > $@
echo 'set MAKEFLAGS=' >> $@
echo 'vs.bat x86 && nmake /f Makefile.$m /nologo %*' >> $@
chmod +x $@
# -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o
C = ${CC} ${CPPFLAGS} -O2 ${CFLAGS} -D__MINGW_USE_VC2005_COMPAT
${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid
.c.$o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
../zlib/configure.log:
echo "all:" >> ../zlib/Makefile
echo ' $$(MAKE) -f win32/Makefile.gcc CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" RC="$(WINDRES)"' >> ../zlib/Makefile
touch ../zlib/configure.log
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" ${MAKE} liblz4.a)

View File

@ -1,47 +1,8 @@
# Mf-ti3ob # Mf-ti3ob
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3ob m = ti3ob
Cpu = I386
mdinclude = -I/usr/local/include -I/usr/X11R6/include threadLibs = -lpthread
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lpthread -lossp-uuid threadFlags = -D_REENTRANT -pthread
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-i3ob
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} ${mdinclude} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,46 +1,5 @@
# Mf-ti3osx # Mf-ti3osx
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3osx m = ti3osx
Cpu = I386
mdclib = -liconv -lm ${ncursesLib} include Mf-i3osx
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough -Werror -g -O2 -msse2 -I/opt/X11/include/ ${CFLAGS}
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,46 +1,8 @@
# Mf-ti3s2 # Mf-ti3s2
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3s2 m = ti3s2
Cpu = I386
mdclib = -lnsl -ldl -lm -lpthread ${cursesLib} -lrt threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -O2 -D_REENTRANT ${CFLAGS} threadFlags = -D_REENTRANT
o = o
mdsrc = i3le.c
mdobj = i3le.o
.SUFFIXES: include Mf-i3s2
.SUFFIXES: .c .o
.c.o:
$C -c -DSOLARIS -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -melf_i386 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -1,46 +1,8 @@
# Mf-tppc32le # Mf-tppc32le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = tppc32le m = tppc32le
Cpu = PPC32
mdclib = -lm -ldl ${ncursesLib} -lpthread -lrt -luuid threadLibs = -lpthread
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} threadFlags = -D_REENTRANT -pthread
o = o
mdsrc = ppc32le.c
mdobj = ppc32le.o
.SUFFIXES: include Mf-ppc32le
.SUFFIXES: .c .o
.c.o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
include Mf-base
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
../zlib/configure.log:
(cd ../zlib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ./configure)
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; ${SetConfigEnv} CFLAGS="${CFLAGS} -m32" ${MAKE} liblz4.a)

View File

@ -153,7 +153,7 @@ ptr S_compute_bytes_allocated(xg, xs) ptr xg; ptr xs; {
n += S_G.bytes_of_space[s][g]; n += S_G.bytes_of_space[s][g];
/* add in bytes in active segments */ /* add in bytes in active segments */
if (S_G.next_loc[s][g] != FIX(0)) if (S_G.next_loc[s][g] != FIX(0))
n += (char *)S_G.next_loc[s][g] - (char *)S_G.base_loc[s][g]; n += (uptr)S_G.next_loc[s][g] - (uptr)S_G.base_loc[s][g];
} }
if (g == S_G.max_nonstatic_generation) if (g == S_G.max_nonstatic_generation)
g = static_generation; g = static_generation;
@ -183,7 +183,7 @@ static void maybe_fire_collector() {
bytes += S_G.bytes_of_space[s][0]; bytes += S_G.bytes_of_space[s][0];
/* bytes in current block of segments */ /* bytes in current block of segments */
if (S_G.next_loc[s][0] != FIX(0)) if (S_G.next_loc[s][0] != FIX(0))
bytes += (char *)S_G.next_loc[s][0] - (char *)S_G.base_loc[s][0]; bytes += (uptr)S_G.next_loc[s][0] - (uptr)S_G.base_loc[s][0];
} }
/* arbitrary fudge factor to account for space we may not be using yet /* arbitrary fudge factor to account for space we may not be using yet
@ -231,10 +231,10 @@ ptr S_find_more_room(s, g, n, old) ISPC s; IGEN g; iptr n; ptr old; {
S_G.first_loc[s][g] = new; S_G.first_loc[s][g] = new;
} else { } else {
/* increment bytes_allocated by the closed-off partial segment */ /* increment bytes_allocated by the closed-off partial segment */
S_G.bytes_of_space[s][g] += (char *)old - (char *)S_G.base_loc[s][g]; S_G.bytes_of_space[s][g] += (uptr)old - (uptr)S_G.base_loc[s][g];
/* lay down an end-of-segment marker */ /* lay down an end-of-segment marker */
*(ptr*)old = forward_marker; *(ptr*)TO_VOIDP(old) = forward_marker;
*((ptr*)old + 1) = new; *((ptr*)TO_VOIDP(old) + 1) = new;
} }
/* base address of current block of segments to track amount of allocation */ /* base address of current block of segments to track amount of allocation */
@ -307,7 +307,7 @@ FORCEINLINE void mark_segment_dirty(seginfo *si, IGEN from_g) {
void S_dirty_set(ptr *loc, ptr x) { void S_dirty_set(ptr *loc, ptr x) {
*loc = x; *loc = x;
if (!Sfixnump(x)) { if (!Sfixnump(x)) {
seginfo *si = SegInfo(addr_get_segment(loc)); seginfo *si = SegInfo(addr_get_segment(TO_PTR(loc)));
if (si->use_marks) { if (si->use_marks) {
/* GC must be in progress */ /* GC must be in progress */
if (!IMMEDIATE(x)) { if (!IMMEDIATE(x)) {
@ -318,7 +318,7 @@ void S_dirty_set(ptr *loc, ptr x) {
} else { } else {
IGEN from_g = si->generation; IGEN from_g = si->generation;
if (from_g != 0) { if (from_g != 0) {
si->dirty_bytes[((uptr)loc >> card_offset_bits) & ((1 << segment_card_offset_bits) - 1)] = 0; si->dirty_bytes[((uptr)TO_PTR(loc) >> card_offset_bits) & ((1 << segment_card_offset_bits) - 1)] = 0;
mark_segment_dirty(si, from_g); mark_segment_dirty(si, from_g);
} }
} }
@ -326,13 +326,13 @@ void S_dirty_set(ptr *loc, ptr x) {
} }
/* scan remembered set from P to ENDP, transfering to dirty vector */ /* scan remembered set from P to ENDP, transfering to dirty vector */
void S_scan_dirty(ptr **p, ptr **endp) { void S_scan_dirty(ptr *p, ptr *endp) {
uptr this, last; uptr this, last;
last = 0; last = 0;
while (p < endp) { while (p < endp) {
ptr *loc = *p; ptr loc = *p;
/* whether building s directory or running UXLB code, the most /* whether building s directory or running UXLB code, the most
common situations are that *loc is a fixnum, this == last, or loc common situations are that *loc is a fixnum, this == last, or loc
is in generation 0. the generated code no longer adds elements is in generation 0. the generated code no longer adds elements
@ -369,7 +369,7 @@ void S_scan_remembered_set() {
eap = (uptr)EAP(tc); eap = (uptr)EAP(tc);
real_eap = (uptr)REAL_EAP(tc); real_eap = (uptr)REAL_EAP(tc);
S_scan_dirty((ptr **)eap, (ptr **)real_eap); S_scan_dirty(TO_VOIDP(eap), TO_VOIDP(real_eap));
eap = real_eap; eap = real_eap;
if (eap - ap > alloc_waste_maximum) { if (eap - ap > alloc_waste_maximum) {
@ -410,7 +410,7 @@ ptr S_get_more_room_help(ptr tc, uptr ap, uptr type, uptr size) {
tc_mutex_acquire() tc_mutex_acquire()
S_scan_dirty((ptr **)eap, (ptr **)real_eap); S_scan_dirty(TO_VOIDP(eap), TO_VOIDP(real_eap));
eap = real_eap; eap = real_eap;
if (eap - ap >= size) { if (eap - ap >= size) {
@ -461,15 +461,15 @@ void S_list_bits_set(p, bits) ptr p; iptr bits; {
If a race loses bits, that's ok, as long as it's unlikely. */ If a race loses bits, that's ok, as long as it's unlikely. */
if (!si->list_bits) { if (!si->list_bits) {
ptr list_bits; void *list_bits;
if (si->generation == 0) { if (si->generation == 0) {
ptr tc = get_thread_context(); ptr tc = get_thread_context();
thread_find_room(tc, typemod, ptr_align(segment_bitmap_bytes), list_bits); thread_find_room_voidp(tc, ptr_align(segment_bitmap_bytes), list_bits);
} else { } else {
tc_mutex_acquire() tc_mutex_acquire()
find_room(space_data, si->generation, typemod, ptr_align(segment_bitmap_bytes), list_bits); find_room_voidp(space_data, si->generation, ptr_align(segment_bitmap_bytes), list_bits);
tc_mutex_release() tc_mutex_release()
} }
@ -514,8 +514,8 @@ ptr S_ephemeron_cons_in(gen, car, cdr) IGEN gen; ptr car, cdr; {
find_room(space_ephemeron, gen, type_pair, size_ephemeron, p); find_room(space_ephemeron, gen, type_pair, size_ephemeron, p);
INITCAR(p) = car; INITCAR(p) = car;
INITCDR(p) = cdr; INITCDR(p) = cdr;
EPHEMERONPREVREF(p) = NULL; EPHEMERONPREVREF(p) = 0;
EPHEMERONNEXT(p) = NULL; EPHEMERONNEXT(p) = 0;
return p; return p;
} }
@ -958,7 +958,7 @@ ptr S_code(tc, type, n) ptr tc; iptr type, n; {
/* we record the code modification here, even though we haven't /* we record the code modification here, even though we haven't
even started modifying the code yet, since we always create even started modifying the code yet, since we always create
and fill the code object within a critical section. */ and fill the code object within a critical section. */
S_record_code_mod(tc, (uptr)&CODEIT(p,0), (uptr)n); S_record_code_mod(tc, (uptr)TO_PTR(&CODEIT(p,0)), (uptr)n);
return p; return p;
} }

View File

@ -472,9 +472,9 @@ static INT glzemit_lz4(lz4File_out *lz4, void *buffer, UINT count) {
/* allocate one out_buffer (per thread) since we don't need one for each file. /* allocate one out_buffer (per thread) since we don't need one for each file.
the buffer is freed by destroy_thread. */ the buffer is freed by destroy_thread. */
if ((cached_out_buffer = LZ4OUTBUFFER(tc)) == NULL || cached_out_buffer->size < lz4->out_buffer_size) { if ((cached_out_buffer = TO_VOIDP(LZ4OUTBUFFER(tc))) == NULL || cached_out_buffer->size < lz4->out_buffer_size) {
if (cached_out_buffer != NULL) free(cached_out_buffer); if (cached_out_buffer != NULL) free(cached_out_buffer);
if ((LZ4OUTBUFFER(tc) = cached_out_buffer = malloc(sizeof(sized_buffer) + lz4->out_buffer_size)) == NULL) return -1; if ((LZ4OUTBUFFER(tc) = TO_PTR(cached_out_buffer = malloc(sizeof(sized_buffer) + lz4->out_buffer_size))) == 0) return -1;
cached_out_buffer->size = lz4->out_buffer_size; cached_out_buffer->size = lz4->out_buffer_size;
} }
out_buffer = cached_out_buffer->buffer; out_buffer = cached_out_buffer->buffer;

View File

@ -67,7 +67,7 @@ extern ptr S_compute_bytes_allocated PROTO((ptr xg, ptr xs));
extern ptr S_bytes_finalized PROTO(()); extern ptr S_bytes_finalized PROTO(());
extern ptr S_find_more_room PROTO((ISPC s, IGEN g, iptr n, ptr old)); extern ptr S_find_more_room PROTO((ISPC s, IGEN g, iptr n, ptr old));
extern void S_dirty_set PROTO((ptr *loc, ptr x)); extern void S_dirty_set PROTO((ptr *loc, ptr x));
extern void S_scan_dirty PROTO((ptr **p, ptr **endp)); extern void S_scan_dirty PROTO((ptr *p, ptr *endp));
extern void S_scan_remembered_set PROTO((void)); extern void S_scan_remembered_set PROTO((void));
extern void S_get_more_room PROTO((void)); extern void S_get_more_room PROTO((void));
extern ptr S_get_more_room_help PROTO((ptr tc, uptr ap, uptr type, uptr size)); extern ptr S_get_more_room_help PROTO((ptr tc, uptr ap, uptr type, uptr size));
@ -120,6 +120,9 @@ extern int S_fasl_intern_rtd(ptr *x);
#ifdef X86_64 #ifdef X86_64
extern void x86_64_set_popcount_present PROTO((ptr code)); extern void x86_64_set_popcount_present PROTO((ptr code));
#endif #endif
#ifdef PORTABLE_BYTECODE_BIGENDIAN
extern void S_swap_dounderflow_header_endian PROTO((ptr code));
#endif
/* vfasl.c */ /* vfasl.c */
extern ptr S_to_vfasl PROTO((ptr v)); extern ptr S_to_vfasl PROTO((ptr v));
@ -230,14 +233,8 @@ extern void S_glzclearerr PROTO((glzFile fdfile));
extern INT S_gzxfile_fd PROTO((ptr x)); extern INT S_gzxfile_fd PROTO((ptr x));
extern glzFile S_gzxfile_gzfile PROTO((ptr x)); extern glzFile S_gzxfile_gzfile PROTO((ptr x));
extern ptr S_new_open_input_fd PROTO((const char *filename, IBOOL compressed)); extern ptr S_new_open_input_fd PROTO((const char *filename, IBOOL compressed));
extern ptr S_new_open_output_fd PROTO(( extern ptr S_new_open_output_fd PROTO((const char *filename, INT mode, INT options));
const char *filename, INT mode, extern ptr S_new_open_input_output_fd PROTO((const char *filename, INT mode, INT options));
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed));
extern ptr S_new_open_input_output_fd PROTO((
const char *filename, INT mode,
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed));
extern ptr S_close_fd PROTO((ptr file, IBOOL gzflag)); extern ptr S_close_fd PROTO((ptr file, IBOOL gzflag));
extern ptr S_compress_input_fd PROTO((INT fd, I64 fp)); extern ptr S_compress_input_fd PROTO((INT fd, I64 fp));
extern ptr S_compress_output_fd PROTO((INT fd)); extern ptr S_compress_output_fd PROTO((INT fd));
@ -414,6 +411,11 @@ extern void S_call_help PROTO((ptr tc, IBOOL singlep, IBOOL lock_ts));
extern void S_call_one_result PROTO((void)); extern void S_call_one_result PROTO((void));
extern void S_call_any_results PROTO((void)); extern void S_call_any_results PROTO((void));
#ifdef PORTABLE_BYTECODE
/* pb.c */
extern void S_pb_interp(ptr tc, void *bytecode);
#endif
#ifdef WIN32 #ifdef WIN32
/* windows.c */ /* windows.c */
extern INT S_getpagesize(void); extern INT S_getpagesize(void);

192
c/fasl.c
View File

@ -232,6 +232,10 @@ static void faslin PROTO((ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f));
static void fasl_record PROTO((ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr size)); static void fasl_record PROTO((ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr size));
static IBOOL rtd_equiv PROTO((ptr x, ptr y)); static IBOOL rtd_equiv PROTO((ptr x, ptr y));
static IBOOL equalp PROTO((ptr x, ptr y)); static IBOOL equalp PROTO((ptr x, ptr y));
#ifdef PORTABLE_BYTECODE
static void pb_set_abs PROTO((void *address, uptr item));
static uptr pb_get_abs PROTO((void *address));
#endif /* AARCH64 */
#ifdef ARMV6 #ifdef ARMV6
static void arm32_set_abs PROTO((void *address, uptr item)); static void arm32_set_abs PROTO((void *address, uptr item));
static uptr arm32_get_abs PROTO((void *address)); static uptr arm32_get_abs PROTO((void *address));
@ -262,6 +266,9 @@ static U32 adjust_delay_inst PROTO((U32 delay_inst, U32 *old_call_addr, U32 *new
static INT sparc64_set_lit_only PROTO((void *address, uptr item, I32 destreg)); static INT sparc64_set_lit_only PROTO((void *address, uptr item, I32 destreg));
static void sparc64_set_literal PROTO((void *address, uptr item)); static void sparc64_set_literal PROTO((void *address, uptr item));
#endif /* SPARC64 */ #endif /* SPARC64 */
#ifdef PORTABLE_BYTECODE_BIGENDIAN
static void swap_code_endian(octet *code, uptr len);
#endif
static double s_nan; static double s_nan;
@ -556,7 +563,7 @@ static ptr bv_fasl_entry(ptr tc, ptr bv, int ty, uptr offset, uptr len, unbufFas
struct faslFileObj ffo; struct faslFileObj ffo;
if (ty == fasl_type_vfasl) { if (ty == fasl_type_vfasl) {
x = S_vfasl(bv, (ptr)0, offset, len); x = S_vfasl(bv, NULL, offset, len);
} else if (ty == fasl_type_fasl) { } else if (ty == fasl_type_fasl) {
ffo.size = len; ffo.size = len;
ffo.next = ffo.buf = &BVIT(bv, offset); ffo.next = ffo.buf = &BVIT(bv, offset);
@ -1021,6 +1028,9 @@ static void faslin(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f) {
S_G.profile_counters = Scons(S_weak_cons(co, pinfos), S_G.profile_counters); S_G.profile_counters = Scons(S_weak_cons(co, pinfos), S_G.profile_counters);
} }
bytesin((octet *)&CODEIT(co, 0), n, f); bytesin((octet *)&CODEIT(co, 0), n, f);
#ifdef PORTABLE_BYTECODE_BIGENDIAN
swap_code_endian((octet *)&CODEIT(co, 0), n);
#endif
m = uptrin(f); m = uptrin(f);
CODERELOC(co) = reloc = S_relocation_table(m); CODERELOC(co) = reloc = S_relocation_table(m);
RELOCCODE(reloc) = co; RELOCCODE(reloc) = co;
@ -1095,37 +1105,46 @@ static void faslin(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f) {
#define big 0 #define big 0
#define little 1 #define little 1
#ifdef PORTABLE_BYTECODE
# ifdef PORTABLE_BYTECODE_BIGENDIAN
# define unknown big
# else
# define unknown little
# endif
#else
# define unknown 3
#endif
static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr size) { static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr size) {
uptr n, addr; ptr p; UINT padty; uptr n, addr; ptr p; UINT padty;
n = uptrin(f); n = uptrin(f);
*x = p = S_record(size_record_inst(size)); *x = p = S_record(size_record_inst(size));
faslin(tc, &RECORDINSTTYPE(p), t, pstrbuf, f); faslin(tc, &RECORDINSTTYPE(p), t, pstrbuf, f);
addr = (uptr)&RECORDINSTIT(p, 0); addr = (uptr)TO_PTR(&RECORDINSTIT(p, 0));
for (; n != 0; n -= 1) { for (; n != 0; n -= 1) {
padty = bytein(f); padty = bytein(f);
addr += padty >> 4; addr += padty >> 4;
switch (padty & 0xf) { switch (padty & 0xf) {
case fasl_fld_ptr: case fasl_fld_ptr:
faslin(tc, (ptr *)addr, t, pstrbuf, f); faslin(tc, TO_VOIDP(addr), t, pstrbuf, f);
addr += sizeof(ptr); addr += sizeof(ptr);
break; break;
case fasl_fld_u8: case fasl_fld_u8:
*(U8 *)addr = (U8)bytein(f); *(U8 *)TO_VOIDP(addr) = (U8)bytein(f);
addr += 1; addr += 1;
break; break;
case fasl_fld_i16: case fasl_fld_i16:
*(I16 *)addr = (I16)iptrin(f); *(I16 *)TO_VOIDP(addr) = (I16)iptrin(f);
addr += 2; addr += 2;
break; break;
case fasl_fld_i24: { case fasl_fld_i24: {
iptr q = iptrin(f); iptr q = iptrin(f);
#if (native_endianness == little) #if (native_endianness == little)
*(U16 *)addr = (U16)q; *(U16 *)TO_VOIDP(addr) = (U16)q;
*(U8 *)(addr + 2) = (U8)(q >> 16); *(U8 *)TO_VOIDP(addr + 2) = (U8)(q >> 16);
#elif (native_endianness == big) #elif (native_endianness == big)
*(U16 *)addr = (U16)(q >> 8); *(U16 *)TO_VOIDP(addr) = (U16)(q >> 8);
*(U8 *)(addr + 2) = (U8)q; *(U8 *)TO_VOIDP(addr + 2) = (U8)q;
#else #else
unexpected_endianness(); unexpected_endianness();
#endif #endif
@ -1133,7 +1152,7 @@ static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr si
break; break;
} }
case fasl_fld_i32: case fasl_fld_i32:
*(I32 *)addr = (I32)iptrin(f); *(I32 *)TO_VOIDP(addr) = (I32)iptrin(f);
addr += 4; addr += 4;
break; break;
case fasl_fld_i40: { case fasl_fld_i40: {
@ -1147,11 +1166,11 @@ static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr si
unexpected_ptr_bits(); unexpected_ptr_bits();
#endif #endif
#if (native_endianness == little) #if (native_endianness == little)
*(U32 *)addr = (U32)q; *(U32 *)TO_VOIDP(addr) = (U32)q;
*(U8 *)(addr + 4) = (U8)(q >> 32); *(U8 *)TO_VOIDP(addr + 4) = (U8)(q >> 32);
#elif (native_endianness == big) #elif (native_endianness == big)
*(U32 *)addr = (U32)(q >> 8); *(U32 *)TO_VOIDP(addr) = (U32)(q >> 8);
*(U8 *)(addr + 4) = (U8)q; *(U8 *)TO_VOIDP(addr + 4) = (U8)q;
#else #else
unexpected_endianness(); unexpected_endianness();
#endif #endif
@ -1169,11 +1188,11 @@ static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr si
unexpected_ptr_bits(); unexpected_ptr_bits();
#endif #endif
#if (native_endianness == little) #if (native_endianness == little)
*(U32 *)addr = (U32)q; *(U32 *)TO_VOIDP(addr) = (U32)q;
*(U16 *)(addr + 4) = (U16)(q >> 32); *(U16 *)TO_VOIDP(addr + 4) = (U16)(q >> 32);
#elif (native_endianness == big) #elif (native_endianness == big)
*(U32 *)addr = (U32)(q >> 16); *(U32 *)TO_VOIDP(addr) = (U32)(q >> 16);
*(U16 *)(addr + 4) = (U16)q; *(U16 *)TO_VOIDP(addr + 4) = (U16)q;
#else #else
unexpected_endianness(); unexpected_endianness();
#endif #endif
@ -1191,12 +1210,12 @@ static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr si
unexpected_ptr_bits(); unexpected_ptr_bits();
#endif #endif
#if (native_endianness == little) #if (native_endianness == little)
*(U32 *)addr = (U32)q; *(U32 *)TO_VOIDP(addr) = (U32)q;
*(U16 *)(addr + 4) = (U16)(q >> 32); *(U16 *)TO_VOIDP(addr + 4) = (U16)(q >> 32);
*(U8 *)(addr + 6) = (U8)(q >> 48); *(U8 *)TO_VOIDP(addr + 6) = (U8)(q >> 48);
#elif (native_endianness == big) #elif (native_endianness == big)
*(U32 *)addr = (U32)(q >> 24); *(U32 *)TO_VOIDP(addr) = (U32)(q >> 24);
*(U32 *)(addr + 3) = (U32)q; *(U32 *)TO_VOIDP(addr + 3) = (U32)q;
#else #else
unexpected_endianness(); unexpected_endianness();
#endif #endif
@ -1213,16 +1232,16 @@ static void fasl_record(ptr tc, ptr *x, ptr t, ptr *pstrbuf, faslFile f, uptr si
#else #else
unexpected_ptr_bits(); unexpected_ptr_bits();
#endif #endif
*(I64 *)addr = q; *(I64 *)TO_VOIDP(addr) = q;
addr += 8; addr += 8;
break; break;
} }
case fasl_fld_single: case fasl_fld_single:
*(float *)addr = (float)singlein(f); *(float *)TO_VOIDP(addr) = (float)singlein(f);
addr += sizeof(float); addr += sizeof(float);
break; break;
case fasl_fld_double: case fasl_fld_double:
*(double *)addr = (double)doublein(f); *(double *)TO_VOIDP(addr) = (double)doublein(f);
addr += sizeof(double); addr += sizeof(double);
break; break;
default: default:
@ -1318,12 +1337,18 @@ INT pax_encode21(INT n)
void S_set_code_obj(who, typ, p, n, x, o) char *who; IFASLCODE typ; iptr n, o; ptr p, x; { void S_set_code_obj(who, typ, p, n, x, o) char *who; IFASLCODE typ; iptr n, o; ptr p, x; {
void *address; uptr item; void *address; uptr item;
address = (void *)((uptr)p + n); address = TO_VOIDP((uptr)p + n);
item = (uptr)x + o; item = (uptr)x + o;
switch (typ) { switch (typ) {
case reloc_abs: case reloc_abs:
*(uptr *)address = item; *(uptr *)address = item;
break; break;
#ifdef PORTABLE_BYTECODE
case reloc_pb_abs:
case reloc_pb_proc:
pb_set_abs(address, item);
break;
#endif /* AARCH64 */
#ifdef ARMV6 #ifdef ARMV6
case reloc_arm32_abs: case reloc_arm32_abs:
arm32_set_abs(address, item); arm32_set_abs(address, item);
@ -1406,11 +1431,17 @@ void S_set_code_obj(who, typ, p, n, x, o) char *who; IFASLCODE typ; iptr n, o; p
ptr S_get_code_obj(typ, p, n, o) IFASLCODE typ; iptr n, o; ptr p; { ptr S_get_code_obj(typ, p, n, o) IFASLCODE typ; iptr n, o; ptr p; {
void *address; uptr item; void *address; uptr item;
address = (void *)((uptr)p + n); address = TO_VOIDP((uptr)p + n);
switch (typ) { switch (typ) {
case reloc_abs: case reloc_abs:
item = *(uptr *)address; item = *(uptr *)address;
break; break;
#ifdef PORTABLE_BYTECODE
case reloc_pb_abs:
case reloc_pb_proc:
item = pb_get_abs(address);
break;
#endif /* AARCH64 */
#ifdef ARMV6 #ifdef ARMV6
case reloc_arm32_abs: case reloc_arm32_abs:
item = arm32_get_abs(address); item = arm32_get_abs(address);
@ -1479,6 +1510,33 @@ ptr S_get_code_obj(typ, p, n, o) IFASLCODE typ; iptr n, o; ptr p; {
} }
#ifdef PORTABLE_BYTECODE
/* Address pieces in a movz,movk,movk,movk sequence are upper 16 bits */
#define ADDRESS_BITS_SHIFT 16
#define ADDRESS_BITS_MASK ((U32)0xffff0000)
static void pb_set_abs(void *address, uptr item) {
((U32 *)address)[0] = ((((U32 *)address)[0] & ~ADDRESS_BITS_MASK) | ((item & 0xFFFF) << ADDRESS_BITS_SHIFT));
((U32 *)address)[1] = ((((U32 *)address)[1] & ~ADDRESS_BITS_MASK) | (((item >> 16) & 0xFFFF) << ADDRESS_BITS_SHIFT));
#if ptr_bytes == 8
((U32 *)address)[2] = ((((U32 *)address)[2] & ~ADDRESS_BITS_MASK) | (((item >> 32) & 0xFFFF) << ADDRESS_BITS_SHIFT));
((U32 *)address)[3] = ((((U32 *)address)[3] & ~ADDRESS_BITS_MASK) | (((item >> 48) & 0xFFFF) << ADDRESS_BITS_SHIFT));
#endif
}
static uptr pb_get_abs(void *address) {
return ((uptr)((((U32 *)address)[0] & ADDRESS_BITS_MASK) >> ADDRESS_BITS_SHIFT)
| ((uptr)((((U32 *)address)[1] & ADDRESS_BITS_MASK) >> ADDRESS_BITS_SHIFT) << 16)
#if ptr_bytes == 8
| ((uptr)((((U32 *)address)[2] & ADDRESS_BITS_MASK) >> ADDRESS_BITS_SHIFT) << 32)
| ((uptr)((((U32 *)address)[3] & ADDRESS_BITS_MASK) >> ADDRESS_BITS_SHIFT) << 48)
#endif
);
}
#endif /* AARCH64 */
#ifdef ARMV6 #ifdef ARMV6
static void arm32_set_abs(void *address, uptr item) { static void arm32_set_abs(void *address, uptr item) {
/* code generator produces ldrlit destreg, 0; brai 0; long 0 */ /* code generator produces ldrlit destreg, 0; brai 0; long 0 */
@ -1852,3 +1910,81 @@ static void sparc64_set_literal(address, item) void *address; uptr item; {
sparc64_set_lit_only(address, item, destreg); sparc64_set_lit_only(address, item, destreg);
} }
#endif /* SPARC64 */ #endif /* SPARC64 */
#ifdef PORTABLE_BYTECODE_BIGENDIAN
static void swap_code_endian(octet *code, uptr len)
{
octet *next_rpheader = NULL;
uptr header_size = 0;
while (len > 0) {
if (code == next_rpheader) {
/* swap 8-byte segments while we're in the header */
while (header_size > 0) {
octet a = code[0];
octet b = code[1];
octet c = code[2];
octet d = code[3];
octet e = code[4];
octet f = code[5];
octet g = code[6];
octet h = code[7];
code[0] = h;
code[1] = g;
code[2] = f;
code[3] = e;
code[4] = d;
code[5] = c;
code[6] = b;
code[7] = a;
code += 8;
len -= 8;
header_size -= 8;
}
} else {
/* swap a 4-byte instruction */
octet a = code[0];
octet b = code[1];
octet c = code[2];
octet d = code[3];
code[0] = d;
code[1] = c;
code[2] = b;
code[3] = a;
if (a == pb_adr) {
/* after a few more instructions, we'll hit
a header where 64-bit values needs to be
swapped, instead of 32-bit values */
uptr delta = ((uptr)d << 16) + c;
octet *after_rpheader = code + 4 + delta;
if (after_rpheader[-8] & 0x1)
header_size = size_rp_compact_header;
else
header_size = size_rp_header;
next_rpheader = after_rpheader - header_size;
}
code += 4;
len -= 4;
}
}
}
void S_swap_dounderflow_header_endian(ptr co)
{
/* The `dounderflow` library entry starts with a header, so
it does not have a `pb_adr` instruction before. We need
to finish swapping the header's `ptr`-sized values, but
the mv-return address is already linked, so the only
thing to fix turns out to be the first `ptr`. */
uint32_t *code = (uint32_t *)&CODEIT(co, 0);
uint32_t a = code[0];
uint32_t b = code[1];
code[0] = b;
code[1] = a;
}
#endif

View File

@ -23,8 +23,8 @@
/* we can now return arbitrary values (aligned or not) /* we can now return arbitrary values (aligned or not)
* since the garbage collector ignores addresses outside of the heap * since the garbage collector ignores addresses outside of the heap
* or within foreign segments */ * or within foreign segments */
#define ptr_to_addr(p) ((void *)p) #define ptr_to_addr(p) TO_VOIDP(p)
#define addr_to_ptr(a) ((ptr)a) #define addr_to_ptr(a) TO_PTR(a)
/* buckets should be prime */ /* buckets should be prime */
#define buckets 457 #define buckets 457
@ -52,7 +52,9 @@
/* locally defined functions */ /* locally defined functions */
static iptr symhash PROTO((const char *s)); static iptr symhash PROTO((const char *s));
static ptr lookup_static PROTO((const char *s)); static ptr lookup_static PROTO((const char *s));
#ifdef LOAD_SHARED_OBJECT
static ptr lookup_dynamic PROTO((const char *s, ptr tbl)); static ptr lookup_dynamic PROTO((const char *s, ptr tbl));
#endif
static ptr lookup PROTO((const char *s)); static ptr lookup PROTO((const char *s));
static ptr remove_foreign_entry PROTO((const char *s)); static ptr remove_foreign_entry PROTO((const char *s));
static void *lookup_foreign_entry PROTO((const char *s)); static void *lookup_foreign_entry PROTO((const char *s));
@ -129,10 +131,9 @@ static ptr lookup_dynamic(s, tbl) const char *s; ptr tbl; {
static ptr lookup(s) const char *s; { static ptr lookup(s) const char *s; {
iptr b; ptr p; iptr b; ptr p;
#ifdef LOOKUP_DYNAMIC
ptr x; ptr x;
#ifdef LOOKUP_DYNAMIC
x = lookup_dynamic(s, S_foreign_dynamic); x = lookup_dynamic(s, S_foreign_dynamic);
if (x == addr_to_ptr(0)) if (x == addr_to_ptr(0))
#endif /* LOOKUP_DYNAMIC */ #endif /* LOOKUP_DYNAMIC */

210
c/gc.c
View File

@ -266,7 +266,7 @@ uptr list_length(ptr ls) {
#endif #endif
#define init_mask(dest, tg, init) { \ #define init_mask(dest, tg, init) { \
find_room(space_data, tg, typemod, ptr_align(segment_bitmap_bytes), dest); \ find_room_voidp(space_data, tg, ptr_align(segment_bitmap_bytes), dest); \
memset(dest, init, segment_bitmap_bytes); \ memset(dest, init, segment_bitmap_bytes); \
} }
@ -291,7 +291,7 @@ static int flonum_is_forwarded_p(ptr p, seginfo *si) {
return si->forwarded_flonums[segment_bitmap_byte(p)] & segment_bitmap_bit(p); return si->forwarded_flonums[segment_bitmap_byte(p)] & segment_bitmap_bit(p);
} }
# define FLONUM_FWDADDRESS(p) *(ptr*)(UNTYPE(p, type_flonum)) # define FLONUM_FWDADDRESS(p) *(ptr*)TO_VOIDP(UNTYPE(p, type_flonum))
# define FORWARDEDP(p, si) ((TYPEBITS(p) == type_flonum) ? flonum_is_forwarded_p(p, si) : (FWDMARKER(p) == forward_marker)) # define FORWARDEDP(p, si) ((TYPEBITS(p) == type_flonum) ? flonum_is_forwarded_p(p, si) : (FWDMARKER(p) == forward_marker))
# define GET_FWDADDRESS(p) ((TYPEBITS(p) == type_flonum) ? FLONUM_FWDADDRESS(p) : FWDADDRESS(p)) # define GET_FWDADDRESS(p) ((TYPEBITS(p) == type_flonum) ? FLONUM_FWDADDRESS(p) : FWDADDRESS(p))
@ -380,11 +380,11 @@ FORCEINLINE void check_triggers(seginfo *si) {
if (si->has_triggers) { if (si->has_triggers) {
if (si->trigger_ephemerons) { if (si->trigger_ephemerons) {
add_trigger_ephemerons_to_pending(si->trigger_ephemerons); add_trigger_ephemerons_to_pending(si->trigger_ephemerons);
si->trigger_ephemerons = NULL; si->trigger_ephemerons = 0;
} }
if (si->trigger_guardians) { if (si->trigger_guardians) {
add_trigger_guardians_to_recheck(si->trigger_guardians); add_trigger_guardians_to_recheck(si->trigger_guardians);
si->trigger_guardians = NULL; si->trigger_guardians = 0;
} }
si->has_triggers = 0; si->has_triggers = 0;
} }
@ -461,7 +461,7 @@ static ptr copy_stack(old, length, clength) ptr old; iptr *length, clength; {
find_room(space_data, target_generation, typemod, n, new); find_room(space_data, target_generation, typemod, n, new);
n = ptr_align(clength); n = ptr_align(clength);
/* warning: stack may have been left non-double-aligned by split_and_resize */ /* warning: stack may have been left non-double-aligned by split_and_resize */
memcpy_aligned(new, old, n); memcpy_aligned(TO_VOIDP(new), TO_VOIDP(old), n);
/* also returning possibly updated value in *length */ /* also returning possibly updated value in *length */
return new; return new;
@ -531,7 +531,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
for (ls = S_threads; ls != Snil; ls = Scdr(ls)) { for (ls = S_threads; ls != Snil; ls = Scdr(ls)) {
ptr tc = (ptr)THREADTC(Scar(ls)); ptr tc = (ptr)THREADTC(Scar(ls));
S_scan_dirty((ptr **)EAP(tc), (ptr **)REAL_EAP(tc)); S_scan_dirty(TO_VOIDP(EAP(tc)), TO_VOIDP(REAL_EAP(tc)));
EAP(tc) = REAL_EAP(tc) = AP(tc) = (ptr)0; EAP(tc) = REAL_EAP(tc) = AP(tc) = (ptr)0;
} }
@ -648,7 +648,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
iptr i; iptr i;
count_roots_len = list_length(count_roots_ls); count_roots_len = list_length(count_roots_ls);
find_room(space_data, 0, typemod, ptr_align(count_roots_len*sizeof(count_root_t)), count_roots); find_room_voidp(space_data, 0, ptr_align(count_roots_len*sizeof(count_root_t)), count_roots);
for (ls = count_roots_ls, i = 0; ls != Snil; ls = Scdr(ls), i++) { for (ls = count_roots_ls, i = 0; ls != Snil; ls = Scdr(ls), i++) {
ptr p = Scar(ls); ptr p = Scar(ls);
@ -678,7 +678,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
#ifdef ENABLE_OBJECT_COUNTS #ifdef ENABLE_OBJECT_COUNTS
/* sweep count_roots in order and accumulate counts */ /* sweep count_roots in order and accumulate counts */
if (count_roots_len > 0) { if (count_roots_len > 0) {
ptr prev = NULL; uptr prev_total = total_size_so_far(); ptr prev = 0; uptr prev_total = total_size_so_far();
iptr i; iptr i;
# ifdef ENABLE_MEASURE # ifdef ENABLE_MEASURE
@ -717,7 +717,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
total = total_size_so_far(); total = total_size_so_far();
p = S_cons_in(space_new, 0, FIX(total-prev_total), Snil); p = S_cons_in(space_new, 0, FIX(total-prev_total), Snil);
if (prev != NULL) if (prev != 0)
Scdr(prev) = p; Scdr(prev) = p;
else else
count_roots_counts = p; count_roots_counts = p;
@ -800,13 +800,13 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
blnext = bl->cdr; blnext = bl->cdr;
b = bl->car; b = bl->car;
/* mark this bucket old for the rebuilding loop */ /* mark this bucket old for the rebuilding loop */
b->next = (bucket *)((uptr)b->next | 1); b->next = TO_VOIDP((uptr)TO_PTR(b->next) | 1);
sym = b->sym; sym = b->sym;
idx = UNFIX(SYMHASH(sym)) % S_G.oblist_length; idx = UNFIX(SYMHASH(sym)) % S_G.oblist_length;
oblist_cell = &S_G.oblist[idx]; oblist_cell = &S_G.oblist[idx];
if (!((uptr)*oblist_cell & 1)) { if (!((uptr)TO_PTR(*oblist_cell) & 1)) {
/* mark this bucket in the set */ /* mark this bucket in the set */
*oblist_cell = (bucket *)((uptr)*oblist_cell | 1); *oblist_cell = TO_VOIDP((uptr)TO_PTR(*oblist_cell) | 1);
/* repurpose the bucket list element for the list of buckets to rebuild later */ /* repurpose the bucket list element for the list of buckets to rebuild later */
/* idiot_checks verifies these have the same size */ /* idiot_checks verifies these have the same size */
bpl = (bucket_pointer_list *)bl; bpl = (bucket_pointer_list *)bl;
@ -899,7 +899,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
rep = GUARDIANOBJ(ls); rep = GUARDIANOBJ(ls);
if (FWDMARKER(rep) == forward_marker) rep = FWDADDRESS(rep); if (FWDMARKER(rep) == forward_marker) rep = FWDADDRESS(rep);
/* Caution: Building in assumption about shape of an ftype pointer */ /* Caution: Building in assumption about shape of an ftype pointer */
addr = RECORDINSTIT(rep, 0); addr = TO_VOIDP(RECORDINSTIT(rep, 0));
LOCKED_DECR(addr, b); LOCKED_DECR(addr, b);
if (!b) continue; if (!b) continue;
} }
@ -1072,12 +1072,12 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
bl = tg == static_generation ? NULL : S_G.buckets_of_generation[tg]; bl = tg == static_generation ? NULL : S_G.buckets_of_generation[tg];
for (bpl = buckets_to_rebuild; bpl != NULL; bpl = bpl->cdr) { for (bpl = buckets_to_rebuild; bpl != NULL; bpl = bpl->cdr) {
pb = bpl->car; pb = bpl->car;
for (b = (bucket *)((uptr)*pb - 1); b != NULL && ((uptr)(b->next) & 1); b = bnext) { for (b = TO_VOIDP((uptr)TO_PTR(*pb) - 1); b != NULL && ((uptr)TO_PTR(b->next) & 1); b = bnext) {
bnext = (bucket *)((uptr)(b->next) - 1); bnext = TO_VOIDP((uptr)TO_PTR(b->next) - 1);
sym = b->sym; sym = b->sym;
si = SegInfo(ptr_get_segment(sym)); si = SegInfo(ptr_get_segment(sym));
if (marked(si, sym) || (FWDMARKER(sym) == forward_marker && ((sym = FWDADDRESS(sym)) || 1))) { if (marked(si, sym) || (FWDMARKER(sym) == forward_marker && ((sym = FWDADDRESS(sym)) || 1))) {
find_room(space_data, tg, typemod, sizeof(bucket), b); find_room_voidp(space_data, tg, ptr_align(sizeof(bucket)), b);
#ifdef ENABLE_OBJECT_COUNTS #ifdef ENABLE_OBJECT_COUNTS
S_G.countof[tg][countof_oblist] += 1; S_G.countof[tg][countof_oblist] += 1;
S_G.bytesof[tg][countof_oblist] += sizeof(bucket); S_G.bytesof[tg][countof_oblist] += sizeof(bucket);
@ -1087,7 +1087,7 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
pb = &b->next; pb = &b->next;
if (tg != static_generation) { if (tg != static_generation) {
blnext = bl; blnext = bl;
find_room(space_data, tg, typemod, sizeof(bucket_list), bl); find_room_voidp(space_data, tg, ptr_align(sizeof(bucket_list)), bl);
#ifdef ENABLE_OBJECT_COUNTS #ifdef ENABLE_OBJECT_COUNTS
S_G.countof[tg][countof_oblist] += 1; S_G.countof[tg][countof_oblist] += 1;
S_G.bytesof[tg][countof_oblist] += sizeof(bucket_list); S_G.bytesof[tg][countof_oblist] += sizeof(bucket_list);
@ -1172,9 +1172,9 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
si->next = S_G.occupied_segments[s][tg]; si->next = S_G.occupied_segments[s][tg];
S_G.occupied_segments[s][tg] = si; S_G.occupied_segments[s][tg] = si;
S_G.bytes_of_space[s][tg] += si->marked_count; S_G.bytes_of_space[s][tg] += si->marked_count;
si->trigger_guardians = NULL; si->trigger_guardians = 0;
#ifdef PRESERVE_FLONUM_EQ #ifdef PRESERVE_FLONUM_EQ
si->forwarded_flonums = NULL; si->forwarded_flonums = 0;
#endif #endif
} else { } else {
chunkinfo *chunk = si->chunk; chunkinfo *chunk = si->chunk;
@ -1278,15 +1278,15 @@ ptr GCENTRY(ptr tc, IGEN mcg, IGEN tg, ptr count_roots_ls) {
slp = &sweep_loc[s];\ slp = &sweep_loc[s];\
nlp = &S_G.next_loc[s][g];\ nlp = &S_G.next_loc[s][g];\
if (*slp == 0) *slp = S_G.first_loc[s][g];\ if (*slp == 0) *slp = S_G.first_loc[s][g];\
pp = (ptr *)*slp;\ pp = TO_VOIDP(*slp);\
while (pp != (nl = (ptr *)*nlp))\ while (pp != (nl = TO_VOIDP(*nlp)))\
do\ do\
if ((p = *pp) == forward_marker)\ if ((p = *pp) == forward_marker)\
pp = (ptr *)*(pp + 1);\ pp = TO_VOIDP(*(pp + 1)); \
else\ else\
body\ body\
while (pp != nl);\ while (pp != nl);\
*slp = (ptr)pp; *slp = TO_PTR(pp);
static void resweep_weak_pairs(g, oldweakspacesegments) IGEN g; seginfo *oldweakspacesegments; { static void resweep_weak_pairs(g, oldweakspacesegments) IGEN g; seginfo *oldweakspacesegments; {
ptr *slp, *nlp; ptr *pp, p, *nl; ptr *slp, *nlp; ptr *pp, p, *nl;
@ -1307,7 +1307,7 @@ static void resweep_weak_pairs(g, oldweakspacesegments) IGEN g; seginfo *oldweak
int mask = si->marked_mask[i]; int mask = si->marked_mask[i];
if (mask != 0) { if (mask != 0) {
/* Assuming 4 pairs per 8 words */ /* Assuming 4 pairs per 8 words */
pp = (ptr *)build_ptr(si->number, (i << (log2_ptr_bytes+3))); pp = TO_VOIDP(build_ptr(si->number, (i << (log2_ptr_bytes+3))));
if (mask & 0x1) if (mask & 0x1)
forward_or_bwp(pp, *pp); forward_or_bwp(pp, *pp);
pp += 2; pp += 2;
@ -1346,7 +1346,7 @@ static void sweep_generation(tc, g) ptr tc; IGEN g; {
sweep_from_stack(tc); sweep_from_stack(tc);
sweep_space(space_impure, { sweep_space(space_impure, {
SET_BACKREFERENCE(TYPE((ptr)pp, type_pair)) /* only pairs put here in backreference mode */ SET_BACKREFERENCE(TYPE(TO_PTR(pp), type_pair)) /* only pairs put here in backreference mode */
relocate_help(pp, p) relocate_help(pp, p)
p = *(pp += 1); p = *(pp += 1);
relocate_help(pp, p) relocate_help(pp, p)
@ -1355,19 +1355,19 @@ static void sweep_generation(tc, g) ptr tc; IGEN g; {
SET_BACKREFERENCE(Sfalse) SET_BACKREFERENCE(Sfalse)
sweep_space(space_symbol, { sweep_space(space_symbol, {
p = TYPE((ptr)pp, type_symbol); p = TYPE(TO_PTR(pp), type_symbol);
sweep_symbol(p); sweep_symbol(p);
pp += size_symbol / sizeof(ptr); pp += size_symbol / sizeof(ptr);
}) })
sweep_space(space_port, { sweep_space(space_port, {
p = TYPE((ptr)pp, type_typed_object); p = TYPE(TO_PTR(pp), type_typed_object);
sweep_port(p); sweep_port(p);
pp += size_port / sizeof(ptr); pp += size_port / sizeof(ptr);
}) })
sweep_space(space_weakpair, { sweep_space(space_weakpair, {
SET_BACKREFERENCE(TYPE((ptr)pp, type_pair)) SET_BACKREFERENCE(TYPE(TO_PTR(pp), type_pair))
p = *(pp += 1); p = *(pp += 1);
relocate_help(pp, p) relocate_help(pp, p)
pp += 1; pp += 1;
@ -1375,13 +1375,13 @@ static void sweep_generation(tc, g) ptr tc; IGEN g; {
SET_BACKREFERENCE(Sfalse) SET_BACKREFERENCE(Sfalse)
sweep_space(space_ephemeron, { sweep_space(space_ephemeron, {
p = TYPE((ptr)pp, type_pair); p = TYPE(TO_PTR(pp), type_pair);
add_ephemeron_to_pending(p); add_ephemeron_to_pending(p);
pp += size_ephemeron / sizeof(ptr); pp += size_ephemeron / sizeof(ptr);
}) })
sweep_space(space_pure, { sweep_space(space_pure, {
SET_BACKREFERENCE(TYPE((ptr)pp, type_pair)) /* only pairs put here in backreference mode */ SET_BACKREFERENCE(TYPE(TO_PTR(pp), type_pair)) /* only pairs put here in backreference mode */
relocate_help(pp, p) relocate_help(pp, p)
p = *(pp += 1); p = *(pp += 1);
relocate_help(pp, p) relocate_help(pp, p)
@ -1390,40 +1390,40 @@ static void sweep_generation(tc, g) ptr tc; IGEN g; {
SET_BACKREFERENCE(Sfalse) SET_BACKREFERENCE(Sfalse)
sweep_space(space_continuation, { sweep_space(space_continuation, {
p = TYPE((ptr)pp, type_closure); p = TYPE(TO_PTR(pp), type_closure);
sweep_continuation(p); sweep_continuation(p);
pp += size_continuation / sizeof(ptr); pp += size_continuation / sizeof(ptr);
}) })
sweep_space(space_pure_typed_object, { sweep_space(space_pure_typed_object, {
p = TYPE((ptr)pp, type_typed_object); p = TYPE(TO_PTR(pp), type_typed_object);
pp = (ptr *)((uptr)pp + sweep_typed_object(tc, p)); pp = TO_VOIDP(((uptr)TO_PTR(pp) + sweep_typed_object(tc, p)));
}) })
sweep_space(space_code, { sweep_space(space_code, {
p = TYPE((ptr)pp, type_typed_object); p = TYPE(TO_PTR(pp), type_typed_object);
sweep_code_object(tc, p); sweep_code_object(tc, p);
pp += size_code(CODELEN(p)) / sizeof(ptr); pp += size_code(CODELEN(p)) / sizeof(ptr);
}) })
sweep_space(space_impure_record, { sweep_space(space_impure_record, {
p = TYPE((ptr)pp, type_typed_object); p = TYPE(TO_PTR(pp), type_typed_object);
sweep_record(p); sweep_record(p);
pp = (ptr *)((iptr)pp + pp = TO_VOIDP((iptr)TO_PTR(pp) +
size_record_inst(UNFIX(RECORDDESCSIZE(RECORDINSTTYPE(p))))); size_record_inst(UNFIX(RECORDDESCSIZE(RECORDINSTTYPE(p)))));
}) })
/* space used only as needed for backreferences: */ /* space used only as needed for backreferences: */
sweep_space(space_impure_typed_object, { sweep_space(space_impure_typed_object, {
p = TYPE((ptr)pp, type_typed_object); p = TYPE(TO_PTR(pp), type_typed_object);
pp = (ptr *)((uptr)pp + sweep_typed_object(tc, p)); pp = TO_VOIDP((uptr)TO_PTR(pp) + sweep_typed_object(tc, p));
}) })
/* space used only as needed for backreferences: */ /* space used only as needed for backreferences: */
sweep_space(space_closure, { sweep_space(space_closure, {
p = TYPE((ptr)pp, type_closure); p = TYPE(TO_PTR(pp), type_closure);
sweep(tc, p); sweep(tc, p);
pp = (ptr *)((uptr)pp + size_object(p)); pp = TO_VOIDP((uptr)TO_PTR(pp) + size_object(p));
}) })
/* don't sweep from space_count_pure or space_count_impure */ /* don't sweep from space_count_pure or space_count_impure */
@ -1443,10 +1443,10 @@ void enlarge_sweep_stack() {
ptr new_sweep_stack; ptr new_sweep_stack;
find_room(space_data, 0, typemod, ptr_align(new_sz), new_sweep_stack); find_room(space_data, 0, typemod, ptr_align(new_sz), new_sweep_stack);
if (sz != 0) if (sz != 0)
memcpy(new_sweep_stack, sweep_stack_start, sz); memcpy(TO_VOIDP(new_sweep_stack), TO_VOIDP(sweep_stack_start), sz);
sweep_stack_start = (ptr *)new_sweep_stack; sweep_stack_start = TO_VOIDP(new_sweep_stack);
sweep_stack_limit = (ptr *)((uptr)new_sweep_stack + new_sz); sweep_stack_limit = TO_VOIDP((uptr)new_sweep_stack + new_sz);
sweep_stack = (ptr *)((uptr)new_sweep_stack + sz); sweep_stack = TO_VOIDP((uptr)new_sweep_stack + sz);
} }
void sweep_from_stack(tc) ptr tc; { void sweep_from_stack(tc) ptr tc; {
@ -1538,12 +1538,12 @@ static void sweep_dirty(void) {
} }
min_youngest = 0xff; min_youngest = 0xff;
nl = from_g == tg ? (ptr *)orig_next_loc[s] : (ptr *)S_G.next_loc[s][from_g]; nl = from_g == tg ? TO_VOIDP(orig_next_loc[s]) : TO_VOIDP(S_G.next_loc[s][from_g]);
ppend = build_ptr(seg, 0); ppend = TO_VOIDP(build_ptr(seg, 0));
if (s == space_weakpair) { if (s == space_weakpair) {
weakseginfo *next = weaksegments_to_resweep; weakseginfo *next = weaksegments_to_resweep;
find_room(space_data, 0, typemod, sizeof(weakseginfo), weaksegments_to_resweep); find_room_voidp(space_data, 0, ptr_align(sizeof(weakseginfo)), weaksegments_to_resweep);
weaksegments_to_resweep->si = dirty_si; weaksegments_to_resweep->si = dirty_si;
weaksegments_to_resweep->next = next; weaksegments_to_resweep->next = next;
} }
@ -1573,7 +1573,7 @@ static void sweep_dirty(void) {
|| (s == space_closure)) { || (s == space_closure)) {
while (pp < ppend && *pp != forward_marker) { while (pp < ppend && *pp != forward_marker) {
/* handle two pointers at a time */ /* handle two pointers at a time */
if (!dirty_si->marked_mask || marked(dirty_si, pp)) { if (!dirty_si->marked_mask || marked(dirty_si, TO_PTR(pp))) {
relocate_dirty(pp,tg,youngest) relocate_dirty(pp,tg,youngest)
pp += 1; pp += 1;
relocate_dirty(pp,tg,youngest) relocate_dirty(pp,tg,youngest)
@ -1587,13 +1587,13 @@ static void sweep_dirty(void) {
segments begins at the start of a segment, segments begins at the start of a segment,
and symbols are much smaller (we assume) and symbols are much smaller (we assume)
than the segment size. */ than the segment size. */
pp = (ptr *)build_ptr(seg,0) + pp = (ptr *)TO_VOIDP(build_ptr(seg,0)) +
((pp - (ptr *)build_ptr(seg,0)) / ((pp - (ptr *)TO_VOIDP(build_ptr(seg,0))) /
(size_symbol / sizeof(ptr))) * (size_symbol / sizeof(ptr))) *
(size_symbol / sizeof(ptr)); (size_symbol / sizeof(ptr));
while (pp < ppend && *pp != forward_marker) { /* might overshoot card by part of a symbol. no harm. */ while (pp < ppend && *pp != forward_marker) { /* might overshoot card by part of a symbol. no harm. */
ptr p = TYPE((ptr)pp, type_symbol); ptr p = TYPE(TO_PTR(pp), type_symbol);
if (!dirty_si->marked_mask || marked(dirty_si, p)) if (!dirty_si->marked_mask || marked(dirty_si, p))
youngest = sweep_dirty_symbol(p, tg, youngest); youngest = sweep_dirty_symbol(p, tg, youngest);
@ -1606,13 +1606,13 @@ static void sweep_dirty(void) {
segments begins at the start of a segment, segments begins at the start of a segment,
and ports are much smaller (we assume) and ports are much smaller (we assume)
than the segment size. */ than the segment size. */
pp = (ptr *)build_ptr(seg,0) + pp = (ptr *)TO_VOIDP(build_ptr(seg,0)) +
((pp - (ptr *)build_ptr(seg,0)) / ((pp - (ptr *)TO_VOIDP(build_ptr(seg,0))) /
(size_port / sizeof(ptr))) * (size_port / sizeof(ptr))) *
(size_port / sizeof(ptr)); (size_port / sizeof(ptr));
while (pp < ppend && *pp != forward_marker) { /* might overshoot card by part of a port. no harm. */ while (pp < ppend && *pp != forward_marker) { /* might overshoot card by part of a port. no harm. */
ptr p = TYPE((ptr)pp, type_typed_object); ptr p = TYPE(TO_PTR(pp), type_typed_object);
if (!dirty_si->marked_mask || marked(dirty_si, p)) if (!dirty_si->marked_mask || marked(dirty_si, p))
youngest = sweep_dirty_port(p, tg, youngest); youngest = sweep_dirty_port(p, tg, youngest);
@ -1624,8 +1624,8 @@ static void sweep_dirty(void) {
if (dirty_si->marked_mask) { if (dirty_si->marked_mask) {
/* To get to the start of a record, move backward as long as bytes /* To get to the start of a record, move backward as long as bytes
are marked and segment space+generation+marked is the same. */ are marked and segment space+generation+marked is the same. */
uptr byte = segment_bitmap_byte(pp); uptr byte = segment_bitmap_byte(TO_PTR(pp));
uptr bit = segment_bitmap_bit(pp); uptr bit = segment_bitmap_bit(TO_PTR(pp));
uptr at_seg = seg; uptr at_seg = seg;
seginfo *si = dirty_si; seginfo *si = dirty_si;
@ -1692,7 +1692,7 @@ static void sweep_dirty(void) {
p = TYPE(p, type_typed_object); p = TYPE(p, type_typed_object);
/* now sweep, but watch out for unmarked holes in the dirty region */ /* now sweep, but watch out for unmarked holes in the dirty region */
while ((ptr *)UNTYPE(p, type_typed_object) < ppend) { while ((ptr *)TO_VOIDP(UNTYPE(p, type_typed_object)) < ppend) {
seginfo *si = SegInfo(ptr_get_segment(p)); seginfo *si = SegInfo(ptr_get_segment(p));
if (!marked(si, p)) { if (!marked(si, p)) {
/* skip unmarked words */ /* skip unmarked words */
@ -1736,14 +1736,14 @@ static void sweep_dirty(void) {
} }
/* now find first within dirty area */ /* now find first within dirty area */
while ((ptr *)UNTYPE(pnext, type_typed_object) <= pp) { while ((ptr *)TO_VOIDP(UNTYPE(pnext, type_typed_object)) <= pp) {
p = pnext; p = pnext;
pnext = (ptr)((iptr)p + pnext = (ptr)((iptr)p +
size_record_inst(UNFIX(RECORDDESCSIZE(RECORDINSTTYPE(p))))); size_record_inst(UNFIX(RECORDDESCSIZE(RECORDINSTTYPE(p)))));
} }
/* now sweep */ /* now sweep */
while ((ptr *)UNTYPE(p, type_typed_object) < ppend) { while ((ptr *)TO_VOIDP(UNTYPE(p, type_typed_object)) < ppend) {
/* quit on end of segment */ /* quit on end of segment */
if (FWDMARKER(p) == forward_marker) break; if (FWDMARKER(p) == forward_marker) break;
@ -1756,7 +1756,7 @@ static void sweep_dirty(void) {
} else if (s == space_weakpair) { } else if (s == space_weakpair) {
while (pp < ppend && *pp != forward_marker) { while (pp < ppend && *pp != forward_marker) {
/* skip car field and handle cdr field */ /* skip car field and handle cdr field */
if (!dirty_si->marked_mask || marked(dirty_si, pp)) { if (!dirty_si->marked_mask || marked(dirty_si, TO_PTR(pp))) {
pp += 1; pp += 1;
relocate_dirty(pp, tg, youngest) relocate_dirty(pp, tg, youngest)
pp += 1; pp += 1;
@ -1765,7 +1765,7 @@ static void sweep_dirty(void) {
} }
} else if (s == space_ephemeron) { } else if (s == space_ephemeron) {
while (pp < ppend && *pp != forward_marker) { while (pp < ppend && *pp != forward_marker) {
ptr p = TYPE((ptr)pp, type_pair); ptr p = TYPE(TO_PTR(pp), type_pair);
if (!dirty_si->marked_mask || marked(dirty_si, p)) if (!dirty_si->marked_mask || marked(dirty_si, p))
youngest = check_dirty_ephemeron(p, tg, youngest); youngest = check_dirty_ephemeron(p, tg, youngest);
pp += size_ephemeron / sizeof(ptr); pp += size_ephemeron / sizeof(ptr);
@ -1809,8 +1809,8 @@ static void resweep_dirty_weak_pairs() {
for (ls = weaksegments_to_resweep; ls != NULL; ls = ls->next) { for (ls = weaksegments_to_resweep; ls != NULL; ls = ls->next) {
seginfo *dirty_si = ls->si; seginfo *dirty_si = ls->si;
from_g = dirty_si->generation; from_g = dirty_si->generation;
nl = from_g == tg ? (ptr *)orig_next_loc[space_weakpair] : (ptr *)S_G.next_loc[space_weakpair][from_g]; nl = from_g == tg ? TO_VOIDP(orig_next_loc[space_weakpair]) : TO_VOIDP(S_G.next_loc[space_weakpair][from_g]);
ppend = build_ptr(dirty_si->number, 0); ppend = TO_VOIDP(build_ptr(dirty_si->number, 0));
min_youngest = 0xff; min_youngest = 0xff;
d = 0; d = 0;
while (d < cards_per_segment) { while (d < cards_per_segment) {
@ -1876,7 +1876,7 @@ static void add_pending_guardian(ptr gdn, ptr tconc)
static void add_trigger_guardians_to_recheck(ptr ls) static void add_trigger_guardians_to_recheck(ptr ls)
{ {
ptr last = ls, next = GUARDIANNEXT(ls); ptr last = ls, next = GUARDIANNEXT(ls);
while (next != NULL) { while (next != 0) {
last = next; last = next;
next = GUARDIANNEXT(next); next = GUARDIANNEXT(next);
} }
@ -1884,30 +1884,30 @@ static void add_trigger_guardians_to_recheck(ptr ls)
recheck_guardians_ls = ls; recheck_guardians_ls = ls;
} }
static ptr pending_ephemerons = NULL; static ptr pending_ephemerons = 0;
/* Ephemerons that we haven't looked at, chained through `next`. */ /* Ephemerons that we haven't looked at, chained through `next`. */
static void ephemeron_remove(ptr pe) { static void ephemeron_remove(ptr pe) {
ptr next = EPHEMERONNEXT(pe); ptr next = EPHEMERONNEXT(pe);
*((ptr *)EPHEMERONPREVREF(pe)) = next; *((ptr *)TO_VOIDP(EPHEMERONPREVREF(pe))) = next;
if (next) if (next)
EPHEMERONPREVREF(next) = EPHEMERONPREVREF(pe); EPHEMERONPREVREF(next) = EPHEMERONPREVREF(pe);
EPHEMERONPREVREF(pe) = NULL; EPHEMERONPREVREF(pe) = 0;
EPHEMERONNEXT(pe) = NULL; EPHEMERONNEXT(pe) = 0;
} }
static void ephemeron_add(ptr *first, ptr pe) { static void ephemeron_add(ptr *first, ptr pe) {
ptr last_pe = pe, next_pe = EPHEMERONNEXT(pe), next; ptr last_pe = pe, next_pe = EPHEMERONNEXT(pe), next;
while (next_pe != NULL) { while (next_pe != 0) {
last_pe = next_pe; last_pe = next_pe;
next_pe = EPHEMERONNEXT(next_pe); next_pe = EPHEMERONNEXT(next_pe);
} }
next = *first; next = *first;
*first = pe; *first = pe;
EPHEMERONPREVREF(pe) = (ptr)first; EPHEMERONPREVREF(pe) = TO_PTR(first);
EPHEMERONNEXT(last_pe) = next; EPHEMERONNEXT(last_pe) = next;
if (next) if (next)
EPHEMERONPREVREF(next) = &EPHEMERONNEXT(last_pe); EPHEMERONPREVREF(next) = TO_PTR(&EPHEMERONNEXT(last_pe));
} }
static void add_ephemeron_to_pending(ptr pe) { static void add_ephemeron_to_pending(ptr pe) {
@ -1929,8 +1929,8 @@ static void check_ephemeron(ptr pe) {
seginfo *si; seginfo *si;
PUSH_BACKREFERENCE(pe); PUSH_BACKREFERENCE(pe);
EPHEMERONNEXT(pe) = NULL; EPHEMERONNEXT(pe) = 0;
EPHEMERONPREVREF(pe) = NULL; EPHEMERONPREVREF(pe) = 0;
p = Scar(pe); p = Scar(pe);
if (!IMMEDIATE(p) && (si = MaybeSegInfo(ptr_get_segment(p))) != NULL && si->old_space) { if (!IMMEDIATE(p) && (si = MaybeSegInfo(ptr_get_segment(p))) != NULL && si->old_space) {
@ -1955,8 +1955,8 @@ static void check_pending_ephemerons() {
ptr pe, next_pe; ptr pe, next_pe;
pe = pending_ephemerons; pe = pending_ephemerons;
pending_ephemerons = NULL; pending_ephemerons = 0;
while (pe != NULL) { while (pe != 0) {
next_pe = EPHEMERONNEXT(pe); next_pe = EPHEMERONNEXT(pe);
check_ephemeron(pe); check_ephemeron(pe);
pe = next_pe; pe = next_pe;
@ -2013,20 +2013,20 @@ static int check_dirty_ephemeron(ptr pe, int tg, int youngest) {
static void finish_pending_ephemerons(seginfo *si) { static void finish_pending_ephemerons(seginfo *si) {
/* Any ephemeron still in a trigger list is an ephemeron /* Any ephemeron still in a trigger list is an ephemeron
whose key was not reached. */ whose key was not reached. */
if (pending_ephemerons != NULL) if (pending_ephemerons != 0)
S_error_abort("clear_trigger_ephemerons(gc): non-empty pending list"); S_error_abort("clear_trigger_ephemerons(gc): non-empty pending list");
for (; si != NULL; si = si->next) { for (; si != NULL; si = si->next) {
if (si->trigger_ephemerons) { if (si->trigger_ephemerons) {
ptr pe, next_pe; ptr pe, next_pe;
for (pe = si->trigger_ephemerons; pe != NULL; pe = next_pe) { for (pe = si->trigger_ephemerons; pe != 0; pe = next_pe) {
INITCAR(pe) = Sbwp_object; INITCAR(pe) = Sbwp_object;
INITCDR(pe) = Sbwp_object; INITCDR(pe) = Sbwp_object;
next_pe = EPHEMERONNEXT(pe); next_pe = EPHEMERONNEXT(pe);
EPHEMERONPREVREF(pe) = NULL; EPHEMERONPREVREF(pe) = 0;
EPHEMERONNEXT(pe) = NULL; EPHEMERONNEXT(pe) = 0;
} }
si->trigger_ephemerons = NULL; si->trigger_ephemerons = 0;
} }
} }
} }
@ -2058,7 +2058,7 @@ static uptr target_generation_space_so_far() {
for (s = 0; s <= max_real_space; s++) { for (s = 0; s <= max_real_space; s++) {
sz += S_G.bytes_of_space[s][g]; sz += S_G.bytes_of_space[s][g];
if (S_G.next_loc[s][g] != FIX(0)) if (S_G.next_loc[s][g] != FIX(0))
sz += (char *)S_G.next_loc[s][g] - (char *)S_G.base_loc[s][g]; sz += (uptr)S_G.next_loc[s][g] - (uptr)S_G.base_loc[s][g];
} }
return sz; return sz;
@ -2080,16 +2080,16 @@ void copy_and_clear_list_bits(seginfo *oldspacesegments, IGEN tg) {
/* Besides marking or copying `si->list_bits`, clear bits /* Besides marking or copying `si->list_bits`, clear bits
where there's no corresponding mark bit, so we don't try to where there's no corresponding mark bit, so we don't try to
check forwarding in a future GC */ check forwarding in a future GC */
seginfo *bits_si = SegInfo(ptr_get_segment((ptr)si->list_bits)); seginfo *bits_si = SegInfo(ptr_get_segment(TO_PTR(si->list_bits)));
if (bits_si->old_space) { if (bits_si->old_space) {
if (bits_si->use_marks) { if (bits_si->use_marks) {
if (!bits_si->marked_mask) if (!bits_si->marked_mask)
init_mask(bits_si->marked_mask, tg, 0); init_mask(bits_si->marked_mask, tg, 0);
bits_si->marked_mask[segment_bitmap_byte((ptr)si->list_bits)] |= segment_bitmap_bit((ptr)si->list_bits); bits_si->marked_mask[segment_bitmap_byte(TO_PTR(si->list_bits))] |= segment_bitmap_bit(TO_PTR(si->list_bits));
} else { } else {
octet *copied_bits; octet *copied_bits;
find_room(space_data, tg, typemod, ptr_align(segment_bitmap_bytes), copied_bits); find_room_voidp(space_data, tg, ptr_align(segment_bitmap_bytes), copied_bits);
memcpy_aligned(copied_bits, si->list_bits, segment_bitmap_bytes); memcpy_aligned(copied_bits, si->list_bits, segment_bitmap_bytes);
si->list_bits = copied_bits; si->list_bits = copied_bits;
} }
@ -2140,9 +2140,9 @@ static void init_measure(IGEN min_gen, IGEN max_gen) {
min_measure_generation = min_gen; min_measure_generation = min_gen;
max_measure_generation = max_gen; max_measure_generation = max_gen;
find_room(space_data, 0, typemod, init_stack_len, measure_stack_start); find_room_voidp(space_data, 0, init_stack_len, measure_stack_start);
measure_stack = (ptr *)measure_stack_start; measure_stack = TO_VOIDP(measure_stack_start);
measure_stack_limit = (ptr *)((uptr)measure_stack_start + init_stack_len); measure_stack_limit = TO_VOIDP((uptr)TO_PTR(measure_stack_start) + init_stack_len);
measured_seginfos = Snil; measured_seginfos = Snil;
@ -2154,14 +2154,14 @@ static void finish_measure() {
for (ls = measured_seginfos; ls != Snil; ls = Scdr(ls)) { for (ls = measured_seginfos; ls != Snil; ls = Scdr(ls)) {
ptr pe, next_pe; ptr pe, next_pe;
seginfo *si = (seginfo *)Scar(ls); seginfo *si = TO_VOIDP(Scar(ls));
si->measured_mask = NULL; si->measured_mask = NULL;
for (pe = si->trigger_ephemerons; pe != NULL; pe = next_pe) { for (pe = si->trigger_ephemerons; pe != 0; pe = next_pe) {
next_pe = EPHEMERONNEXT(pe); next_pe = EPHEMERONNEXT(pe);
EPHEMERONPREVREF(pe) = NULL; EPHEMERONPREVREF(pe) = 0;
EPHEMERONNEXT(pe) = NULL; EPHEMERONNEXT(pe) = 0;
} }
si->trigger_ephemerons = NULL; si->trigger_ephemerons = 0;
} }
measure_all_enabled = 0; measure_all_enabled = 0;
@ -2173,7 +2173,7 @@ static void init_counting_mask(seginfo *si) {
static void init_measure_mask(seginfo *si) { static void init_measure_mask(seginfo *si) {
init_mask(si->measured_mask, 0, 0); init_mask(si->measured_mask, 0, 0);
measured_seginfos = S_cons_in(space_new, 0, (ptr)si, measured_seginfos); measured_seginfos = S_cons_in(space_new, 0, TO_PTR(si), measured_seginfos);
} }
#define measure_unreached(si, p) \ #define measure_unreached(si, p) \
@ -2217,18 +2217,18 @@ static void push_measure(ptr p)
if (si->trigger_ephemerons) { if (si->trigger_ephemerons) {
add_trigger_ephemerons_to_pending_measure(si->trigger_ephemerons); add_trigger_ephemerons_to_pending_measure(si->trigger_ephemerons);
si->trigger_ephemerons = NULL; si->trigger_ephemerons = 0;
} }
if (measure_stack == measure_stack_limit) { if (measure_stack == measure_stack_limit) {
uptr sz = ptr_bytes * (measure_stack_limit - measure_stack_start); uptr sz = ptr_bytes * (measure_stack_limit - measure_stack_start);
uptr new_sz = 2*sz; uptr new_sz = 2*sz;
ptr new_measure_stack; ptr *new_measure_stack;
find_room(space_data, 0, typemod, ptr_align(new_sz), new_measure_stack); find_room_voidp(space_data, 0, ptr_align(new_sz), new_measure_stack);
memcpy(new_measure_stack, measure_stack_start, sz); memcpy(new_measure_stack, measure_stack_start, sz);
measure_stack_start = (ptr *)new_measure_stack; measure_stack_start = new_measure_stack;
measure_stack_limit = (ptr *)((uptr)new_measure_stack + new_sz); measure_stack_limit = TO_VOIDP((uptr)TO_PTR(new_measure_stack) + new_sz);
measure_stack = (ptr *)((uptr)new_measure_stack + sz); measure_stack = TO_VOIDP((uptr)TO_PTR(new_measure_stack) + sz);
} }
*(measure_stack++) = p; *(measure_stack++) = p;
@ -2266,8 +2266,8 @@ static void check_ephemeron_measure(ptr pe) {
ptr p; ptr p;
seginfo *si; seginfo *si;
EPHEMERONPREVREF(pe) = NULL; EPHEMERONPREVREF(pe) = 0;
EPHEMERONNEXT(pe) = NULL; EPHEMERONNEXT(pe) = 0;
p = Scar(pe); p = Scar(pe);
if (!IMMEDIATE(p) && (si = MaybeSegInfo(ptr_get_segment(p))) != NULL if (!IMMEDIATE(p) && (si = MaybeSegInfo(ptr_get_segment(p))) != NULL
@ -2293,8 +2293,8 @@ static void check_pending_measure_ephemerons() {
ptr pe, next_pe; ptr pe, next_pe;
pe = pending_measure_ephemerons; pe = pending_measure_ephemerons;
pending_measure_ephemerons = NULL; pending_measure_ephemerons = 0;
while (pe != NULL) { while (pe != 0) {
next_pe = EPHEMERONNEXT(pe); next_pe = EPHEMERONNEXT(pe);
check_ephemeron_measure(pe); check_ephemeron_measure(pe);
pe = next_pe; pe = next_pe;
@ -2306,7 +2306,7 @@ void gc_measure_one(ptr p) {
if (si->trigger_ephemerons) { if (si->trigger_ephemerons) {
add_trigger_ephemerons_to_pending_measure(si->trigger_ephemerons); add_trigger_ephemerons_to_pending_measure(si->trigger_ephemerons);
si->trigger_ephemerons = NULL; si->trigger_ephemerons = 0;
} }
measure(p); measure(p);
@ -2332,7 +2332,7 @@ IBOOL flush_measure_stack() {
} }
ptr S_count_size_increments(ptr ls, IGEN generation) { ptr S_count_size_increments(ptr ls, IGEN generation) {
ptr l, totals = Snil, totals_prev = NULL; ptr l, totals = Snil, totals_prev = 0;
tc_mutex_acquire(); tc_mutex_acquire();

View File

@ -530,10 +530,10 @@ void S_addr_tell(ptr p) {
static void check_heap_dirty_msg(msg, x) char *msg; ptr *x; { static void check_heap_dirty_msg(msg, x) char *msg; ptr *x; {
INT d; seginfo *si; INT d; seginfo *si;
si = SegInfo(addr_get_segment(x)); si = SegInfo(addr_get_segment(TO_PTR(x)));
d = (INT)(((uptr)x >> card_offset_bits) & ((1 << segment_card_offset_bits) - 1)); d = (INT)(((uptr)TO_PTR(x) >> card_offset_bits) & ((1 << segment_card_offset_bits) - 1));
printf("%s dirty byte %d found in segment %#tx, card %d at %#tx\n", msg, si->dirty_bytes[d], (ptrdiff_t)(si->number), d, (ptrdiff_t)x); printf("%s dirty byte %d found in segment %#tx, card %d at %#tx\n", msg, si->dirty_bytes[d], (ptrdiff_t)(si->number), d, (ptrdiff_t)x);
printf("from "); segment_tell(addr_get_segment(x)); printf("from "); segment_tell(addr_get_segment(TO_PTR(x)));
printf("to "); segment_tell(addr_get_segment(*x)); printf("to "); segment_tell(addr_get_segment(*x));
} }
@ -638,18 +638,18 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
|| s == space_immobile_impure || s == space_count_pure || s == space_count_impure || s == space_closure) { || s == space_immobile_impure || s == space_count_pure || s == space_count_impure || s == space_closure) {
/* doesn't handle: space_port, space_continuation, space_code, space_pure_typed_object, /* doesn't handle: space_port, space_continuation, space_code, space_pure_typed_object,
space_impure_record, or impure_typed_object */ space_impure_record, or impure_typed_object */
nl = (ptr *)S_G.next_loc[s][g]; nl = TO_VOIDP(S_G.next_loc[s][g]);
/* check for dangling references */ /* check for dangling references */
pp1 = (ptr *)build_ptr(seg, 0); pp1 = TO_VOIDP(build_ptr(seg, 0));
pp2 = (ptr *)build_ptr(seg + 1, 0); pp2 = TO_VOIDP(build_ptr(seg + 1, 0));
if (pp1 <= nl && nl < pp2) pp2 = nl; if (pp1 <= nl && nl < pp2) pp2 = nl;
while (pp1 < pp2) { while (pp1 < pp2) {
if (!si->marked_mask || (si->marked_mask[segment_bitmap_byte(pp1)] & segment_bitmap_bit(pp1))) { if (!si->marked_mask || (si->marked_mask[segment_bitmap_byte(TO_PTR(pp1))] & segment_bitmap_bit(TO_PTR(pp1)))) {
int a; int a;
for (a = 0; (a < ptr_alignment) && (pp1 < pp2); a++) { for (a = 0; (a < ptr_alignment) && (pp1 < pp2); a++) {
#define in_ephemeron_pair_part(pp1, seg) ((((uptr)(pp1) - (uptr)build_ptr(seg, 0)) % size_ephemeron) < size_pair) #define in_ephemeron_pair_part(pp1, seg) ((((uptr)TO_PTR(pp1) - (uptr)build_ptr(seg, 0)) % size_ephemeron) < size_pair)
if ((s == space_ephemeron) && !in_ephemeron_pair_part(pp1, seg)) { if ((s == space_ephemeron) && !in_ephemeron_pair_part(pp1, seg)) {
/* skip non-pair part of ephemeron */ /* skip non-pair part of ephemeron */
} else { } else {
@ -692,7 +692,7 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
if (s == space_impure || s == space_symbol || s == space_weakpair || s == space_ephemeron if (s == space_impure || s == space_symbol || s == space_weakpair || s == space_ephemeron
|| s == space_immobile_impure || s == space_closure) { || s == space_immobile_impure || s == space_closure) {
found_eos = 0; found_eos = 0;
pp2 = pp1 = build_ptr(seg, 0); pp2 = pp1 = TO_VOIDP(build_ptr(seg, 0));
for (d = 0; d < cards_per_segment; d += 1) { for (d = 0; d < cards_per_segment; d += 1) {
if (found_eos) { if (found_eos) {
if (si->dirty_bytes[d] != 0xff) { if (si->dirty_bytes[d] != 0xff) {
@ -716,7 +716,7 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
dirty = 0xff; dirty = 0xff;
while (pp1 < pp2) { while (pp1 < pp2) {
if (!si->marked_mask || (si->marked_mask[segment_bitmap_byte(pp1)] & segment_bitmap_bit(pp1))) { if (!si->marked_mask || (si->marked_mask[segment_bitmap_byte(TO_PTR(pp1))] & segment_bitmap_bit(TO_PTR(pp1)))) {
int a; int a;
for (a = 0; (a < ptr_alignment) && (pp1 < pp2); a++) { for (a = 0; (a < ptr_alignment) && (pp1 < pp2); a++) {
if ((s == space_ephemeron) && !in_ephemeron_pair_part(pp1, seg)) { if ((s == space_ephemeron) && !in_ephemeron_pair_part(pp1, seg)) {
@ -890,25 +890,25 @@ static void check_locked_object(ptr p, IBOOL locked, IGEN g, IBOOL aftergc, IGEN
seginfo *psi = MaybeSegInfo(ptr_get_segment(p)); seginfo *psi = MaybeSegInfo(ptr_get_segment(p));
if (!psi) { if (!psi) {
S_checkheap_errors += 1; S_checkheap_errors += 1;
printf("!!! generation %d %s object has no segment: %p\n", g, what, p); printf("!!! generation %d %s object has no segment: %p\n", g, what, TO_VOIDP(p));
} else { } else {
if (psi->generation != g) { if (psi->generation != g) {
S_checkheap_errors += 1; S_checkheap_errors += 1;
printf("!!! generation %d %s object in generation %d segment: %p\n", g, what, psi->generation, p); printf("!!! generation %d %s object in generation %d segment: %p\n", g, what, psi->generation, TO_VOIDP(p));
} }
if (!psi->must_mark && locked) { if (!psi->must_mark && locked) {
S_checkheap_errors += 1; S_checkheap_errors += 1;
printf("!!! generation %d %s object not on must-mark page: %p\n", g, what, p); printf("!!! generation %d %s object not on must-mark page: %p\n", g, what, TO_VOIDP(p));
} }
if (!psi->marked_mask) { if (!psi->marked_mask) {
if (aftergc && (psi->generation <= mcg)) { if (aftergc && (psi->generation <= mcg)) {
S_checkheap_errors += 1; S_checkheap_errors += 1;
printf("!!! %s object not in marked segment: %p\n", what, p); printf("!!! %s object not in marked segment: %p\n", what, TO_VOIDP(p));
printf(" in: "); segment_tell(psi->number); printf(" in: "); segment_tell(psi->number);
} }
} else if (!(psi->marked_mask[segment_bitmap_byte(p)] & segment_bitmap_bit(p))) { } else if (!(psi->marked_mask[segment_bitmap_byte(p)] & segment_bitmap_bit(p))) {
S_checkheap_errors += 1; S_checkheap_errors += 1;
printf("!!! generation %d %s object not marked: %p\n", g, what, p); printf("!!! generation %d %s object not marked: %p\n", g, what, TO_VOIDP(p));
} }
} }
} }

View File

@ -40,20 +40,20 @@ void S_intern_init() {
static void oblist_insert(ptr sym, iptr idx, IGEN g) { static void oblist_insert(ptr sym, iptr idx, IGEN g) {
bucket *b, *oldb, **pb; bucket *b, *oldb, **pb;
find_room(g == 0 ? space_new : space_data, g, typemod, sizeof(bucket), b); find_room_voidp(g == 0 ? space_new : space_data, g, ptr_align(sizeof(bucket)), b);
b->sym = sym; b->sym = sym;
if (g == 0) { if (g == 0) {
b->next = S_G.oblist[idx]; b->next = S_G.oblist[idx];
S_G.oblist[idx] = b; S_G.oblist[idx] = b;
} else { } else {
for (pb = &S_G.oblist[idx]; (oldb = *pb) != NULL && SegmentGeneration(addr_get_segment(oldb)) < g; pb = &oldb->next); for (pb = &S_G.oblist[idx]; (oldb = *pb) != NULL && SegmentGeneration(addr_get_segment(TO_PTR(oldb))) < g; pb = &oldb->next);
b->next = oldb; b->next = oldb;
*pb = b; *pb = b;
} }
if (g != static_generation) { if (g != static_generation) {
bucket_list *bl; bucket_list *bl;
find_room(g == 0 ? space_new : space_data, g, typemod, sizeof(bucket_list), bl); find_room_voidp(g == 0 ? space_new : space_data, g, ptr_align(sizeof(bucket_list)), bl);
bl->car = b; bl->car = b;
bl->cdr = S_G.buckets_of_generation[g]; bl->cdr = S_G.buckets_of_generation[g];
S_G.buckets_of_generation[g] = bl; S_G.buckets_of_generation[g] = bl;
@ -85,7 +85,7 @@ void S_resize_oblist(void) {
idx = OBINDEX(UNFIX(SYMHASH(sym)), new_oblist_length); idx = OBINDEX(UNFIX(SYMHASH(sym)), new_oblist_length);
g = GENERATION(sym); g = GENERATION(sym);
for (pb = &new_oblist[idx]; (oldb = *pb) != NULL && SegmentGeneration(addr_get_segment(oldb)) < g; pb = &oldb->next) { for (pb = &new_oblist[idx]; (oldb = *pb) != NULL && SegmentGeneration(addr_get_segment(TO_PTR(oldb))) < g; pb = &oldb->next) {
inc++; inc++;
if (done) if (done)
dinc++; dinc++;

View File

@ -51,9 +51,7 @@
#endif /* PTHREADS */ #endif /* PTHREADS */
/* locally defined functions */ /* locally defined functions */
static ptr new_open_output_fd_helper PROTO((const char *filename, INT mode, static ptr new_open_output_fd_helper PROTO((const char *filename, INT mode, INT flags, INT options));
INT flags, INT no_create, INT no_fail, INT no_truncate,
INT append, INT lock, INT replace, INT compressed));
static INT lockfile PROTO((INT fd)); static INT lockfile PROTO((INT fd));
static int is_valid_zlib_length(iptr count); static int is_valid_zlib_length(iptr count);
static int is_valid_lz4_length(iptr count); static int is_valid_lz4_length(iptr count);
@ -144,9 +142,12 @@ static INT lockfile(INT fd) { return FLOCK(fd, LOCK_EX); }
#ifdef LOCKF #ifdef LOCKF
static INT lockfile(INT fd) { return lockf(fd, F_LOCK, (off_t)0); } static INT lockfile(INT fd) { return lockf(fd, F_LOCK, (off_t)0); }
#endif #endif
#if !defined(FLOCK) && !defined(LOCKF)
static INT lockfile(INT fd) { return fd >= 0; }
#endif
#define MAKE_GZXFILE(x) Sinteger((iptr)x) #define MAKE_GZXFILE(x) Sinteger((iptr)TO_PTR(x))
#define GZXFILE_GZFILE(x) ((glzFile)Sinteger_value(x)) #define GZXFILE_GZFILE(x) ((glzFile)TO_VOIDP(Sinteger_value(x)))
INT S_gzxfile_fd(ptr x) { INT S_gzxfile_fd(ptr x) {
return GZXFILE_GZFILE(x)->fd; return GZXFILE_GZFILE(x)->fd;
@ -273,10 +274,7 @@ ptr S_compress_output_fd(INT fd) {
return Sbox(MAKE_GZXFILE(file)); return Sbox(MAKE_GZXFILE(file));
} }
static ptr new_open_output_fd_helper( static ptr new_open_output_fd_helper( const char *infilename, INT mode, INT flags, INT options) {
const char *infilename, INT mode, INT flags,
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed) {
char *filename; char *filename;
INT saved_errno = 0; INT saved_errno = 0;
iptr error; iptr error;
@ -284,14 +282,14 @@ static ptr new_open_output_fd_helper(
ptr tc = get_thread_context(); ptr tc = get_thread_context();
flags |= flags |=
(no_create ? 0 : O_CREAT) | ((options & open_fd_no_create) ? 0 : O_CREAT) |
((no_fail || no_create) ? 0 : O_EXCL) | ((options & (open_fd_no_fail | open_fd_no_create)) ? 0 : O_EXCL) |
(no_truncate ? 0 : O_TRUNC) | ((options & open_fd_no_truncate) ? 0 : O_TRUNC) |
((!append) ? 0 : O_APPEND); ((!(options & open_fd_append)) ? 0 : O_APPEND);
filename = S_malloc_pathname(infilename); filename = S_malloc_pathname(infilename);
if (replace && UNLINK(filename) != 0 && errno != ENOENT) { if ((options & open_fd_replace) && UNLINK(filename) != 0 && errno != ENOENT) {
ptr str = S_strerror(errno); ptr str = S_strerror(errno);
switch (errno) { switch (errno) {
case EACCES: case EACCES:
@ -324,7 +322,7 @@ static ptr new_open_output_fd_helper(
} }
} }
if (lock) { if (options & open_fd_lock) {
DEACTIVATE(tc) DEACTIVATE(tc)
error = lockfile(fd); error = lockfile(fd);
saved_errno = errno; saved_errno = errno;
@ -335,7 +333,7 @@ static ptr new_open_output_fd_helper(
} }
} }
if (!compressed) { if (!(options & open_fd_compressed)) {
return MAKE_FD(fd); return MAKE_FD(fd);
} }
@ -349,27 +347,19 @@ static ptr new_open_output_fd_helper(
return MAKE_GZXFILE(file); return MAKE_GZXFILE(file);
} }
ptr S_new_open_output_fd( ptr S_new_open_output_fd(const char *filename, INT mode, INT options) {
const char *filename, INT mode,
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed) {
return new_open_output_fd_helper( return new_open_output_fd_helper(
filename, mode, O_BINARY | O_WRONLY, filename, mode, O_BINARY | O_WRONLY,
no_create, no_fail, no_truncate, options);
append, lock, replace, compressed);
} }
ptr S_new_open_input_output_fd( ptr S_new_open_input_output_fd(const char *filename, INT mode, INT options) {
const char *filename, INT mode, if (options & open_fd_compressed)
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed) {
if (compressed)
return Sstring("compressed input/output files not supported"); return Sstring("compressed input/output files not supported");
else else
return new_open_output_fd_helper( return new_open_output_fd_helper(
filename, mode, O_BINARY | O_RDWR, filename, mode, O_BINARY | O_RDWR,
no_create, no_fail, no_truncate, options);
append, lock, replace, 0);
} }
ptr S_close_fd(ptr file, IBOOL gzflag) { ptr S_close_fd(ptr file, IBOOL gzflag) {

View File

@ -732,12 +732,12 @@ void S_trunc_rem(tc, origx, y, q, r) ptr tc, origx, y, *q, *r; {
if (Sfixnump(y)) { if (Sfixnump(y)) {
if (x == FIX(most_negative_fixnum) && y == FIX(-1)) { if (x == FIX(most_negative_fixnum) && y == FIX(-1)) {
iptr m = most_negative_fixnum /* pull out to avoid bogus Sun C warning */; iptr m = most_negative_fixnum /* pull out to avoid bogus Sun C warning */;
if (q != (ptr)NULL) *q = Sinteger(-m); if (q != NULL) *q = Sinteger(-m);
if (r != (ptr)NULL) *r = FIX(0); if (r != NULL) *r = FIX(0);
return; return;
} else { } else {
if (q != (ptr)NULL) *q = FIX((iptr)x / (iptr)y); if (q != NULL) *q = FIX((iptr)x / (iptr)y);
if (r != (ptr)NULL) *r = (ptr)((iptr)x % (iptr)y); if (r != NULL) *r = (ptr)((iptr)x % (iptr)y);
return; return;
} }
} else { } else {

929
c/pb.c Normal file
View File

@ -0,0 +1,929 @@
#include "system.h"
#include <string.h>
#include <math.h>
/* Interpreter for portable bytecode. See "pb.ss". */
typedef uint32_t instruction_t;
#define INSTR_op(instr) ((instr) & 0xFF)
#define INSTR_d_dest(instr) (((instr) >> 8) & 0xF)
#define INSTR_dr_dest(instr) INSTR_d_dest(instr)
#define INSTR_dr_reg(instr) (((instr) >> 16) & 0xF)
#define INSTR_di_dest(instr) INSTR_d_dest(instr)
#define INSTR_di_imm(instr) (((int32_t)(instr)) >> 16)
#define INSTR_di_imm_unsigned(instr) ((instr) >> 16)
#define INSTR_drr_dest(instr) INSTR_d_dest(instr)
#define INSTR_drr_reg1(instr) (((instr) >> 12) & 0xF)
#define INSTR_drr_reg2(instr) (((instr) >> 16) & 0xF)
#define INSTR_dri_dest(instr) INSTR_d_dest(instr)
#define INSTR_dri_reg(instr) (((instr) >> 12) & 0xF)
#define INSTR_dri_imm(instr) (((int32_t)(instr)) >> 16)
#define INSTR_i_imm(instr) (((int32_t)(instr)) >> 8)
#define SHIFT_MASK(v) ((v) & (ptr_bits-1))
static uptr regs[16];
static double fpregs[8];
enum {
Cretval = 9,
Carg1 = 9,
Carg2,
Carg3,
Carg4,
Carg5,
Carg6,
Carg7
};
enum {
Cfpretval = 1,
Cfparg1 = 1,
Cfparg2,
Cfparg3,
Cfparg4,
Cfparg5,
Cfparg6
};
void S_machine_init() {}
#define SIGN_FLIP(r, a, b) ((~((a ^ b) | (r ^ ~b))) >> (ptr_bits-1))
#if __GNUC__ >= 5
# define USE_OVERFLOW_INTRINSICS 1
#else
# define USE_OVERFLOW_INTRINSICS 0
#endif
#if 0
# define TRACE(print, record) print
#elif 0
# define TRACE(print, record) record
static instruction_t *branch_from, *branch_to;
static instruction_t *jump_from, *jump_to;
static instruction_t *interp_from, *interp_to;
static instruction_t *call_from; static void *call_to;
#else
# define TRACE(print, record) /* empty */
#endif
void S_pb_interp(ptr tc, void *bytecode) {
instruction_t *ip = (instruction_t *)bytecode, *next_ip, instr;
int flag = 0;
regs[0] = (uptr)tc;
TRACE(printf("enter %p\n", ip), );
while (1) {
instr = *ip;
next_ip = ip + 1;
switch(INSTR_op(instr)) {
case pb_mov16_pb_zero_bits_pb_shift0:
regs[INSTR_di_dest(instr)] = (uptr)INSTR_di_imm_unsigned(instr);
break;
case pb_mov16_pb_zero_bits_pb_shift1:
regs[INSTR_di_dest(instr)] = (uptr)INSTR_di_imm_unsigned(instr) << 16;
break;
case pb_mov16_pb_zero_bits_pb_shift2:
#if ptr_bits == 64
regs[INSTR_di_dest(instr)] = (uptr)INSTR_di_imm_unsigned(instr) << 32;
#else
regs[INSTR_di_dest(instr)] = 0;
#endif
break;
case pb_mov16_pb_zero_bits_pb_shift3:
#if ptr_bits == 64
regs[INSTR_di_dest(instr)] = (uptr)INSTR_di_imm_unsigned(instr) << 48;
#else
regs[INSTR_di_dest(instr)] = 0;
#endif
break;
case pb_mov16_pb_keep_bits_pb_shift0:
regs[INSTR_di_dest(instr)] |= (uptr)INSTR_di_imm_unsigned(instr);
break;
case pb_mov16_pb_keep_bits_pb_shift1:
regs[INSTR_di_dest(instr)] |= (uptr)INSTR_di_imm_unsigned(instr) << 16;
break;
case pb_mov16_pb_keep_bits_pb_shift2:
#if ptr_bits == 64
regs[INSTR_di_dest(instr)] |= (uptr)INSTR_di_imm_unsigned(instr) << 32;
#endif
break;
case pb_mov16_pb_keep_bits_pb_shift3:
#if ptr_bits == 64
regs[INSTR_di_dest(instr)] |= (uptr)INSTR_di_imm_unsigned(instr) << 48;
#endif
break;
case pb_mov_pb_i_i:
regs[INSTR_dr_dest(instr)] = regs[INSTR_dr_reg(instr)];
break;
case pb_mov_pb_d_d:
fpregs[INSTR_dr_dest(instr)] = fpregs[INSTR_dr_reg(instr)];
break;
case pb_mov_pb_i_d:
fpregs[INSTR_dr_dest(instr)] = (double)(iptr)regs[INSTR_dr_reg(instr)];
break;
case pb_mov_pb_d_i:
regs[INSTR_dr_dest(instr)] = (iptr)fpregs[INSTR_dr_reg(instr)];
break;
#if ptr_bits == 64
case pb_mov_pb_i_bits_d_bits:
memcpy(&fpregs[INSTR_dr_dest(instr)], &regs[INSTR_dr_reg(instr)], sizeof(double));
break;
case pb_mov_pb_d_bits_i_bits:
memcpy(&regs[INSTR_dr_dest(instr)], &fpregs[INSTR_dr_reg(instr)], sizeof(double));
break;
#else
case pb_mov_pb_i_i_bits_d_bits:
{
uint64_t d;
d = regs[INSTR_drr_reg1(instr)] | ((uint64_t)regs[INSTR_drr_reg2(instr)] << 32);
memcpy(&fpregs[INSTR_drr_dest(instr)], &d, sizeof(double));
}
break;
case pb_mov_pb_d_lo_bits_i_bits:
{
uint64_t d;
memcpy(&d, &fpregs[INSTR_dr_reg(instr)], sizeof(double));
regs[INSTR_dr_dest(instr)] = d;
}
break;
case pb_mov_pb_d_hi_bits_i_bits:
{
uint64_t d;
memcpy(&d, &fpregs[INSTR_dr_reg(instr)], sizeof(double));
d >>= 32;
regs[INSTR_dr_dest(instr)] = d;
}
break;
#endif
case pb_mov_pb_s_d:
{
float f;
#ifdef PORTABLE_BYTECODE_BIGENDIAN
memcpy(&f, (char *)&fpregs[INSTR_dr_reg(instr)] + 4, sizeof(float));
#else
memcpy(&f, &fpregs[INSTR_dr_reg(instr)], sizeof(float));
#endif
fpregs[INSTR_dr_dest(instr)] = f;
}
break;
case pb_mov_pb_d_s:
{
float f;
f = fpregs[INSTR_dr_reg(instr)];
#ifdef PORTABLE_BYTECODE_BIGENDIAN
memcpy((char *)&fpregs[INSTR_dr_dest(instr)] + 4, &f, sizeof(float));
#else
memcpy(&fpregs[INSTR_dr_dest(instr)], &f, sizeof(float));
#endif
}
break;
case pb_bin_op_pb_no_signal_pb_add_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_add_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] + (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_sub_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] - regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_sub_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] - (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_mul_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] * regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_mul_pb_immediate:
regs[INSTR_dri_dest(instr)] = (uptr)regs[INSTR_dri_reg(instr)] * (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_div_pb_register:
regs[INSTR_drr_dest(instr)] = (iptr)regs[INSTR_drr_reg1(instr)] / (iptr)regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_div_pb_immediate:
regs[INSTR_dri_dest(instr)] = (iptr)regs[INSTR_dri_reg(instr)] / (iptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_and_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] & regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_and_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] & (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_ior_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] | regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_ior_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] | (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_xor_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] ^ regs[INSTR_drr_reg2(instr)];
break;
case pb_bin_op_pb_no_signal_pb_xor_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] ^ (uptr)INSTR_dri_imm(instr);
break;
case pb_bin_op_pb_no_signal_pb_lsl_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] << SHIFT_MASK(regs[INSTR_drr_reg2(instr)]);
break;
case pb_bin_op_pb_no_signal_pb_lsl_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] << SHIFT_MASK(INSTR_dri_imm(instr));
break;
case pb_bin_op_pb_no_signal_pb_lsr_pb_register:
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] >> SHIFT_MASK(regs[INSTR_drr_reg2(instr)]);
break;
case pb_bin_op_pb_no_signal_pb_lsr_pb_immediate:
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] >> SHIFT_MASK(INSTR_dri_imm(instr));
break;
case pb_bin_op_pb_no_signal_pb_asr_pb_register:
regs[INSTR_drr_dest(instr)] = (iptr)regs[INSTR_drr_reg1(instr)] >> SHIFT_MASK(regs[INSTR_drr_reg2(instr)]);
break;
case pb_bin_op_pb_no_signal_pb_asr_pb_immediate:
regs[INSTR_dri_dest(instr)] = (iptr)regs[INSTR_dri_reg(instr)] >> SHIFT_MASK(INSTR_dri_imm(instr));
break;
case pb_bin_op_pb_no_signal_pb_lslo_pb_register:
#ifdef PORTABLE_BYTECODE_BIGENDIAN
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] >> regs[INSTR_drr_reg2(instr)];
#else
regs[INSTR_drr_dest(instr)] = regs[INSTR_drr_reg1(instr)] << regs[INSTR_drr_reg2(instr)];
#endif
break;
case pb_bin_op_pb_no_signal_pb_lslo_pb_immediate:
#ifdef PORTABLE_BYTECODE_BIGENDIAN
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] >> INSTR_dri_imm(instr);
#else
regs[INSTR_dri_dest(instr)] = regs[INSTR_dri_reg(instr)] << INSTR_dri_imm(instr);
#endif
break;
case pb_bin_op_pb_signal_pb_add_pb_register:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_drr_reg1(instr)];
iptr b = (iptr)regs[INSTR_drr_reg2(instr)];
iptr r;
flag = __builtin_add_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_drr_reg1(instr)];
uptr b = regs[INSTR_drr_reg2(instr)];
uptr r = a + b;
regs[INSTR_drr_dest(instr)] = r;
flag = SIGN_FLIP(r, a, b);
#endif
}
break;
case pb_bin_op_pb_signal_pb_add_pb_immediate:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_dri_reg(instr)];
iptr b = INSTR_dri_imm(instr);
iptr r;
flag = __builtin_add_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_dri_reg(instr)];
uptr b = (uptr)INSTR_dri_imm(instr);
uptr r = a + b;
regs[INSTR_dri_dest(instr)] = r;
flag = SIGN_FLIP(r, a, b);
#endif
}
break;
case pb_bin_op_pb_signal_pb_sub_pb_register:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_drr_reg1(instr)];
iptr b = (iptr)regs[INSTR_drr_reg2(instr)];
iptr r;
flag = __builtin_sub_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_drr_reg1(instr)];
uptr b = regs[INSTR_drr_reg2(instr)];
uptr r = a - b;
regs[INSTR_drr_dest(instr)] = r;
flag = SIGN_FLIP(r, a, ~b);
#endif
}
break;
case pb_bin_op_pb_signal_pb_sub_pb_immediate:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_dri_reg(instr)];
iptr b = INSTR_dri_imm(instr);
iptr r;
flag = __builtin_sub_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_dri_reg(instr)];
uptr b = (uptr)INSTR_dri_imm(instr);
uptr r = a - b;
regs[INSTR_dri_dest(instr)] = r;
flag = SIGN_FLIP(r, a, ~b);
#endif
}
break;
case pb_bin_op_pb_signal_pb_mul_pb_register:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_drr_reg1(instr)];
iptr b = (iptr)regs[INSTR_drr_reg2(instr)];
iptr r;
flag = __builtin_mul_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_drr_reg1(instr)];
uptr b = regs[INSTR_drr_reg2(instr)];
uptr r = a * b;
regs[INSTR_drr_dest(instr)] = r;
if (b != 0) {
if (b == (uptr)-1)
flag = (a != r * (uptr)-1);
else
flag = ((iptr)a != (iptr)r / (iptr)b);
} else
flag = 0;
#endif
}
break;
case pb_bin_op_pb_signal_pb_mul_pb_immediate:
{
#if USE_OVERFLOW_INTRINSICS
iptr a = (iptr)regs[INSTR_dri_reg(instr)];
iptr b = INSTR_dri_imm(instr);
iptr r;
flag = __builtin_mul_overflow(a, b, &r);
regs[INSTR_drr_dest(instr)] = (uptr)r;
#else
uptr a = regs[INSTR_dri_reg(instr)];
uptr b = (uptr)INSTR_dri_imm(instr);
uptr r = a * b;
regs[INSTR_dri_dest(instr)] = r;
if (b != 0) {
if (b == (uptr)-1)
flag = (a != r * (uptr)-1);
else
flag = ((iptr)a != (iptr)r / (iptr)b);
} else
flag = 0;
#endif
}
break;
case pb_bin_op_pb_signal_pb_subz_pb_register:
{
iptr r = regs[INSTR_drr_reg1(instr)] - regs[INSTR_drr_reg2(instr)];
regs[INSTR_drr_dest(instr)] = r;
flag = (r == 0);
}
break;
case pb_bin_op_pb_signal_pb_subz_pb_immediate:
{
iptr r = regs[INSTR_dri_reg(instr)] - (uptr)INSTR_dri_imm(instr);
regs[INSTR_dri_dest(instr)] = r;
flag = (r == 0);
}
break;
case pb_cmp_op_pb_eq_pb_register:
flag = regs[INSTR_dr_dest(instr)] == regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_eq_pb_immediate:
flag = regs[INSTR_di_dest(instr)] == (uptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_lt_pb_register:
flag = (iptr)regs[INSTR_dr_dest(instr)] < (iptr)regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_lt_pb_immediate:
flag = (iptr)regs[INSTR_di_dest(instr)] < (iptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_gt_pb_register:
flag = (iptr)regs[INSTR_dr_dest(instr)] > (iptr)regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_gt_pb_immediate:
flag = (iptr)regs[INSTR_di_dest(instr)] > (iptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_le_pb_register:
flag = (iptr)regs[INSTR_dr_dest(instr)] <= (iptr)regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_le_pb_immediate:
flag = (iptr)regs[INSTR_di_dest(instr)] <= (iptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_ge_pb_register:
flag = (iptr)regs[INSTR_dr_dest(instr)] >= (iptr)regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_ge_pb_immediate:
flag = (iptr)regs[INSTR_di_dest(instr)] >= (iptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_ab_pb_register:
flag = regs[INSTR_dr_dest(instr)] > regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_ab_pb_immediate:
flag = regs[INSTR_di_dest(instr)] > (uptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_bl_pb_register:
flag = regs[INSTR_dr_dest(instr)] < regs[INSTR_dr_reg(instr)];
break;
case pb_cmp_op_pb_bl_pb_immediate:
flag = regs[INSTR_di_dest(instr)] < (uptr)INSTR_di_imm(instr);
break;
case pb_cmp_op_pb_cs_pb_register:
flag = ((regs[INSTR_dr_dest(instr)] & regs[INSTR_dr_reg(instr)]) != 0);
break;
case pb_cmp_op_pb_cs_pb_immediate:
flag = ((regs[INSTR_di_dest(instr)] & (uptr)INSTR_di_imm(instr)) != 0);
break;
case pb_cmp_op_pb_cc_pb_register:
flag = ((regs[INSTR_dr_dest(instr)] & regs[INSTR_dr_reg(instr)]) == 0);
break;
case pb_cmp_op_pb_cc_pb_immediate:
flag = ((regs[INSTR_di_dest(instr)] & (uptr)INSTR_di_imm(instr)) == 0);
break;
case pb_fp_bin_op_pb_add_pb_register:
fpregs[INSTR_drr_dest(instr)] = fpregs[INSTR_drr_reg1(instr)] + fpregs[INSTR_drr_reg2(instr)];
break;
case pb_fp_bin_op_pb_sub_pb_register:
fpregs[INSTR_drr_dest(instr)] = fpregs[INSTR_drr_reg1(instr)] - fpregs[INSTR_drr_reg2(instr)];
break;
case pb_fp_bin_op_pb_mul_pb_register:
fpregs[INSTR_drr_dest(instr)] = fpregs[INSTR_drr_reg1(instr)] * fpregs[INSTR_drr_reg2(instr)];
break;
case pb_fp_bin_op_pb_div_pb_register:
fpregs[INSTR_drr_dest(instr)] = fpregs[INSTR_drr_reg1(instr)] / fpregs[INSTR_drr_reg2(instr)];
break;
case pb_un_op_pb_not_pb_register:
regs[INSTR_dr_dest(instr)] = ~(regs[INSTR_dr_reg(instr)]);
break;
case pb_un_op_pb_not_pb_immediate:
regs[INSTR_di_dest(instr)] = ~((uptr)(iptr)INSTR_di_imm(instr));
break;
case pb_fp_un_op_pb_sqrt_pb_register:
fpregs[INSTR_dr_dest(instr)] = sqrt(fpregs[INSTR_dr_reg(instr)]);
break;
case pb_fp_cmp_op_pb_eq_pb_register:
flag = fpregs[INSTR_dr_dest(instr)] == fpregs[INSTR_dr_reg(instr)];
break;
case pb_fp_cmp_op_pb_lt_pb_register:
flag = fpregs[INSTR_dr_dest(instr)] < fpregs[INSTR_dr_reg(instr)];
break;
case pb_fp_cmp_op_pb_le_pb_register:
flag = fpregs[INSTR_dr_dest(instr)] <= fpregs[INSTR_dr_reg(instr)];
break;
case pb_rev_op_pb_int16_pb_register:
#if ptr_bits == 64
regs[INSTR_dr_dest(instr)] = ((uptr)((iptr)(regs[INSTR_dr_reg(instr)] << 56) >> 48)
| ((regs[INSTR_dr_reg(instr)] & 0xFF00) >> 8));
#else
regs[INSTR_dr_dest(instr)] = ((uptr)((iptr)(regs[INSTR_dr_reg(instr)] << 24) >> 16)
| ((regs[INSTR_dr_reg(instr)] & 0xFF00) >> 8));
#endif
break;
case pb_rev_op_pb_uint16_pb_register:
regs[INSTR_dr_dest(instr)] = (((regs[INSTR_dr_reg(instr)] & 0x00FF) << 8)
| ((regs[INSTR_dr_reg(instr)] & 0xFF00) >> 8));
break;
case pb_rev_op_pb_int32_pb_register:
#if ptr_bits == 64
regs[INSTR_dr_dest(instr)] = ((uptr)((iptr)(regs[INSTR_dr_reg(instr)] << 56) >> 32)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0xFF000000) >> 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00FF0000) >> 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000FF00) << 8));
#else
regs[INSTR_dr_dest(instr)] = ((regs[INSTR_dr_reg(instr)] << 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0xFF000000) >> 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00FF0000) >> 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000FF00) << 8));
#endif
break;
case pb_rev_op_pb_uint32_pb_register:
regs[INSTR_dr_dest(instr)] = (((regs[INSTR_dr_reg(instr)] & (uptr)0x000000FF) << 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0xFF000000) >> 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00FF0000) >> 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000FF00) << 8));
break;
case pb_rev_op_pb_int64_pb_register:
#if ptr_bits == 64
regs[INSTR_dr_dest(instr)] = (((regs[INSTR_dr_reg(instr)] & (uptr)0x00000000000000FF) << 56)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x000000000000FF00) << 40)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000000000FF0000) << 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00000000FF000000) << 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x000000FF00000000) >> 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000FF0000000000) >> 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00FF000000000000) >> 40)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0xFF00000000000000) >> 56));
#else
regs[INSTR_dr_dest(instr)] = (((regs[INSTR_dr_reg(instr)] & (uptr)0x000000FF) << 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0xFF000000) >> 24)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x00FF0000) >> 8)
| ((regs[INSTR_dr_reg(instr)] & (uptr)0x0000FF00) << 8));
#endif
break;
case pb_ld_op_pb_int8_pb_register:
regs[INSTR_drr_dest(instr)] = *(int8_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_int8_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(int8_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_uint8_pb_register:
regs[INSTR_drr_dest(instr)] = *(uint8_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_uint8_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(uint8_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_int16_pb_register:
regs[INSTR_drr_dest(instr)] = *(int16_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_int16_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(int16_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_uint16_pb_register:
regs[INSTR_drr_dest(instr)] = *(uint16_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_uint16_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(uint16_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_int32_pb_register:
regs[INSTR_drr_dest(instr)] = *(int32_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_int32_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(int32_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_uint32_pb_register:
regs[INSTR_drr_dest(instr)] = *(uint32_t *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_uint32_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(uint32_t *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_int64_pb_register:
regs[INSTR_drr_dest(instr)] = *(uptr *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_int64_pb_immediate:
regs[INSTR_dri_dest(instr)] = *(uptr *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_double_pb_register:
fpregs[INSTR_drr_dest(instr)] = *(double *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_double_pb_immediate:
fpregs[INSTR_dri_dest(instr)] = *(double *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_ld_op_pb_single_pb_register:
fpregs[INSTR_drr_dest(instr)] = *(float *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]);
break;
case pb_ld_op_pb_single_pb_immediate:
fpregs[INSTR_dri_dest(instr)] = *(float *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr));
break;
case pb_st_op_pb_int8_pb_register:
*(char *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = (char)regs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_int8_pb_immediate:
*(char *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = (char)regs[INSTR_dri_dest(instr)];
break;
case pb_st_op_pb_int16_pb_register:
*(short *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = (short)regs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_int16_pb_immediate:
*(short *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = (short)regs[INSTR_dri_dest(instr)];
break;
case pb_st_op_pb_int32_pb_register:
*(int *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = (int)regs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_int32_pb_immediate:
*(int *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = (int)regs[INSTR_dri_dest(instr)];
break;
case pb_st_op_pb_int64_pb_register:
*(uptr *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = regs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_int64_pb_immediate:
*(uptr *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = regs[INSTR_dri_dest(instr)];
break;
case pb_st_op_pb_double_pb_register:
*(double *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = fpregs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_double_pb_immediate:
*(double *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = fpregs[INSTR_dri_dest(instr)];
break;
case pb_st_op_pb_single_pb_register:
*(float *)TO_VOIDP(regs[INSTR_drr_reg1(instr)] + regs[INSTR_drr_reg2(instr)]) = fpregs[INSTR_drr_dest(instr)];
break;
case pb_st_op_pb_single_pb_immediate:
*(float *)TO_VOIDP(regs[INSTR_dri_reg(instr)] + INSTR_dri_imm(instr)) = fpregs[INSTR_dri_dest(instr)];
break;
case pb_b_op_pb_fals_pb_register:
if (!flag) {
next_ip = (instruction_t *)TO_VOIDP(regs[INSTR_dr_reg(instr)]);
TRACE(printf("branch %p -> %p\n", ip, next_ip), { branch_from = ip; branch_to = next_ip; });
}
break;
case pb_b_op_pb_fals_pb_immediate:
if (!flag) {
next_ip = (instruction_t *)TO_VOIDP((char *)next_ip + INSTR_i_imm(instr));
TRACE(printf("branch %p -> %p\n", ip, next_ip), { branch_from = ip; branch_to = next_ip; });
}
break;
case pb_b_op_pb_true_pb_register:
if (flag) {
next_ip = (instruction_t *)TO_VOIDP(regs[INSTR_dr_reg(instr)]);
TRACE(printf("branch %p -> %p\n", ip, next_ip), { branch_from = ip; branch_to = next_ip; });
}
break;
case pb_b_op_pb_true_pb_immediate:
if (flag) {
next_ip = (instruction_t *)TO_VOIDP((char *)next_ip + INSTR_i_imm(instr));
TRACE(printf("branch %p -> %p\n", ip, next_ip), { branch_from = ip; branch_to = next_ip; });
}
break;
case pb_b_op_pb_always_pb_register:
next_ip = (instruction_t *)TO_VOIDP(regs[INSTR_dr_reg(instr)]);
TRACE(printf("jump %p -> %p\n", ip, next_ip), { jump_from = ip; jump_to = next_ip; });
break;
case pb_b_op_pb_always_pb_immediate:
next_ip = (instruction_t *)TO_VOIDP((char *)next_ip + INSTR_i_imm(instr));
TRACE(printf("jump %p -> %p\n", ip, next_ip), { jump_from = ip; jump_to = next_ip; });
break;
case pb_bs_op_pb_register:
next_ip = (instruction_t *)TO_VOIDP(*(uptr *)TO_VOIDP(regs[INSTR_dr_dest(instr)] + regs[INSTR_dr_reg(instr)]));
TRACE(printf("jump %p -> %p\n", ip, next_ip), { jump_from = ip; jump_to = next_ip; });
break;
case pb_bs_op_pb_immediate:
next_ip = (instruction_t *)TO_VOIDP(*(uptr *)TO_VOIDP(regs[INSTR_di_dest(instr)] + INSTR_di_imm(instr)));
TRACE(printf("jump %p -> %p\n", ip, next_ip), { jump_from = ip; jump_to = next_ip; });
break;
case pb_return:
return; /* <--- not break */
case pb_adr:
regs[INSTR_di_dest(instr)] = (uptr)TO_PTR(next_ip) + INSTR_di_imm(instr);
break;
case pb_interp:
{
void *code = TO_VOIDP(regs[INSTR_d_dest(instr)]);
TRACE(printf("interp %p -> %p\n", ip, code), { interp_from = ip; interp_to = (instruction_t *)regs[0]; });
S_pb_interp((ptr)regs[0], code);
}
break;
case pb_call:
{
void *proc = TO_VOIDP(regs[INSTR_dri_dest(instr)]);
TRACE(printf("call %p -> %p %x\n", ip, proc, INSTR_dri_imm(instr)), { call_from = ip; call_to = proc; });
switch (INSTR_dri_imm(instr)) {
case pb_call_void:
((pb_void_t)proc)();
break;
case pb_call_void_uptr:
((pb_void_uptr_t)proc)(regs[Carg1]);
break;
case pb_call_void_int32:
((pb_void_int32_t)proc)(regs[Carg1]);
break;
case pb_call_void_uint32:
((pb_void_uint32_t)proc)(regs[Carg1]);
break;
case pb_call_void_voids:
((pb_void_voids_t)proc)(TO_VOIDP(regs[Carg1]));
break;
case pb_call_void_uptr_uint32:
((pb_void_uptr_uint32_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_void_int32_uptr:
((pb_void_int32_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_void_int32_voids:
((pb_void_int32_voids_t)proc)(regs[Carg1], TO_VOIDP(regs[Carg2]));
break;
case pb_call_void_uptr_voids:
((pb_void_uptr_voids_t)proc)(regs[Carg1], TO_VOIDP(regs[Carg2]));
break;
case pb_call_void_int32_int32:
((pb_void_int32_int32_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_void_uptr_uptr:
((pb_void_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_void_voids_voids:
((pb_void_voids_voids_t)proc)(TO_VOIDP(regs[Carg1]), TO_VOIDP(regs[Carg2]));
break;
case pb_call_void_uptr_uptr_uptr:
((pb_void_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3]);
break;
case pb_call_void_uptr_uptr_uptr_uptr_uptr:
((pb_void_uptr_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5]);
break;
case pb_call_int32:
regs[Cretval] = ((pb_int32_t)proc)();
break;
case pb_call_int32_uptr:
regs[Cretval] = ((pb_int32_uptr_t)proc)(regs[Carg1]);
break;
case pb_call_int32_voids:
regs[Cretval] = ((pb_int32_voids_t)proc)(TO_VOIDP(regs[Carg1]));
break;
case pb_call_int32_uptr_int32:
regs[Cretval] = ((pb_int32_uptr_int32_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_int32_uptr_uptr:
regs[Cretval] = ((pb_int32_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_int32_int32_int32:
regs[Cretval] = ((pb_int32_int32_int32_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_int32_voids_int32:
regs[Cretval] = ((pb_int32_voids_int32_t)proc)(TO_VOIDP(regs[Carg1]), regs[Carg2]);
break;
case pb_call_int32_int32_voids:
regs[Cretval] = ((pb_int32_int32_voids_t)proc)(regs[Carg1], TO_VOIDP(regs[Carg2]));
break;
case pb_call_int32_double_double_double_double_double_double:
regs[Cretval] = ((pb_int32_double_double_double_double_double_double_t)proc)(fpregs[Cfparg1], fpregs[Cfparg2], fpregs[Cfparg3],
fpregs[Cfparg4], fpregs[Cfparg5], fpregs[Cfparg6]);
break;
case pb_call_uint32:
regs[Cretval] = ((pb_uint32_t)proc)();
break;
case pb_call_double_double:
fpregs[Cfpretval] = ((pb_double_double_t)proc)(fpregs[Cfparg1]);
break;
case pb_call_double_uptr:
fpregs[Cfpretval] = ((pb_double_uptr_t)proc)(regs[Carg1]);
break;
case pb_call_double_double_double:
fpregs[Cfpretval] = ((pb_double_double_double_t)proc)(fpregs[Cfparg1], fpregs[Cfparg2]);
break;
case pb_call_int32_int32:
regs[Cretval] = ((pb_int32_int32_t)proc)(regs[Carg1]);
break;
case pb_call_int32_int32_uptr:
regs[Cretval] = ((pb_int32_int32_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_int32_voids_voids_voids_voids_uptr:
regs[Cretval] = ((pb_int32_voids_voids_voids_voids_uptr_t)proc)(TO_VOIDP(regs[Carg1]), TO_VOIDP(regs[Carg2]), TO_VOIDP(regs[Carg3]),
TO_VOIDP(regs[Carg4]), regs[Carg5]);
break;
case pb_call_uptr:
regs[Cretval] = ((pb_uptr_t)proc)();
break;
case pb_call_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_t)proc)(regs[Carg1]);
break;
case pb_call_uptr_int32:
regs[Cretval] = ((pb_uptr_int32_t)proc)(regs[Carg1]);
break;
case pb_call_uptr_voids:
regs[Cretval] = ((pb_uptr_voids_t)proc)(TO_VOIDP(regs[Carg1]));
break;
case pb_call_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_uptr_uptr_int32:
regs[Cretval] = ((pb_uptr_uptr_int32_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_uptr_uptr_int64:
#if ptr_bits == 64
regs[Cretval] = ((pb_uptr_uptr_int64_t)proc)(regs[Carg1], regs[Carg2]);
#else
regs[Cretval] = ((pb_uptr_uptr_int64_t)proc)(regs[Carg1], regs[Carg2] | ((int64_t)regs[Carg3] << 32));
#endif
break;
case pb_call_uptr_int32_uptr:
regs[Cretval] = ((pb_uptr_int32_uptr_t)proc)(regs[Carg1], regs[Carg2]);
break;
case pb_call_uptr_voids_uptr:
regs[Cretval] = ((pb_uptr_voids_uptr_t)proc)(TO_VOIDP(regs[Carg1]), regs[Carg2]);
break;
case pb_call_uptr_uptr_voids:
regs[Cretval] = ((pb_uptr_uptr_voids_t)proc)(regs[Carg1], TO_VOIDP(regs[Carg2]));
break;
case pb_call_uptr_voids_int32:
regs[Cretval] = ((pb_uptr_voids_int32_t)proc)(TO_VOIDP(regs[Carg1]), regs[Carg2]);
break;
case pb_call_uptr_voids_voids:
regs[Cretval] = ((pb_uptr_voids_voids_t)proc)(TO_VOIDP(regs[Carg1]), TO_VOIDP(regs[Carg2]));
break;
case pb_call_uptr_uptr_int32_int32:
regs[Cretval] = ((pb_uptr_uptr_int32_int32_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_voids_int32_int32:
regs[Cretval] = ((pb_uptr_voids_int32_int32_t)proc)(TO_VOIDP(regs[Carg1]), regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_voids_uptr_uptr:
regs[Cretval] = ((pb_uptr_voids_uptr_uptr_t)proc)(TO_VOIDP(regs[Carg1]), regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_uptr_uptr_int32:
regs[Cretval] = ((pb_uptr_uptr_uptr_int32_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_int32_int32_uptr:
regs[Cretval] = ((pb_uptr_int32_int32_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3]);
break;
case pb_call_uptr_int32_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_int32_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4]);
break;
case pb_call_uptr_int32_int32_uptr_uptr:
regs[Cretval] = ((pb_uptr_int32_int32_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4]);
break;
case pb_call_uptr_int32_voids_uptr_uptr:
regs[Cretval] = ((pb_uptr_int32_voids_uptr_uptr_t)proc)(regs[Carg1], TO_VOIDP(regs[Carg2]), regs[Carg3],
regs[Carg4]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr_int32:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_int32_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5]);
break;
case pb_call_uptr_voids_voids_voids_voids_uptr:
regs[Cretval] = ((pb_uptr_voids_voids_voids_voids_uptr_t)proc)(TO_VOIDP(regs[Carg1]), TO_VOIDP(regs[Carg2]), TO_VOIDP(regs[Carg3]),
TO_VOIDP(regs[Carg4]), regs[Carg5]);
break;
case pb_call_uptr_uptr_int32_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_int32_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5], regs[Carg6]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5], regs[Carg6]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr_uptr_uptr_int32:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_uptr_uptr_int32_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5], regs[Carg6],
regs[Carg7]);
break;
case pb_call_uptr_uptr_uptr_uptr_uptr_uptr_uptr_uptr:
regs[Cretval] = ((pb_uptr_uptr_uptr_uptr_uptr_uptr_uptr_uptr_t)proc)(regs[Carg1], regs[Carg2], regs[Carg3],
regs[Carg4], regs[Carg5], regs[Carg6],
regs[Carg7]);
break;
case pb_call_uptr_double_double_double_double_double_double:
regs[Cretval] = ((pb_uptr_double_double_double_double_double_double_t)proc)(fpregs[Cfparg1], fpregs[Cfparg2], fpregs[Cfparg3],
fpregs[Cfparg4], fpregs[Cfparg5], fpregs[Cfparg6]);
break;
case pb_call_voids:
regs[Cretval] = TO_PTR(((pb_voids_t)proc)());
break;
case pb_call_voids_uptr:
regs[Cretval] = TO_PTR(((pb_voids_uptr_t)proc)(regs[Carg1]));
break;
default:
S_error_abort("unsupported call prototype");
break;
}
}
break;
case pb_inc_pb_register:
{
uptr r = *(uptr *)TO_VOIDP(regs[INSTR_dr_dest(instr)]) + regs[INSTR_dr_reg(instr)];
*(uptr *)TO_VOIDP(regs[INSTR_dr_dest(instr)]) = r;
flag = (r == 0);
}
break;
case pb_inc_pb_immediate:
{
uptr r = *(uptr *)TO_VOIDP(regs[INSTR_di_dest(instr)]) + INSTR_di_imm(instr);
*(uptr *)TO_VOIDP(regs[INSTR_di_dest(instr)]) = r;
flag = (r == 0);
}
break;
case pb_lock:
{
uptr *l = TO_VOIDP(regs[INSTR_d_dest(instr)]);
if (*l == 0) {
*l = 1;
flag = 1;
} else
flag = 0;
}
break;
case pb_cas:
{
uptr *l = TO_VOIDP(regs[INSTR_drr_dest(instr)]);
uptr old = regs[INSTR_drr_reg1(instr)];
uptr new = regs[INSTR_drr_reg2(instr)];
if (*l == old) {
*l = new;
flag = 1;
} else
flag = 0;
}
break;
default:
S_error_abort("illegal pb instruction");
break;
}
ip = next_ip;
}
}

View File

@ -45,6 +45,10 @@ static void install_library_entry(n, x) ptr n, x; {
if (n == FIX(library_cpu_features)) if (n == FIX(library_cpu_features))
x86_64_set_popcount_present(x); x86_64_set_popcount_present(x);
#endif #endif
#ifdef PORTABLE_BYTECODE_BIGENDIAN
if (n == FIX(library_dounderflow))
S_swap_dounderflow_header_endian(CLOSCODE(x));
#endif
} }
ptr S_lookup_library_entry(n, errorp) iptr n; IBOOL errorp; { ptr S_lookup_library_entry(n, errorp) iptr n; IBOOL errorp; {
@ -81,7 +85,7 @@ ptr int2ptr(iptr f)
return (ptr)(f & ~0x3); return (ptr)(f & ~0x3);
} }
#else /* HPUX */ #else /* HPUX */
#define proc2ptr(x) (ptr)(iptr)(x) #define proc2ptr(x) TO_PTR(x)
#endif /* HPUX */ #endif /* HPUX */
void S_install_c_entry(i, x) iptr i; ptr x; { void S_install_c_entry(i, x) iptr i; ptr x; {
@ -122,12 +126,12 @@ static void create_c_entry_vector() {
S_install_c_entry(CENTRY_handle_overflow, proc2ptr(S_handle_overflow)); S_install_c_entry(CENTRY_handle_overflow, proc2ptr(S_handle_overflow));
S_install_c_entry(CENTRY_handle_overflood, proc2ptr(S_handle_overflood)); S_install_c_entry(CENTRY_handle_overflood, proc2ptr(S_handle_overflood));
S_install_c_entry(CENTRY_handle_nonprocedure_symbol, proc2ptr(S_handle_nonprocedure_symbol)); S_install_c_entry(CENTRY_handle_nonprocedure_symbol, proc2ptr(S_handle_nonprocedure_symbol));
S_install_c_entry(CENTRY_thread_list, (ptr)&S_threads); S_install_c_entry(CENTRY_thread_list, TO_PTR(&S_threads));
S_install_c_entry(CENTRY_split_and_resize, proc2ptr(S_split_and_resize)); S_install_c_entry(CENTRY_split_and_resize, proc2ptr(S_split_and_resize));
#ifdef PTHREADS #ifdef PTHREADS
S_install_c_entry(CENTRY_raw_collect_cond, (ptr)&S_collect_cond); S_install_c_entry(CENTRY_raw_collect_cond, TO_PTR(&S_collect_cond));
S_install_c_entry(CENTRY_raw_collect_thread0_cond, (ptr)&S_collect_thread0_cond); S_install_c_entry(CENTRY_raw_collect_thread0_cond, TO_PTR(&S_collect_thread0_cond));
S_install_c_entry(CENTRY_raw_tc_mutex, (ptr)&S_tc_mutex); S_install_c_entry(CENTRY_raw_tc_mutex, TO_PTR(&S_tc_mutex));
S_install_c_entry(CENTRY_activate_thread, proc2ptr(S_activate_thread)); S_install_c_entry(CENTRY_activate_thread, proc2ptr(S_activate_thread));
S_install_c_entry(CENTRY_deactivate_thread, proc2ptr(Sdeactivate_thread)); S_install_c_entry(CENTRY_deactivate_thread, proc2ptr(Sdeactivate_thread));
S_install_c_entry(CENTRY_unactivate_thread, proc2ptr(S_unactivate_thread)); S_install_c_entry(CENTRY_unactivate_thread, proc2ptr(S_unactivate_thread));

View File

@ -25,8 +25,8 @@
/* locally defined functions */ /* locally defined functions */
static INT s_errno PROTO((void)); static INT s_errno PROTO((void));
static iptr s_addr_in_heap PROTO((uptr x)); static IBOOL s_addr_in_heap PROTO((uptr x));
static iptr s_ptr_in_heap PROTO((ptr x)); static IBOOL s_ptr_in_heap PROTO((ptr x));
static ptr s_generation PROTO((ptr x)); static ptr s_generation PROTO((ptr x));
static iptr s_fxmul PROTO((iptr x, iptr y)); static iptr s_fxmul PROTO((iptr x, iptr y));
static iptr s_fxdiv PROTO((iptr x, iptr y)); static iptr s_fxdiv PROTO((iptr x, iptr y));
@ -146,11 +146,11 @@ static INT s_errno() {
return errno; return errno;
} }
static iptr s_addr_in_heap(x) uptr x; { static IBOOL s_addr_in_heap(x) uptr x; {
return MaybeSegInfo(addr_get_segment(x)) != NULL; return MaybeSegInfo(addr_get_segment(x)) != NULL;
} }
static iptr s_ptr_in_heap(x) ptr x; { static IBOOL s_ptr_in_heap(x) ptr x; {
return MaybeSegInfo(ptr_get_segment(x)) != NULL; return MaybeSegInfo(ptr_get_segment(x)) != NULL;
} }
@ -258,7 +258,7 @@ static ptr s_decode_float(x) ptr x; {
} }
#define FMTBUFSIZE 120 #define FMTBUFSIZE 120
#define CHUNKADDRLT(x, y) (((chunkinfo *)(Scar(x)))->addr < ((chunkinfo *)(Scar(y)))->addr) #define CHUNKADDRLT(x, y) (((chunkinfo *)TO_VOIDP(Scar(x)))->addr < ((chunkinfo *)TO_VOIDP(Scar(y)))->addr)
mkmergesort(sort_chunks, merge_chunks, ptr, Snil, CHUNKADDRLT, INITCDR) mkmergesort(sort_chunks, merge_chunks, ptr, Snil, CHUNKADDRLT, INITCDR)
static ptr sorted_chunk_list(void) { static ptr sorted_chunk_list(void) {
@ -266,7 +266,7 @@ static ptr sorted_chunk_list(void) {
for (i = PARTIAL_CHUNK_POOLS; i >= -1; i -= 1) { for (i = PARTIAL_CHUNK_POOLS; i >= -1; i -= 1) {
for (chunk = (i == -1) ? S_chunks_full : S_chunks[i]; chunk != NULL; chunk = chunk->next) { for (chunk = (i == -1) ? S_chunks_full : S_chunks[i]; chunk != NULL; chunk = chunk->next) {
ls = Scons(chunk, ls); ls = Scons(TO_PTR(chunk), ls);
n += 1; n += 1;
} }
} }
@ -347,7 +347,7 @@ static void s_show_chunks(FILE *out, ptr sorted_chunks) {
ptr ls; ptr ls;
for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) { for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) {
chunk = Scar(ls); chunk = TO_VOIDP(Scar(ls));
max_addr = chunk->addr; max_addr = chunk->addr;
if (chunk->segs > max_segs) max_segs = chunk->segs; if (chunk->segs > max_segs) max_segs = chunk->segs;
if ((void *)chunk > max_header_addr) max_header_addr = (void *)chunk; if ((void *)chunk > max_header_addr) max_header_addr = (void *)chunk;
@ -367,7 +367,7 @@ static void s_show_chunks(FILE *out, ptr sorted_chunks) {
snprintf(fmtbuf, FMTBUFSIZE, "%%#0%dtx %%#0%dtx (+ %%#0%dtx bytes @ %%#0%dtx) %%%dtd of %%%dtd\n", snprintf(fmtbuf, FMTBUFSIZE, "%%#0%dtx %%#0%dtx (+ %%#0%dtx bytes @ %%#0%dtx) %%%dtd of %%%dtd\n",
addrwidth, byteswidth, headerbyteswidth, headeraddrwidth, segswidth, segswidth); addrwidth, byteswidth, headerbyteswidth, headeraddrwidth, segswidth, segswidth);
for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) { for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) {
chunk = Scar(ls); chunk = TO_VOIDP(Scar(ls));
fprintf(out, fmtbuf, (ptrdiff_t)chunk->addr, (ptrdiff_t)chunk->bytes, fprintf(out, fmtbuf, (ptrdiff_t)chunk->addr, (ptrdiff_t)chunk->bytes,
(ptrdiff_t)(sizeof(chunkinfo) + sizeof(seginfo) * chunk->segs), (ptrdiff_t)(sizeof(chunkinfo) + sizeof(seginfo) * chunk->segs),
(ptrdiff_t)chunk, (ptrdiff_t)chunk->nused_segs, (ptrdiff_t)chunk->segs); (ptrdiff_t)chunk, (ptrdiff_t)chunk->nused_segs, (ptrdiff_t)chunk->segs);
@ -422,7 +422,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn) {
bytes[s][g] += S_G.bytes_of_space[s][g]; bytes[s][g] += S_G.bytes_of_space[s][g];
/* add in bytes in active segments */ /* add in bytes in active segments */
if (S_G.next_loc[s][g] != FIX(0)) if (S_G.next_loc[s][g] != FIX(0))
bytes[s][g] += (char *)S_G.next_loc[s][g] - (char *)S_G.base_loc[s][g]; bytes[s][g] += (uptr)S_G.next_loc[s][g] - (uptr)S_G.base_loc[s][g];
} }
} }
@ -529,7 +529,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn) {
for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) { for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) {
iptr last_seg; iptr last_seg;
chunk = Scar(ls); chunk = TO_VOIDP(Scar(ls));
last_seg = chunk->base + chunk->segs; last_seg = chunk->base + chunk->segs;
if (last_seg > max_seg) max_seg = last_seg; if (last_seg > max_seg) max_seg = last_seg;
} }
@ -544,7 +544,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn) {
for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) { for (ls = sorted_chunks; ls != Snil; ls = Scdr(ls)) {
seginfo *si; seginfo *si;
chunk = Scar(ls); chunk = TO_VOIDP(Scar(ls));
if (chunk->base != next_base && segsprinted != 0) { if (chunk->base != next_base && segsprinted != 0) {
for (;;) { for (;;) {
@ -849,14 +849,14 @@ static I32 s_chdir(const char *inpath) {
#ifdef GETWD #ifdef GETWD
static char *s_getwd() { static char *s_getwd() {
return GETWD((char *)&BVIT(S_bytevector(PATH_MAX), 0)); return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0)));
} }
#endif /* GETWD */ #endif /* GETWD */
static ptr s_set_code_byte(p, n, x) ptr p, n, x; { static ptr s_set_code_byte(p, n, x) ptr p, n, x; {
I8 *a; I8 *a;
a = (I8 *)((uptr)p + UNFIX(n)); a = (I8 *)TO_VOIDP((uptr)p + UNFIX(n));
*a = (I8)UNFIX(x); *a = (I8)UNFIX(x);
return Svoid; return Svoid;
} }
@ -864,7 +864,7 @@ static ptr s_set_code_byte(p, n, x) ptr p, n, x; {
static ptr s_set_code_word(p, n, x) ptr p, n, x; { static ptr s_set_code_word(p, n, x) ptr p, n, x; {
I16 *a; I16 *a;
a = (I16 *)((uptr)p + UNFIX(n)); a = (I16 *)TO_VOIDP((uptr)p + UNFIX(n));
*a = (I16)UNFIX(x); *a = (I16)UNFIX(x);
return Svoid; return Svoid;
} }
@ -872,7 +872,7 @@ static ptr s_set_code_word(p, n, x) ptr p, n, x; {
static ptr s_set_code_long(p, n, x) ptr p, n, x; { static ptr s_set_code_long(p, n, x) ptr p, n, x; {
I32 *a; I32 *a;
a = (I32 *)((uptr)p + UNFIX(n)); a = (I32 *)TO_VOIDP((uptr)p + UNFIX(n));
*a = (I32)(Sfixnump(x) ? UNFIX(x) : Sinteger_value(x)); *a = (I32)(Sfixnump(x) ? UNFIX(x) : Sinteger_value(x));
return Svoid; return Svoid;
} }
@ -880,14 +880,14 @@ static ptr s_set_code_long(p, n, x) ptr p, n, x; {
static void s_set_code_long2(p, n, h, l) ptr p, n, h, l; { static void s_set_code_long2(p, n, h, l) ptr p, n, h, l; {
I32 *a; I32 *a;
a = (I32 *)((uptr)p + UNFIX(n)); a = (I32 *)TO_VOIDP((uptr)p + UNFIX(n));
*a = (I32)((UNFIX(h) << 16) + UNFIX(l)); *a = (I32)((UNFIX(h) << 16) + UNFIX(l));
} }
static ptr s_set_code_quad(p, n, x) ptr p, n, x; { static ptr s_set_code_quad(p, n, x) ptr p, n, x; {
I64 *a; I64 *a;
a = (I64 *)((uptr)p + UNFIX(n)); a = (I64 *)TO_VOIDP((uptr)p + UNFIX(n));
*a = Sfixnump(x) ? UNFIX(x) : S_int64_value("\\#set-code-quad!", x); *a = Sfixnump(x) ? UNFIX(x) : S_int64_value("\\#set-code-quad!", x);
return Svoid; return Svoid;
} }
@ -1535,22 +1535,37 @@ static ptr s_profile_release_counters(void) {
void S_dump_tc(ptr tc) { void S_dump_tc(ptr tc) {
INT i; INT i;
printf("AC0=%p AC1=%p SFP=%p CP=%p\n", AC0(tc), AC1(tc), SFP(tc), CP(tc)); printf("AC0=%p AC1=%p SFP=%p CP=%p\n", TO_VOIDP(AC0(tc)), TO_VOIDP(AC1(tc)), TO_VOIDP(SFP(tc)), TO_VOIDP(CP(tc)));
printf("ESP=%p AP=%p EAP=%p\n", ESP(tc), AP(tc), EAP(tc)); printf("ESP=%p AP=%p EAP=%p\n", TO_VOIDP(ESP(tc)), TO_VOIDP(AP(tc)), TO_VOIDP(EAP(tc)));
printf("TRAP=%p XP=%p YP=%p REAL_EAP=%p\n", TRAP(tc), XP(tc), YP(tc), REAL_EAP(tc)); printf("TRAP=%p XP=%p YP=%p REAL_EAP=%p\n", TO_VOIDP(TRAP(tc)), TO_VOIDP(XP(tc)), TO_VOIDP(YP(tc)), TO_VOIDP(REAL_EAP(tc)));
printf("CCHAIN=%p RANDOMSEED=%ld SCHEMESTACK=%p STACKCACHE=%p\n", CCHAIN(tc), (long)RANDOMSEED(tc), SCHEMESTACK(tc), STACKCACHE(tc)); printf("CCHAIN=%p RANDOMSEED=%ld SCHEMESTACK=%p STACKCACHE=%p\n", TO_VOIDP(CCHAIN(tc)), (long)RANDOMSEED(tc),
printf("STACKLINK=%p SCHEMESTACKSIZE=%ld WINDERS=%p U=%p\n", STACKLINK(tc), (long)SCHEMESTACKSIZE(tc), WINDERS(tc), U(tc)); TO_VOIDP(SCHEMESTACK(tc)), TO_VOIDP(STACKCACHE(tc)));
printf("V=%p W=%p X=%p Y=%p\n", V(tc), W(tc), X(tc), Y(tc)); printf("STACKLINK=%p SCHEMESTACKSIZE=%ld WINDERS=%p U=%p\n", TO_VOIDP(STACKLINK(tc)), (long)SCHEMESTACKSIZE(tc), TO_VOIDP(WINDERS(tc)), TO_VOIDP(U(tc)));
printf("SOMETHING=%p KBDPEND=%p SIGPEND=%p TIMERTICKS=%p\n", SOMETHINGPENDING(tc), KEYBOARDINTERRUPTPENDING(tc), SIGNALINTERRUPTPENDING(tc), TIMERTICKS(tc)); printf("V=%p W=%p X=%p Y=%p\n", TO_VOIDP(V(tc)), TO_VOIDP(W(tc)), TO_VOIDP(X(tc)), TO_VOIDP(Y(tc)));
printf("DISABLECOUNT=%p PARAMETERS=%p\n", DISABLECOUNT(tc), PARAMETERS(tc)); printf("SOMETHING=%p KBDPEND=%p SIGPEND=%p TIMERTICKS=%p\n", TO_VOIDP(SOMETHINGPENDING(tc)), TO_VOIDP(KEYBOARDINTERRUPTPENDING(tc)),
TO_VOIDP(SIGNALINTERRUPTPENDING(tc)), TO_VOIDP(TIMERTICKS(tc)));
printf("DISABLECOUNT=%p PARAMETERS=%p\n", TO_VOIDP(DISABLECOUNT(tc)), TO_VOIDP(PARAMETERS(tc)));
for (i = 0 ; i < virtual_register_count ; i += 1) { for (i = 0 ; i < virtual_register_count ; i += 1) {
printf("VIRTREG[%d]=%p", i, VIRTREG(tc, i)); printf("VIRTREG[%d]=%p", i, TO_VOIDP(VIRTREG(tc, i)));
if ((i & 0x11) == 0x11 || i == virtual_register_count - 1) printf("\n"); if ((i & 0x11) == 0x11 || i == virtual_register_count - 1) printf("\n");
} }
fflush(stdout); fflush(stdout);
} }
#define proc2ptr(x) (ptr)(iptr)(x) static IBOOL s_native_little_endian() {
#define big 0
#define little 1
#ifdef PORTABLE_BYTECODE
# ifdef PORTABLE_BYTECODE_BIGENDIAN
# define unknown big
# else
# define unknown little
# endif
#endif
return native_endianness == little;
}
#define proc2ptr(x) TO_PTR(x)
void S_prim5_init() { void S_prim5_init() {
if (!S_boot_time) return; if (!S_boot_time) return;
@ -1662,6 +1677,8 @@ void S_prim5_init() {
Sforeign_symbol("(cs)phantom_bytevector_adjust", (void*)S_phantom_bytevector_adjust); Sforeign_symbol("(cs)phantom_bytevector_adjust", (void*)S_phantom_bytevector_adjust);
Sforeign_symbol("(cs)native_little_endian", (void *)s_native_little_endian);
Sforeign_symbol("(cs)logand", (void *)S_logand); Sforeign_symbol("(cs)logand", (void *)S_logand);
Sforeign_symbol("(cs)logbitp", (void *)S_logbitp); Sforeign_symbol("(cs)logbitp", (void *)S_logbitp);
Sforeign_symbol("(cs)logbit0", (void *)S_logbit0); Sforeign_symbol("(cs)logbit0", (void *)S_logbit0);
@ -1835,8 +1852,8 @@ static ptr s_get_reloc(co, with_offsets) ptr co; IBOOL with_offsets; {
} }
static void s_byte_copy(ptr src, iptr srcoff, ptr dst, iptr dstoff, iptr cnt) { static void s_byte_copy(ptr src, iptr srcoff, ptr dst, iptr dstoff, iptr cnt) {
void *srcaddr = (void *)((iptr)src + srcoff); void *srcaddr = TO_VOIDP((iptr)src + srcoff);
void *dstaddr = (void *)((iptr)dst + dstoff); void *dstaddr = TO_VOIDP((iptr)dst + dstoff);
if (dst != src) if (dst != src)
memcpy(dstaddr, srcaddr, cnt); memcpy(dstaddr, srcaddr, cnt);
else else
@ -1844,8 +1861,8 @@ static void s_byte_copy(ptr src, iptr srcoff, ptr dst, iptr dstoff, iptr cnt) {
} }
static void s_ptr_copy(ptr src, iptr srcoff, ptr dst, iptr dstoff, iptr cnt) { static void s_ptr_copy(ptr src, iptr srcoff, ptr dst, iptr dstoff, iptr cnt) {
void *srcaddr = (void *)((iptr)src + srcoff); void *srcaddr = TO_VOIDP((iptr)src + srcoff);
void *dstaddr = (void *)((iptr)dst + dstoff); void *dstaddr = TO_VOIDP((iptr)dst + dstoff);
cnt = cnt << log2_ptr_bytes; cnt = cnt << log2_ptr_bytes;
if (dst != src) if (dst != src)
memcpy(dstaddr, srcaddr, cnt); memcpy(dstaddr, srcaddr, cnt);
@ -1994,11 +2011,11 @@ static uptr s_malloc(iptr n) {
else else
S_error("foreign-alloc", "malloc failed"); S_error("foreign-alloc", "malloc failed");
} }
return (uptr)p; return (uptr)TO_PTR(p);
} }
static void s_free(uptr addr) { static void s_free(uptr addr) {
free((void *)addr); free(TO_VOIDP(addr));
} }
#ifdef FEATURE_ICONV #ifdef FEATURE_ICONV
@ -2086,7 +2103,7 @@ static ptr s_iconv_from_string(uptr cd, ptr in, uptr i, uptr iend, ptr out, uptr
size_t inbytesleft, outbytesleft; size_t inbytesleft, outbytesleft;
uptr inmax, k, new_i, new_o; uptr inmax, k, new_i, new_o;
outbuf = (char *)&BVIT(out, o); outbuf = TO_VOIDP(&BVIT(out, o));
outbytesleft = oend - o; outbytesleft = oend - o;
inmax = iend - i; inmax = iend - i;
@ -2122,7 +2139,7 @@ static ptr s_iconv_to_string(uptr cd, ptr in, uptr i, uptr iend, ptr out, uptr o
size_t inbytesleft, outbytesleft; size_t inbytesleft, outbytesleft;
uptr outmax, k, new_i, new_o; uptr outmax, k, new_i, new_o;
inbuf = (char *)&BVIT(in, i); inbuf = TO_VOIDP(&BVIT(in, i));
inbytesleft = iend - i; inbytesleft = iend - i;
outmax = oend - o; outmax = oend - o;

View File

@ -22,7 +22,7 @@
/* Representation is arecord with 6 `double` fields: */ /* Representation is arecord with 6 `double` fields: */
#define RECORDINSTDBLA(x) ((double *)((uptr)&RECORDINSTIT(x, 0) + (max_float_alignment - ptr_bytes))) #define RECORDINSTDBLA(x) ((double *)TO_VOIDP((uptr)TO_PTR(&RECORDINSTIT(x, 0)) + (max_float_alignment - ptr_bytes)))
#define RANDSTATEX10(x) (RECORDINSTDBLA(x)[0]) #define RANDSTATEX10(x) (RECORDINSTDBLA(x)[0])
#define RANDSTATEX11(x) (RECORDINSTDBLA(x)[1]) #define RANDSTATEX11(x) (RECORDINSTDBLA(x)[1])

View File

@ -121,10 +121,10 @@ static void main_init() {
CODEFREE(p) = 0; CODEFREE(p) = 0;
CODEINFO(p) = Sfalse; CODEINFO(p) = Sfalse;
CODEPINFOS(p) = Snil; CODEPINFOS(p) = Snil;
RPHEADERFRAMESIZE(&CODEIT(p, 0)) = 0; RPHEADERFRAMESIZE(TO_PTR(&CODEIT(p, 0))) = 0;
RPHEADERLIVEMASK(&CODEIT(p, 0)) = 0; RPHEADERLIVEMASK(TO_PTR(&CODEIT(p, 0))) = 0;
RPHEADERTOPLINK(&CODEIT(p, 0)) = RPHEADERTOPLINK(TO_PTR(&CODEIT(p, 0))) =
(uptr)&RPHEADERTOPLINK(&CODEIT(p, 0)) - (uptr)p; (uptr)TO_PTR(&RPHEADERTOPLINK(TO_PTR(&CODEIT(p, 0)))) - (uptr)p;
S_protect(&S_G.dummy_code_object); S_protect(&S_G.dummy_code_object);
S_G.dummy_code_object = p; S_G.dummy_code_object = p;
@ -184,6 +184,7 @@ static void idiot_checks() {
(long)sizeof(short), short_bits); (long)sizeof(short), short_bits);
oops = 1; oops = 1;
} }
#ifndef PORTABLE_BYTECODE
if (sizeof(long) * 8 != long_bits) { if (sizeof(long) * 8 != long_bits) {
fprintf(stderr, "sizeof(long) * 8 [%ld] != long_bits [%d]\n", fprintf(stderr, "sizeof(long) * 8 [%ld] != long_bits [%d]\n",
(long)sizeof(long), long_bits); (long)sizeof(long), long_bits);
@ -195,12 +196,14 @@ static void idiot_checks() {
(long)sizeof(long long), long_long_bits); (long)sizeof(long long), long_long_bits);
oops = 1; oops = 1;
} }
#endif
#endif #endif
if (sizeof(wchar_t) * 8 != wchar_bits) { if (sizeof(wchar_t) * 8 != wchar_bits) {
fprintf(stderr, "sizeof(wchar_t) * 8 [%ld] != wchar_bits [%d]\n", fprintf(stderr, "sizeof(wchar_t) * 8 [%ld] != wchar_bits [%d]\n",
(long)sizeof(wchar_t), wchar_bits); (long)sizeof(wchar_t), wchar_bits);
oops = 1; oops = 1;
} }
#ifndef PORTABLE_BYTECODE
if (sizeof(size_t) * 8 != size_t_bits) { if (sizeof(size_t) * 8 != size_t_bits) {
fprintf(stderr, "sizeof(size_t) * 8 [%ld] != size_t_bits [%d]\n", fprintf(stderr, "sizeof(size_t) * 8 [%ld] != size_t_bits [%d]\n",
(long)sizeof(size_t), size_t_bits); (long)sizeof(size_t), size_t_bits);
@ -223,6 +226,7 @@ static void idiot_checks() {
(long)sizeof(time_t), time_t_bits); (long)sizeof(time_t), time_t_bits);
oops = 1; oops = 1;
} }
#endif
if (sizeof(bigit) * 8 != bigit_bits) { if (sizeof(bigit) * 8 != bigit_bits) {
fprintf(stderr, "sizeof(bigit) * 8 [%ld] != bigit_bits [%d]\n", fprintf(stderr, "sizeof(bigit) * 8 [%ld] != bigit_bits [%d]\n",
(long)sizeof(bigit), bigit_bits); (long)sizeof(bigit), bigit_bits);
@ -287,6 +291,7 @@ static void idiot_checks() {
} }
#define big 0 #define big 0
#define little 1 #define little 1
#define unknown 2
if (native_endianness == big) { if (native_endianness == big) {
uptr x[1]; uptr x[1];
*x = 1; *x = 1;
@ -294,7 +299,7 @@ static void idiot_checks() {
fprintf(stderr, "endianness claimed to be big, appears to be little\n"); fprintf(stderr, "endianness claimed to be big, appears to be little\n");
oops = 1; oops = 1;
} }
} else { } else if (native_endianness == little) {
uptr x[1]; uptr x[1];
*x = 1; *x = 1;
if (*(char *)x == 0) { if (*(char *)x == 0) {
@ -314,7 +319,7 @@ static void idiot_checks() {
fprintf(stderr, "cards_per_segment is not a multiple of sizeof(iptr)\n"); fprintf(stderr, "cards_per_segment is not a multiple of sizeof(iptr)\n");
oops = 1; oops = 1;
} }
if (((uptr)(&((seginfo *)0)->dirty_bytes[0]) & (sizeof(iptr) - 1)) != 0) { if (((uptr)TO_PTR(&((seginfo *)0)->dirty_bytes[0]) & (sizeof(iptr) - 1)) != 0) {
/* gc sometimes processes dirty bytes sizeof(iptr) bytes at a time */ /* gc sometimes processes dirty bytes sizeof(iptr) bytes at a time */
fprintf(stderr, "dirty_bytes[0] is not iptr-aligned wrt to seginfo struct\n"); fprintf(stderr, "dirty_bytes[0] is not iptr-aligned wrt to seginfo struct\n");
oops = 1; oops = 1;
@ -365,14 +370,16 @@ static void check_ap(tc) ptr tc; {
(void) fprintf(stderr, "ap is not double word aligned\n"); (void) fprintf(stderr, "ap is not double word aligned\n");
S_abnormal_exit(); S_abnormal_exit();
} }
if ((ptr *)AP(tc) > (ptr *)EAP(tc)) { if ((uptr)AP(tc) > (uptr)EAP(tc)) {
(void) fprintf(stderr, "ap is greater than eap\n"); (void) fprintf(stderr, "ap is greater than eap\n");
S_abnormal_exit(); S_abnormal_exit();
} }
} }
void S_generic_invoke(tc, code) ptr tc; ptr code; { void S_generic_invoke(tc, code) ptr tc; ptr code; {
#if defined(PPCAIX) #if defined(PORTABLE_BYTECODE)
S_pb_interp(tc, (void *)&CODEIT(code,0));
#elif defined(PPCAIX)
struct {caddr_t entry, toc, static_link;} hdr; struct {caddr_t entry, toc, static_link;} hdr;
hdr.entry = (caddr_t)&CODEIT(code,0); hdr.entry = (caddr_t)&CODEIT(code,0);
hdr.toc = (caddr_t)0; hdr.toc = (caddr_t)0;

View File

@ -174,11 +174,11 @@ void Sinitframe(n) iptr n; {
void S_initframe(tc, n) ptr tc; iptr n; { void S_initframe(tc, n) ptr tc; iptr n; {
/* check for and handle stack overflow */ /* check for and handle stack overflow */
if ((ptr *)SFP(tc) + n + 2 > (ptr *)ESP(tc)) if ((ptr *)TO_VOIDP(SFP(tc)) + n + 2 > (ptr *)TO_VOIDP(ESP(tc)))
S_overflow(tc, (n+2)*sizeof(ptr)); S_overflow(tc, (n+2)*sizeof(ptr));
/* intermediate frame contains old RA + cchain */; /* intermediate frame contains old RA + cchain */;
SFP(tc) = (ptr)((ptr *)SFP(tc) + 2); SFP(tc) = TO_PTR((ptr *)TO_VOIDP(SFP(tc)) + 2);
} }
void Sput_arg(i, x) iptr i; ptr x; { void Sput_arg(i, x) iptr i; ptr x; {
@ -229,9 +229,9 @@ void S_call_help(tc_in, singlep, lock_ts) ptr tc_in; IBOOL singlep; IBOOL lock_t
/* Lock a code object passed in TS, which is a more immediate /* Lock a code object passed in TS, which is a more immediate
caller whose return address is on the C stack */ caller whose return address is on the C stack */
S_immobilize_object(TS(tc)); S_immobilize_object(TS(tc));
CCHAIN(tc) = Scons(Scons(jb, Scons(code,TS(tc))), CCHAIN(tc)); CCHAIN(tc) = Scons(Scons(TO_PTR(jb), Scons(code,TS(tc))), CCHAIN(tc));
} else { } else {
CCHAIN(tc) = Scons(Scons(jb, Scons(code,Sfalse)), CCHAIN(tc)); CCHAIN(tc) = Scons(Scons(TO_PTR(jb), Scons(code,Sfalse)), CCHAIN(tc));
} }
FRAME(tc, -1) = CCHAIN(tc); FRAME(tc, -1) = CCHAIN(tc);
@ -247,7 +247,7 @@ void S_call_help(tc_in, singlep, lock_ts) ptr tc_in; IBOOL singlep; IBOOL lock_t
break; break;
case 1: { /* normal return */ case 1: { /* normal return */
ptr yp = CCHAIN(tc); ptr yp = CCHAIN(tc);
FREEJMPBUF(CAAR(yp)); FREEJMPBUF(TO_VOIDP(CAAR(yp)));
CCHAIN(tc) = Scdr(yp); CCHAIN(tc) = Scdr(yp);
break; break;
} }
@ -282,7 +282,7 @@ void S_return() {
ptr tc = get_thread_context(); ptr tc = get_thread_context();
ptr xp, yp; ptr xp, yp;
SFP(tc) = (ptr)((ptr *)SFP(tc) - 2); SFP(tc) = TO_PTR((ptr *)TO_VOIDP(SFP(tc)) - 2);
/* grab saved cchain */ /* grab saved cchain */
yp = FRAME(tc, 1); yp = FRAME(tc, 1);
@ -298,10 +298,10 @@ void S_return() {
S_mobilize_object(Scar(p)); S_mobilize_object(Scar(p));
if (Scdr(p) != Sfalse) S_mobilize_object(Scdr(p)); if (Scdr(p) != Sfalse) S_mobilize_object(Scdr(p));
if (xp == yp) break; if (xp == yp) break;
FREEJMPBUF(CAAR(xp)); FREEJMPBUF(TO_VOIDP(CAAR(xp)));
} }
/* reset cchain and return via longjmp */ /* reset cchain and return via longjmp */
CCHAIN(tc) = yp; CCHAIN(tc) = yp;
LONGJMP(CAAR(yp), 1); LONGJMP(TO_VOIDP(CAAR(yp)), 1);
} }

View File

@ -52,7 +52,7 @@ static void split(k, s) ptr k; ptr *s; {
tc_mutex_acquire() tc_mutex_acquire()
/* set m to size of lower piece, n to size of upper piece */ /* set m to size of lower piece, n to size of upper piece */
m = (uptr)s - (uptr)CONTSTACK(k); m = (uptr)TO_PTR(s) - (uptr)CONTSTACK(k);
n = CONTCLENGTH(k) - m; n = CONTCLENGTH(k) - m;
si = SegInfo(ptr_get_segment(k)); si = SegInfo(ptr_get_segment(k));
@ -67,8 +67,8 @@ static void split(k, s) ptr k; ptr *s; {
Snil, Snil,
Sfalse); Sfalse);
CONTLENGTH(k) = CONTCLENGTH(k) = n; CONTLENGTH(k) = CONTCLENGTH(k) = n;
CONTSTACK(k) = (ptr)s; CONTSTACK(k) = TO_PTR(s);
*s = (ptr)DOUNDERFLOW; *s = TO_PTR(DOUNDERFLOW);
tc_mutex_release() tc_mutex_release()
} }
@ -91,14 +91,14 @@ void S_split_and_resize() {
iptr frame_size; iptr frame_size;
ptr *front_stack_ptr, *end_stack_ptr, *split_point, *guard; ptr *front_stack_ptr, *end_stack_ptr, *split_point, *guard;
front_stack_ptr = (ptr *)CONTSTACK(k); front_stack_ptr = TO_VOIDP(CONTSTACK(k));
end_stack_ptr = (ptr *)((uptr)front_stack_ptr + CONTCLENGTH(k)); end_stack_ptr = TO_VOIDP((uptr)TO_PTR(front_stack_ptr) + CONTCLENGTH(k));
guard = (ptr *)((uptr)end_stack_ptr - underflow_limit); guard = TO_VOIDP((uptr)TO_PTR(end_stack_ptr) - underflow_limit);
/* set split point to base of top frame */ /* set split point to base of top frame */
frame_size = ENTRYFRAMESIZE(CONTRET(k)); frame_size = ENTRYFRAMESIZE(CONTRET(k));
split_point = (ptr *)((uptr)end_stack_ptr - frame_size); split_point = TO_VOIDP((uptr)TO_PTR(end_stack_ptr) - frame_size);
/* split only if we have more than one frame */ /* split only if we have more than one frame */
if (split_point != front_stack_ptr) { if (split_point != front_stack_ptr) {
@ -107,7 +107,7 @@ void S_split_and_resize() {
for (;;) { for (;;) {
ptr *p; ptr *p;
frame_size = ENTRYFRAMESIZE(*split_point); frame_size = ENTRYFRAMESIZE(*split_point);
p = (ptr *)((uptr)split_point - frame_size); p = TO_VOIDP((uptr)TO_PTR(split_point) - frame_size);
if (p < guard) break; if (p < guard) break;
split_point = p; split_point = p;
} }
@ -138,11 +138,11 @@ iptr S_continuation_depth(k) ptr k; {
n = 0; n = 0;
/* terminate on shot 1-shot, which could be null_continuation */ /* terminate on shot 1-shot, which could be null_continuation */
while (CONTLENGTH(k) != scaled_shot_1_shot_flag) { while (CONTLENGTH(k) != scaled_shot_1_shot_flag) {
stack_base = (ptr *)CONTSTACK(k); stack_base = TO_VOIDP(CONTSTACK(k));
frame_size = ENTRYFRAMESIZE(CONTRET(k)); frame_size = ENTRYFRAMESIZE(CONTRET(k));
stack_ptr = (ptr *)((uptr)stack_base + CONTCLENGTH(k)); stack_ptr = TO_VOIDP((uptr)TO_PTR(stack_base) + CONTCLENGTH(k));
for (;;) { for (;;) {
stack_ptr = (ptr *)((uptr)stack_ptr - frame_size); stack_ptr = TO_VOIDP((uptr)TO_PTR(stack_ptr) - frame_size);
n += 1; n += 1;
if (stack_ptr == stack_base) break; if (stack_ptr == stack_base) break;
frame_size = ENTRYFRAMESIZE(*stack_ptr); frame_size = ENTRYFRAMESIZE(*stack_ptr);
@ -157,8 +157,8 @@ ptr S_single_continuation(k, n) ptr k; iptr n; {
/* bug out on shot 1-shots, which could be null_continuation */ /* bug out on shot 1-shots, which could be null_continuation */
while (CONTLENGTH(k) != scaled_shot_1_shot_flag) { while (CONTLENGTH(k) != scaled_shot_1_shot_flag) {
stack_base = (ptr *)CONTSTACK(k); stack_base = TO_VOIDP(CONTSTACK(k));
stack_top = (ptr *)((uptr)stack_base + CONTCLENGTH(k)); stack_top = TO_VOIDP((uptr)TO_PTR(stack_base) + CONTCLENGTH(k));
stack_ptr = stack_top; stack_ptr = stack_top;
frame_size = ENTRYFRAMESIZE(CONTRET(k)); frame_size = ENTRYFRAMESIZE(CONTRET(k));
for (;;) { for (;;) {
@ -172,14 +172,14 @@ ptr S_single_continuation(k, n) ptr k; iptr n; {
k = CONTLINK(k); k = CONTLINK(k);
} }
stack_ptr = (ptr *)((uptr)stack_ptr - frame_size); stack_ptr = TO_VOIDP((uptr)TO_PTR(stack_ptr) - frame_size);
if (stack_ptr != stack_base) if (stack_ptr != stack_base)
split(k, stack_ptr); split(k, stack_ptr);
return k; return k;
} else { } else {
n -= 1; n -= 1;
stack_ptr = (ptr *)((uptr)stack_ptr - frame_size); stack_ptr = TO_VOIDP((uptr)TO_PTR(stack_ptr) - frame_size);
if (stack_ptr == stack_base) break; if (stack_ptr == stack_base) break;
frame_size = ENTRYFRAMESIZE(*stack_ptr); frame_size = ENTRYFRAMESIZE(*stack_ptr);
} }
@ -201,7 +201,7 @@ void S_handle_overflood() {
ptr tc = get_thread_context(); ptr tc = get_thread_context();
/* xp points to where esp needs to be */ /* xp points to where esp needs to be */
S_overflow(tc, ((ptr *)XP(tc) - (ptr *)SFP(tc))*sizeof(ptr)); S_overflow(tc, ((ptr *)TO_VOIDP(XP(tc)) - (ptr *)TO_VOIDP(SFP(tc)))*sizeof(ptr));
} }
void S_handle_apply_overflood() { void S_handle_apply_overflood() {
@ -227,39 +227,39 @@ void S_overflow(tc, frame_request) ptr tc; iptr frame_request; {
iptr split_stack_length, split_stack_clength; iptr split_stack_length, split_stack_clength;
ptr nuate; ptr nuate;
sfp = (ptr *)SFP(tc); sfp = TO_VOIDP(SFP(tc));
nuate = SYMVAL(S_G.nuate_id); nuate = SYMVAL(S_G.nuate_id);
if (!Scodep(nuate)) { if (!Scodep(nuate)) {
S_error_abort("overflow: nuate not yet defined"); S_error_abort("overflow: nuate not yet defined");
} }
guard = (ptr *)((uptr)sfp - underflow_limit); guard = TO_VOIDP((uptr)TO_PTR(sfp) - underflow_limit);
/* leave at least stack_slop headroom in the old stack to reduce the need for return-point overflow checks */ /* leave at least stack_slop headroom in the old stack to reduce the need for return-point overflow checks */
other_guard = (ptr *)((uptr)SCHEMESTACK(tc) + (uptr)SCHEMESTACKSIZE(tc) - (uptr)stack_slop); other_guard = TO_VOIDP((uptr)SCHEMESTACK(tc) + (uptr)SCHEMESTACKSIZE(tc) - (uptr)TO_PTR(stack_slop));
if ((uptr)other_guard < (uptr)guard) guard = other_guard; if ((uptr)TO_PTR(other_guard) < (uptr)TO_PTR(guard)) guard = other_guard;
/* split only if old stack contains more than underflow_limit bytes */ /* split only if old stack contains more than underflow_limit bytes */
if (guard > (ptr *)SCHEMESTACK(tc)) { if (guard > (ptr *)TO_VOIDP(SCHEMESTACK(tc))) {
iptr frame_size; iptr frame_size;
/* set split point to base of the frame below the current one */ /* set split point to base of the frame below the current one */
frame_size = ENTRYFRAMESIZE(*sfp); frame_size = ENTRYFRAMESIZE(*sfp);
split_point = (ptr *)((uptr)sfp - frame_size); split_point = TO_VOIDP((uptr)TO_PTR(sfp) - frame_size);
/* split only if we have more than one frame */ /* split only if we have more than one frame */
if (split_point != (ptr *)SCHEMESTACK(tc)) { if (split_point != TO_VOIDP(SCHEMESTACK(tc))) {
/* walk the stack to set split_point at first frame above guard */ /* walk the stack to set split_point at first frame above guard */
/* note that first frame may have put us below the guard already */ /* note that first frame may have put us below the guard already */
for (;;) { for (;;) {
ptr *p; ptr *p;
frame_size = ENTRYFRAMESIZE(*split_point); frame_size = ENTRYFRAMESIZE(*split_point);
p = (ptr *)((uptr)split_point - frame_size); p = TO_VOIDP((uptr)TO_PTR(split_point) - frame_size);
if (p < guard) break; if (p < guard) break;
split_point = p; split_point = p;
} }
split_stack_clength = (uptr)split_point - (uptr)SCHEMESTACK(tc); split_stack_clength = (uptr)TO_PTR(split_point) - (uptr)SCHEMESTACK(tc);
/* promote to multi-shot if current stack is shrimpy */ /* promote to multi-shot if current stack is shrimpy */
if (SCHEMESTACKSIZE(tc) < default_stack_size / 4) { if (SCHEMESTACKSIZE(tc) < default_stack_size / 4) {
@ -284,16 +284,16 @@ void S_overflow(tc, frame_request) ptr tc; iptr frame_request; {
tc_mutex_release() tc_mutex_release()
/* overwrite old return address with dounderflow */ /* overwrite old return address with dounderflow */
*split_point = (ptr)DOUNDERFLOW; *split_point = TO_PTR(DOUNDERFLOW);
} }
} else { } else {
split_point = (ptr *)SCHEMESTACK(tc); split_point = TO_VOIDP(SCHEMESTACK(tc));
} }
above_split_size = SCHEMESTACKSIZE(tc) - ((uptr)split_point - (uptr)SCHEMESTACK(tc)); above_split_size = SCHEMESTACKSIZE(tc) - ((uptr)TO_PTR(split_point) - (uptr)SCHEMESTACK(tc));
/* allocate a new stack, retaining same relative sfp */ /* allocate a new stack, retaining same relative sfp */
sfp_offset = (uptr)sfp - (uptr)split_point; sfp_offset = (uptr)TO_PTR(sfp) - (uptr)TO_PTR(split_point);
tc_mutex_acquire() tc_mutex_acquire()
S_reset_scheme_stack(tc, above_split_size + frame_request); S_reset_scheme_stack(tc, above_split_size + frame_request);
tc_mutex_release() tc_mutex_release()
@ -302,7 +302,7 @@ void S_overflow(tc, frame_request) ptr tc; iptr frame_request; {
/* copy up everything above the split point. we don't know where the /* copy up everything above the split point. we don't know where the
current frame ends, so we copy through the end of the old stack */ current frame ends, so we copy through the end of the old stack */
{ptr *p, *q; iptr n; {ptr *p, *q; iptr n;
p = (ptr *)SCHEMESTACK(tc); p = TO_VOIDP(SCHEMESTACK(tc));
q = split_point; q = split_point;
for (n = above_split_size; n != 0; n -= sizeof(ptr)) *p++ = *q++; for (n = above_split_size; n != 0; n -= sizeof(ptr)) *p++ = *q++;
} }
@ -325,10 +325,10 @@ static void reset_scheme() {
tc_mutex_acquire() tc_mutex_acquire()
/* eap should always be up-to-date now that we write-through to the tc /* eap should always be up-to-date now that we write-through to the tc
when making any changes to eap when eap is a real register */ when making any changes to eap when eap is a real register */
S_scan_dirty((ptr **)EAP(tc), (ptr **)REAL_EAP(tc)); S_scan_dirty(TO_VOIDP(EAP(tc)), TO_VOIDP(REAL_EAP(tc)));
S_reset_allocation_pointer(tc); S_reset_allocation_pointer(tc);
S_reset_scheme_stack(tc, stack_slop); S_reset_scheme_stack(tc, stack_slop);
FRAME(tc,0) = (ptr)DOUNDERFLOW; FRAME(tc,0) = TO_PTR(DOUNDERFLOW);
tc_mutex_release() tc_mutex_release()
} }
@ -399,7 +399,7 @@ static void do_error(type, who, s, args) iptr type; const char *who, *s; ptr arg
AC0(tc) = (ptr)1; AC0(tc) = (ptr)1;
CP(tc) = S_symbol_value(S_G.error_id); CP(tc) = S_symbol_value(S_G.error_id);
S_put_scheme_arg(tc, 1, args); S_put_scheme_arg(tc, 1, args);
LONGJMP(CAAR(CCHAIN(tc)), -1); LONGJMP(TO_VOIDP(CAAR(CCHAIN(tc))), -1);
} }
static void handle_call_error(tc, type, x) ptr tc; iptr type; ptr x; { static void handle_call_error(tc, type, x) ptr tc; iptr type; ptr x; {
@ -607,7 +607,7 @@ struct signal_queue {
}; };
static IBOOL enqueue_scheme_signal(ptr tc, INT sig) { static IBOOL enqueue_scheme_signal(ptr tc, INT sig) {
struct signal_queue *queue = (struct signal_queue *)(SIGNALINTERRUPTQUEUE(tc)); struct signal_queue *queue = TO_VOIDP(SIGNALINTERRUPTQUEUE(tc));
/* ignore the signal if we failed to allocate the queue */ /* ignore the signal if we failed to allocate the queue */
if (queue == NULL) return 0; if (queue == NULL) return 0;
INT tail = queue->tail; INT tail = queue->tail;
@ -622,7 +622,7 @@ static IBOOL enqueue_scheme_signal(ptr tc, INT sig) {
ptr S_dequeue_scheme_signals(ptr tc) { ptr S_dequeue_scheme_signals(ptr tc) {
ptr ls = Snil; ptr ls = Snil;
struct signal_queue *queue = (struct signal_queue *)(SIGNALINTERRUPTQUEUE(tc)); struct signal_queue *queue = TO_VOIDP(SIGNALINTERRUPTQUEUE(tc));
if (queue == NULL) return ls; if (queue == NULL) return ls;
INT head = queue->head; INT head = queue->head;
INT tail = queue->tail; INT tail = queue->tail;
@ -652,7 +652,7 @@ static ptr allocate_scheme_signal_queue() {
if (queue != (struct signal_queue *)0) { if (queue != (struct signal_queue *)0) {
queue->head = queue->tail = 0; queue->head = queue->tail = 0;
} }
return (ptr)queue; return TO_PTR(queue);
} }
ptr S_allocate_scheme_signal_queue() { ptr S_allocate_scheme_signal_queue() {
@ -686,7 +686,7 @@ static void handle_signal(INT sig, UNUSED siginfo_t *si, UNUSED void *data) {
ptr tc = get_thread_context(); ptr tc = get_thread_context();
/* disable keyboard interrupts in subordinate threads until we think /* disable keyboard interrupts in subordinate threads until we think
of something more clever to do with them */ of something more clever to do with them */
if (tc == S_G.thread_context) { if (tc == TO_PTR(&S_G.thread_context)) {
if (!S_pants_down && Sboolean_value(KEYBOARDINTERRUPTPENDING(tc))) { if (!S_pants_down && Sboolean_value(KEYBOARDINTERRUPTPENDING(tc))) {
/* this is a no-no, but the only other options are to ignore /* this is a no-no, but the only other options are to ignore
the signal or to kill the process */ the signal or to kill the process */

View File

@ -59,12 +59,14 @@ void S_segment_init() {
S_G.number_of_nonstatic_segments = 0; S_G.number_of_nonstatic_segments = 0;
S_G.number_of_empty_segments = 0; S_G.number_of_empty_segments = 0;
#ifndef PORTABLE_BYTECODE
if (seginfo_space_disp != offsetof(seginfo, space)) if (seginfo_space_disp != offsetof(seginfo, space))
S_error_abort("seginfo_space_disp is wrong"); S_error_abort("seginfo_space_disp is wrong");
if (seginfo_generation_disp != offsetof(seginfo, generation)) if (seginfo_generation_disp != offsetof(seginfo, generation))
S_error_abort("seginfo_generation_disp is wrong"); S_error_abort("seginfo_generation_disp is wrong");
if (seginfo_list_bits_disp != offsetof(seginfo, list_bits)) if (seginfo_list_bits_disp != offsetof(seginfo, list_bits))
S_error_abort("seginfo_list_bits_disp is wrong"); S_error_abort("seginfo_list_bits_disp is wrong");
#endif
} }
static uptr membytes = 0; static uptr membytes = 0;
@ -362,11 +364,11 @@ static seginfo *allocate_segments(nreq) uptr nreq; {
addr = S_getmem(bytes, 0); addr = S_getmem(bytes, 0);
debug(printf("allocate_segments addr = %p\n", addr)) debug(printf("allocate_segments addr = %p\n", addr))
base = addr_get_segment((uptr)addr + bytes_per_segment - 1); base = addr_get_segment((uptr)TO_PTR(addr) + bytes_per_segment - 1);
/* if the base of the first segment is the same as the base of the chunk, and /* if the base of the first segment is the same as the base of the chunk, and
the last segment isn't the last segment in memory (which could cause 'next' and 'end' the last segment isn't the last segment in memory (which could cause 'next' and 'end'
pointers to wrap), we've actually got nact + 1 usable segments in this chunk */ pointers to wrap), we've actually got nact + 1 usable segments in this chunk */
if (build_ptr(base, 0) == addr && base + nact != ((uptr)1 << (ptr_bits - segment_offset_bits)) - 1) if (build_ptr(base, 0) == TO_PTR(addr) && base + nact != ((uptr)1 << (ptr_bits - segment_offset_bits)) - 1)
nact += 1; nact += 1;
chunk = S_getmem(sizeof(chunkinfo) + sizeof(seginfo) * nact, 0); chunk = S_getmem(sizeof(chunkinfo) + sizeof(seginfo) * nact, 0);

View File

@ -25,14 +25,14 @@
/* segment_info */ /* segment_info */
#define SEGMENT_T1_SIZE (1<<segment_t1_bits) #define SEGMENT_T1_SIZE ((uptr)1<<segment_t1_bits)
#define SEGMENT_T1_IDX(i) ((i)&(SEGMENT_T1_SIZE-1)) #define SEGMENT_T1_IDX(i) ((i)&(SEGMENT_T1_SIZE-1))
#ifdef segment_t3_bits #ifdef segment_t3_bits
#define SEGMENT_T2_SIZE (1<<segment_t2_bits) #define SEGMENT_T2_SIZE ((uptr)1<<segment_t2_bits)
#define SEGMENT_T2_IDX(i) (((i)>>segment_t1_bits)&(SEGMENT_T2_SIZE-1)) #define SEGMENT_T2_IDX(i) (((i)>>segment_t1_bits)&(SEGMENT_T2_SIZE-1))
#define SEGMENT_T3_SIZE (1<<segment_t3_bits) #define SEGMENT_T3_SIZE ((uptr)1<<segment_t3_bits)
#define SEGMENT_T3_IDX(i) ((i)>>(segment_t2_bits+segment_t1_bits)) #define SEGMENT_T3_IDX(i) ((i)>>(segment_t2_bits+segment_t1_bits))
FORCEINLINE seginfo *SegInfo(uptr i) { FORCEINLINE seginfo *SegInfo(uptr i) {
@ -49,7 +49,7 @@ FORCEINLINE seginfo *MaybeSegInfo(uptr i) {
#else /* segment_t3_bits */ #else /* segment_t3_bits */
#ifdef segment_t2_bits #ifdef segment_t2_bits
#define SEGMENT_T2_SIZE (1<<segment_t2_bits) #define SEGMENT_T2_SIZE ((uptr)1<<segment_t2_bits)
#define SEGMENT_T2_IDX(i) ((i)>>segment_t1_bits) #define SEGMENT_T2_IDX(i) ((i)>>segment_t1_bits)
#define SEGMENT_T3_SIZE 0 #define SEGMENT_T3_SIZE 0

View File

@ -55,17 +55,17 @@ ptr S_create_thread_object(who, p_tc) const char *who; ptr p_tc; {
tc_mutex_acquire() tc_mutex_acquire()
if (S_threads == Snil) { if (S_threads == Snil) {
tc = (ptr)S_G.thread_context; tc = TO_PTR(S_G.thread_context);
} else { /* clone parent */ } else { /* clone parent */
ptr p_v = PARAMETERS(p_tc); ptr p_v = PARAMETERS(p_tc);
iptr i, n = Svector_length(p_v); iptr i, n = Svector_length(p_v);
/* use S_vector_in to avoid thread-local allocation */ /* use S_vector_in to avoid thread-local allocation */
ptr v = S_vector_in(space_new, 0, n); ptr v = S_vector_in(space_new, 0, n);
tc = (ptr)malloc(size_tc); tc = TO_PTR(malloc(size_tc));
if (tc == (ptr)0) if (tc == (ptr)0)
S_error(who, "unable to malloc thread data structure"); S_error(who, "unable to malloc thread data structure");
memcpy((void *)tc, (void *)p_tc, size_tc); memcpy(TO_VOIDP(tc), TO_VOIDP(p_tc), size_tc);
for (i = 0; i < n; i += 1) for (i = 0; i < n; i += 1)
INITVECTIT(v, i) = Svector_ref(p_v, i); INITVECTIT(v, i) = Svector_ref(p_v, i);
@ -88,7 +88,7 @@ ptr S_create_thread_object(who, p_tc) const char *who; ptr p_tc; {
/* S_reset_scheme_stack initializes stack, size, esp, and sfp */ /* S_reset_scheme_stack initializes stack, size, esp, and sfp */
S_reset_scheme_stack(tc, stack_slop); S_reset_scheme_stack(tc, stack_slop);
FRAME(tc,0) = (ptr)&CODEIT(S_G.dummy_code_object,size_rp_header); FRAME(tc,0) = TO_PTR(&CODEIT(S_G.dummy_code_object,size_rp_header));
/* S_reset_allocation_pointer initializes ap and eap */ /* S_reset_allocation_pointer initializes ap and eap */
S_reset_allocation_pointer(tc); S_reset_allocation_pointer(tc);
@ -127,7 +127,7 @@ ptr S_create_thread_object(who, p_tc) const char *who; ptr p_tc; {
GUARDIANENTRIES(tc) = Snil; GUARDIANENTRIES(tc) = Snil;
LZ4OUTBUFFER(tc) = NULL; LZ4OUTBUFFER(tc) = 0;
tc_mutex_release() tc_mutex_release()
@ -205,7 +205,7 @@ static IBOOL destroy_thread(tc) ptr tc; {
S_nthreads -= 1; S_nthreads -= 1;
/* process remembered set before dropping allocation area */ /* process remembered set before dropping allocation area */
S_scan_dirty((ptr **)EAP(tc), (ptr **)REAL_EAP(tc)); S_scan_dirty((ptr *)EAP(tc), (ptr *)REAL_EAP(tc));
/* process guardian entries */ /* process guardian entries */
{ {

View File

@ -74,35 +74,44 @@ typedef int IFASLCODE; /* fasl type codes */
#define SBUFSIZ BUFSIZ #define SBUFSIZ BUFSIZ
#endif #endif
#define ALREADY_PTR(p) (p)
/* inline allocation --- mutex required */ /* inline allocation --- mutex required */
/* find room allocates n bytes in space s and generation g into /* find room allocates n bytes in space s and generation g into
* destination x, tagged with ty, punting to find_more_room if * destination x, tagged with ty, punting to find_more_room if
* no space is left in the current segment. n is assumed to be * no space is left in the current segment. n is assumed to be
* an integral multiple of the object alignment. */ * an integral multiple of the object alignment. */
#define find_room(s, g, t, n, x) {\ #define find_room_T(s, g, t, n, T, x) { \
ptr X = S_G.next_loc[s][g];\ ptr X = S_G.next_loc[s][g];\
S_G.next_loc[s][g] = (ptr)((uptr)X + (n));\ S_G.next_loc[s][g] = (ptr)((uptr)X + (n));\
if ((S_G.bytes_left[s][g] -= (n)) < 0) X = S_find_more_room(s, g, n, X);\ if ((S_G.bytes_left[s][g] -= (n)) < 0) X = S_find_more_room(s, g, n, X);\
(x) = TYPE(X, t);\ (x) = T(TYPE(X, t)); \
} }
#define find_room(s, g, t, n, x) find_room_T(s, g, t, n, ALREADY_PTR, x)
#define find_room_voidp(s, g, n, x) find_room_T(s, g, typemod, n, TO_VOIDP, x)
/* thread-local inline allocation --- no mutex required */ /* thread-local inline allocation --- no mutex required */
/* thread_find_room allocates n bytes in the local allocation area of /* thread_find_room allocates n bytes in the local allocation area of
* the thread (hence space new, generation zero) into destination x, tagged * the thread (hence space new, generation zero) into destination x, tagged
* with type t, punting to find_more_room if no space is left in the current * with type t, punting to find_more_room if no space is left in the current
* allocation area. n is assumed to be an integral multiple of the object * allocation area. n is assumed to be an integral multiple of the object
* alignment. */ * alignment. */
#define thread_find_room(tc, t, n, x) {\ #define thread_find_room_T(tc, t, n, T, x) { \
ptr _tc = tc;\ ptr _tc = tc;\
uptr _ap = (uptr)AP(_tc);\ uptr _ap = (uptr)AP(_tc);\
if ((uptr)n > ((uptr)EAP(_tc) - _ap)) {\ if ((uptr)n > ((uptr)EAP(_tc) - _ap)) {\
(x) = S_get_more_room_help(_tc, _ap, t, n);\ ptr _hp = S_get_more_room_help(_tc, _ap, t, n); \
(x) = T(_hp); \
} else {\ } else {\
(x) = TYPE(_ap,t);\ (x) = T(TYPE(_ap,t)); \
AP(_tc) = (ptr)(_ap + n);\ AP(_tc) = (ptr)(_ap + n);\
}\ }\
} }
#define thread_find_room(tc, t, n, x) thread_find_room_T(tc, t, n, ALREADY_PTR, x)
#define thread_find_room_voidp(tc, n, x) thread_find_room_T(tc, typemod, n, TO_VOIDP, x)
#ifndef NO_PRESERVE_FLONUM_EQ #ifndef NO_PRESERVE_FLONUM_EQ
# define PRESERVE_FLONUM_EQ # define PRESERVE_FLONUM_EQ
#endif #endif
@ -154,7 +163,13 @@ typedef struct _seginfo {
#endif #endif
octet *counting_mask; /* bitmap of counting roots during a GC */ octet *counting_mask; /* bitmap of counting roots during a GC */
octet *measured_mask; /* bitmap of objects that have been measured */ octet *measured_mask; /* bitmap of objects that have been measured */
#ifdef PORTABLE_BYTECODE
union { ptr force_alignment;
#endif
octet dirty_bytes[cards_per_segment]; /* one dirty byte per card */ octet dirty_bytes[cards_per_segment]; /* one dirty byte per card */
#ifdef PORTABLE_BYTECODE
};
#endif
} seginfo; } seginfo;
typedef struct _chunkinfo { typedef struct _chunkinfo {
@ -259,7 +274,7 @@ typedef struct _bucket_pointer_list {
#define UNTYPE(x,type) ((ptr)((iptr)(x) + typemod - (type))) #define UNTYPE(x,type) ((ptr)((iptr)(x) + typemod - (type)))
#define UNTYPE_ANY(x) ((ptr)(((iptr)(x) + (typemod - 1)) & ~(typemod - 1))) #define UNTYPE_ANY(x) ((ptr)(((iptr)(x) + (typemod - 1)) & ~(typemod - 1)))
#define TYPEBITS(x) ((iptr)(x) & (typemod - 1)) #define TYPEBITS(x) ((iptr)(x) & (typemod - 1))
#define TYPEFIELD(x) (*(ptr *)UNTYPE(x, type_typed_object)) #define TYPEFIELD(x) (*(ptr *)TO_VOIDP(UNTYPE(x, type_typed_object)))
#define FIX(x) Sfixnum(x) #define FIX(x) Sfixnum(x)
#define UNFIX(x) Sfixnum_value(x) #define UNFIX(x) Sfixnum_value(x)
@ -316,7 +331,7 @@ typedef struct _bucket_pointer_list {
#define LIST4(x,y,z,w) Scons(x, LIST3(y, z, w)) #define LIST4(x,y,z,w) Scons(x, LIST3(y, z, w))
#define REGARG(tc,i) ARGREG(tc,(i)-1) #define REGARG(tc,i) ARGREG(tc,(i)-1)
#define FRAME(tc,i) (((ptr *)SFP(tc))[i]) #define FRAME(tc,i) (((ptr *)TO_VOIDP(SFP(tc)))[i])
#ifdef PTHREADS #ifdef PTHREADS
typedef struct { typedef struct {
@ -376,7 +391,7 @@ typedef struct {
S_mutex_release(&S_tc_mutex);\ S_mutex_release(&S_tc_mutex);\
} }
#else #else
#define get_thread_context() (ptr)S_G.thread_context #define get_thread_context() TO_PTR(S_G.thread_context)
#define deactivate_thread(tc) {} #define deactivate_thread(tc) {}
#define reactivate_thread(tc) {} #define reactivate_thread(tc) {}
#define tc_mutex_acquire() {} #define tc_mutex_acquire() {}
@ -412,9 +427,9 @@ typedef struct {
#define MAKE_FD(fd) Sinteger(fd) #define MAKE_FD(fd) Sinteger(fd)
#define GET_FD(file) ((INT)Sinteger_value(file)) #define GET_FD(file) ((INT)Sinteger_value(file))
#define PTRFIELD(x,disp) (*(ptr *)((uptr)(x)+disp)) #define PTRFIELD(x,disp) (*(ptr *)TO_VOIDP(((uptr)(x)+disp)))
#define INITPTRFIELD(x,disp) (*(ptr *)((uptr)(x)+disp)) #define INITPTRFIELD(x,disp) (*(ptr *)TO_VOIDP(((uptr)(x)+disp)))
#define SETPTRFIELD(x,disp,y) DIRTYSET(((ptr *)((uptr)(x)+disp)),(y)) #define SETPTRFIELD(x,disp,y) DIRTYSET(((ptr *)TO_VOIDP((uptr)(x)+disp)),(y))
#define INCRGEN(g) (g = g == S_G.max_nonstatic_generation ? static_generation : g+1) #define INCRGEN(g) (g = g == S_G.max_nonstatic_generation ? static_generation : g+1)
#define IMMEDIATE(x) (Sfixnump(x) || Simmediatep(x)) #define IMMEDIATE(x) (Sfixnump(x) || Simmediatep(x))

View File

@ -17,86 +17,95 @@
#include "config.h" #include "config.h"
#if (machine_type == machine_type_arm32le || machine_type == machine_type_tarm32le || machine_type == machine_type_arm64le || machine_type == machine_type_tarm64le) #if (machine_type == machine_type_arm32le || machine_type == machine_type_tarm32le || machine_type == machine_type_arm64le || machine_type == machine_type_tarm64le)
#if (machine_type == machine_type_tarm32le || machine_type == machine_type_tarm64le) # define OS_ANY_LINUX
#define PTHREADS # if (machine_type == machine_type_tarm32le || machine_type == machine_type_tarm64le)
#endif # define PTHREADS
#define NOBLOCK O_NONBLOCK # endif
#define LOAD_SHARED_OBJECT # define OS_ANY_LINUX
#define USE_MMAP # define LITTLE_ENDIAN_IEEE_DOUBLE
#define MMAP_HEAP # define FLUSHCACHE
#define IEEE_DOUBLE
#define LITTLE_ENDIAN_IEEE_DOUBLE
#define LDEXP
#define ARCHYPERBOLIC
#define GETPAGESIZE() getpagesize()
typedef char *memcpy_t;
#define MAKE_NAN(x) { x = 0.0; x = x / x; }
#define GETWD(x) getcwd((x),PATH_MAX)
typedef int tputsputcchar;
#define LOCKF
#define DIRMARKERP(c) ((c) == '/')
#define FLUSHCACHE
#ifndef DISABLE_X11
#define LIBX11 "libX11.so"
#endif
#define LSEEK lseek64
#define OFF_T off64_t
#define _LARGEFILE64_SOURCE
#define SECATIME(sb) (sb).st_atim.tv_sec
#define SECCTIME(sb) (sb).st_ctim.tv_sec
#define SECMTIME(sb) (sb).st_mtim.tv_sec
#define NSECATIME(sb) (sb).st_atim.tv_nsec
#define NSECCTIME(sb) (sb).st_ctim.tv_nsec
#define NSECMTIME(sb) (sb).st_mtim.tv_nsec
#define ICONV_INBUF_TYPE char **
#define UNUSED __attribute__((__unused__))
#endif #endif
#if (machine_type == machine_type_ppc32le || machine_type == machine_type_tppc32le || machine_type == machine_type_ppc64le || machine_type == machine_type_tppc64le) #if (machine_type == machine_type_ppc32le || machine_type == machine_type_tppc32le || machine_type == machine_type_ppc64le || machine_type == machine_type_tppc64le)
#if (machine_type == machine_type_tppc32le || machine_type == machine_type_tppc64le) # define OS_ANY_LINUX
#define PTHREADS # if (machine_type == machine_type_tppc32le || machine_type == machine_type_tppc64le)
#endif # define PTHREADS
#define NOBLOCK O_NONBLOCK # endif
#define LOAD_SHARED_OBJECT # define FLUSHCACHE
#define USE_MMAP
#define MMAP_HEAP
#define IEEE_DOUBLE
#define LDEXP
#define ARCHYPERBOLIC
#define GETPAGESIZE() getpagesize()
typedef char *memcpy_t;
#define MAKE_NAN(x) { x = 0.0; x = x / x; }
#define GETWD(x) getcwd((x),PATH_MAX)
typedef int tputsputcchar;
#define LOCKF
#define DIRMARKERP(c) ((c) == '/')
#define FLUSHCACHE
#ifndef DISABLE_X11
#define LIBX11 "libX11.so"
#endif
#define LSEEK lseek64
#define OFF_T off64_t
#define _LARGEFILE64_SOURCE
#define SECATIME(sb) (sb).st_atim.tv_sec
#define SECCTIME(sb) (sb).st_ctim.tv_sec
#define SECMTIME(sb) (sb).st_mtim.tv_sec
#define NSECATIME(sb) (sb).st_atim.tv_nsec
#define NSECCTIME(sb) (sb).st_ctim.tv_nsec
#define NSECMTIME(sb) (sb).st_mtim.tv_nsec
#define ICONV_INBUF_TYPE char **
#define UNUSED __attribute__((__unused__))
#endif #endif
#if (machine_type == machine_type_i3le || machine_type == machine_type_ti3le || machine_type == machine_type_a6le || machine_type == machine_type_ta6le) #if (machine_type == machine_type_i3le || machine_type == machine_type_ti3le || machine_type == machine_type_a6le || machine_type == machine_type_ta6le)
#if (machine_type == machine_type_ti3le || machine_type == machine_type_ta6le) # define OS_ANY_LINUX
#define PTHREADS # if (machine_type == machine_type_ti3le || machine_type == machine_type_ta6le)
# define PTHREADS
# endif
# define LITTLE_ENDIAN_IEEE_DOUBLE
#endif #endif
#if (machine_type == machine_type_i3fb || machine_type == machine_type_ti3fb || machine_type == machine_type_a6fb || machine_type == machine_type_ta6fb)
# define OS_ANY_FREEBSD
# if (machine_type == machine_type_ti3fb || machine_type == machine_type_ta6fb)
# define PTHREADS
# endif
# define LITTLE_ENDIAN_IEEE_DOUBLE
#endif
#if (machine_type == machine_type_i3nb || machine_type == machine_type_ti3nb || machine_type == machine_type_a6nb || machine_type == machine_type_ta6nb)
# define OS_ANY_NETBSD
# if (machine_type == machine_type_ti3nb || machine_type == machine_type_ta6nb)
# define PTHREADS
# endif
#endif
#if (machine_type == machine_type_i3nt || machine_type == machine_type_ti3nt || machine_type == machine_type_a6nt || machine_type == machine_type_ta6nt)
# define OS_ANY_WINDOWS
# if (machine_type == machine_type_ti3nt || machine_type == machine_type_ta6nt)
# define PTHREADS
# endif
#endif
#if (machine_type == machine_type_i3ob || machine_type == machine_type_ti3ob || machine_type == machine_type_a6ob || machine_type == machine_type_ta6ob)
# define OS_ANY_OPENBSD
# if (machine_type == machine_type_ti3ob || machine_type == machine_type_ta6ob)
# define PTHREADS
# endif
#endif
#if (machine_type == machine_type_i3osx || machine_type == machine_type_ti3osx || machine_type == machine_type_a6osx || machine_type == machine_type_ta6osx)
# define OS_ANY_MACOSX
# if (machine_type == machine_type_ti3osx || machine_type == machine_type_ta6osx)
# define PTHREADS
# endif
#endif
#if (machine_type == machine_type_pb)
# if defined(__powerpc__) && !defined(__powerpc64__)
# define PORTABLE_BYTECODE_BIGENDIAN
# endif
# if defined(__linux__)
# define OS_ANY_LINUX
# ifndef PORTABLE_BYTECODE_BIGENDIAN
# define LITTLE_ENDIAN_IEEE_DOUBLE
# endif
# elif defined(__NetBSD__)
# define OS_ANY_NETBSD
# elif defined(__OpenBSD__) && !defined(__Bitrig__)
# define OS_ANY_OPENBSD
# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# define OS_ANY_FREEBSD
# elif defined(_MSC_VER) || defined(__MINGW32__)
# define OS_ANY_WINDOWS
# elif __APPLE__
# define OS_ANY_MACOSX
# endif
#endif
#ifdef OS_ANY_LINUX
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
#define USE_MMAP #define USE_MMAP
#define MMAP_HEAP #define MMAP_HEAP
#define IEEE_DOUBLE #define IEEE_DOUBLE
#define LITTLE_ENDIAN_IEEE_DOUBLE
#define LDEXP #define LDEXP
#define ARCHYPERBOLIC #define ARCHYPERBOLIC
#define GETPAGESIZE() getpagesize() #define GETPAGESIZE() getpagesize()
@ -107,7 +116,7 @@ typedef int tputsputcchar;
#define LOCKF #define LOCKF
#define DIRMARKERP(c) ((c) == '/') #define DIRMARKERP(c) ((c) == '/')
#ifndef DISABLE_X11 #ifndef DISABLE_X11
#define LIBX11 "libX11.so" # define LIBX11 "libX11.so"
#endif #endif
#define LSEEK lseek64 #define LSEEK lseek64
#define OFF_T off64_t #define OFF_T off64_t
@ -122,16 +131,12 @@ typedef int tputsputcchar;
#define UNUSED __attribute__((__unused__)) #define UNUSED __attribute__((__unused__))
#endif #endif
#if (machine_type == machine_type_i3fb || machine_type == machine_type_ti3fb || machine_type == machine_type_a6fb || machine_type == machine_type_ta6fb) #ifdef OS_ANY_FREEBSD
#if (machine_type == machine_type_ti3fb || machine_type == machine_type_ta6fb)
#define PTHREADS
#endif
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
#define USE_MMAP #define USE_MMAP
#define MMAP_HEAP #define MMAP_HEAP
#define IEEE_DOUBLE #define IEEE_DOUBLE
#define LITTLE_ENDIAN_IEEE_DOUBLE
#define LDEXP #define LDEXP
#define ARCHYPERBOLIC #define ARCHYPERBOLIC
#define GETPAGESIZE() getpagesize() #define GETPAGESIZE() getpagesize()
@ -155,10 +160,9 @@ typedef int tputsputcchar;
#define USE_OSSP_UUID #define USE_OSSP_UUID
#endif #endif
#if (machine_type == machine_type_i3nb || machine_type == machine_type_ti3nb || machine_type == machine_type_a6nb || machine_type == machine_type_ta6nb) #ifdef OS_ANY_NETBSD
#if (machine_type == machine_type_ti3nb || machine_type == machine_type_ta6nb) #ifdef PTHREADS
#define NETBSD # define NETBSD
#define PTHREADS
#endif #endif
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
@ -191,10 +195,7 @@ typedef int tputsputcchar;
#define USE_MBRTOWC_L #define USE_MBRTOWC_L
#endif #endif
#if (machine_type == machine_type_i3nt || machine_type == machine_type_ti3nt || machine_type == machine_type_a6nt || machine_type == machine_type_ta6nt) #ifdef OS_ANY_WINDOWS
#if (machine_type == machine_type_ti3nt || machine_type == machine_type_ta6nt)
#define PTHREADS
#endif
#define GETPAGESIZE() S_getpagesize() #define GETPAGESIZE() S_getpagesize()
#define GETWD(x) GETCWD(x, _MAX_PATH) #define GETWD(x) GETCWD(x, _MAX_PATH)
#define IEEE_DOUBLE #define IEEE_DOUBLE
@ -257,10 +258,7 @@ struct timespec;
#endif #endif
#endif #endif
#if (machine_type == machine_type_i3ob || machine_type == machine_type_ti3ob || machine_type == machine_type_a6ob || machine_type == machine_type_ta6ob) #ifdef OS_ANY_OPENBSD
#if (machine_type == machine_type_ti3ob || machine_type == machine_type_ta6ob)
#define PTHREADS
#endif
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
#define USE_MMAP #define USE_MMAP
@ -291,10 +289,7 @@ typedef int tputsputcchar;
#define USE_OSSP_UUID #define USE_OSSP_UUID
#endif #endif
#if (machine_type == machine_type_i3osx || machine_type == machine_type_ti3osx || machine_type == machine_type_a6osx || machine_type == machine_type_ta6osx) #ifdef OS_ANY_MACOSX
#if (machine_type == machine_type_ti3osx || machine_type == machine_type_ta6osx)
#define PTHREADS
#endif
#define MACOSX #define MACOSX
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
@ -326,9 +321,13 @@ typedef int tputsputcchar;
#endif #endif
#if (machine_type == machine_type_i3qnx || machine_type == machine_type_ti3qnx) #if (machine_type == machine_type_i3qnx || machine_type == machine_type_ti3qnx)
#if (machine_type == machine_type_ti3qnx) # define OS_ANY_QNX
#define PTHREADS # if (machine_type == machine_type_ti3qnx)
# define PTHREADS
# endif
#endif #endif
#ifdef OS_ANY_QNX
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
#define USE_MMAP #define USE_MMAP
@ -359,9 +358,13 @@ typedef int tputsputcchar;
#endif #endif
#if (machine_type == machine_type_i3s2 || machine_type == machine_type_ti3s2 || machine_type == machine_type_a6s2 || machine_type == machine_type_ta6s2) #if (machine_type == machine_type_i3s2 || machine_type == machine_type_ti3s2 || machine_type == machine_type_a6s2 || machine_type == machine_type_ta6s2)
#if (machine_type == machine_type_ti3s2 || machine_type == machine_type_ta6s2) # define OS_ANY_SOLARIS2
#define PTHREADS # if (machine_type == machine_type_ti3s2 || machine_type == machine_type_ta6s2)
# define PTHREADS
# endif
#endif #endif
#ifdef OS_ANY_SOLARIS2
#define NOBLOCK O_NONBLOCK #define NOBLOCK O_NONBLOCK
#define LOAD_SHARED_OBJECT #define LOAD_SHARED_OBJECT
#define USE_MMAP #define USE_MMAP

View File

@ -195,8 +195,8 @@ static vfasl_hash_table *make_vfasl_hash_table(IBOOL permanent);
static void vfasl_hash_table_set(vfasl_hash_table *ht, ptr key, ptr value); static void vfasl_hash_table_set(vfasl_hash_table *ht, ptr key, ptr value);
static ptr vfasl_hash_table_ref(vfasl_hash_table *ht, ptr key); static ptr vfasl_hash_table_ref(vfasl_hash_table *ht, ptr key);
static ptr vfasl_malloc(uptr sz); static void *vfasl_malloc(uptr sz);
static ptr vfasl_calloc(uptr sz, uptr n); static void *vfasl_calloc(uptr sz, uptr n);
static void sort_offsets(vfoff *p, vfoff len); static void sort_offsets(vfoff *p, vfoff len);
@ -242,10 +242,10 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
vspace_offsets[vspaces_count] = header.data_size; vspace_offsets[vspaces_count] = header.data_size;
if (bv) { if (bv) {
ptr base_addr = &BVIT(bv, sizeof(vfasl_header) + offset); void *base_addr = &BVIT(bv, sizeof(vfasl_header) + offset);
thread_find_room(tc, typemod, header.data_size, data); thread_find_room(tc, typemod, header.data_size, data);
memcpy(data, base_addr, header.data_size); memcpy(TO_VOIDP(data), base_addr, header.data_size);
table = ptr_add(base_addr, header.data_size); table = ptr_add(TO_PTR(base_addr), header.data_size);
} else { } else {
if (S_vfasl_boot_mode > 0) { if (S_vfasl_boot_mode > 0) {
for (s = 0; s < vspaces_count; s++) { for (s = 0; s < vspaces_count; s++) {
@ -256,7 +256,7 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
} else { } else {
find_room(vspace_spaces[s], static_generation, typemod, sz, vspaces[s]) find_room(vspace_spaces[s], static_generation, typemod, sz, vspaces[s])
} }
if (S_fasl_stream_read(stream, vspaces[s], sz) < 0) if (S_fasl_stream_read(stream, TO_VOIDP(vspaces[s]), sz) < 0)
S_error("fasl-read", "input truncated"); S_error("fasl-read", "input truncated");
} else } else
vspaces[s] = (ptr)0; vspaces[s] = (ptr)0;
@ -269,12 +269,12 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
to_static = 1; to_static = 1;
} else { } else {
thread_find_room(tc, typemod, header.data_size, data) thread_find_room(tc, typemod, header.data_size, data)
if (S_fasl_stream_read(stream, data, header.data_size) < 0) if (S_fasl_stream_read(stream, TO_VOIDP(data), header.data_size) < 0)
S_error("fasl-read", "input truncated"); S_error("fasl-read", "input truncated");
} }
thread_find_room(tc, typemod, ptr_align(header.table_size), table) thread_find_room(tc, typemod, ptr_align(header.table_size), table)
if (S_fasl_stream_read(stream, table, header.table_size) < 0) if (S_fasl_stream_read(stream, TO_VOIDP(table), header.table_size) < 0)
S_error("fasl-read", "input truncated"); S_error("fasl-read", "input truncated");
} }
@ -284,11 +284,11 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
} else } else
data = vspaces[0]; data = vspaces[0];
symrefs = table; symrefs = TO_VOIDP(table);
rtdrefs = ptr_add(symrefs, header.symref_count * sizeof(vfoff)); rtdrefs = TO_VOIDP(ptr_add(TO_PTR(symrefs), header.symref_count * sizeof(vfoff)));
singletonrefs = ptr_add(rtdrefs, header.rtdref_count * sizeof(vfoff)); singletonrefs = TO_VOIDP(ptr_add(TO_PTR(rtdrefs), header.rtdref_count * sizeof(vfoff)));
bm = ptr_add(singletonrefs, header.singletonref_count * sizeof(vfoff)); bm = TO_VOIDP(ptr_add(TO_PTR(singletonrefs), header.singletonref_count * sizeof(vfoff)));
bm_end = ptr_add(table, header.table_size); bm_end = TO_VOIDP(ptr_add(TO_PTR(table), header.table_size));
#if 0 #if 0
printf("\n" printf("\n"
@ -333,7 +333,7 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
next_offset2 = vspace_offsets[s2+1]; \ next_offset2 = vspace_offsets[s2+1]; \
} \ } \
} while (0) } while (0)
#define SPACE_PTR(off) ptr_add(vspaces[s2], (off) - offset2) #define SPACE_PTR(off) TO_VOIDP(ptr_add(vspaces[s2], (off) - offset2))
/* Fix up pointers. The initial content has all pointers relative to /* Fix up pointers. The initial content has all pointers relative to
the start of the data. Since the spaces of referenced pointers the start of the data. Since the spaces of referenced pointers
@ -418,7 +418,7 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
if (S_vfasl_boot_mode > 0) { if (S_vfasl_boot_mode > 0) {
IGEN gen = SegInfo(ptr_get_segment(isym))->generation; IGEN gen = SegInfo(ptr_get_segment(isym))->generation;
if (gen < static_generation) { if (gen < static_generation) {
printf("WARNING: vfasl symbol already interned, but at generation %d: %p ", gen, isym); printf("WARNING: vfasl symbol already interned, but at generation %d: %p ", gen, TO_VOIDP(isym));
S_prin1(isym); S_prin1(isym);
printf("\n"); printf("\n");
} }
@ -443,15 +443,15 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
vfoff i; vfoff i;
for (i = 0; i < header.symref_count; i++) { for (i = 0; i < header.symref_count; i++) {
uptr p2_off, sym_pos; uptr p2_off, sym_pos;
ptr p2, sym, val; ptr *p2, sym, val;
p2_off = symrefs[i]; p2_off = symrefs[i];
INC_SPACE_OFFSET(p2_off); INC_SPACE_OFFSET(p2_off);
p2 = SPACE_PTR(p2_off); p2 = SPACE_PTR(p2_off);
sym_pos = UNFIX(*(ptr **)p2); sym_pos = UNFIX(*p2);
sym = TYPE(ptr_add(syms, symbol_pos_to_offset(sym_pos)), type_symbol); sym = TYPE(ptr_add(syms, symbol_pos_to_offset(sym_pos)), type_symbol);
if ((val = SYMVAL(sym)) != sunbound) if ((val = SYMVAL(sym)) != sunbound)
sym = val; sym = val;
*(ptr **)p2 = sym; *p2 = sym;
} }
} }
@ -564,7 +564,7 @@ ptr S_vfasl(ptr bv, void *stream, iptr offset, iptr input_len)
ptr S_vfasl_to(ptr bv) ptr S_vfasl_to(ptr bv)
{ {
return S_vfasl(bv, (ptr)0, 0, Sbytevector_length(bv)); return S_vfasl(bv, NULL, 0, Sbytevector_length(bv));
} }
/************************************************************/ /************************************************************/
@ -576,14 +576,14 @@ static void vfasl_init(vfasl_info *vfi) {
vfi->base_addr = (ptr)0; vfi->base_addr = (ptr)0;
vfi->sym_count = 0; vfi->sym_count = 0;
vfi->symref_count = 0; vfi->symref_count = 0;
vfi->symrefs = (ptr)0; vfi->symrefs = NULL;
vfi->base_rtd = S_G.base_rtd; vfi->base_rtd = S_G.base_rtd;
vfi->rtdref_count = 0; vfi->rtdref_count = 0;
vfi->rtdrefs = (ptr)0; vfi->rtdrefs = NULL;
vfi->singletonref_count = 0; vfi->singletonref_count = 0;
vfi->singletonrefs = (ptr)0; vfi->singletonrefs = NULL;
vfi->graph = make_vfasl_hash_table(0); vfi->graph = make_vfasl_hash_table(0);
vfi->ptr_bitmap = (ptr)0; vfi->ptr_bitmap = NULL;
vfi->installs_library_entry = 0; vfi->installs_library_entry = 0;
for (s = 0; s < vspaces_count; s++) { for (s = 0; s < vspaces_count; s++) {
@ -594,8 +594,8 @@ static void vfasl_init(vfasl_info *vfi) {
c->length = 0; c->length = 0;
c->used = 0; c->used = 0;
c->swept = 0; c->swept = 0;
c->next = (ptr)0; c->next = NULL;
c->prev = (ptr)0; c->prev = NULL;
vfi->spaces[s].first = c; vfi->spaces[s].first = c;
vfi->spaces[s].total_bytes = 0; vfi->spaces[s].total_bytes = 0;
@ -663,7 +663,7 @@ ptr S_to_vfasl(ptr v)
bv = S_bytevector(size); bv = S_bytevector(size);
memset(&BVIT(bv, 0), 0, size); memset(&BVIT(bv, 0), 0, size);
p = &BVIT(bv, 0); p = TO_PTR(&BVIT(bv, 0));
/* Skip header for now */ /* Skip header for now */
p = ptr_add(p, sizeof(vfasl_header)); p = ptr_add(p, sizeof(vfasl_header));
@ -679,22 +679,22 @@ ptr S_to_vfasl(ptr v)
c->length = vfi->spaces[s].total_bytes; c->length = vfi->spaces[s].total_bytes;
c->used = 0; c->used = 0;
c->swept = 0; c->swept = 0;
c->next = (ptr)0; c->next = NULL;
c->prev = (ptr)0; c->prev = NULL;
vfi->spaces[s].first = c; vfi->spaces[s].first = c;
p = ptr_add(p, vfi->spaces[s].total_bytes); p = ptr_add(p, vfi->spaces[s].total_bytes);
vfi->spaces[s].total_bytes = 0; vfi->spaces[s].total_bytes = 0;
} }
vfi->symrefs = p; vfi->symrefs = TO_VOIDP(p);
p = ptr_add(p, sizeof(vfoff) * vfi->symref_count); p = ptr_add(p, sizeof(vfoff) * vfi->symref_count);
vfi->base_rtd = S_G.base_rtd; vfi->base_rtd = S_G.base_rtd;
vfi->rtdrefs = p; vfi->rtdrefs = TO_VOIDP(p);
p = ptr_add(p, sizeof(vfoff) * vfi->rtdref_count); p = ptr_add(p, sizeof(vfoff) * vfi->rtdref_count);
vfi->singletonrefs = p; vfi->singletonrefs = TO_VOIDP(p);
p = ptr_add(p, sizeof(vfoff) * vfi->singletonref_count); p = ptr_add(p, sizeof(vfoff) * vfi->singletonref_count);
vfi->sym_count = 0; vfi->sym_count = 0;
@ -704,7 +704,7 @@ ptr S_to_vfasl(ptr v)
vfi->graph = make_vfasl_hash_table(0); vfi->graph = make_vfasl_hash_table(0);
vfi->ptr_bitmap = p; vfi->ptr_bitmap = TO_VOIDP(p);
/* Write data */ /* Write data */
@ -714,7 +714,7 @@ ptr S_to_vfasl(ptr v)
/* Make all pointers relative to the start of the data area */ /* Make all pointers relative to the start of the data area */
{ {
ptr *p2 = vfi->base_addr; ptr *p2 = TO_VOIDP(vfi->base_addr);
uptr base_addr = (uptr)vfi->base_addr; uptr base_addr = (uptr)vfi->base_addr;
octet *bm = vfi->ptr_bitmap; octet *bm = vfi->ptr_bitmap;
octet *bm_end = bm + bitmap_size; octet *bm_end = bm + bitmap_size;
@ -833,7 +833,7 @@ static ptr vfasl_copy_all(vfasl_info *vfi, ptr v) {
break; break;
case vspace_impure: case vspace_impure:
while (pp < pp_end) { while (pp < pp_end) {
vfasl_relocate(vfi, pp); vfasl_relocate(vfi, TO_VOIDP(pp));
pp = ptr_add(pp, sizeof(ptr)); pp = ptr_add(pp, sizeof(ptr));
} }
break; break;
@ -865,7 +865,7 @@ static ptr vfasl_copy_all(vfasl_info *vfi, ptr v) {
static void vfasl_register_pointer(vfasl_info *vfi, ptr *pp) { static void vfasl_register_pointer(vfasl_info *vfi, ptr *pp) {
if (vfi->ptr_bitmap) { if (vfi->ptr_bitmap) {
uptr delta = ptr_diff(pp, vfi->base_addr) >> log2_ptr_bytes; uptr delta = ptr_diff(TO_PTR(pp), vfi->base_addr) >> log2_ptr_bytes;
uptr i = delta >> log2_byte_bits; uptr i = delta >> log2_byte_bits;
uptr bit = (((uptr)1) << (delta & (byte_bits - 1))); uptr bit = (((uptr)1) << (delta & (byte_bits - 1)));
vfi->ptr_bitmap[i] |= bit; vfi->ptr_bitmap[i] |= bit;
@ -881,7 +881,7 @@ static uptr ptr_base_diff(vfasl_info *vfi, ptr p) {
static void vfasl_register_symbol_reference(vfasl_info *vfi, ptr *pp, ptr p) { static void vfasl_register_symbol_reference(vfasl_info *vfi, ptr *pp, ptr p) {
if (vfi->symrefs) if (vfi->symrefs)
vfi->symrefs[vfi->symref_count] = ptr_base_diff(vfi, pp); vfi->symrefs[vfi->symref_count] = ptr_base_diff(vfi, TO_PTR(pp));
vfi->symref_count++; vfi->symref_count++;
*pp = SYMVAL(p); /* replace symbol reference with index of symbol */ *pp = SYMVAL(p); /* replace symbol reference with index of symbol */
} }
@ -894,7 +894,7 @@ static void vfasl_register_rtd_reference(vfasl_info *vfi, ptr pp) {
static void vfasl_register_singleton_reference(vfasl_info *vfi, ptr *pp, int which) { static void vfasl_register_singleton_reference(vfasl_info *vfi, ptr *pp, int which) {
if (vfi->singletonrefs) if (vfi->singletonrefs)
vfi->singletonrefs[vfi->singletonref_count] = ptr_base_diff(vfi, pp); vfi->singletonrefs[vfi->singletonref_count] = ptr_base_diff(vfi, TO_PTR(pp));
vfi->singletonref_count++; vfi->singletonref_count++;
*pp = FIX(which); *pp = FIX(which);
} }
@ -959,7 +959,7 @@ static ptr vfasl_find_room(vfasl_info *vfi, int s, ITYPE t, iptr n) {
new_c->used = 0; new_c->used = 0;
new_c->swept = 0; new_c->swept = 0;
new_c->prev = (ptr)0; new_c->prev = NULL;
new_c->next = c; new_c->next = c;
c->prev = new_c; c->prev = new_c;
@ -978,7 +978,7 @@ static ptr vfasl_find_room(vfasl_info *vfi, int s, ITYPE t, iptr n) {
iptr newlen = segment_align(n); iptr newlen = segment_align(n);
c = vfasl_malloc(sizeof(vfasl_chunk)); c = vfasl_malloc(sizeof(vfasl_chunk));
c->bytes = vfasl_malloc(newlen); c->bytes = TO_PTR(vfasl_malloc(newlen));
c->length = newlen; c->length = newlen;
c->used = 0; c->used = 0;
c->swept = 0; c->swept = 0;
@ -987,7 +987,7 @@ static ptr vfasl_find_room(vfasl_info *vfi, int s, ITYPE t, iptr n) {
if (old_c->next && !old_c->length) if (old_c->next && !old_c->length)
old_c = old_c->next; /* drop useless chunk created above */ old_c = old_c->next; /* drop useless chunk created above */
c->prev = (ptr)0; c->prev = NULL;
c->next = old_c; c->next = old_c;
old_c->prev = c; old_c->prev = c;
@ -1036,7 +1036,7 @@ static void vfasl_relocate(vfasl_info *vfi, ptr *ppp) {
if ((TYPEBITS(pp) == type_typed_object) if ((TYPEBITS(pp) == type_typed_object)
&& TYPEP((tf = TYPEFIELD(pp)), mask_record, type_record) && TYPEP((tf = TYPEFIELD(pp)), mask_record, type_record)
&& is_rtd(tf, vfi)) && is_rtd(tf, vfi))
vfasl_register_rtd_reference(vfi, ppp); vfasl_register_rtd_reference(vfi, TO_PTR(ppp));
vfasl_register_pointer(vfi, ppp); vfasl_register_pointer(vfi, ppp);
} }
} }
@ -1101,6 +1101,8 @@ static IFASLCODE abs_reloc_variant(IFASLCODE type) {
return reloc_ppc32_abs; return reloc_ppc32_abs;
else else
return reloc_abs; return reloc_abs;
#elif defined(PORTABLE_BYTECODE)
return reloc_pb_abs;
#else #else
>> need to fill in for this platform << >> need to fill in for this platform <<
#endif #endif
@ -1274,7 +1276,8 @@ static void fasl_init_entry_tables()
ptr entry = Svector_ref(S_G.library_entry_vector, i); ptr entry = Svector_ref(S_G.library_entry_vector, i);
if (entry != Sfalse) { if (entry != Sfalse) {
vfasl_hash_table_set(S_G.library_entries, entry, (ptr)(i+1)); vfasl_hash_table_set(S_G.library_entries, entry, (ptr)(i+1));
vfasl_hash_table_set(S_G.library_entry_codes, CLOSCODE(entry), (ptr)(i+1)); if (Sprocedurep(entry))
vfasl_hash_table_set(S_G.library_entry_codes, CLOSCODE(entry), (ptr)(i+1));
} }
} }
} }
@ -1417,15 +1420,15 @@ static ptr vfasl_hash_table_ref(vfasl_hash_table *ht, ptr key) {
/*************************************************************/ /*************************************************************/
static ptr vfasl_malloc(uptr sz) { static void *vfasl_malloc(uptr sz) {
ptr tc = get_thread_context(); ptr tc = get_thread_context();
ptr p; void *p;
thread_find_room(tc, typemod, ptr_align(sz), p) thread_find_room_voidp(tc, ptr_align(sz), p)
return p; return p;
} }
static ptr vfasl_calloc(uptr sz, uptr n) { static void *vfasl_calloc(uptr sz, uptr n) {
ptr p; void *p;
sz *= n; sz *= n;
p = vfasl_malloc(sz); p = vfasl_malloc(sz);
memset(p, 0, sz); memset(p, 0, sz);

45
configure vendored
View File

@ -25,6 +25,7 @@ machs=$machs$sep2$last
m="" m=""
w="" w=""
pb=no
threads=yes threads=yes
nothreads=no nothreads=no
temproot="" temproot=""
@ -186,6 +187,9 @@ while [ $# != 0 ] ; do
--32) --32)
bits=32 bits=32
;; ;;
--pb)
pb=yes
;;
--installprefix=*) --installprefix=*)
installprefix=`echo $1 | sed -e 's/^--installprefix=//'` installprefix=`echo $1 | sed -e 's/^--installprefix=//'`
;; ;;
@ -307,6 +311,13 @@ while [ $# != 0 ] ; do
shift shift
done done
if [ "$m" = "pb" ] ; then
echo "Don't select pb using -m or --machine, because pb needs the"
echo " machine as the kernel host machine. Instead, use --pb to select"
echo " a pb (portable bytecode) build."
exit 1
fi
if [ "$bits" = "" ] ; then if [ "$bits" = "" ] ; then
if uname -a | egrep 'amd64|x86_64|aarch64' > /dev/null 2>&1 ; then if uname -a | egrep 'amd64|x86_64|aarch64' > /dev/null 2>&1 ; then
bits=64 bits=64
@ -320,10 +331,16 @@ if [ "$threads" = "" ] ; then
fi fi
if [ "$m" = "" ] ; then if [ "$m" = "" ] ; then
if [ $bits = 64 ] ; then machine_supplied=no
if [ $threads = yes ] ; then m=$tm64 ; else m=$m64 ; fi if [ $pb = yes ] ; then
m=pb
if [ $bits = 64 ] ; then mpbhost=$m64 ; else mpbhost=$m32 ; fi
else else
if [ $threads = yes ] ; then m=$tm32 ; else m=$m32 ; fi if [ $bits = 64 ] ; then
if [ $threads = yes ] ; then m=$tm64 ; else m=$m64 ; fi
else
if [ $threads = yes ] ; then m=$tm32 ; else m=$m32 ; fi
fi
fi fi
fi fi
@ -413,9 +430,17 @@ if [ "$help" = "yes" ]; then
fi fi
if [ "$m" = "" -o ! -f boot/$m/scheme.boot ] ; then if [ "$m" = "" -o ! -f boot/$m/scheme.boot ] ; then
echo "no suitable machine type found" echo "No suitable machine type found."
echo "try rerunning as $0 -m=<machine type>" if [ "$machine_supplied" = "no" ] ; then
echo "available machine types: $machs" echo "Try rerunning as $0 -m=<machine type>"
fi
echo "Available machine types: $machs"
if [ -f boot/pb/scheme.boot ] ; then
echo "A pb machine type is available, so you might also try"
echo " $0 --pb"
echo " make <machine type>.bootquick"
echo "and then try $0 again."
fi
exit 1 exit 1
fi fi
@ -447,7 +472,7 @@ else
fi fi
fi fi
./workarea $m $w ./workarea $m $w $mpbhost
sed -e 's/$(m)/'$m'/g'\ sed -e 's/$(m)/'$m'/g'\
-e 's/$(workarea)/'$w'/g'\ -e 's/$(workarea)/'$w'/g'\
@ -501,6 +526,9 @@ if [ "$disablecurses" = "yes" ]; then
ncursesLib= ncursesLib=
fi fi
warningFlags="-Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough"
optFlags=-O2
cat > $w/c/Mf-config << END cat > $w/c/Mf-config << END
CC=$CC CC=$CC
CPPFLAGS=$CPPFLAGS CPPFLAGS=$CPPFLAGS
@ -521,6 +549,9 @@ zlibLib=$zlibLib
LZ4Lib=$LZ4Lib LZ4Lib=$LZ4Lib
zlibHeaderDep=$zlibHeaderDep zlibHeaderDep=$zlibHeaderDep
LZ4HeaderDep=$LZ4HeaderDep LZ4HeaderDep=$LZ4HeaderDep
warningFlags=$warningFlags
optFlags=$optFlags
KernelCFlags=$KernelCFlags
Kernel=\${${Kernel}} Kernel=\${${Kernel}}
KernelLinkDeps=\${${Kernel}LinkDeps} KernelLinkDeps=\${${Kernel}LinkDeps}
KernelLinkLibs=\${${Kernel}LinkLibs} KernelLinkLibs=\${${Kernel}LinkLibs}

View File

@ -1512,7 +1512,7 @@ where \var{length} is an exact nonnegative integer,
\var{conv} is \scheme{#f} or a string naming a valid convention \var{conv} is \scheme{#f} or a string naming a valid convention
as described on page~\ref{page:conv-description}, as described on page~\ref{page:conv-description},
signedness is either \scheme{signed} or \scheme{unsigned}, and signedness is either \scheme{signed} or \scheme{unsigned}, and
endianness is one of \scheme{native}, \scheme{big}, or \scheme{little}. endianness is one of \scheme{native}, \scheme{swapped}, \scheme{big}, or \scheme{little}.
A restriction not reflected above is that A restriction not reflected above is that
\scheme{function} ftypes cannot be used as the types of \scheme{function} ftypes cannot be used as the types of
@ -1695,17 +1695,23 @@ the \scheme{endian} ftype with a \scheme{big} or \scheme{little}
\var{endianness} specifier. \var{endianness} specifier.
The \scheme{native} specifier can be used to force a return The \scheme{native} specifier can be used to force a return
back to \scheme{native} representation. back to \scheme{native} representation.
The \scheme{swapped} specifier can be used to swap the
representation relative to the default or enclosing representation.
Each \scheme{endian} form affects only ftypes nested syntactically Each \scheme{endian} form affects only ftypes nested syntactically
within it and not nested within a closer \scheme{endian} form. within it and not nested within a closer \scheme{endian} form.
The total size $n$ of the fields within an ftype bits form must The total size $n$ of the fields within an ftype bits form must
be 8, 16, 24, 32, 40, 48, 56, or 64. padding must be added manually if needed. be 8, 16, 24, 32, 40, 48, 56, or 64. Padding must be added manually, if needed.
In little-endian representation, the first field occupies In little-endian representation, the first field occupies
the low-order bits of the containing 8, 16, 24, 32, 40, 48, 56, or 64-bit word, the low-order bits of the containing 8, 16, 24, 32, 40, 48, 56, or 64-bit word,
with each subsequent field just above the preceding field. with each subsequent field just above the preceding field.
In big-endian representation, the first field occupies the In big-endian representation, the first field occupies the
high-order bits, with each subsequent field just below the high-order bits, with each subsequent field just below the
preceding field. preceding field. For a machine type where endianness is not
known at compile time (such as the porrtable bytecode
virtual machine), a bit field must be specified explicitly
as \scheme{big} or \scheme{little} endian by an enclosing
declaration.
Two ftypes are considered equivalent only if defined by the Two ftypes are considered equivalent only if defined by the
same \scheme{ftype} binding. same \scheme{ftype} binding.

View File

@ -45,6 +45,19 @@ coverage:
bootfiles: build bootfiles: build
$(MAKE) -f Mf-boot $(MAKE) -f Mf-boot
.PHONY: reset
reset:
(cd s && $(MAKE) reset)
%.boot:
mkdir -p ../boot/$*
$(MAKE) -f Mf-boot $*.boot
%.bootquick:
(cd c && $(MAKE))
mkdir -p boot/$*
$(MAKE) -f Mf-boot $*.boot o=3 d=0 what=all
.PHONY: bintar .PHONY: bintar
bintar: build bintar: build
(cd bintar && $(MAKE)) (cd bintar && $(MAKE))

View File

@ -43,11 +43,19 @@ coverage:
bootfiles: bootfiles:
(cd $(workarea) && $(MAKE) bootfiles) (cd $(workarea) && $(MAKE) bootfiles)
# Supply XM=<machine> to build boot files for <machine> .PHONY: reset
.PHONY: boot reset:
boot: build (cd $(workarea) && $(MAKE) reset)
mkdir -p boot/$(XM)
(cd $(workarea) && $(MAKE) -f Mf-boot $(XM).boot) # <machine>.boot to build boot files for <machine>
%.boot:
(cd $(workarea) && $(MAKE) $*.boot)
# <machine>.bootquick to build boot files for <machine>
# with o=3 d=0 for the cross compiler, and only after
# building the kernel for the configured machine
%.bootquick:
(cd $(workarea) && $(MAKE) $*.bootquick)
# Supply ORIG=<dir> to build using existing at <dir> # Supply ORIG=<dir> to build using existing at <dir>
.PHONY: from-orig .PHONY: from-orig

View File

@ -19,7 +19,8 @@ doit: $(bootfiles)
%.boot: %.boot:
( cd .. ; ./workarea $* xc-$* ) ( cd .. ; ./workarea $* xc-$* )
( cd ../xc-$*/s ; make -f Mf-cross base=../../$(workarea) --jobs=2 m=$(m) xm=$* ) ( cd ../xc-$*/s ; make -f Mf-cross base=../../$(workarea) m=$(m) xm=$* )
mkdir -p ../boot/$*
for x in `echo scheme.boot petite.boot scheme.h equates.h gc-oce.inc gc-ocd.inc vfasl.inc` ; do\ for x in `echo scheme.boot petite.boot scheme.h equates.h gc-oce.inc gc-ocd.inc vfasl.inc` ; do\
if [ ! -h ../xc-$*/boot/$*/$$x ] ; then \ if [ ! -h ../xc-$*/boot/$*/$$x ] ; then \
mv -f ../xc-$*/boot/$*/$$x ../boot/$*/$$x ;\ mv -f ../xc-$*/boot/$*/$$x ../boot/$*/$$x ;\

View File

@ -62,7 +62,7 @@ InstallLZ4Target=
# no changes should be needed below this point # # no changes should be needed below this point #
############################################################################### ###############################################################################
Version=csv9.5.3.34 Version=csv9.5.3.35
Include=boot/$m Include=boot/$m
PetiteBoot=boot/$m/petite.boot PetiteBoot=boot/$m/petite.boot
SchemeBoot=boot/$m/scheme.boot SchemeBoot=boot/$m/scheme.boot

View File

@ -1149,7 +1149,9 @@
; regression test to verify that we can evaluate a foreign-callable form inside the procedure to ; regression test to verify that we can evaluate a foreign-callable form inside the procedure to
; which scheme-start is set, which was failing because its relocation information was discarded ; which scheme-start is set, which was failing because its relocation information was discarded
; by the static-generation collection. ; by the static-generation collection.
(equal? (or
(case (machine-type) [(pb) #t] [else #f]) ; no callables in pb
(equal?
(begin (begin
(unless (or (embedded?) (equal? *scheme* (format "../bin/~a/scheme~a" (machine-type) (if (windows?) ".exe" "")))) (unless (or (embedded?) (equal? *scheme* (format "../bin/~a/scheme~a" (machine-type) (if (windows?) ".exe" ""))))
(errorf #f "not testing boot file based on ../boot/~a/petite.boot, since *scheme* isn't ../bin/~a/scheme~a" (errorf #f "not testing boot file based on ../boot/~a/petite.boot, since *scheme* isn't ../bin/~a/scheme~a"
@ -1172,7 +1174,7 @@
(close-input-port from-stderr) (close-input-port from-stderr)
(unless (eof-object? err) (error 'bootfile-test2 err)) (unless (eof-object? err) (error 'bootfile-test2 err))
out))) out)))
"#<code>\n") "#<code>\n"))
) )
(mat hostop (mat hostop

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6fb m ?= a6fb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6le m ?= a6le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m64 -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -m64 -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6nb m ?= a6nb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6nt m ?= a6nt
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6ob m ?= a6ob
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6osx m ?= a6osx
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = a6s2 m ?= a6s2
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
gcc -m64 -fPIC -shared -I${Include} -o foreign1.so ${fsrc} gcc -m64 ${threadFlags} -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
gcc -o cat_flush cat_flush.c gcc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = arm32le m ?= arm32le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so

27
mats/Mf-arm64le Normal file
View File

@ -0,0 +1,27 @@
# Mf-arm64le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m ?= arm64le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so
include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3fb m ?= i3fb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3le m ?= i3le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -m32 -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3nb m ?= i3nb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3nt m ?= i3nt
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3ob m ?= i3ob
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3osx m ?= i3osx
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = i3s2 m ?= i3s2
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
gcc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc} gcc -m32 -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
gcc -o cat_flush cat_flush.c gcc -o cat_flush cat_flush.c

5
mats/Mf-pb Normal file
View File

@ -0,0 +1,5 @@
# Mf-pb
m = pb
include Mf-pbhost

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
m = ppc32le m ?= ppc32le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c fsrc = foreign1.c foreign2.c foreign3.c foreign4.c
fobj = foreign1.so fobj = foreign1.so
@ -21,7 +21,7 @@ fobj = foreign1.so
include Mf-base include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc} cc -m32 -fPIC ${threadFlags} -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ta6fb # Mf-ta6fb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6fb m = ta6fb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-a6fb
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ta6le # Mf-ta6le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6le m = ta6le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-a6le
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m64 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ta6nb # Mf-ta6nb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6nb m = ta6nb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-a6nb
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,30 +1,5 @@
# Mf-ta6nt # Mf-ta6nt
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6nt m = ta6nt
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-a6nt
fobj = foreign1.so
mdclean = cat_flush.exe cat_flush.obj foreign1.exp foreign1.lib foreign1.obj foreign2.obj foreign3.obj
include Mf-base
export MSYS_NO_PATHCONV=1
foreign1.so: $(fsrc)
cmd.exe /c "vs.bat amd64 && cl /DWIN32 /DX86_64 /Fe$@ /I${Include} /LD /MD /nologo ../bin/$m/csv953.lib $(fsrc)"
cat_flush: cat_flush.c
cmd.exe /c "vs.bat amd64 && cl /DWIN32 /DX86_64 /MD /nologo $<"

View File

@ -1,27 +1,7 @@
# Mf-ta6ob # Mf-ta6ob
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6ob m = ta6ob
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-a6ob
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,5 @@
# Mf-ta6osx # Mf-ta6osx
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6osx m = ta6osx
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-a6osx
fobj = foreign1.so
include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m64 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ta6s2 # Mf-ta6s2
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ta6s2 m = ta6s2
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -D_REENTRANT
fobj = foreign1.so
include Mf-base include Mf-a6s2
foreign1.so: ${fsrc} ../boot/$m/scheme.h
gcc -m64 -D_REENTRANT -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
gcc -o cat_flush cat_flush.c

View File

@ -1,27 +1,5 @@
# Mf-tarm32le # Mf-tarm32le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = tarm32le m = tarm32le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-arm32le
fobj = foreign1.so
include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,5 @@
# Mf-tarm64le # Mf-tarm64le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = tarm64le m = tarm64le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-arm64le
fobj = foreign1.so
include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ti3fb # Mf-ti3fb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3fb m = ti3fb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-i3fb
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ti3le # Mf-ti3le
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3le m = ti3le
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-i3le
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m32 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,7 @@
# Mf-ti3nb # Mf-ti3nb
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3nb m = ti3nb
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-i3nb
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,30 +1,5 @@
# Mf-ti3nt # Mf-ti3nt
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3nt m = ti3nt
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-i3nt
fobj = foreign1.so
mdclean = cat_flush.exe cat_flush.obj foreign1.exp foreign1.lib foreign1.obj foreign2.obj foreign3.obj
include Mf-base
export MSYS_NO_PATHCONV=1
foreign1.so: $(fsrc)
cmd.exe /c "vs.bat x86 && cl /DWIN32 /Fe$@ /I${Include} /LD /MD /nologo ../bin/$m/csv953.lib $(fsrc)"
cat_flush: cat_flush.c
cmd.exe /c "vs.bat x86 && cl /DWIN32 /MD /nologo $<"

View File

@ -1,27 +1,7 @@
# Mf-ti3ob # Mf-ti3ob
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3ob m = ti3ob
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c threadFlags = -pthread
fobj = foreign1.so
include Mf-base include Mf-i3ob
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

View File

@ -1,27 +1,5 @@
# Mf-ti3osx # Mf-ti3osx
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m = ti3osx m = ti3osx
fsrc = foreign1.c foreign2.c foreign3.c foreign4.c include Mf-i3osx
fobj = foreign1.so
include Mf-base
foreign1.so: ${fsrc} ../boot/$m/scheme.h
cc -m32 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
cat_flush: cat_flush.c
cc -o cat_flush cat_flush.c

Some files were not shown because too many files have changed in this diff Show More