| | @@ -57,6 +57,7 @@ |
| 57 | 57 | listing*: BOOL; (* -S: each instruction's text is kept, for list *) |
| 58 | 58 | said: ^Said; |
| 59 | 59 | numSaid, saidCap: INT; |
| 60 | + labelAt: INT; (* where a jump was last fixed to the place it was at *) |
| 60 | 61 | |
| 61 | 62 | proc setListing*(yes: BOOL); |
| 62 | 63 | begin |
| | @@ -881,6 +882,7 @@ |
| 881 | 882 | |
| 882 | 883 | proc fixLink*(L: INT); |
| 883 | 884 | begin |
| 885 | + if L # NoLabel then labelAt := Chunk.pc; end; |
| 884 | 886 | fixLinkTo(L, Chunk.pc); |
| 885 | 887 | end; |
| 886 | 888 | |
| | @@ -891,10 +893,11 @@ |
| 891 | 893 | 4 bytes back and an E9 byte (jmp) is before it; a jcc's field follows |
| 892 | 894 | the bytes 0F 8x, never E9. L then becomes the next jump on the chain, |
| 893 | 895 | which the field held. The caller must place L next, before anything |
| 894 | | - can have noted where the jmp ended. *) |
| 896 | + can have noted where the jmp ended; and no jump may have been fixed |
| 897 | + to just after it, as an if's, which would then land beyond. *) |
| 895 | 898 | proc dropJumpTo*(var L: INT); |
| 896 | 899 | begin |
| 897 | | - if (L = NoLabel) or (L # Chunk.pc - 4) or (Chunk.text[L - 1] # 0E9H) then return; end; |
| 900 | + if (L = NoLabel) or (L # Chunk.pc - 4) or (Chunk.text[L - 1] # 0E9H) or (labelAt = Chunk.pc) then return; end; |
| 898 | 901 | L := Chunk.get4At(L); |
| 899 | 902 | Chunk.takeBack(5); |
| 900 | 903 | if listing and (numSaid > 0) and (said[numSaid - 1].at = Chunk.pc) then DEC(numSaid); end; |