petdance/scratch — Issue #184: docs/parrotbyte.pod && docs/pdds/pdd13_bytecode.pod are either incorrect/unclear
Author: petdance
Created: 2011-11-01 04:25:09+00:00
State: open

{{{
fixup_unpack() in src/packfile.c contains the following code:

for (i = 0; i < self->fixup_count; i++) {
PackFile_FixupEntry * const entry =
self->fixups[i] =
mem_allocate_typed(PackFile_FixupEntry);
entry->type = PF_fetch_opcode(pf, &cursor);
switch (entry->type) {
case enum_fixup_label:
case enum_fixup_sub:
entry->name = PF_fetch_cstring(pf, &cursor);
entry->offset = PF_fetch_opcode(pf, &cursor);
break;
case enum_fixup_none:
break;
default:
PIO_eprintf(interp,
"PackFile_FixupTable_unpack: Unknown fixup type
%d!\n",
entry->type);
return NULL;
}
}
}}}

And include/parrot/packfile.h has the following:

{{{
typedef enum {
enum_fixup_none,
enum_fixup_label,
enum_fixup_sub
} enum_fixup_t;
}}}

When walking through fixup_unpack() in GDB, I get the following:

{{{

Breakpoint 4, fixup_unpack (interp=0x805f7e0, seg=0x825c5d8,
cursor=0x9d570120) at src/packfile.c:3043
...
...
3072 entry->type = PF_fetch_opcode(pf, &cursor);
(gdb) n
3073 switch (entry->type) {
(gdb) p entry->type
$13 = 2
}}}

However, the docs -- namely docs/pdds/pdd13_bytecode.pod (in the section
titled "Fixup Segment") and docs/parrotbyte.pod (in the section "Fixup
segment") say that the type for a subroutine fixup should be 0x01, not 0x02
...

This should either be corrected if wrong, or the docs should be cleared up a
bit otherwise to make the meaning more clear.

Thanks,
Jesse Taylor

PREVIOUSLY tracked by RT#51634.