Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Again the infix ops

2 views
Skip to first unread message

Leopold Toetsch

unread,
Mar 31, 2005, 9:30:18 AM3/31/05
to Perl 6 Internals
Below inline/attached is a proposal to fix the MMD infix ops.
INFIX.txt

Luke Palmer

unread,
Mar 31, 2005, 10:25:40 AM3/31/05
to Leopold Toetsch, Perl 6 Internals
Leopold Toetsch writes:
> But with one more indirection a PIC-like scheme can work with
> read-only bytecode too (probably). E.g. the assembler emits instead
> of the proposed:
>
> infix "__add", Pd, Pl, Pr
>
> this opcode:
>
> infix (.MMD_ADD << 24) | n, Pd, Pl, Pr

Just 256? Why don't you add another argument to the infix opcode?

Luke

Leopold Toetsch

unread,
Mar 31, 2005, 11:13:57 AM3/31/05
to Luke Palmer, perl6-i...@perl.org

256 diffent infix operations with the signature _p_p_p should doit it
for a while. If not the assembler can emit C<infix2> for the next bunch
of 256 :)

> Luke

leo

Nicholas Clark

unread,
Apr 1, 2005, 4:12:13 PM4/1/05
to Leopold Toetsch, Luke Palmer, perl6-i...@perl.org

Can 2 different bytecode segments each try to define a new infix operator?
If so, how do they number their infix operators to avoid a clash?

Nicholas Clark

Leopold Toetsch

unread,
Apr 2, 2005, 4:45:01 AM4/2/05
to Nicholas Clark, perl6-i...@perl.org
Nicholas Clark <ni...@ccl4.org> wrote:

> Can 2 different bytecode segments each try to define a new infix operator?
> If so, how do they number their infix operators to avoid a clash?

The same problem arises with user defined opcodes or generally for a
name => index mapping for which the assembler and the Parrot run cores
need the same view.

I see three possible solutions:

1) demand predeclaration of such resources in main (at compile time):

$I0 = register_infix "__hyper_add" # assign next infix op number

or a variation of this theme: demand that the assembler and runtime
"executes" such registration in the same order.

2) do a runtime lookup

infix "__hyper_add", Pd, Pl, Pr

3) treat unknown infix ops as ordinary multi sub calls

Pd = "__hyper_add"(Pl, Pr)

With runcores that can rewrite the bytecode all three boil down to the
same and fast PIC-based operation.

> Nicholas Clark

leo

0 new messages