[M3devel] double double double double checking jmp_buf size/alignment

Jay K jay.krell at cornell.edu
Fri Mar 5 16:40:28 CET 2010


Randy, thanks, we agree.

 

Target.m3:

    | Systems.I386_INTERIX =>

                (* Visual C++'s 16, plus two ints, one to say if sigmask saved, and one to possibly save it. *)

                Jumpbuf_size := 18 * Address.size;

 

    | Systems.NT386, Systems.NT386GNU,
      Systems.I386_NT, Systems.I386_CYGWIN,
      Systems.I386_MINGW =>

                 (* Cygwin is 13, Visual C++ is 16. Interix is 18.
                    Use 18 for interop.
                    Note that Cygwin's setjmp.h header is wrong, off by a factor of 4.
                    Cygwin provides setjmp and _setjmp that resolve the same.
                    Visual C++ provides only _setjmp.
                    Visual C++ also has _setjmp3 that the compiler generates
                    a call to. In fact _setjmp appears to only use 8 ints
                    and _setjmp3 appears to use more. Consider switching to _setjmp3.
                 *)
                 Jumpbuf_size := (18 * Address.size);


 - Jay
 


From: rcolebur at SCIRES.COM
To: m3devel at elegosoft.com
Date: Wed, 6 Jan 2010 15:03:02 -0500
Subject: Re: [M3devel] double double double double checking jmp_buf size/alignment







Jay:
 
Results on the following platforms are all identical:
 
Windows 2000, Intel Pentium 3:  64 4
Windows XP, Intel Core Duo T2400:  64 4
Windows Vista, Intel Core2 Duo P9600:  64 4
 
Regards,
Randy Coleburn
 


From: jayk123 at hotmail.com [mailto:jayk123 at hotmail.com] On Behalf Of Jay K
Sent: Wednesday, January 06, 2010 8:18 AM
To: m3devel
Subject: Re: [M3devel] double double double double checking jmp_buf size/alignment
 
Was truncated!..edited slightly to avoid..





From: jay.krell at cornell.edu
To: m3devel at elegosoft.com
Subject: double double double double checking jmp_buf size/alignment
Date: Wed, 6 Jan 2010 12:28:02 +0000

Getting this right is very important.
  Well, we can overstate but it is wasteful.


So anyone with any time, please compile/run this and send the "platform" (uname -a) and the output, thanks.
Or look at m3-libs/m3core/src/C/*/Csetjmp.i3 and
m3-sys/m3middle/src/Target.m3 and see if all three agree.


I have checked a bunch of systems myself but extra checking is good.


If you have a system we do not yet or any longer support, those are ok too.
 (e.g. Alpha_*, ARM_*, MIPS_*, *_Irix, *_VMS, *_Tru64 etc.)

 
#include <setjmp.h>
#include <stdio.h>

#ifdef __GNUC__
#define ALIGN_OF(x) ((int)(sizeof(struct { char a; x b; }) - sizeof(x)))
#else
#define ALIGN_OF(x) ((int)__alignof(x))

int main()
{
  printf("%d %d\n", (int)sizeof(jmp_buf), ALIGN_OF(jmp_buf));
  return 0;
}


Thanks,
 - Jay 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100305/329abfcf/attachment-0002.html>


More information about the M3devel mailing list