[snip]When PIR code has a function call syntax:
foo(i, j)
the created code has currently (amongst other) a line:
newsub Px, .Sub, foo
where the label "foo" is a relative branch offset.
This is suboptimal for several reasons:
[snip]So I think, we should do instead something like this:
get_sub Px, foo # find the PMC with label "foo" in constants # at compile time and # replace "foo" with the index in constants clone Py, Px # if Px would be modified, clone it first [1]
find_global Px, "foo" # we have that already, but hash lookup!
Is that reasonable?
Yeah, but I think I've a better approach. Instead of doing this, let's just get PMC constants implemented. (I know -- "just" he says :) Each sub in a bytecode segment can get a slot in the constant table, and we can map in sub fetches to the (as of now nonexistent) set_p_pc op.
While we're at it we should see about adding in an integer constant table that can be fixed up on load (to take care of those pesky "what number did my PMC class map to" problems more quickly than the hash lookup) but we can put that off a bit.
--
Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk