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 site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.