Simon --
> But this still sucks:
>
> while (code >= code_start && code < (code_start + code_size) && code->i) {
> DO_OP(code, temp, func, interpreter);
> }
>
> Three tests and an addition each op. At the *very least*, we should store
> code_end = code_start + code_size. And at best...
This:
while (code >= code_start && code < (code_start+code_size) && *code)
{ DO_OP(code, interpreter); }
should be the same as this:
IV code_end = code_start + code_size;
while (code >= code_start && code < code_end && *code)
{ DO_OP(code, interpreter); }
once the optimizer is through (disclaimer: IANAO).
>
> DS> "The default dispatch loop shouldn't check. The Safe dispatch loop (note the
> DS> caps there... :) should check."
If we add:
#define PARROT_SAFE_FLAG 0x04 /* Watch bytecode block bounds */
to include/parrot/interpreter.h, then we could change the core runops
loop to look like this:
if (interpreter->flags & PARROT_SAFE_FLAG) {
IV code_end = code_start + code_size; /* Nice and explicit */
while (code >= code_start && code < code_end && *code)
{ DO_OP(code, interpreter); }
}
else {
while (*code) { DO_OP(code, interpreter); }
}
But I don't know if that is on track with where folks want to head of
"safe" operation, or if this is a good way but should be called
something other than "safe"...
Regards,
-- Gregor
_____________________________________________________________________
/ perl -e 'srand(-2091643526); print chr rand 90 for (0..4)' \
Gregor N. Purdy [EMAIL PROTECTED]
Focus Research, Inc. http://www.focusresearch.com/
8080 Beckett Center Drive #203 513-860-3570 vox
West Chester, OH 45069 513-860-3579 fax
\_____________________________________________________________________/