[squeak-dev] Re: Using V8 for other languages
Paolo Bonzini
bonzini at gnu.org
Sun Sep 7 11:18:51 UTC 2008
> which is not much fewer than there are now. Don't confuse encoding with
> semantics. My Squeak compiler (heavily derivative of the current Squeak
> compiler) currently has 34 opcodes distributed over 253 bytecodes. Of
> these, 7 are for optimizations other than inlining blocks, so reduce to
> 27.
GNU Smalltalk has 22 opcodes that are very close to Eliot's list (I
marked the changes with notes on the right):
SEND (n, super, num_args); << Eliot's "send" and "send super"
PUSH_TEMPORARY_VARIABLE (n);
PUSH_OUTER_TEMP (n, scopes);
PUSH_LIT_VARIABLE (n); << could be push constant + #value
PUSH_RECEIVER_VARIABLE (n);
STORE_TEMPORARY_VARIABLE (n);
STORE_OUTER_TEMP (n, scopes);
STORE_LIT_VARIABLE (n); << could be #value:
STORE_RECEIVER_VARIABLE (n);
JUMP (ofs); << could be done with sends
POP_JUMP_TRUE (ofs); << likewise
POP_JUMP_FALSE (ofs); << likewise
PUSH_INTEGER (n); << could be push constant
PUSH_SELF;
PUSH_SPECIAL (n); << could be push constant
PUSH_LIT_CONSTANT (n);
POP_INTO_NEW_STACKTOP (n); << Eliot's make array
POP_STACK_TOP;
MAKE_DIRTY_BLOCK;
RETURN_METHOD_STACK_TOP;
RETURN_CONTEXT_STACK_TOP;
DUP_STACK_TOP;
(24 counting the "line number" mark and a special "exit interpreter"
bytecode used by only one method in the entire system) distributed over
58 bytecodes. There are 6 unused bytecodes, and 192 more bytecodes are
used for "composite" operations like
PUSH_LIT_CONSTANT (arg);
MAKE_DIRTY_BLOCK ();
or
DUP_STACK_TOP ();
PUSH_TEMPORARY_VARIABLE (arg);
PUSH_INTEGER (1);
PLUS_SPECIAL ();
My 2 cents,
Paolo
More information about the Squeak-dev
mailing list
|