[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MPS: Win64 testers?
From: |
Eli Zaretskii |
Subject: |
Re: MPS: Win64 testers? |
Date: |
Sat, 27 Jul 2024 11:02:31 +0300 |
> Date: Thu, 25 Jul 2024 15:39:51 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: emacs-devel@gnu.org
>
> On Thursday, July 25th, 2024 at 07:16, Eli Zaretskii <eliz@gnu.org> wrote:
> > I think you are indeed the first one. I use 32-bit MinGW, and for
> > that I have a working build of MPS (and can share the diffs if someone
> > wants them), but a 64-bit MinGW build of MPS will need other changes,
> > at least in some cases.
>
> It'd be great if you could share the diffs, so I could see where I've gone
> wrong! I've got the 64-bit build with mps to start by now, but haven't really
> tested it for stability much. It survives a few garbage collection cycles, at
> least.
My diffs are attached below. Note that they are for the 32-bit MinGW
build, so not all of them are relevant for a 64-bit MinGW build, and
some stuff for a 64-bit build is missing and you will have to add it.
For example, the code/w3i3gc.gmk file is only for the 32-bit build;
you will need to create code/w3i6gc.gmk instead. You'll also need to
add the 64-bit MinGW fragment to code/mpstd.h (where I added the stuff
for the 32-bit MinGW).
To build, I did the following from the MSYS Bash prompt:
$ cd code
$ make -f w3i3gc.gmk
To run the test suite, I did the following from the cmd window:
d:\usr\...\mps-release-1.118.0\code>..\tool\testrun.bat w3i3gc cool testrun
(where "..." stands for the specific place I have the sources, which
is immaterial for the purposes of this discussion).
To install, say from the MSYS Bash:
$ make install
> As a general question, would there be interest in CI for such systems? I'm
> setting up something locally, but I've been trying to be careful so that the
> Dockerfiles I'm using should work on x86_64 GNU/Linux machines generally.
I think it will be useful, but I don't know how much effort it will
need from you, so I cannot say if it's justified at this stage.
> > > - _setjmp_ex assumes 16-byte alignment of jmp_buf to store the XMM
> > > registers, but we allocate handlers with 8-byte alignment in MPS builds.
> >
> > Where and how do you see that?
>
> I'm not quite sure what you're asking. I saw this trying to run things in
> wine in a docker image on an x86_64 GNU/Linux machine, ran it in gdb.exe,
> found the instruction causing the segfault, and fixed things so it wouldn't.
>
> https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/winecrt0/setjmp.c#L123
> is the instruction that segfaulted here. I'm not sure whether that's what you
> were asking.
>
> The jump buffer is declared with 16-byte alignment here:
> https://gitlab.winehq.org/wine/wine/-/blob/master/include/msvcrt/setjmp.h#L50
>
> A side effect of this is that LISP_ALIGNMENT is 16, which breaks MPS because
> vectorlike_nbytes rounds up to a multiple of LISP_ALIGNMENT, not just
> GCALIGNMENT.
If the "_setjmp_ex assumes 16-byte alignment of jmp_buf to store the
XMM registers" part is about what Wine does, then my question is where
did you see that "we allocate handlers with 8-byte alignment in MPS
builds"?
> Looking over my diff, here's what I had to fix to get things to the current
> stage on msys and msys2 (using MSYSTEM=MINGW64).
>
> - disable the sanity check in the Makefile, because backticks/pipes don't
> work properly
How so? what doesn't work? By "makefile", which Makefile do you mean?
the one in Emacs or the one in MPS?
> - make WINDRES include the --use-temp-file flag, for the same reason
Is this in Emacs Makefiles? I guess Wine is not a good emulation of
Windows, then.
> - wrap the add-name-to-file calls in loadup.el in with-demoted-errors (link
> problems?)
I have no idea. Maybe hard links are not properly emulated by Wine?
> - force LISP_ALIGNMENT to be 8, not 16
Does this mean 'struct Lisp_*' structures are 16-byte aligned in the
64-bit MinGW build? If not, what forces LISP_ALIGNMENT to be 16?
> - change my local generation size settings to be much more conservative for
> the msys build. I think scratch/igc is fine, though.
Don't understand what this means, sorry. What are your "local
generation size settings"?
> - make sys_setjmp and sys_longjmp use a larger buffer and memmove() the data
> in it so it's 16-byte aligned
Why would this be any different from a non-MPS build for 64-bit MinGW?
> - disable the failure exit on close_stream failure in sysdep.c, and silently
> ignore such errors
I guess you are using UCRT? These problems with UCRT are known, but
no one came up with an explanation for them yet. What happens if you
link against MSVCRT instead?
> - trace the extra 'ztrillion' bignum in timefns.c
What happens if you don't?
> - for the msys build, run autogen.sh outside of wine, since there are virtual
> memory issues inflooping the process otherwise
Sounds like Wine is not a good idea at all...
Here are the diffs I promised.
--- ./code/comm.gmk~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/comm.gmk 2024-04-23 15:07:15.288562200 +0300
@@ -72,7 +72,7 @@ endif
# TELEMETRY TARGETS
-EVENT_TARGETS = mpseventcnv mpseventpy mpseventsql mpseventtxt
+EVENT_TARGETS = mpseventcnv$(EXEEXT) mpseventpy$(EXEEXT) mpseventsql$(EXEEXT)
mpseventtxt$(EXEEXT)
# EXTRA TARGETS
@@ -80,7 +80,7 @@ EVENT_TARGETS = mpseventcnv mpseventpy m
# Don't build mpseventsql by default (might not have sqlite3 installed),
# but do build the other event target.
-EXTRA_TARGETS ?= $(filter-out mpseventsql,$(EVENT_TARGETS))
+EXTRA_TARGETS ?= $(filter-out mpseventsql$(EXEEXT),$(EVENT_TARGETS))
#
@@ -161,7 +161,11 @@ POOLN = pooln.c
MV2 = poolmv2.c
MVFF = poolmvff.c
TESTLIB = testlib.c
+ifneq ($(PFM),w3i3gc)
TESTTHR = testthrix.c
+else
+TESTTHR = testthrw3.c
+endif
FMTDY = fmtdy.c fmtno.c
FMTDYTST = fmtdy.c fmtno.c fmtdytst.c
FMTHETST = fmthe.c fmtdy.c fmtno.c fmtdytst.c
@@ -253,57 +257,61 @@ LIB_TARGETS=mps.a mpsplan.a
# Test executables go in TEST_TARGETS.
TEST_TARGETS=\
- abqtest \
- addrobj \
- airtest \
- amcss \
- amcsshe \
- amcssth \
- amsss \
- amssshe \
- apss \
- arenacv \
- awlut \
- awluthe \
- awlutth \
- btcv \
- bttest \
- djbench \
- extcon \
- finalcv \
- finaltest \
- forktest \
- fotest \
- gcbench \
- landtest \
- locbwcss \
- lockcov \
- lockut \
- locusss \
- locv \
- messtest \
- mpmss \
- mpsicv \
- mv2test \
- nailboardtest \
- poolncv \
- qs \
- sacss \
- segsmss \
- sncss \
- steptest \
- tagtest \
- teletest \
- walkt0 \
- zcoll \
- zmess \
- ztfm
+ abqtest$(EXEEXT) \
+ addrobj$(EXEEXT) \
+ airtest$(EXEEXT) \
+ amcss$(EXEEXT) \
+ amcsshe$(EXEEXT) \
+ amcssth$(EXEEXT) \
+ amsss$(EXEEXT) \
+ amssshe$(EXEEXT) \
+ apss$(EXEEXT) \
+ arenacv$(EXEEXT) \
+ awlut$(EXEEXT) \
+ awluthe$(EXEEXT) \
+ awlutth$(EXEEXT) \
+ btcv$(EXEEXT) \
+ bttest$(EXEEXT) \
+ djbench$(EXEEXT) \
+ extcon$(EXEEXT) \
+ finalcv$(EXEEXT) \
+ finaltest$(EXEEXT) \
+ fotest$(EXEEXT) \
+ gcbench$(EXEEXT) \
+ landtest$(EXEEXT) \
+ locbwcss$(EXEEXT) \
+ lockcov$(EXEEXT) \
+ lockut$(EXEEXT) \
+ locusss$(EXEEXT) \
+ locv$(EXEEXT) \
+ messtest$(EXEEXT) \
+ mpmss$(EXEEXT) \
+ mpsicv$(EXEEXT) \
+ mv2test$(EXEEXT) \
+ nailboardtest$(EXEEXT) \
+ poolncv$(EXEEXT) \
+ qs$(EXEEXT) \
+ sacss$(EXEEXT) \
+ segsmss$(EXEEXT) \
+ sncss$(EXEEXT) \
+ steptest$(EXEEXT) \
+ tagtest$(EXEEXT) \
+ teletest$(EXEEXT) \
+ walkt0$(EXEEXT) \
+ zcoll$(EXEEXT) \
+ zmess$(EXEEXT) \
+ ztfm$(EXEEXT)
+
+ifneq ($(PFM),w3i3gc)
+TEST_TARGETS = $(TEST_TARGETS) forktest$(EXEEXT)
+
+endif
# This target records programs that we were once able to build but
# can't at the moment:
UNBUILDABLE_TARGETS=\
- replay # depends on the EPVM pool
+ replay$(EXEEXT) # depends on the EPVM pool
ALL_TARGETS=$(LIB_TARGETS) $(TEST_TARGETS) $(EXTRA_TARGETS)
@@ -446,154 +454,154 @@ $(PFM)/cool/mps.a: $(MPMOBJ)
ifdef VARIETY
-$(PFM)/$(VARIETY)/abqtest: $(PFM)/$(VARIETY)/abqtest.o \
+$(PFM)/$(VARIETY)/abqtest$(EXEEXT): $(PFM)/$(VARIETY)/abqtest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/addrobj: $(PFM)/$(VARIETY)/addrobj.o \
+$(PFM)/$(VARIETY)/addrobj$(EXEEXT): $(PFM)/$(VARIETY)/addrobj.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/airtest: $(PFM)/$(VARIETY)/airtest.o \
+$(PFM)/$(VARIETY)/airtest$(EXEEXT): $(PFM)/$(VARIETY)/airtest.o \
$(FMTSCMOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/amcss: $(PFM)/$(VARIETY)/amcss.o \
+$(PFM)/$(VARIETY)/amcss$(EXEEXT): $(PFM)/$(VARIETY)/amcss.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/amcsshe: $(PFM)/$(VARIETY)/amcsshe.o \
+$(PFM)/$(VARIETY)/amcsshe$(EXEEXT): $(PFM)/$(VARIETY)/amcsshe.o \
$(FMTHETSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/amcssth: $(PFM)/$(VARIETY)/amcssth.o \
+$(PFM)/$(VARIETY)/amcssth$(EXEEXT): $(PFM)/$(VARIETY)/amcssth.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/amsss: $(PFM)/$(VARIETY)/amsss.o \
+$(PFM)/$(VARIETY)/amsss$(EXEEXT): $(PFM)/$(VARIETY)/amsss.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/amssshe: $(PFM)/$(VARIETY)/amssshe.o \
+$(PFM)/$(VARIETY)/amssshe$(EXEEXT): $(PFM)/$(VARIETY)/amssshe.o \
$(FMTHETSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/apss: $(PFM)/$(VARIETY)/apss.o \
+$(PFM)/$(VARIETY)/apss$(EXEEXT): $(PFM)/$(VARIETY)/apss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/arenacv: $(PFM)/$(VARIETY)/arenacv.o \
+$(PFM)/$(VARIETY)/arenacv$(EXEEXT): $(PFM)/$(VARIETY)/arenacv.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/awlut: $(PFM)/$(VARIETY)/awlut.o \
+$(PFM)/$(VARIETY)/awlut$(EXEEXT): $(PFM)/$(VARIETY)/awlut.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/awluthe: $(PFM)/$(VARIETY)/awluthe.o \
+$(PFM)/$(VARIETY)/awluthe$(EXEEXT): $(PFM)/$(VARIETY)/awluthe.o \
$(FMTHETSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/awlutth: $(PFM)/$(VARIETY)/awlutth.o \
+$(PFM)/$(VARIETY)/awlutth$(EXEEXT): $(PFM)/$(VARIETY)/awlutth.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/btcv: $(PFM)/$(VARIETY)/btcv.o \
+$(PFM)/$(VARIETY)/btcv$(EXEEXT): $(PFM)/$(VARIETY)/btcv.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/bttest: $(PFM)/$(VARIETY)/bttest.o \
+$(PFM)/$(VARIETY)/bttest$(EXEEXT): $(PFM)/$(VARIETY)/bttest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/djbench: $(PFM)/$(VARIETY)/djbench.o \
+$(PFM)/$(VARIETY)/djbench$(EXEEXT): $(PFM)/$(VARIETY)/djbench.o \
$(TESTLIBOBJ) $(TESTTHROBJ)
-$(PFM)/$(VARIETY)/extcon: $(PFM)/$(VARIETY)/extcon.o \
+$(PFM)/$(VARIETY)/extcon$(EXEEXT): $(PFM)/$(VARIETY)/extcon.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/finalcv: $(PFM)/$(VARIETY)/finalcv.o \
+$(PFM)/$(VARIETY)/finalcv$(EXEEXT): $(PFM)/$(VARIETY)/finalcv.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/finaltest: $(PFM)/$(VARIETY)/finaltest.o \
+$(PFM)/$(VARIETY)/finaltest$(EXEEXT): $(PFM)/$(VARIETY)/finaltest.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/forktest: $(PFM)/$(VARIETY)/forktest.o \
+$(PFM)/$(VARIETY)/forktest$(EXEEXT): $(PFM)/$(VARIETY)/forktest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/fotest: $(PFM)/$(VARIETY)/fotest.o \
+$(PFM)/$(VARIETY)/fotest$(EXEEXT): $(PFM)/$(VARIETY)/fotest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/gcbench: $(PFM)/$(VARIETY)/gcbench.o \
+$(PFM)/$(VARIETY)/gcbench$(EXEEXT): $(PFM)/$(VARIETY)/gcbench.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(TESTTHROBJ)
-$(PFM)/$(VARIETY)/landtest: $(PFM)/$(VARIETY)/landtest.o \
+$(PFM)/$(VARIETY)/landtest$(EXEEXT): $(PFM)/$(VARIETY)/landtest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \
+$(PFM)/$(VARIETY)/locbwcss$(EXEEXT): $(PFM)/$(VARIETY)/locbwcss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/lockcov: $(PFM)/$(VARIETY)/lockcov.o \
+$(PFM)/$(VARIETY)/lockcov$(EXEEXT): $(PFM)/$(VARIETY)/lockcov.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/lockut: $(PFM)/$(VARIETY)/lockut.o \
+$(PFM)/$(VARIETY)/lockut$(EXEEXT): $(PFM)/$(VARIETY)/lockut.o \
$(TESTLIBOBJ) $(TESTTHROBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/locusss: $(PFM)/$(VARIETY)/locusss.o \
+$(PFM)/$(VARIETY)/locusss$(EXEEXT): $(PFM)/$(VARIETY)/locusss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/locv: $(PFM)/$(VARIETY)/locv.o \
+$(PFM)/$(VARIETY)/locv$(EXEEXT): $(PFM)/$(VARIETY)/locv.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/messtest: $(PFM)/$(VARIETY)/messtest.o \
+$(PFM)/$(VARIETY)/messtest$(EXEEXT): $(PFM)/$(VARIETY)/messtest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpmss: $(PFM)/$(VARIETY)/mpmss.o \
+$(PFM)/$(VARIETY)/mpmss$(EXEEXT): $(PFM)/$(VARIETY)/mpmss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpsicv: $(PFM)/$(VARIETY)/mpsicv.o \
+$(PFM)/$(VARIETY)/mpsicv$(EXEEXT): $(PFM)/$(VARIETY)/mpsicv.o \
$(FMTDYTSTOBJ) $(FMTHETSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mv2test: $(PFM)/$(VARIETY)/mv2test.o \
+$(PFM)/$(VARIETY)/mv2test$(EXEEXT): $(PFM)/$(VARIETY)/mv2test.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/nailboardtest: $(PFM)/$(VARIETY)/nailboardtest.o \
+$(PFM)/$(VARIETY)/nailboardtest$(EXEEXT): $(PFM)/$(VARIETY)/nailboardtest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/poolncv: $(PFM)/$(VARIETY)/poolncv.o \
+$(PFM)/$(VARIETY)/poolncv$(EXEEXT): $(PFM)/$(VARIETY)/poolncv.o \
$(POOLNOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/qs: $(PFM)/$(VARIETY)/qs.o \
+$(PFM)/$(VARIETY)/qs$(EXEEXT): $(PFM)/$(VARIETY)/qs.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/sacss: $(PFM)/$(VARIETY)/sacss.o \
+$(PFM)/$(VARIETY)/sacss$(EXEEXT): $(PFM)/$(VARIETY)/sacss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/segsmss: $(PFM)/$(VARIETY)/segsmss.o \
+$(PFM)/$(VARIETY)/segsmss$(EXEEXT): $(PFM)/$(VARIETY)/segsmss.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/sncss: $(PFM)/$(VARIETY)/sncss.o \
+$(PFM)/$(VARIETY)/sncss$(EXEEXT): $(PFM)/$(VARIETY)/sncss.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/steptest: $(PFM)/$(VARIETY)/steptest.o \
+$(PFM)/$(VARIETY)/steptest$(EXEEXT): $(PFM)/$(VARIETY)/steptest.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/tagtest: $(PFM)/$(VARIETY)/tagtest.o \
+$(PFM)/$(VARIETY)/tagtest$(EXEEXT): $(PFM)/$(VARIETY)/tagtest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/teletest: $(PFM)/$(VARIETY)/teletest.o \
+$(PFM)/$(VARIETY)/teletest$(EXEEXT): $(PFM)/$(VARIETY)/teletest.o \
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/walkt0: $(PFM)/$(VARIETY)/walkt0.o \
+$(PFM)/$(VARIETY)/walkt0$(EXEEXT): $(PFM)/$(VARIETY)/walkt0.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/zcoll: $(PFM)/$(VARIETY)/zcoll.o \
+$(PFM)/$(VARIETY)/zcoll$(EXEEXT): $(PFM)/$(VARIETY)/zcoll.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/zmess: $(PFM)/$(VARIETY)/zmess.o \
+$(PFM)/$(VARIETY)/zmess$(EXEEXT): $(PFM)/$(VARIETY)/zmess.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/ztfm: $(PFM)/$(VARIETY)/ztfm.o \
+$(PFM)/$(VARIETY)/ztfm$(EXEEXT): $(PFM)/$(VARIETY)/ztfm.o \
$(FMTDYTSTOBJ) $(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpseventcnv: $(PFM)/$(VARIETY)/eventcnv.o \
+$(PFM)/$(VARIETY)/mpseventcnv$(EXEEXT): $(PFM)/$(VARIETY)/eventcnv.o \
$(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpseventpy: $(PFM)/$(VARIETY)/eventpy.o \
+$(PFM)/$(VARIETY)/mpseventpy$(EXEEXT): $(PFM)/$(VARIETY)/eventpy.o \
$(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpseventtxt: $(PFM)/$(VARIETY)/eventtxt.o \
+$(PFM)/$(VARIETY)/mpseventtxt$(EXEEXT): $(PFM)/$(VARIETY)/eventtxt.o \
$(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/mpseventsql: $(PFM)/$(VARIETY)/eventsql.o \
+$(PFM)/$(VARIETY)/mpseventsql$(EXEEXT): $(PFM)/$(VARIETY)/eventsql.o \
$(PFM)/$(VARIETY)/mps.a
-$(PFM)/$(VARIETY)/replay: $(PFM)/$(VARIETY)/replay.o \
+$(PFM)/$(VARIETY)/replay$(EXEEXT): $(PFM)/$(VARIETY)/replay.o \
$(PFM)/$(VARIETY)/eventrep.o \
$(PFM)/$(VARIETY)/table.o \
$(PFM)/$(VARIETY)/mps.a
@@ -656,18 +664,18 @@ ifdef TARGET
# %%VARIETY: When adding a new variety, add the dependencies files for it
# here.
ifeq ($(VARIETY),rash)
-include $(PFM)/$(VARIETY)/mps.d
+-include $(PFM)/$(VARIETY)/mps.d
else
ifeq ($(VARIETY),hot)
-include $(PFM)/$(VARIETY)/mps.d
+-include $(PFM)/$(VARIETY)/mps.d
else
-include $(MPM:%.c=$(PFM)/$(VARIETY)/%.d)
+-include $(MPM:%.c=$(PFM)/$(VARIETY)/%.d)
endif # VARIETY != hot
endif # VARIETY != rash
# %%PART: When adding a new part, add the dependencies file for the
# new part here.
-include \
+-include \
$(FMTDY:%.c=$(PFM)/$(VARIETY)/%.d) \
$(FMTDYTST:%.c=$(PFM)/$(VARIETY)/%.d) \
$(FMTHETST:%.c=$(PFM)/$(VARIETY)/%.d) \
@@ -698,11 +706,11 @@ $(PFM)/$(VARIETY)/%.a:
# Executable
-$(PFM)/$(VARIETY)/%:
+$(PFM)/$(VARIETY)/%$(EXEEXT):
$(ECHO) "$(PFM): $@"
$(CC) $(CFLAGSSTRICT) $(LINKFLAGS) -o $@ $^ $(LIBS)
-$(PFM)/$(VARIETY)/mpseventsql:
+$(PFM)/$(VARIETY)/mpseventsql$(EXEEXT):
$(ECHO) "$(PFM): $@"
$(CC) $(CFLAGSLAX) $(LINKFLAGS) -o $@ $^ $(LIBS) -lsqlite3
--- ./code/lockw3.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/lockw3.c 2024-04-23 13:11:22.497139900 +0300
@@ -33,6 +33,25 @@ SRCID(lockw3, "$Id$");
#if defined(LOCK)
+#ifdef __MINGW32__
+# if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000000L
+
+ /* mingw.org's MinGW doesn't have this stuff in its headers. */
+ typedef struct _RTL_RUN_ONCE { PVOID Ptr; } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
+ typedef DWORD (WINAPI *PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID
*);
+
+# define RTL_RUN_ONCE_INIT {0}
+# define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT
+
+ typedef RTL_RUN_ONCE INIT_ONCE;
+ typedef PRTL_RUN_ONCE PINIT_ONCE;
+ typedef WINBOOL (WINAPI *PINIT_ONCE_FN) (PINIT_ONCE InitOnce, PVOID
Parameter, PVOID *Context);
+
+ WINBASEAPI WINBOOL WINAPI InitOnceExecuteOnce (PINIT_ONCE InitOnce,
PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID *Context);
+
+# endif /* __MINGW32_VERSION >= 5000000L */
+#endif /* __MINGW32__ */
+
/* .lock.win32: Win32 lock structure; uses CRITICAL_SECTION */
typedef struct LockStruct {
Sig sig; /* design.mps.sig.field */
--- ./code/mps.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/mps.c 2024-04-23 13:56:08.221252500 +0300
@@ -228,9 +228,9 @@
#include "prmclii6.c" /* x86-64 for Linux mutator context */
#include "span.c" /* generic stack probe */
-/* Windows on IA-32 with Microsoft Visual Studio or Pelles C */
+/* Windows on IA-32 with Microsoft Visual Studio or Pelles C or GCC */
-#elif defined(MPS_PF_W3I3MV) || defined(MPS_PF_W3I3PC)
+#elif defined(MPS_PF_W3I3MV) || defined(MPS_PF_W3I3PC) ||
defined(MPS_PF_W3I3GC)
#include "lockw3.c" /* Windows locks */
#include "thw3.c" /* Windows threading */
--- ./code/mpsiw3.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/mpsiw3.c 2024-04-23 13:45:23.212499000 +0300
@@ -20,6 +20,11 @@ SRCID(mpsiw3, "$Id$");
/* This is defined in protw3.c */
extern LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS info);
+/* These seem to be unused, but MinGW GCC complains about lack of
+ previous prototype. */
+LONG mps_SEH_filter(LPEXCEPTION_POINTERS, void **, size_t *);
+void mps_SEH_handler(void *, size_t);
+
LONG mps_SEH_filter(LPEXCEPTION_POINTERS info,
void **hp_o, size_t *hs_o)
{
--- ./code/mpstd.h~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/mpstd.h 2024-04-23 17:07:42.606079400 +0300
@@ -392,6 +392,22 @@
#define MPS_PF_ALIGN 8
+#elif defined(__MINGW32__) && defined(_X86_) && defined(__GNUC__)
+#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3GC)
+#error "specified CONFIG_PF_... inconsistent with detected w3i3gc"
+#endif
+#define MPS_PF_W3I3GC
+#define MPS_PF_STRING "w3i3gc"
+#define MPS_OS_W3
+#define MPS_ARCH_I3
+#define MPS_BUILD_GC
+#define MPS_T_WORD unsigned long
+#define MPS_T_ULONGEST unsigned long
+#define MPS_WORD_WIDTH 32
+#define MPS_WORD_SHIFT 5
+#define MPS_PF_ALIGN 4
+
+
#else
#error "The MPS Kit does not have a configuration for this platform out of the
box; see manual/build.txt"
#endif
--- ./code/protw3.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/protw3.c 2024-04-23 13:47:36.490634000 +0300
@@ -36,6 +36,7 @@ void ProtSet(Addr base, Addr limit, Acce
NOTREACHED;
}
+LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS);
LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS info)
{
--- ./code/spw3i3.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/spw3i3.c 2024-04-23 09:22:39.390462300 +0300
@@ -27,11 +27,20 @@
void StackProbe(Size depth)
{
+#ifdef __GNUC__
+ __asm__ volatile ("mov %0, %%eax\n\t"
+ "neg %%eax\n\t"
+ "mov (%%esp,%%eax,4), %%eax" /* do the actual probe */
+ : /* no outputs */
+ : "r" (depth)
+ : "eax");
+#else /* MSVC */
__asm {
mov eax, depth
neg eax
mov eax, [esp+eax*4] /* do the actual probe */
}
+#endif
}
--- ./code/testlib.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/testlib.c 2024-04-23 17:02:34.566980300 +0300
@@ -221,7 +221,14 @@ double rnd_double(void)
static unsigned sizelog2(size_t size)
{
+#ifdef __MINGW32__
+ /* For some reason, MinGW sometimes produces a value slightly
+ smaller than the expected one, so we round up to the next FP
+ value. */
+ return (unsigned)(log((double)size) / log(2.0) * (1.0 + __DBL_EPSILON__));
+#else
return (unsigned)(log((double)size) / log(2.0));
+#endif
}
size_t rnd_grain(size_t arena_size)
@@ -232,17 +239,17 @@ size_t rnd_grain(size_t arena_size)
return rnd_align(sizeof(void *), (size_t)1 << sizelog2(arena_size >>
MPS_WORD_SHIFT));
}
-size_t rnd_align(size_t min, size_t max)
+size_t rnd_align(size_t minv, size_t maxv)
{
- unsigned log2min = sizelog2(min);
- unsigned log2max = sizelog2(max);
- Insist(min <= max);
- Insist((size_t)1 << log2min == min);
- Insist((size_t)1 << log2max == max);
+ unsigned log2min = sizelog2(minv);
+ unsigned log2max = sizelog2(maxv);
+ Insist(minv <= maxv);
+ Insist((size_t)1 << log2min == minv);
+ Insist((size_t)1 << log2max == maxv);
if (log2min < log2max)
- return min << (rnd() % (log2max - log2min + 1));
+ return minv << (rnd() % (log2max - log2min + 1));
else
- return min;
+ return minv;
}
double rnd_pause_time(void)
--- ./code/testlib.h~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/testlib.h 2024-04-23 14:31:30.269692800 +0300
@@ -71,7 +71,7 @@
* <https://docs.microsoft.com/en-gb/cpp/c-runtime-library/reference/alloca>
*/
-#if defined(MPS_OS_W3)
+#if defined(MPS_OS_W3) && !defined(__GNUC__)
#define alloca _alloca
@@ -86,7 +86,7 @@
* This macro version may evaluate the name argument twice.
*/
-#if defined(MPS_OS_W3)
+#if defined(MPS_OS_W3) && !defined(__GNUC__)
#define setenv(name, value, overwrite) \
(((overwrite) || !getenv(name)) ? _putenv_s(name, value) : 0)
--- ./code/thw3.c~0 2023-07-11 13:01:52.000000000 +0300
+++ ./code/thw3.c 2024-04-23 13:50:59.803414400 +0300
@@ -259,7 +259,7 @@ Res ThreadDescribe(Thread thread, mps_li
}
-Res ThreadScan(ScanState ss, Thread thread, Word *stackCold,
+Res ThreadScan(ScanState ss, Thread thread, void *stackCold,
mps_area_scan_t scan_area, void *closure)
{
DWORD id;
@@ -285,7 +285,7 @@ Res ThreadScan(ScanState ss, Thread thre
stackPtr = MutatorContextSP(&context);
/* .stack.align */
stackBase = (Word *)AddrAlignUp(stackPtr, sizeof(Word));
- stackLimit = stackCold;
+ stackLimit = (Word *)stackCold;
if (stackBase >= stackLimit)
return ResOK; /* .stack.below-bottom */
--- code/mingw.gmk~0 1970-01-01 02:00:00.000000000 +0200
+++ code/mingw.gmk 2024-04-23 14:29:54.439945000 +0300
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+#
+# mingw.gmk: GNUMAKEFILE FRAGMENT FOR MinGW GCC
+#
+# $Id$
+# Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
+#
+# This file is included by platform makefiles that use the GNU CC
+# compiler. It defines the compiler-specific variables that the
+# common makefile fragment (<code/comm.gmk>) requires.
+
+CC = gcc
+CFLAGSDEBUG = -Og -gdwarf-4 -g3
+CFLAGSOPT = -O2 -gdwarf-4 -g3
+EXEEXT = .exe
+
+# Warnings that might be enabled by clients <design/config/#.warning.impl>.
+CFLAGSCOMPILER := \
+-Waggregate-return \
+-Wall \
+-Wcast-qual \
+-Werror \
+-Wextra \
+-Winline \
+-Wmissing-prototypes \
+-Wnested-externs \
+-Wpointer-arith \
+-Wshadow \
+-Wstrict-aliasing=2 \
+-Wstrict-prototypes \
+-Wswitch-default \
+-Wwrite-strings
+CFLAGSCOMPILERSTRICT := -std=gnu89 -pedantic
+
+# A different set of compiler flags for less strict compilation, for
+# instance when we need to #include a third-party header file that
+# won't fly with -ansi -pedantic. Use sparingly!
+CFLAGSCOMPILERLAX :=
+
+# gcc -MM generates a dependency line of the form:
+# thing.o : thing.c ...
+# The sed line converts this into:
+# <pfm>/<variety>/thing.o <pfm>/<variety>/thing.d : thing.c ...
+# If interrupted, this is liable to leave a zero-length file behind.
+
+define gendep
+$(SHELL) -ec "$(CC) $(CFLAGSSTRICT) -MM $< | \
+ sed '/:/s!$*.o!$(@D)/& $(@D)/$*.d!' > $@"
+[ -s $@ ] || rm -f $@
+endef
+
+
+# C. COPYRIGHT AND LICENSE
+#
+# Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
--- code/w3i3gc.gmk~0 1970-01-01 02:00:00.000000000 +0200
+++ code/w3i3gc.gmk 2024-04-23 14:40:10.709906400 +0300
@@ -0,0 +1,74 @@
+# -*- makefile -*-
+#
+# w3i3gc.gmk: BUILD FOR Windows/x86/MinGW PLATFORM
+#
+# $Id$
+# Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
+
+PFM = w3i3gc
+
+MPMPF = \
+ lockw3.c \
+ mpsiw3.c \
+ prmci3.c \
+ prmcw3.c \
+ prmcw3i3.c \
+ protw3.c \
+ spw3i3.c \
+ thw3.c \
+ vmw3.c
+
+include mingw.gmk
+include comm.gmk
+
+# Installation stuff copied from ../Makefile.in
+
+prefix=d:/usr
+INSTALL_PROGRAM = /bin/install -c
+INSTALL_DATA = /bin/install -c -m 644
+MPS_TARGET_NAME = w3i3gc
+
+build-via-make:
+ $(MAKE) -f $(MPS_TARGET_NAME).gmk EXTRA_TARGETS="$(EXTRA_TARGETS)"
+
+install-make-build: make-install-dirs build-via-make
+ $(INSTALL_DATA) mps*.h $(prefix)/include/
+ $(INSTALL_DATA) $(MPS_TARGET_NAME)/cool/mps.a
$(prefix)/lib/libmps-debug.a
+ $(INSTALL_DATA) $(MPS_TARGET_NAME)/hot/mps.a $(prefix)/lib/libmps.a
+ for PROGRAM in $(EXTRA_TARGETS); do $(INSTALL_PROGRAM)
$(MPS_TARGET_NAME)/hot/$$PROGRAM $(prefix)/bin/$$PROGRAM; done
+
+make-install-dirs:
+ mkdir -p $(prefix)/bin
+ mkdir -p $(prefix)/lib
+ mkdir -p $(prefix)/include
+
+install: install-make-build
+
+# C. COPYRIGHT AND LICENSE
+#
+# Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
- MPS: Win64 testers?, Pip Cet, 2024/07/24
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/25
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/25
- Re: MPS: Win64 testers?,
Eli Zaretskii <=
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/27
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/27
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/27
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/27
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/27
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/27
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/27
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/28
- Re: MPS: Win64 testers?, Eli Zaretskii, 2024/07/28
- Re: MPS: Win64 testers?, Pip Cet, 2024/07/28