On Thursday 04 October 2001 03:51 pm, Gibbs Tanton - tgibbs wrote:
> Ok, I was put in a burlap sack and beaten for my first attempt at this;
> hopefully this attempt will go better.  Based on everyone's (read: Dan's)
> comments I have changed the patch to NOT move integer constants to the
> constant table.  Instead, the assembler dies if you try to make it handle
> an integer constant value larger than 2 ** 31 or smaller than -2 ** 31. 

Well, that obviously should be MAX_whatever and MIN_whatever.
But sufficient for now, since that's probably a configure thing.

> This required a change in two of the integer tests as 0xdeadbeef and
> 0xa0b0c0d0 were both bigger than 2 ** 31.
> Basically, this patch ensures that all code in the pack file is of size
> opcode_t (except the constant table which is in string(char) or double
> format).  It also has the (size_t) casts where pointers are converted to
> integers.

FWIW, size_t != size of pointers everywhere.  (But you're probably safe.)

>
> Summary of what changed:
> 1.) All assembler pack types are now $pack_type{op} except for an explicit
> intval.  The intval pack type is not currently used in the packfile, but
> is used inside the interpreter (for int registers and string lengths and
> such). All bytecode is $pack_type{op}.
> 2.) number constants are no longer changed to the form [nc:N],
> but instead are just N as nothing acutally needed the [nc:N] format.
> 3.)  Fixed some inconsistencies between PackFile and packfile.c in the way
> the string constants were handled (it relied on op and intval to be the
> same
>
> length).  Also changed all of the lengths,types,encodings,etc... that were
> stored in the bytecode to be opcode_t.
> 4.)  Used INT_CONST in basic_opcodes.ops wherever an ic was used (just in
> case.)
> 7.)  Labels are still treated as integers and as such should be 32 bits.
> 8.)  Evaluating numeric and integer constants in the assembler is now
> postponed until the type of the constant is known so that 0 can still
> become
>
> a FLOATVAL constant without having to type 0.0
> 9.) Changed (INTVAL) casts in memory.c, register.h, and strnative.c to
> (size_t) casts just in case sizeof(INTVAL) < sizeof(void*);

!=, not <.  (If you cast back, for instance.)

> 10.) integer.t had 0xdeadbeef changed to 0xdeadbee and 0xa0b0c0d0 to
> 0xa0b0c0d for signed 32 bit compatability.
> Any and all feedback is appreciated.
>
> NOTE: I apologize if this patch is still not what is wanted; I don't want
> to enforce anything I decide to code on parrot, but I thought it might be
> easier to comment on the patch if it were already coded.  If this isn't
> wanted, I will continue to change it until it is :)

I'm still not sure about size_t, but nothing standard had been added until 
recently.  It's probably universal enough to be safe, but we may want to 
just find a type the same size as a pointer and roll our own just to be safe.

-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Reply via email to