[M3devel] LONGINT

Tony Hosking hosking at cs.purdue.edu
Thu Jul 19 16:33:37 CEST 2007


On Jul 19, 2007, at 2:23 AM, Olaf Wagner wrote:

> On Wed, Jul 18, 2007 at 11:53:38PM -0400, Tony Hosking wrote:
>> I've successfully bootstrapped a CM3 compiler that supports LONGINT
>> as a 64-bit integer type (equivalent to "long long" in C) in addition
>> to INTEGER (same as "long" in C).  This will be useful for
>> simplifying interfaces to C library routines that expect to be able
>> to treat 64-bit integers such as "off_t" for lseek, etc.
>>
>> Currently, the compiler does not treat LONGINT as an ordinal type
>> (I'm not sure this would ever be a good idea) so it cannot be used to
>> index arrays, define enumerations etc., though the simple operations
>> ABS, MAX, MIN, addition, comparisons, MOD, multiplication,
>> subtraction, assignment, are all supported.  This includes changes to
>> m3core (with support for Long.T similar to Word.T, plus RTTipe and
>> RTTypeMap, etc.) and libm3 for Pickle2, as well as to m3middle,
>> m3front, and the gcc-based compiler backend.  There is still work
>> that needs to be done to support and test all the other M3 tools such
>> as network objects, etc., with support and testing needed in m3tk for
>> the new type, as well as in other tools like m3browser.
>
> This sounds great! As this topic had been discussed several times,
> and nothing ever came of it, I'd rather thought that it wouldn't
> be different this time. So at last we have explicit 64 bit support.
> I assume that this works on 32 bit platforms as well as an 64 bit
> platforms? 32 bit backends were the main problem when I tried to
> build code generation support some years ago, as suddenly everything
> needed to be 64 bit long in the CG interfaces.

What I did was to allow both INTEGER precision and LONGINT precision  
in M3CG/CG much along the lines of the various floating point  
precisions (REAL, LONGREAL, EXTENDED).  It did require pushing  
support for these alternatives all the way through to the back-end  
though the changes are more cosmetic than major refactoring.  CM3 is  
a pretty clean compiler in that respect.

>
>> How best should I proceed to get this out to the community.  I am
>> tempted to push it into the CVS head just so that it gets some
>> testing, but perhaps that is premature. I can confirm a complete
>> bootstrap via "do-cm3-std.sh" that appears to produce perfectly
>> functional executables, including mentor, etc.
>
> Well, as there are no other major projects ongoing in development
> as far as I know there principally is no need for special care.
> If you can produce a working core system on two or three target
> platforms and provide upgrading instructions, we can put it in the
> main trunk. I'd strongly suggest to tag _everything_ before and
> after commit of the new code though, for example with
>
>   cvs tag devel_LONGINT_start
>   cvs commit
>   cvs tag devel_LONGINT_RC01
>
> just to make sure that we can easily revert to prior versions.

OK, I'll do this.

>
> We'll have to update the M3 language specs, too, and put up
> some HTML documentation on the servers.

Yes, indeed.  I would be keen to get a clean integration of LONGINT  
in the specs that makes sense.  My biggest question for now is  
whether we should consider LONGINT as an ordinal type or not.   
Perhaps there need to be two different classes of ordinal type with  
different base types (INTEGER and LONGINT).

>
> Thanks for all the work,
>
> Olaf
> -- 
> Olaf Wagner -- elego Software Solutions GmbH, Ohmstr. 9, 10179  
> Berlin, Germany
> phone: +49 30 23 45 86 96  mobile: +49 177 23 45 869  fax: +49 30  
> 23 45 86 95
> http://www.elegosoft.com  |  Geschäftsführer: Olaf Wagner  |    
> Sitz: Berlin
> Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr:  
> DE163214194




More information about the M3devel mailing list