Branch: Tag:

2003-11-19

2003-11-19 17:19:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Various assemble()-related cleanups:
Moved the global variable store_linenumbers to an argument of assemble().
assemble() and docode() now return the entrypoint of the generated code.
Support for ALIGN_PIKE_FUNCTION_BEGINNINGS has moved to assemble().
Some lowlevel opcode stuff has been moved from eval_low() to docode().
Moved call of ADD_COMPILED() from the individual files in code/ to assemble().
Added pseudo opcodes F_FILENAME and F_LINE for the benefit of PIKE_PORTABLE_BYTECODE.
assemble() now has some support for PIKE_PORTABLE_BYTECODE.

Rev: src/code/bytecode.c:1.7
Rev: src/code/computedgoto.c:1.4
Rev: src/code/ia32.c:1.36
Rev: src/code/ppc32.c:1.33
Rev: src/code/sparc.c:1.38
Rev: src/docode.c:1.173
Rev: src/docode.h:1.19
Rev: src/las.c:1.343
Rev: src/opcodes.c:1.161
Rev: src/opcodes.h:1.38
Rev: src/peep.c:1.93
Rev: src/peep.h:1.14

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: las.c,v 1.342 2003/11/14 00:13:36 mast Exp $ + || $Id: las.c,v 1.343 2003/11/19 17:19:29 grubba Exp $   */      #include "global.h" - RCSID("$Id: las.c,v 1.342 2003/11/14 00:13:36 mast Exp $"); + RCSID("$Id: las.c,v 1.343 2003/11/19 17:19:29 grubba Exp $");      #include "language.h"   #include "interpret.h"
1391:      node *debug_mkexternalnode(struct program *parent_prog, int i)   { + #if 0 +  return mkidentifiernode(add_ext_ref(Pike_compiler, parent_prog, i)); +  + #else /* !0 */    struct program_state *state;    node *res = mkemptynode();    res->token = F_EXTERNAL;
1459:   #endif       return res; + #endif /* 0 */   }      node *debug_mkcastnode(struct pike_type *type, node *n)
5379:   ptrdiff_t eval_low(node *n,int print_error)   {    unsigned INT16 num_strings, num_constants; +  unsigned INT32 num_program;    size_t jump;    struct svalue *save_sp = Pike_sp;    ptrdiff_t ret;
5397:       if(Pike_compiler->num_parse_error) return -1;    -  num_strings=prog->num_strings; -  num_constants=prog->num_constants; +  num_strings = prog->num_strings; +  num_constants = prog->num_constants; +  num_program = prog->num_program;   #ifdef PIKE_USE_MACHINE_CODE    num_relocations = prog->num_relocations;   #endif /* PIKE_USE_MACHINE_CODE */    -  jump = PIKE_PC; +  jump = docode(dmalloc_touch(node *, n));    - #ifdef INS_ENTRY -  INS_ENTRY(); - #endif /* INS_ENTRY */ -  -  store_linenumbers=0; -  docode(dmalloc_touch(node *, n)); -  ins_f_byte(F_DUMB_RETURN); -  store_linenumbers=1; -  +     ret=-1;    if(!Pike_compiler->num_parse_error)    {
5483: Inside #if defined(PIKE_USE_MACHINE_CODE) and #if defined(VALGRIND_DISCARD_TRANSLATIONS)
     #ifdef VALGRIND_DISCARD_TRANSLATIONS    /* We won't use this machine code any more... */ -  VALGRIND_DISCARD_TRANSLATIONS(prog->program + jump, -  (prog->num_program - jump)*sizeof(PIKE_OPCODE_T)); +  VALGRIND_DISCARD_TRANSLATIONS(prog->program + num_program, +  (prog->num_program - num_program)*sizeof(PIKE_OPCODE_T));   #endif /* VALGRIND_DISCARD_TRANSLATIONS */   #endif /* PIKE_USE_MACHINE_CODE */    -  prog->num_program=jump; +  prog->num_program=num_program;       return ret;   }