At 08:31 AM 12/3/2001 -0800, Terrence Brannon wrote: >Why would a software machine closely emulating CISC architecture be >expected to execute as efficiently on RISC and CISC machines?
Because it means that the machine doesn't do that much work itself, passing most of the work off to the opcode functions, which are in C and thus already native code. Going RISC-like in an interpreter (And yes, Shiram, I am using that properly... :) is a profoundly foolish thing--you're guaranteed that you'll chew up huge amounts of time with opcode dispatch overhead. Yuck. For hardware, RISC makes sense up until the point where your CPU speed outstrips your memory bus bandwidth and you spend a significant chunk of your time twiddling transistors and waiting for data. Instruction decoding and dispatch is essentially free, since you can do it in parallel with other operations. For VMs it doesn't make sense because instruction dispatch is *not* free. (This is where JITs get a lot of their speed win--if all your JIT does is eliminate instruction dispatch you can get a factor of 10x-20x speedup) Minimising dispatch costs means minimizing the number of executed opcodes, which means you want fatter opcodes so you can burn CPU time doing work, not housekeeping. >Does it make any sense to create a low-level machine modeled on >one-architecture instead of a high-level architecture which can flexibly >optimize to either architecture? What, do you mean does it make sense to build a VM rather than something else? What, pray, would you propose as an alternative? >Also, I thought Parrot was not "stack-based" If that is the case then why >does Overview.pod say this: > >"Registers will be stored in register frames, which can be pushed and >popped onto the register stack. For instance, a subroutine or a block >might need its own register frame." Because not being stack based means we don't do nonsense like: PUSH "$foo" GETVARPTR PUSH "$bar" GETVARPTR PUSH "$baz" GETVARPTR ADD STORE to execute "$foo = $bar + $baz". Just because we're not stack based doesn't mean we don't have a stack. Stacks are useful things. (Go ahead, find a CPU that doesn't have one...) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk