()
| 613 | } |
| 614 | |
| 615 | func (c *codegen) writeJumps() { |
| 616 | for j, i := range c.obj.Program { |
| 617 | switch i.Opcode { |
| 618 | case code.Jmp, code.Jm, code.Jnm: |
| 619 | index := i.Operand.(int) |
| 620 | if index > len(c.l) { |
| 621 | c.errorf(nil, "no jump at label %v, table is %v", i.Operand, c.l) |
| 622 | continue |
| 623 | } |
| 624 | offset := c.l[index] |
| 625 | if offset < 0 { |
| 626 | c.errorf(nil, "offset for label %v is negative, table is %v", i.Operand, c.l) |
| 627 | continue |
| 628 | } |
| 629 | c.obj.Program[j].Operand = c.l[index] |
| 630 | } |
| 631 | } |
| 632 | } |