Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C62112

Conditional jump assembly is suboptimal
Submitted by: Kevin Bracey     Appeared in: Compiler 6.21 or before     Fixed in: Compiler 6.30
Problem

There are number of areas where compilation of branches in Inform could be improved. Most of these would involve significant code generation modifications, but there is one straightforward error in conditional jump assembly.

Conditional jumps can take long or short forms. Short forms can jump up to 63 bytes, but Inform only uses them for distances of up to 31 bytes. Fixing this will shave a small amount off of your code size.

Solution

Apply this patch.

  --- asm.c~   Wed Apr 28 21:14:08 1999
  +++ asm.c    Wed Nov 21 12:18:19 2001
  @@ -898,7 +898,7 @@
       if (asm_trace_level >= 4)
           printf("To label %d, which is %d from here\n",
               j, label_offsets[j]-pc);
  -    if ((label_offsets[j] >= pc+2) && (label_offsets[j] < pc+32))
  +    if ((label_offsets[j] >= pc+2) && (label_offsets[j] < pc+64))
       {   if (asm_trace_level >= 4) printf("Short form\n");
           zcode_markers[i+1] = DELETED_MV;
       }
  @@ -956,7 +956,7 @@
           zcode_holding_area[i+1] = addr%256;
       }
       else
  -    {   if (addr >= 32)
  +    {   if (addr >= 64)
           {   compiler_error("Label out of range for branch");
               printf("Addr is %04x\n", addr);
           }


Last updated 17 April 2013. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.