Leopold Toetsch wrote:

> > If memory serves me right, Leopold Toetsch wrote:
> 
>    ^^^...
> 
> Your mailer should know ;-)

That's his mailer talking.  It always does that. :-)

> > Hmm... I guess I can only quote the ECMA spec here ...
> > conv.i1               Convert to int8, pushing int32 on stack
> 
> truncate to [-128..127]? And why the push?

Gopal was listing the IL opcodes, which are stack based.
They pop a value, convert, and then push a new value.
The stack cannot hold int8 values directly, so "conv.i1"
truncates, sign-extends back to int32, and then pushes that.
In Parrot syntax, it would probably be:

    conv.int8 dstreg, srcreg
    conv.uint32 dstreg, srcreg
    (etc)

> What is the behaviour on overflow?

IL has two sets of conversion opcodes.  One which truncates,
ignoring overflow.  And the other which raises an exception
on overflow.  It also has two sets of arithmetic operators
(add, sub, mul) that handle the "no overflow" and "overflow"
cases.  (Overflow handling isn't needed for div, because
it cannot overflow).

Overflow handling would be nice, but we can work around it
in the same way we worked around it for JVM (with a helper
library).  Support for unsigned types is more important.

The list of types in "datatypes.h" looks good.  The one
exception was "signed and unsigned integers the same size
as a pointer".  e.g. the C "intptr_t" type.  Perhaps INTVAL
already handles that?

Cheers,

Rhys.

Reply via email to