develooper Front page | perl.perl6.internals | Postings from July 2002


Thread Next
Tom Hughes
July 14, 2002 07:54
Message ID:
I've been trying to make sense of the current status of keyed access
at all levels, from the assembler through the ops to the vtables and
it has to be said that the harder I look the more confused I seem to

It all seems to be a bit of a mess at the moment, and I'd like to have
a go at cleaning it up but first of all I need to work out how it is
all supposed to work.

It is clear that the encoding currently used by the assembler does not
match that specified by PDD 8 as the following examples show:

  Instruction         PDD 8 Encoding  Actual Current Encoding

  set P1["hi"], 1234  set_p_kc_ic     set_keyed_p_sc_ic
  set P1[S1], 1234    set_p_r_ic      set_keyed_p_s_ic
  set P1[1], 1234     set_p_kc_ic     set_keyed_integer_p_ic_ic
  set P1[I1], 1234    set_p_r_ic      set_keyed_integer_p_k_ic
  set P1[S1], P2[S2]  set_p_r_p_r     set_keyed_p_s_p_s
  set P1[I1], P2[S2]  set_p_kc_p_r    set_keyed_keyed_integer_p_i_p_s

Obviously this is a complete nonsense. To be honest I suspect that
both encodings have problems,

The PDD 8 encoding uses kc and r (why not kc and k?) to encode the keys
regardless of their type so the op has no way of knowing what sort of
argument it is dealing with.

The currently implemented system distinguishes the operand types OK but
trys to differentiate between ops with an integer key and those with
other types of keys which all falls apart when you have a combination
of integer and non-integer keys in the same instruction.

Once we get to multi-component keys things just get even worse. If we
believe PDD 8 then the syntax should be:

  set P1[I1;I2], I3

But what is currently implemented is this:

  set P1[k;I1;I2], I3

In addition it appears that the current implementation would turn that
instrucion into this encoding:


Where each component of the key becomes a separate argument, thereby
requiring an infinite number of ops to cope with an infinite number of
possible key components.

There is a suggestion in PDD 8 that this should be encoded as this:


With the key constant actually referring to an entry in the constant
table that encodes the key.

Moving on the from the assembler I'm not sure how the recent addition
of the _keyed_int vtable methods interacts with all this - they appear
to be at odds with PDD 8 anyway which appears to want to avoid the
kind of vtable explosion that they promote.

Anyhow, that's probably enough for now... If anybody can elighten me
about how all this is supposed to work then I'll try and knock it all
into shape, starting with making sure that PDD 8 is accurate.


Tom Hughes (

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About