petdance/scratch — Issue #461: Can't thaw a Sub (or a PIR subclass of a Sub)
Author: petdance
Created: 2011-11-14 06:10:19+00:00
State: open
Labels: bug, core, Pri-normal, Sev-medium

Code:
```
.sub main :main

$P0 = get_class 'Sub'
$P1 = subclass $P0, 'myProc'

.local pmc pirC
pirC = compreg 'PIR'

.local string code
code = <<"END_CODE"

.sub bar
say "hi"
.end
END_CODE

.local pmc compiled
compiled = pirC(code)
compiled = compiled[0] # just want the first executable sub here.

compiled() # works

.local pmc sub
sub = new 'myProc'
assign sub, compiled
sub() # works

$S0 = freeze sub
say "frozen"
$P2 = thaw $S0
say "thawed"
$P2()
.end
```

Output:
```
hi
hi
frozen
Unsupported key type in Key.thaw
current instr.: 'main' pc 48 (borked.pir:30)
```

I'd expect to be able to thaw this PMC, and then invoke the sub after thaw.

Originally http://trac.parrot.org/parrot/ticket/132
Originally reported by coke (@coke)