pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*   || 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: docode.c,v 1.166 2003/09/19 14:04:48 grubba Exp $ + || $Id: docode.c,v 1.167 2003/12/02 13:49:58 grubba Exp $   */      #include "global.h" - RCSID("$Id: docode.c,v 1.166 2003/09/19 14:04:48 grubba Exp $"); + RCSID("$Id: docode.c,v 1.167 2003/12/02 13:49:58 grubba Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"
pike.git/src/docode.c:177:   void upd_int(int offset, INT32 tmp)   {    MEMCPY(Pike_compiler->new_program->program+offset, (char *)&tmp,sizeof(tmp));   }      INT32 read_int(int offset)   {    return EXTRACT_INT(Pike_compiler->new_program->program+offset);   }    - int store_linenumbers=1; +    static int label_no=0;      int alloc_label(void) { return ++label_no; }      int do_jump(int token,INT32 lbl)   {    if(lbl==-1) lbl=alloc_label();    emit1(token, lbl);    return lbl;   }
pike.git/src/docode.c:2241:    return 1;       default:    Pike_fatal("Infernal compiler error (unknown parse-tree-token %d).\n", n->token);    return 0; /* make gcc happy */    }   }      INT32 do_code_block(node *n)   { -  INT32 ret; +  INT32 entry_point;   #ifdef PIKE_DEBUG    if (current_stack_depth != -4711) Pike_fatal("Reentrance in do_code_block().\n");    current_stack_depth = 0;   #endif       init_bytecode();    label_no=1;    - #ifdef ALIGN_PIKE_FUNCTION_BEGINNINGS -  while( ( (((INT32) PIKE_PC)+2) & (ALIGN_PIKE_JUMPS-1))) -  ins_byte(0); - #endif -  -  ret=PIKE_PC; +     /* NOTE: This is no ordinary label... */    low_insert_label(0);    emit1(F_BYTE,Pike_compiler->compiler_frame->max_number_of_locals);    emit1(F_BYTE,Pike_compiler->compiler_frame->num_args);    emit0(F_ENTRY);    emit0(F_START_FUNCTION);       if(Pike_compiler->compiler_frame->current_function_number >= 0 &&    (Pike_compiler->new_program->identifier_references[    Pike_compiler->compiler_frame->current_function_number].id_flags &
pike.git/src/docode.c:2293:    Pike_compiler->compiler_frame->is_inline=1;       /* NOTE: This is no ordinary label... */    low_insert_label(Pike_compiler->compiler_frame->recur_label);    emit1(F_BYTE,Pike_compiler->compiler_frame->max_number_of_locals);    emit1(F_BYTE,Pike_compiler->compiler_frame->num_args);    emit0(F_ENTRY);    emit0(F_START_FUNCTION);    DO_CODE_BLOCK(n);    } -  assemble(); +  entry_point = assemble(1);      #ifdef PIKE_DEBUG    current_stack_depth = -4711;   #endif -  return ret; +  return entry_point;   }    - int docode(node *n) + INT32 docode(node *n)   { -  int tmp; +  INT32 entry_point;    int label_no_save = label_no;    dynamic_buffer instrbuf_save = instrbuf;    int stack_depth_save = current_stack_depth;    struct statement_label *label_save = current_label;    struct cleanup_frame *top_cleanups_save = top_statement_label_dummy.cleanups;       instrbuf.s.str=0;    label_no=1;    current_stack_depth = 0;    current_label = &top_statement_label_dummy; /* Fix these two to */    top_statement_label_dummy.cleanups = 0; /* please F_PUSH_ARRAY. */    init_bytecode();    -  tmp=do_docode(n,0); -  assemble(); +  insert_opcode0(F_ENTRY, n->line_number, n->current_file); +  /* FIXME: Should we check that do_docode() returns 1? */ +  do_docode(n,0); +  insert_opcode0(F_DUMB_RETURN, n->line_number, n->current_file); +  entry_point = assemble(0); /* Don't store linenumbers. */       instrbuf=instrbuf_save;    label_no = label_no_save;    current_stack_depth = stack_depth_save;    current_label = label_save;    top_statement_label_dummy.cleanups = top_cleanups_save; -  return tmp; +  return entry_point;   }