Re: [Tack-devel] Trying 8-byte integers
Moved to https://github.com/davidgiven/ack
Brought to you by:
dtrg
From: David G. <dg...@co...> - 2019-09-03 19:41:30
|
Worth doing, although it's going to be tough --- let us know how you get on... Remember that you'll also need to change the definition of arith to be a int64_t; this is used (mostly) everywhere for intermediate value representation. That change should be largely orthogonal to the code generation side of things but is probably going to be really fiddly and error prone, as I'm sure there's lots of code which turn ariths into ints and back (quite possibly written by me; the old code is probably pretty good about this due to needing to support 16-bit ints). On Sun, 1 Sep 2019 at 07:03, George Koehler <ke...@gm...> wrote: > The languages of the ACK don't have 64-bit integers, but I want them. > > https://github.com/kernigh/ack/tree/kernigh-data8 begins to add 8-byte > integers for ack -mlinux386. As of now, it adds the .data8 pseudo to > the assembler, some operations like `adi 8` (add 8-byte integers) to > the i386 code generator, and the long long type to ACK C. Some > operations are missing. C literals like 123LL are missing. If I add > the missing operations and literals, then long long will still be > missing in libc, so printf("%lld", value) won't work. > > I have a few ideas for 8-byte integers. The timezone code in ACK's > libc is obsolete and broken. It should learn to read /etc/localtime, > which is in tzfile(5) format and may contain 8-byte integers. ACK's > software-floating point uses a pair of 4-byte integers for the 64-bit > mantissa; switching to an 8-byte integer might simplify the code and > use the add-with-carry in some processors. > > ack -mosx386 will become obsolete when Apple removes 32-bit mode from > macOS. I would like to build 64-bit executables, but there are a few > obstacles: > - I would need to create an amd64 code generator. > - The 64-bit system calls in macOS aren't stable. I would need to load > Apple's libc and make foreign function calls from ACK's libsys to > Apple's libc. > - amd64 code uses a lot of 8-byte integers, so the ACK must be able to > handle 8-byte integers. > > If it can handle 8-byte integers in linux386, this is one step toward > eventually building amd64 code that runs in macOS. > > The ACK is old, and has ossified a maximum width of 4 bytes for > integers. I try to add 8-byte integers by making exceptions to the > 4-byte limit in parts of the ACK. For example, the assembler still > uses 4-byte integers in expressions, but I widened integer literals > from 4 bytes to 8, so .data8 can take a literal (but not an > expression). > > > _______________________________________________ > Tack-devel mailing list > Tac...@li... > https://lists.sourceforge.net/lists/listinfo/tack-devel > -- ┌─── http://www.cowlark.com ─── │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup |