Ticket #436: pdd13fixes-2.patch
File pdd13fixes-2.patch, 7.3 KB (added by NotFound, 13 years ago) |
---|
-
docs/pdds/pdd13_bytecode.pod
184 184 | | | n = u % 16 ? 16 - (u % 16) : 0 | 185 185 +--------+--------+--------------------------------------------------------+ 186 186 187 Everything beyond the header is an opcode, with word length and byte ordering 188 as defined in the header. If the word length and byte ordering of the machine 189 that is reading the PBC file do not match these, it needs to transform the 190 words making up the rest of the packfile. 187 Everything beyond the header is an opcode, with word length and byte ordering as 188 defined in the header. 189 If the word length and byte ordering of the machine that is reading the PBC file 190 do not match these, it needs to transform the words making up the rest of the 191 packfile. 191 192 192 193 =over 4 193 194 … … 279 280 | 0 | 1 | The total size of the segment in opcodes, including | 280 281 | | | this header. | 281 282 +--------+--------+--------------------------------------------------------+ 283 | 1 | 1 | Internal type of the segment | 284 +--------+--------+--------------------------------------------------------+ 285 | 2 | 1 | Internal id | 286 +--------+--------+--------------------------------------------------------+ 287 | 3 | 1 | Size of the following op array, 0 if none | 288 +--------+--------+--------------------------------------------------------+ 282 289 283 290 284 291 =head4 Segment Padding … … 352 359 =head4 Bytecode Segment 353 360 354 361 This segment has no additional headers. It stores a stream of instructions in 355 bytecode format. Instructions have variable length. Each instruction starts 356 with an operation code (opcode). 362 bytecode format, with the length given in the last field of the segment header. 357 363 364 Instructions have variable length. Each instruction starts with an operation 365 code (opcode). 366 358 367 +--------+--------+--------------------------------------------------------+ 359 368 | Offset | Length | Description | 360 369 +--------+--------+--------------------------------------------------------+ … … 393 402 394 403 =head4 Constants Segment 395 404 396 This segment stores number, string and PMC constants. It adds one extra field 397 to its header. 405 This segment stores number, string and PMC constants. 398 406 407 The first element is the number of constants contained. 408 399 409 +--------+--------+--------------------------------------------------------+ 400 410 | Offset | Length | Description | 401 411 +--------+--------+--------------------------------------------------------+ … … 496 506 497 507 =head4 Fixup Segment 498 508 499 The fixup segment maps names of subs to offsets in the bytecode stream. It 500 adds one extra field to its header. 509 The fixup segment maps names of subs to offsets in the bytecode stream. 501 510 511 The number of fixup table entries, n, is given by the last field of the 512 segment header. 513 502 514 {{ TODO: I think label fixups are no longer used. Check if that is so. }} 503 515 504 +--------+--------+--------------------------------------------------------+505 | Offset | Length | Description |506 +--------+--------+--------------------------------------------------------+507 | 1 | 1 | Number of fixup table entries that follow. |508 | | | n |509 +--------+--------+--------------------------------------------------------+510 511 516 This is followed by n fixup table entries, of variable length, that take the 512 517 following form. 513 518 … … 515 520 | Offset | Length | Description | 516 521 +--------+--------+--------------------------------------------------------+ 517 522 | 0 | 1 | Type of the fixup. Must be: | 518 | | | 0x01 - Subroutine fixup | 523 | | | 0x01 - Subroutine fixup constant string | 524 | | | 0x02 - Subroutine fixup ascii string | 519 525 +--------+--------+--------------------------------------------------------+ 520 | 1 | 1 | The label that is being fixed up. A string constant, | 521 | | | stored as an index into the constants table. | 526 | 1 | - | The label that is being fixed up. A string constant, | 527 | | | stored as an index into the constants table in the 01 | 528 | | | case, a NULL terminated ASCII string padded to word | 529 | | | length with zeroes in the 02. | 522 530 +--------+--------+--------------------------------------------------------+ 523 | 2 | 1 | For subroutine fixups, this is an index into the | 524 | | | constants table for the sub PMC corresponding to the | 525 | | | label. | 531 | - | 1 | This is an index into the constants table for the sub | 532 | | | PMC corresponding to the label. | 526 533 +--------+--------+--------------------------------------------------------+ 527 534 528 535 … … 533 540 534 541 =over 4 535 542 543 =item A list of mappings between instructions in the bytecode and line 544 numbers, with one entry per instruction 545 536 546 =item A list of mappings between offsets in the bytecode and filenames, 537 547 indicating that the bytecode from that point on until the next entry was 538 548 generated from the PIR found in the given filename 539 549 540 =item A list of mappings between instructions in the bytecode and line541 numbers, with one entry per instruction542 543 550 =back 544 551 545 The segment starts with: 552 The length of the table of line numbers mapping is given by the last field 553 of the segment header. 546 554 555 Then come the table: 556 547 557 +--------+--------+--------------------------------------------------------+ 548 558 | Offset | Length | Description | 549 559 +--------+--------+--------------------------------------------------------+ 550 | 1 | 1 | Number of filename mappings that follow. | 551 | | | n | 560 | 0 | 1 | Line number for the offset in the bytecode. | 552 561 +--------+--------+--------------------------------------------------------+ 553 562 563 Then come an opcode with n, the number of file mappings. 564 554 565 Then come n mappings. 555 566 556 567 +--------+--------+--------------------------------------------------------+ … … 562 573 | | | index into the constants table. | 563 574 +--------+--------+--------------------------------------------------------+ 564 575 565 This is followed by the line number for each instruction in the bytecode566 segment.567 576 568 569 577 =head4 Annotations Segment 570 578 571 579 Annotations allow any instruction in the bytecode stream to have zero or more … … 591 599 592 600 =back 593 601 602 The last field of the segment header is not used. 603 594 604 The first word in the segment supplies the number of keys. 595 605 596 606 +--------+--------+--------------------------------------------------------+