While trying to speed up hash lookups [1] I came (again) to the problem that we are missing true PMC constants. We just have a special Sub PMC for storing subroutine entries but no general way to represent a constant PMC item. E.g.:

   .const pmc s = "value"
   .const pmc i = 1
   ...
   add $P0, i
   setprop $P0, "xxx", s

This would AFAIK not need a lot more opcode variants, because where we now have C<add_p_ic> and C<add_p_nc>, we would then just have C<add_p_pc>[2]. Only some ops that take PMCs only would need additional variants like setprop_p_sc?_pc.
I'm currently thinking of constant scalar PMCs only, but this could get generalized to constant aggregates too.


Comments?
leo

[1] constant _S("string") gets a precomputed hash value
[2] Compiling "add P0, 1" imcc would look for add_p_ic and if this isn't there then for add_p_pc *and* convert the constant.




Reply via email to