From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: Win64 testers? Date: Sat, 27 Jul 2024 10:42:12 +0000 Message-ID: References: <86le1q54bw.fsf@gnu.org> <86zfq31cvc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10325"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 27 13:59:26 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sXg57-0002WW-HY for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Jul 2024 13:59:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXg4M-0005xs-AQ; Sat, 27 Jul 2024 07:58:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXesW-0005u1-P8 for emacs-devel@gnu.org; Sat, 27 Jul 2024 06:42:20 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXesU-0001IT-Ax for emacs-devel@gnu.org; Sat, 27 Jul 2024 06:42:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1722076935; x=1722336135; bh=07jwdv73VFvY7EESi5pweFt4VOBNQoofoawQS3uef5A=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=UB/fVMmVOYu4Jvv8n3KSXFR1WPLI8e/dqmhB29eaao8/2QhUDLa2PHIKar9H/ILXx l9U4x39xPujGDV/WPmzc9Jm+wZMquXbvsJCnVlWMfZEWSurld7YhVe8IUz5IwDNfAz T5rq5wTKSD7j7IYIytWAbSicw0uoCFoSh9Q6VW3iosPGZNMM8fX9F3p6anw+umICAN iTBr9pSWTgnQEbLLzS6iNjLb076b0rLRMwQjckLhHB5NzkGSgHfXyZLvksrjflv6bh h/bdbwUNQb30wsz4A1B1utXw3mvxskVfJlokv59t/ynbP45UNA9HicU7YIPnepJn2u 82PYE+UYByxsA== In-Reply-To: <86zfq31cvc.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: d76a6699f86ea80444824076ba8b01daa90ffd2f Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 27 Jul 2024 07:58:36 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322123 Archived-At: On Saturday, July 27th, 2024 at 08:02, Eli Zaretskii wrote: > > Date: Thu, 25 Jul 2024 15:39:51 +0000 >=20 > > From: Pip Cet pipcet@protonmail.com > > Cc: emacs-devel@gnu.org > >=20 > > On Thursday, July 25th, 2024 at 07:16, Eli Zaretskii eliz@gnu.org wrote= : > >=20 > > > 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 someon= e > > > wants them), but a 64-bit MinGW build of MPS will need other changes, > > > at least in some cases. > >=20 > > It'd be great if you could share the diffs, so I could see where I've g= one 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 c= ycles, at least. >=20 >=20 > My diffs are attached below. Thanks! > 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. Understood. > 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). >=20 > To build, I did the following from the MSYS Bash prompt: >=20 > $ cd code > $ make -f w3i3gc.gmk >=20 > To run the test suite, I did the following from the cmd window: >=20 > d:\usr\...\mps-release-1.118.0\code>..\tool\testrun.bat w3i3gc cool testr= un >=20 >=20 > (where "..." stands for the specific place I have the sources, which > is immaterial for the purposes of this discussion). >=20 > To install, say from the MSYS Bash: >=20 > $ make install >=20 > > 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 tha= t the Dockerfiles I'm using should work on x86_64 GNU/Linux machines genera= lly. >=20 >=20 > 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. What is the state of Emacs CI generally? emba.gnu.org doesn't even appear t= o be reachable at this point... > > > > - _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. > > >=20 > > > Where and how do you see that? > >=20 > > 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. > >=20 > > 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. > >=20 > > The jump buffer is declared with 16-byte alignment here: https://gitlab= .winehq.org/wine/wine/-/blob/master/include/msvcrt/setjmp.h#L50 > >=20 > > A side effect of this is that LISP_ALIGNMENT is 16, which breaks MPS be= cause vectorlike_nbytes rounds up to a multiple of LISP_ALIGNMENT, not just= GCALIGNMENT. >=20 >=20 > 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"? All our pools are aligned to IGC_ALIGN, which is GCALIGNMENT, which is 8 by= tes on this system. > > Looking over my diff, here's what I had to fix to get things to the cur= rent stage on msys and msys2 (using MSYSTEM=3DMINGW64). > >=20 > > - 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? It's the Emacs Makefile. I haven't investigated properly, but it seems outp= ut to stdout and stderr is sometimes dropped. > > - 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. Yes. > > - wrap the add-name-to-file calls in loadup.el in with-demoted-errors (= link problems?) >=20 > I have no idea. Maybe hard links are not properly emulated by Wine? >=20 > > - force LISP_ALIGNMENT to be 8, not 16 >=20 >=20 > 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? emacs_align_type contains struct thread_state, which contains a jmpbuf, whi= ch is 16-byte aligned. > > - change my local generation size settings to be much more conservative= for the msys build. I think scratch/igc is fine, though. >=20 > Don't understand what this means, sorry. What are your "local > generation size settings"? Ignore that, it's not in scratch/igc and not required for it. Sorry. > > - make sys_setjmp and sys_longjmp use a larger buffer and memmove() the= data in it so it's 16-byte aligned >=20 > Why would this be any different from a non-MPS build for 64-bit MinGW? Because non-MPS allocates handlers with xmalloc(), which is 16-byte aligned= , and the jmpbuf in it is, too. I expect the change is required on MPS buil= ds on native Windows, too, though, because that also specifies 16-byte alig= nment for jmpbuf, IIUC. > > - disable the failure exit on close_stream failure in sysdep.c, and sil= ently 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? I'm using the msys2-docker-experimental image with MSYSTEM=3DMINGW64. I don= 't know whether that means I'm using UCRT, sorry. If I use MSYSTEM=3DUCRT64= , I get many more and different problems... > > - trace the extra 'ztrillion' bignum in timefns.c > What happens if you don't? Oops, sorry, bignum tracing isn't in scratch/igc. So ignore that one, too. > > - for the msys build, run autogen.sh outside of wine, since there are v= irtual memory issues inflooping the process otherwise >=20 > Sounds like Wine is not a good idea at all... Specifically, I'm seeing messages such as this one: 0 [main] perl 508 fork_copy: linked dll data/bss pass 0 failed, 0x56C= DE000..0x56CFE794, done 0, windows pid 1352, Win32 error 5 The library in question is msys-perl5_8.dll, and using rebase.exe (from cyg= win?) to rebase it to 0x7000000 appears to help. I tend to agree that using wine for 32-bit mingw is problematic. Using it f= or 64-bit systems seems fine. > Here are the diffs I promised. Thanks again! Pip