Skip to content

Instantly share code, notes, and snippets.

@Benabik
Created June 28, 2012 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benabik/3014648 to your computer and use it in GitHub Desktop.
Save Benabik/3014648 to your computer and use it in GitHub Desktop.
PIR -> PBC -> PACT.Packfile -> Data.Dumper
PACT$ src/installable_disasm src/temp.pbc
"Packfile" => PMC 'PACT;Packfile' {
uuid: 0 "",
floats: FixedFloatArray (size:0) [
],
strings: FixedStringArray (size:14) [
"WhatIsThis",
"src/temp.pir",
"wit",
"",
"parrot",
"-",
"file",
"line",
"bar",
"main",
"foo",
"baz",
"hi",
"multi"
],
pmcs: FixedPMCArray (size:12) [
FixedIntegerArray (size:1) [
2
],
PMC 'Class' { ... },
FixedIntegerArray (size:1) [
16
],
FixedIntegerArray (size:1) [
17
],
FixedIntegerArray (size:0) [
],
PMC 'Sub' { ... },
PMC 'Sub' { ... },
FixedIntegerArray (size:1) [
1
],
PMC 'Sub' { ... },
FixedIntegerArray (size:1) [
0
],
PMC 'Sub' { ... },
PMC 'Sub' { ... }
],
root: PMC 'PACT;Packfile;Namespace' : Hash {
"" => PMC 'PACT;Packfile;Subroutine' : ResizablePMCArray (size:6) [
PMC 'PACT;Packfile;Label' _0,
PMC 'PACT;Packfile;Op' newclass [
PMC 'PACT;Packfile;Register' P0,
PMC 'PACT;Packfile;Constant;Reference' STRING: 0
],
PMC 'PACT;Packfile;Label' _3,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 0,
PMC 'PACT;Packfile;Register' P0
],
PMC 'PACT;Packfile;Label' _6,
PMC 'PACT;Packfile;Op' returncc [
]
],
"parrot" => PMC 'PACT;Packfile;Namespace' parrot: Hash {
"bar" => PMC 'PACT;Packfile;Subroutine' bar: ResizablePMCArray (size:11) [
PMC 'PACT;Packfile;Debug' src/temp.pir,
PMC 'PACT;Packfile;Annotation' file: {
PMC 'PACT;Packfile;Constant' STRING: "-"
},
PMC 'PACT;Packfile;Annotation' line: {
PMC 'PACT;Packfile;Constant' INT: 1
},
PMC 'PACT;Packfile;Label' _50,
PMC 'PACT;Packfile;Op' get_params [
PMC 'PACT;Packfile;Constant;Reference' PMC: 7,
PMC 'PACT;Packfile;Register' S0
],
PMC 'PACT;Packfile;Label' _53,
PMC 'PACT;Packfile;Op' say [
PMC 'PACT;Packfile;Register' S0
],
PMC 'PACT;Packfile;Label' _55,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _57,
PMC 'PACT;Packfile;Op' returncc [
]
],
"baz" => PMC 'PACT;Packfile;Subroutine' baz: ResizablePMCArray (size:11) [
\root["parrot"]["bar"][0],
\root["parrot"]["bar"][1],
\root["parrot"]["bar"][2],
PMC 'PACT;Packfile;Label' _58,
PMC 'PACT;Packfile;Op' get_params [
PMC 'PACT;Packfile;Constant;Reference' PMC: 9,
PMC 'PACT;Packfile;Register' I0
],
PMC 'PACT;Packfile;Label' _61,
PMC 'PACT;Packfile;Op' say [
PMC 'PACT;Packfile;Constant;Reference' STRING: 11
],
PMC 'PACT;Packfile;Label' _63,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _65,
PMC 'PACT;Packfile;Op' returncc [
]
],
"foo" => PMC 'PACT;Packfile;Subroutine' foo: ResizablePMCArray (size:9) [
\root["parrot"]["bar"][0],
\root["parrot"]["bar"][1],
\root["parrot"]["bar"][2],
PMC 'PACT;Packfile;Label' _45,
PMC 'PACT;Packfile;Op' say [
PMC 'PACT;Packfile;Constant;Reference' STRING: 10
],
PMC 'PACT;Packfile;Label' _47,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _49,
PMC 'PACT;Packfile;Op' returncc [
]
],
"main" => PMC 'PACT;Packfile;Subroutine' main: ResizablePMCArray (size:35) [
\root["parrot"]["bar"][0],
\root["parrot"]["bar"][1],
\root["parrot"]["bar"][2],
PMC 'PACT;Packfile;Label' _7,
PMC 'PACT;Packfile;Op' set [
PMC 'PACT;Packfile;Register' P1,
PMC 'PACT;Packfile;Constant;Reference' PMC: 1
],
PMC 'PACT;Packfile;Label' _10,
PMC 'PACT;Packfile;Op' new [
PMC 'PACT;Packfile;Register' P4,
PMC 'PACT;Packfile;Register' P1
],
PMC 'PACT;Packfile;Label' _13,
PMC 'PACT;Packfile;Op' set_args [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _15,
PMC 'PACT;Packfile;Op' set [
PMC 'PACT;Packfile;Register' P0,
PMC 'PACT;Packfile;Constant;Reference' PMC: 6
],
PMC 'PACT;Packfile;Label' _18,
PMC 'PACT;Packfile;Op' invokecc [
PMC 'PACT;Packfile;Register' P0
],
PMC 'PACT;Packfile;Label' _20,
PMC 'PACT;Packfile;Op' get_results [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _22,
PMC 'PACT;Packfile;Op' set_args [
PMC 'PACT;Packfile;Constant;Reference' PMC: 3,
PMC 'PACT;Packfile;Constant;Reference' STRING: 8
],
PMC 'PACT;Packfile;Label' _25,
PMC 'PACT;Packfile;Op' set [
PMC 'PACT;Packfile;Register' P2,
PMC 'PACT;Packfile;Constant;Reference' PMC: 8
],
PMC 'PACT;Packfile;Label' _28,
PMC 'PACT;Packfile;Op' invokecc [
PMC 'PACT;Packfile;Register' P2
],
PMC 'PACT;Packfile;Label' _30,
PMC 'PACT;Packfile;Op' get_results [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _32,
PMC 'PACT;Packfile;Op' set_args [
PMC 'PACT;Packfile;Constant;Reference' PMC: 2,
PMC 'PACT;Packfile;Constant' INT: 1
],
PMC 'PACT;Packfile;Label' _35,
PMC 'PACT;Packfile;Op' set [
PMC 'PACT;Packfile;Register' P3,
PMC 'PACT;Packfile;Constant;Reference' PMC: 10
],
PMC 'PACT;Packfile;Label' _38,
PMC 'PACT;Packfile;Op' invokecc [
PMC 'PACT;Packfile;Register' P3
],
PMC 'PACT;Packfile;Label' _40,
PMC 'PACT;Packfile;Op' get_results [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _42,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _44,
PMC 'PACT;Packfile;Op' returncc [
]
],
"multi" => PMC 'PACT;Packfile;Subroutine' multi: ResizablePMCArray (size:11) [
\root["parrot"]["bar"][0],
\root["parrot"]["bar"][1],
\root["parrot"]["bar"][2],
PMC 'PACT;Packfile;Label' _66,
PMC 'PACT;Packfile;Op' get_params [
PMC 'PACT;Packfile;Constant;Reference' PMC: 0,
PMC 'PACT;Packfile;Register' P0
],
PMC 'PACT;Packfile;Label' _69,
PMC 'PACT;Packfile;Op' say [
PMC 'PACT;Packfile;Constant;Reference' STRING: 12
],
PMC 'PACT;Packfile;Label' _71,
PMC 'PACT;Packfile;Op' set_returns [
PMC 'PACT;Packfile;Constant;Reference' PMC: 4
],
PMC 'PACT;Packfile;Label' _73,
PMC 'PACT;Packfile;Op' returncc [
]
]
}
},
main: (none)
}
.sub 'wit' :immediate
$P0 = newclass 'WhatIsThis'
.return ($P0)
.end
.sub 'main' :main
.annotate 'file', '-'
.annotate 'line', 1
.const 'Sub' wit = 'wit'
$P1 = new wit
'foo'()
'bar'('bar')
'baz'(1)
.end
.sub 'foo'
say 'foo'
.end
.sub 'bar'
.param string str
say str
.end
.sub 'baz'
.param int n
say 'baz'
.end
.sub 'multi' :multi('WhatIsThis')
.param pmc wit
say 'hi'
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment