Helo Tristan<br><br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div>
> What about declaring that pointers are always 64 bits, for all<br>
> purposes other than final code generation of actual pointer<br>
> instructions? Would that solve the problem?<br>
<br>
</div></div>No, sizeof will report wrong values.<br></blockquote></div><div><br>Could
I modify the parser to let sizeof be a function.<br>And use natual
indexing(ie. the Natural Units) :<br></div><br>19.4 Natural Indexing<br>The
natural indexing mechanism is the critical functionality that enables
EBC to be executed<br>
unchanged on 32- or 64-bit systems. Natural indexing is used to specify
the offset of data relative<br>to a base address. However, rather than
specifying the offset as a fixed number of bytes, the offset<br>is
encoded in a form that specifies the actual offset in two parts: a
constant offset, and an offset<br>
specified as a number of natural units (where one natural unit = sizeof
(VOID *)). These two<br>values are used to compute the actual offset to
data at runtime. When the VM decodes an index<br>during execution, the
resultant offset is computed based on the natural processor size. The
encoded<br>
indexes themselves may be 16, 32, or 64 bits in size. Table 19-4
describes the fields in a natural<br>index encoding.<br><br>Table 19-4.
Index Encoding<br>Bit # Description<br>N Sign bit
(sign), most significant bit<br>
N-3..N-1 Bits assigned to natural units (w)<br>A..N-4 Constant
units (c)<br>0..A-1 Natural units (n)<br><br>As shown in Table
19-4, for a given encoded index, the most significant bit (bit N)
specifies the<br>
sign of the resultant offset after it has been calculated. The sign bit
is followed by three bits<br>(N-3..N-1) that are used to compute the
width of the natural units field (n). The value (w) from<br>this field
is multiplied by the index size in bytes to determine the actual width
(A) of the natural<br>
units field (n). Once the width of the natural units field has been
determined, then the natural units<br>(n) and constant units (c) can be
extracted. The offset is then calculated at runtime according to the<br>following
equation:<br>
Offset = (c + n * (sizeof (VOID *))) * sign<br></div><br>to evaluate
sizeof(void*) at running time?<br><br>Maybe it can use the following
code to get the sizeof(void*) at whether 32-bit and 64-bit processor:<br><br>MOVI
R1, 0<br>
MOVI R2, Label<br>
ADD32 R1, @R2 (1, 0)<br>
Label:<br><br>And use natural indexing mechanism to solve the dynamic
structure layout problem??<br><br>thanks<br><br>ching