# New Ticket Created by Leopold Toetsch
# Please include the string: [perl #36639]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36639 >
SYNOPSIS
pbc_merge -o all.pbc a.pbc, b.pbc [, ...]
ABSTRACT
Read all given pbc files and repack the bytecode into one result pbc.
DESCRIPTION
Since r8676 parrot can (again) create a string representation of evaled
code.
compiled = compiler(code)
print io, compiled
is all to create a packfile, suitable for later loading with
C<load_bytecode>.
But as some language compilers like forth create a lot of evaled code,
there should be a way to combine these packfiles into one.
The utility should roughly work like this:
- create all default segments
- for all pbcs
append each segment to the combined one and
- fold constants
- relocate subroutine offsets to the new offset
Folding constants is a bit tricky, as it needs also to walk trough the
code and replace changed constant table entries.
see also imcc/pbc.c, src/packfile.c, and
src/interpreter.c:prederef_args() or src/debug.c /disassemble for
reading opcodes and arguments.
leo