Diff for /gforth/engine/main.c between versions 1.184 and 1.185

version 1.184, 2007/06/30 20:28:55 version 1.185, 2007/07/01 11:56:03
Line 239  Label *xts; /* same content as vm_prims, Line 239  Label *xts; /* same content as vm_prims,
 #endif  #endif
   
 #ifndef NO_DYNAMIC  #ifndef NO_DYNAMIC
   #if defined(__alpha)
   #define CODE_ALIGNMENT 16
   #else
   #define CODE_ALIGNMENT 0
   #endif
   
 #define MAX_IMMARGS 2  #define MAX_IMMARGS 2
   
 typedef struct {  typedef struct {
Line 1078  static void flush_to_here(void) Line 1084  static void flush_to_here(void)
 #endif  #endif
 }  }
   
   static void align_code(void)
        /* align code_here on some platforms */
   {
   #ifndef NO_DYNAMIC
   #if defined(__alpha)
     Cell alignment = CODE_ALIGNMENT;
     int nops[] = {0x47ff041f,0x2ffe0000,0x47ff041f,0x2ffe0000};
     UCell offset = ((UCell)code_here)&(alignment-1);
     UCell length = alignment-offset;
     if (offset != 0) {
       memcpy(code_here,((Address)nops)+offset,length);
       code_here += length;
     }
   #endif /* defined(__alpha) */
   #endif /* defined(NO_DYNAMIC */
   }  
   
 #ifndef NO_DYNAMIC  #ifndef NO_DYNAMIC
 static void append_jump(void)  static void append_jump(void)
 {  {
Line 1088  static void append_jump(void) Line 1111  static void append_jump(void)
     code_here += pi->restlength;      code_here += pi->restlength;
     memcpy(code_here, goto_start, goto_len);      memcpy(code_here, goto_start, goto_len);
     code_here += goto_len;      code_here += goto_len;
 #if defined(__alpha)      align_code();
     {  
       /* align code after jump */  
       Cell alignment = 16;  
       code_here = (Address)((((UCell)code_here)+(alignment-1))&~(alignment-1));  
     }  
 #endif  
     last_jump=0;      last_jump=0;
   }    }
 }  }
Line 1117  static Address append_prim(Cell p) Line 1134  static Address append_prim(Cell p)
   PrimInfo *pi = &priminfos[p];    PrimInfo *pi = &priminfos[p];
   Address old_code_here = code_here;    Address old_code_here = code_here;
   
   if (code_area+code_area_size < code_here+pi->length+pi->restlength+goto_len) {    if (code_area+code_area_size < code_here+pi->length+pi->restlength+goto_len+CODE_ALIGNMENT) {
     struct code_block_list *p;      struct code_block_list *p;
     append_jump();      append_jump();
     flush_to_here();      flush_to_here();
Line 1759  void compile_prim1(Cell *start) Line 1776  void compile_prim1(Cell *start)
     optimize_rewrite(instps,origs,ninsts);      optimize_rewrite(instps,origs,ninsts);
     /* fprintf(stderr,"optimize_rewrite(...,%d)\n",ninsts); */      /* fprintf(stderr,"optimize_rewrite(...,%d)\n",ninsts); */
     ninsts=0;      ninsts=0;
     if (start==NULL)      if (start==NULL) {
         align_code();
       return;        return;
       }
   }    }
   prim_num = ((Xt)*start)-vm_prims;    prim_num = ((Xt)*start)-vm_prims;
   if(prim_num >= npriminfos) {    if(prim_num >= npriminfos) {

Removed from v.1.184  
changed lines
  Added in v.1.185


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>