Steve Fink <[EMAIL PROTECTED]> writes:

> Could you describe better the need and usefulness of these ops? My
> immediate reaction is "Why not just code loops ourselves?" I think
> your ops can be implemented in two currently-existing opcodes apiece,
> and I'm guessing that JIT support for the more primitive ops is going
> to appear before support for the loop ops.

yes, all of the looping constructs can be done with an inc/dec +
eq/if. 

> On the other hand, I may be overlooking a good reason for adding
> these. The two reasons I can think of right now are (1) you've done
> benchmarking and combining these ops demonstrates a significant
> speedup or (2) some hardware architectures have native instructions
> for the loop ops that are measurably more efficient than the direct
> translation of the primitive op pair. (Though I doubt that; the
> primitives are at least as easy for the hardware to parallelize and
> neither possibility touches any more or less data memory.)

Neither (1) nor (2) was on my mind when i wrote the ops. it was a
pruely a my-hand-written-pasm-code-would-be-cleaner-if kind of
thing. it boils down to who is the byte-code aimed at? compilers or
people? if parrot was truly aimed at compilers it would be RISCy and
PMCs + multi-method ops wouldn't exist (at least not directly in
Parrot). If parrot is aimed at people hand writing parrot assembler
then the looping ops make sense. this being the real world parrot is
somewhere in between these two, so i would like to put the question
differently:

   loop and friends make my life as an assembler writer easier, do
   they have any detrimental effects on parrot?

maybe the looping ops should be macros?

regarding (2): vector processors would certainly benefit from having
loops (espicially the ones over arrays of similar things (a large
percentage of real world loops)) explicitly labeled as such. i'm sure
the JIT compiler will be smart enough to figure this out by itself, by
if i (or my compiler) know's its a loop why not mark it as such?

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There's a crack in everything.
It's how the light gets in.
     -Isonard Cohen


Reply via email to