[Yhc] some ideas for revamping numeric bytecodes

Thomas Shackell shackell at cs.york.ac.uk
Mon Aug 7 06:07:42 EDT 2006


Hi Rob,

Yes some operations are represented through bytecode operations and some 
through FFI calls.

Your proposal is an interesting idea but, as I see it, it does have some 
disadvantages:

   - It's not very extensible, if we need to add more operations and
     we've run out of reserved codes then it would be necessary to change
     the bytecode format.

   - It would introduce instructions with complex bit packed arguments.
     It's generally reckoned to be a good idea to avoid bit packing
     arguments in an interpreter because it's actually really expensive
     (and fiddly) to decode them.

   - It's a little more symmetrical than the current system but it is
     still quite asymmetrical; for example it could be argued "Why make a
     special case for the numeric functions?".
	
     For example, compare putChar with floating point signum; putChar
     might be called hundreds of times in one program but I've never even
     seen a program that actually uses floating poing signum!

   - There's nothing very wrong with the current system. It is a little
     asymmetrical but it's not a big problem. There would be more of a
     case to removing the numeric bytecodes and just using the FFI
     interface (as Hugs does) but I'm a big fan of:
                "if it aint broke, don't fix it".

So I would vote in favour of leaving it as it is, but please keep the 
suggestions comming :-)


Thanks

Tom


Robert Dockins wrote:
> Hello,
> 
> A few weeks ago I was thinking about the strange situation with Yhc's 
> numeric primitives.  Some of them are in the bytecode set, and some are 
> handled through the FFI (at least I think that's what's happening).  
> Thinking about it led me to decide it would be better to somehow 
> represent all the numeric primitives as bytecode operations.  So, I 
> wrote up a proposal.  Anyone who is interested can check it out at:
> 
> http://haskell.org/haskellwiki/Image:Num-bytecodes.txt
> 
> The ideas are about 3/4 baked (which is to say, somewhat more than 
> half-baked ;-) )  I think the integer stuff is pretty good, and the 
> floating point is OK.  I'm less sure about the pointer stuff.  At any 
> rate, I thought I'd share the proposal so it doesn't become completely 
> lost in the dark recesses of my home directory.
> 
> 
> Rob Dockins
> 
> Speak softly and drive a Sherman tank.
> Laugh hard; it's a long way to the bank.
>           -- TMBG
> 
> 
> 
> _______________________________________________
> Yhc mailing list
> Yhc at haskell.org
> http://www.haskell.org/mailman/listinfo/yhc



More information about the Yhc mailing list