Skip to content
Snippets Groups Projects
Select Git revision
  • 8f797ab27fd39e7aaee2cc0790d96e8d5ae2037e
  • master default protected
  • 9.0
  • 8.0
  • nt-tools
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2020
  • v8.0.2018
  • v8.0.2016
  • v8.0.2014
  • v8.0.2012
  • v8.0.2008
  • v8.0.2006
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
41 results

bytecode.h

Blame
  • bytecode.h 1.74 KiB
    /*
    || 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: bytecode.h,v 1.13 2005/11/21 10:38:22 grubba Exp $
    */
    
    #define UPDATE_PC()
    
    #define ins_pointer(PTR)	add_relocated_int_to_program((PTR))
    #define read_pointer(OFF)	read_int(OFF)
    #define upd_pointer(OFF, PTR)	upd_int((OFF), (PTR))
    #define ins_align(ALIGN)	do { \
        while (Pike_compiler->new_program->num_program % (ALIGN)) { \
          add_to_program(0); \
        } \
      } while(0)
    #define ins_byte(VAL)		add_to_program((VAL))
    #define ins_data(VAL)		add_relocated_int_to_program((VAL))
    #define read_program_data(PTR, OFF)	EXTRACT_INT((PTR) + (sizeof(INT32)*(OFF)))
    
    #define PROG_COUNTER pc
    
    #define READ_INCR_BYTE(PC)	EXTRACT_UCHAR((PC)++)
    
    #define CHECK_RELOC(REL, PROG_SIZE)		\
      do {						\
        if ((REL) > (PROG_SIZE)-4) {		\
          Pike_error("Bad relocation: %"PRINTSIZET"d > %"PRINTSIZET"d\n",	\
    		 (REL), (PROG_SIZE)-4);		\
        }						\
      } while(0)
    
    /* FIXME: Uses internal variable 'byteorder'. */
    #define DECODE_PROGRAM(P)						\
      do {									\
        struct program *p_ = (P);						\
        int num_reloc = (int)p_->num_relocations;				\
        if (byteorder != PIKE_BYTEORDER) {					\
          int e;								\
          /* NOTE: Only 1234 <==> 4321 byte-order relocation supported. */	\
          for (e=0; e<num_reloc; e++) {					\
    	size_t reloc = p_->relocations[e];				\
    	unsigned INT8 tmp1;						\
    	unsigned INT8 tmp2;						\
    	tmp1 = p_->program[reloc];					\
    	tmp2 = p_->program[reloc+1];					\
    	p_->program[reloc] = p_->program[reloc+3];			\
    	p_->program[reloc+1] = p_->program[reloc+2];			\
    	p_->program[reloc+3] = tmp1;					\
    	p_->program[reloc+2] = tmp2;					\
          }									\
        }									\
      } while(0)