[SVN ci] MMD 23 - convert subtract MMD functions and opcodes

1 view
Skip to first unread message

Leopold Toetsch

unread,
Apr 15, 2005, 5:21:45 AM4/15/05
to Perl 6 Internals
Continuing the MMD infix plan, we now have:

1) the subtract MMD functions are converted to the new function signature:

PMC* subtract(PMC* value, PMC* dest)

If C<dest> isn't NULL it's set to the result of the operation and the
result is returned. This is the existing behavior. The TODO new "n_sub"
opcode will return a new destination with the result as needed by
languages like Python or Lisp.

2) There are now distinct infix variants of subtract, with "i_"
prepended to the function name:

void i_subtract(PMC *value)

3) during opcode generation, the "sub" opcode is converted according to:

sub Px, Py, Pz => infix .MMD_SUBTRACT, Px, Py, Pz
sub Px, Py => infix .MMD_I_SUBTRACT, Px, Py
sub Px, Px, Py => infix .MMD_I_SUBTRACT, Px, Py

I'm not quite sure, if the latter is technically correct or useful. It
might cause a problem, when operators are overloaded. OTOH it can safe a
compare "if (dest == SELF) ...".

4) Tcl and Python scalars use the inherited subtract MMD of Parrot core
types Integer, Float, Complex, and BigInt. The old (duplicated,
cut'n'pasted) variants of subtract got just deleted in Tcl and Python
dynamic classes.

5) for type promotion on Integer overflow, I've changed the bignum
vtables. We now have:

PMC* VTABLE_get_bignum(INTERP, SELF)

which returns a new big integer of the appropriate type e.g. a PyLong.
Along with morph these two functions are enough to preserve the HLLs
view of types. There is a new test t/dynclass/pyint_26 that shows
correct promotion of PyInt to PyLong.

6) during changing the scalar classes I found a lot of unused functions
and vtables. E.g.
- get_bool_keyed* # unused, unneeded
- set_bool_keyed* # same
- set_number
- set_string # no vtable slots, we have assign anyway
This is partially cleaned up now.

7) make test succeeds, this includes t/dynclass/py*.t

cd languages/tcl
TEST_PROG_ARGS=-G make test shows 46/228 failing, with DOD enabled
almost all fail.

I don't know yet, what's going on here. It seems that TclParser is the
culprit. It creates during class_init a lot of strings e.g. "bs_nl",
which are declared static in that file. But these strings aren't
anchored anywhere or registered with Parrot's DOD registry.

leo

PS please "make realclean" so that vtable changes are propagated

Reply all
Reply to author
Forward
0 new messages