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

Jay K jay.krell at cornell.edu
Wed Jun 3 03:58:10 CEST 2015


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.i3index 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/56199005/attachment-0001.html>


More information about the M3devel mailing list