[Yhc] Yhc bytecode thoughts

Neil Mitchell ndmitchell at gmail.com
Sat Mar 4 16:02:09 EST 2006


Hi,

This message is probably mainly targeted at Tom, but since we have a
mailing list and other people may be interested, I thought I'd send it
to everyone.

I was looking at compiled bytecode, and I noticed things that might be
able to be improved - in rough order of difficulty. I don't think any
of these impact on the backend at all, but might make faster code in
general.

== SLIDE 0 ==
I noticed some of these, I take it they are a noop? If so, lets
peephole them away! Probably one line of code...

== JUMP_FALSE -> JUMP_ZERO ==
If we moved from JUMP_FALSE to JUMP_ZERO (which i take it is the same
semantics anyway!) then this could often be used for case statements
on two constructors (say lists, for example). Also case on a bool is
expanded to a case, if we had JUMP_ZERO this could be collapsed back
as a more general transformation. Less code, faster code, happier
code.

== EVAL; JUMP; RETURN ==
I noticed a few things that EVAL, then JUMP, then RETURN - of course
you could collapse the EVAL to EVAL_RETURN and throw away the jump.
Less code, more speed, everyone is happy :)

== branch factorisation ==
I noticed a few cases where two branches both jump to the same place,
and execute the same code, but the code before the jump's are the
same. These could be factorised into the after the jump bit - less
code, same speed, there are possibly more important things before
worrying about this...

Thanks

Neil


More information about the Yhc mailing list