Ticket #1324 (closed todo: wontfix)
:immediate sub cannot load_bytecode
|Reported by:||jkeenan||Owned by:||whiteknight|
|Cc:||chromatic whiteknight kjs||Language:|
When RT #60000 was closed, chromatic indicated there would probably be a better way of accomplishing its aim.
"It's actually IMCC_INFO(interp)->ghash. In particular, constant folding assigns register numbers to constant PMCs and STRINGs as addresses into the constant table. That's good.
"Those constants are still around for code loaded from :immediate subs. That's also good.
"The problem is that the SymReg structures which represent those constants keep their assigned register numbers. That's bad, because they only get added to the bytecode if they don't already have register numbers representing indices into the constant table.
"Thus, they don't get assigned. This is a problem when handling parameters or return values. The PCC section of IMCC creates a FixedIntegerArray to handle these arguments, and that's a constant PMC in the bytecode. If this doesn't get created somehow (in the case I just described), other parts of the PCC-handling code expect it's there and throw an assertion if it isn't.
"The right fix is to walk IMCC_INFO(interp)->ghash and reset the color of all constant SymRegs to -1 before running any pragma subs (e_pbc_end_sub() in compilers/imcc/pbc.c), but r32633 is a quicker workaround for now, to get this closed. I'll work on the prettier fix in the next couple of days, unless someone beats me to it."
This needs to be followed in Trac.