Branch: Tag:

2002-11-02

2002-11-02 13:42:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Extracted the handling of F_POINTER to specific instruction handling.
Added generic handling of I_ISJUMP{ARG,ARGS}.
Added debug check for I_HASPOINTER instructions.

Rev: src/peep.c:1.78

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: peep.c,v 1.77 2002/10/11 01:39:34 nilsson Exp $ + || $Id: peep.c,v 1.78 2002/11/02 13:42:07 grubba Exp $   */      #include "global.h"
26:   #include "interpret.h"   #include "pikecode.h"    - RCSID("$Id: peep.c,v 1.77 2002/10/11 01:39:34 nilsson Exp $"); + RCSID("$Id: peep.c,v 1.78 2002/11/02 13:42:07 grubba Exp $");      static void asm_opt(void);   
349:    ins_f_byte(F_RETURN);    break;    +  case F_POINTER: + #ifdef PIKE_DEBUG +  if(c->arg > max_label || c->arg < 0) +  Pike_fatal("Jump to unknown label?\n"); + #endif +  tmp = DO_NOT_WARN((INT32)PIKE_PC); +  ins_pointer(jumps[c->arg]); +  jumps[c->arg]=tmp; +  break; +     default:    switch(instrs[c->opcode - F_OFFSET].flags & I_IS_MASK)    {
365:       ins_f_byte(c->opcode);    -  case I_ISPOINTER: +    #ifdef PIKE_DEBUG -  if(c->arg > max_label || c->arg < 0) Pike_fatal("Jump to unknown label?\n"); +  if(c->arg > max_label || c->arg < 0) +  Pike_fatal("Jump to unknown label?\n");   #endif    tmp = DO_NOT_WARN((INT32)PIKE_PC);    ins_pointer(jumps[c->arg]);    jumps[c->arg]=tmp;    break;    -  +  case I_ISJUMPARGS:    case I_TWO_ARGS:    ins_f_byte_with_2_args(c->opcode, c->arg, c->arg2);    break;    -  +  case I_ISJUMPARG:    case I_HASARG:    ins_f_byte_with_arg(c->opcode, c->arg);    break;
398:    ADJUST_PIKE_PC (PIKE_PC);   #endif    + #ifdef PIKE_DEBUG +  if (instrs[c->opcode - F_OFFSET].flags & I_HASPOINTER) { +  if ((e+1 < length) || c[1].opcode != F_POINTER) { +  Pike_fatal("Expected instruction %s to be followed by a pointer.\n" +  "Got %s\n.", +  instrs[c->opcode - F_OFFSET].name, +  (e+1 < length)?instrs[c[1]->opcode - F_OFFSET].name:"EOI"); +  } +  } + #endif /* PIKE_DEBUG */ +    #ifdef ALIGN_PIKE_JUMPS    if(e+1 < length)    {