pike.git / src / peep.c

version» Context lines:

pike.git/src/peep.c:10:   #include "lex.h"   #include "pike_memory.h"   #include "peep.h"   #include "dmalloc.h"   #include "stuff.h"   #include "bignum.h"   #include "opcodes.h"   #include "builtin_functions.h"   #include "constants.h"    - RCSID("$Id: peep.c,v 1.53 2001/07/09 14:19:16 grubba Exp $"); + RCSID("$Id: peep.c,v 1.54 2001/07/16 19:48:59 hubbe Exp $");      static void asm_opt(void);      dynamic_buffer instrbuf;      static int hasarg(int opcode)   {    return instrs[opcode-F_OFFSET].flags & I_HASARG;   }   
pike.git/src/peep.c:128: Inside #if defined(PIKE_DEBUG)
   if(instr > (long)instrbuf.s.len / (long)sizeof(p_instr) || instr < 0)    fatal("update_arg outside known space.\n");   #endif    p=(p_instr *)instrbuf.s.str;    p[instr].arg=arg;   }         /**** Bytecode Generator *****/    +  + #if defined(__i386__) && defined(__GNUC__) +  + #define PUSH_INT(X) ins_int((INT32)(X), add_to_program) + #define PUSH_ADDR(X) PUSH_INT((X)) + #define PUSHL(X) add_to_program(0x68),PUSH_INT((X) + #define CALL_ABSOLUTE(X) add_to_program(0x9a),PUSH_ADDR((X)) + #define RET() add_to_program(0xc3); + #define POP(X) \ +  add_to_program(0x83), /* Addl.b 0x4, %esp */ \ +  add_to_program(0xc4), \ +  add_to_program(-X) +  + #endif +  +    void ins_f_byte(unsigned int b)   {   #ifdef PIKE_DEBUG    if(store_linenumbers && b<F_MAX_OPCODE)    ADD_COMPILED(b);   #endif /* PIKE_DEBUG */       b-=F_OFFSET;   #ifdef PIKE_DEBUG    if(b>255)    Pike_error("Instruction too big %d\n",b);   #endif -  +  + #ifdef PIKE_USE_MACHINE_CODE + #if defined(__i386__) && defined(__GNUC__) +  CALL_ABSOLUTE(instrs[b].address); +  return + #endif + #endif +    #ifdef HAVE_COMPUTED_GOTO    add_to_program(fcode_to_opcode[b]);   #else /* !HAVE_COMPUTED_GOTO */    add_to_program((unsigned char)b);   #endif /* HAVE_COMPUTED_GOTO */   }      static void ins_f_byte_with_arg(unsigned int a,unsigned INT32 b)   { -  + #ifdef PIKE_USE_MACHINE_CODE + #if defined(__i386__) && defined(__GNUC__) +  add_to_program(0xc7); /* movl $xxxx, (%esp) */ +  add_to_program(0x04); +  add_to_program(0x24); +  PUSH_INT(b); +  ins_f_byte(a); +  return; + #endif + #endif +    #ifndef HAVE_COMPUTED_GOTO    switch(b >> 8)    {    case 0 : break;    case 1 : ins_f_byte(F_PREFIX_256); break;    case 2 : ins_f_byte(F_PREFIX_512); break;    case 3 : ins_f_byte(F_PREFIX_768); break;    case 4 : ins_f_byte(F_PREFIX_1024); break;    default:    if( b < 256*256)
pike.git/src/peep.c:182:    }   #endif /* !HAVE_COMPUTED_GOTO */    ins_f_byte(a);    add_to_program((PIKE_OPCODE_T)b);   }      static void ins_f_byte_with_2_args(unsigned int a,    unsigned INT32 c,    unsigned INT32 b)   { - #ifndef HAVE_COMPUTED_GOTO + #ifdef PIKE_USE_MACHINE_CODE + #if defined(__i386__) && defined(__GNUC__) +  add_to_program(0xc7); /* movl $xxxx, 4(%esp) */ +  add_to_program(0x44); +  add_to_program(0x24); +  add_to_program(0x04); +  PUSH_INT(c); +  ins_f_byte_with_arg(a,b); +  return + #endif + #endif +  + #ifdef HAVE_COMPUTED_GOTO    switch(b >> 8)    {    case 0 : break;    case 1 : ins_f_byte(F_PREFIX2_256); break;    case 2 : ins_f_byte(F_PREFIX2_512); break;    case 3 : ins_f_byte(F_PREFIX2_768); break;    case 4 : ins_f_byte(F_PREFIX2_1024); break;    default:    if( b < 256*256)    {