[M3devel] 32bit host 64bit target TextLiteral recurring problem

Jay jay.krell at cornell.edu
Wed Jun 3 18:36:17 CEST 2015


I do this. I shouldn't have to make local edits each time. It isn't meant to only be once. I should be able to long-term use a 32bit toolset to target 32bit & 64bit.

 - Jay

On Jun 3, 2015, at 5:16 AM, Antony Hosking <hosking at purdue.edu> wrote:

> Other than cross-compile from 32 to 64 bit what purpose does this serve?
> 
> Sent from my iPad
> 
> On Jun 2, 2015, at 9:58 PM, Jay K <jay.krell at cornell.edu> wrote:
> 
>> We cannot cross from 32bit host to 64bit target.
>> 
>> 
>> Ok to commit this?
>> 
>> diff --git a/m3-libs/m3core/src/text/TextLiteral.i3 b/m3-libs/m3core/src/text/TextLiteral.i3
>> index fa72589..37bf238 100644
>> --- a/m3-libs/m3core/src/text/TextLiteral.i3
>> +++ b/m3-libs/m3core/src/text/TextLiteral.i3
>> @@ -12,9 +12,16 @@ UNSAFE INTERFACE TextLiteral;
>>  IMPORT RTHooks, TextClass;
>>  
>>  CONST
>> - (* DIV BITSIZE should not be here! *)
>> +(* When cm3 uses TInt and when pickle special cases this, it should be approx:
>> +    MaxBytes = LAST (INTEGER) - BITSIZE (INTEGER) * 2 *)
>> +(* This fails for 32bit host and 64bit target:
>> +    MaxBytes = 16_7FFFFFFF DIV BITSIZE (Byte) - 7; *)
>> +(* Until/unless unpickling special cases this, it must not be sizeof(INTEGER)
>> +   dependent. *)
>> + (* DIV BITSIZE should not be here -- compiler limitation due to
>> +    non-use of TInt. *)
>>   (* MaxBytes = LAST (INTEGER) DIV BITSIZE (Byte) - 7 - 8 * ORD(BITSIZE(INTEGER) = 64); *)
>> - MaxBytes = 16_7FFFFFFF DIV BITSIZE (Byte) - 7; 
>> + MaxBytes = 16_7FFFFFFF DIV BITSIZE (Byte) - 15;
>>      (* - 8 * ORD(BITSIZE(INTEGER) = 64) *) 
>>      (* Do not adjust this for INTEGER size.  It makes T have different 
>>         fingerprints on 32- and 64-bit machines, which undermines pickling/
>> 
>> 
>> Yes I know TEXT pickles will be broken.
>> I propose that unpickle should special case a few values here.
>> Or, isn't the brand supposed to help?
>> Or, can we encode this in a better way, w/o an upper bound?
>> I know if you put in 0..0 or 0..-1 you incur range violations at runtime.
>> Which makes me wonder -- are TEXTs unsafe?
>> 
>> Should we support a syntax something like:
>> 
>>     cnt : INTEGER;
>>     buf : ARRAY [0..cnt - 1] OF Byte;
>> ?
>> 
>> Thanks,
>>  - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150603/feff9b93/attachment-0002.html>


More information about the M3devel mailing list