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

References ...

8 views
Skip to first unread message

Leopold Toetsch

unread,
Oct 8, 2003, 11:12:40 AM10/8/03
to P6I
... are autogenrated sice some time. They delegete all but a few methods
to the refered PMC. [1]
But there are some pieces missing IMHO:
There is no means to get at the type of what the Ref refers too.
And we can't dereference the ref.

I'm thinking of 2 new ops:

deref Px, Py # set Px to what Ref Py refers to
ref S0, Py # := typeof S0, Py->referee
ref I0, Py # := typeof I0, Py->referee

The "deref" opocde could call vtable->get_pmc, which isn't covered by
any opcode yet (assign does a set_pmc - but we don't have the opposite).

This could be also useful for Keys. We can do:
new P0, .Key
new P1, .PerlString
set P1, "key"
assign P0, P1
But there is no opcode to get the PerlString out of the key.

Comments welcome,
leo

[1]
new P1, .PerlString
set P1, 42
new P0, .Ref, P1

print P0
print "\n"

inc P1 # or inc PO
print P0
print "\n"

typeof S0, P0
print S0
print "\n"
typeof S0, P1
print S0
print "\n"
end
42
43
Ref
PerlInt

Leopold Toetsch

unread,
Oct 8, 2003, 12:43:27 PM10/8/03
to Melvin Smith, perl6-i...@perl.org
Melvin Smith <mel...@us.ibm.com> wrote:

> I think if you have the op for dereferencing, you don't need the
> additional ops for
> getting the type of the reference.

Too true, thanks
leo

Nicholas Clark

unread,
Oct 9, 2003, 6:05:53 PM10/9/03
to Leopold Toetsch, Melvin Smith, perl6-i...@perl.org

Yes, but if you have to go via another PMC register then you may spill.
Whereas it seemed that the type retrieval ops went direct to S and I
registers, which may save spillage. (at a cost of more ops)

Nicholas Clark

Melvin Smith

unread,
Oct 9, 2003, 7:58:16 PM10/9/03
to Nicholas Clark, Leopold Toetsch, Melvin Smith, perl6-i...@perl.org

Well, 1 extra register is required which shouldn't be enough to worry
about. Spillage is pretty rare with the number of registers we have
so I doubt it will make a difference.

-Melvin


0 new messages