Main Page | Class List | Directories | File List | Class Members | File Members

docode.c File Reference

#include "global.h"
#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"
#include "svalue.h"
#include "pike_embed.h"
#include "builtin_functions.h"
#include "peep.h"
#include "docode.h"
#include "operators.h"
#include "object.h"
#include "opcodes.h"
#include "lex.h"
#include "mapping.h"
#include "multiset.h"

Classes

struct  cleanup_frame
struct  statement_label_name
struct  statement_label
struct  switch_data

Defines

#define PUSH_CLEANUP_FRAME(func, arg)
#define POP_AND_DONT_CLEANUP
#define POP_AND_DO_CLEANUP
#define BLOCK_BEGIN
#define BLOCK_END
#define PUSH_STATEMENT_LABEL
#define POP_STATEMENT_LABEL
#define LBLCACHESIZE   4711
#define CURRENT_INSTR   ((long)instrbuf.s.len / (long)sizeof(p_instr))
#define MAX_UNWIND   100
#define BUF   ((p_instr *)instrbuf.s.str)
#define DO_CODE_BLOCK(X)   do_pop(do_docode((X),DO_NOT_COPY | DO_POP ))
#define do_jump_when_zero(N, L)   do_cond_jump(N,L,0,DO_POP|DO_NOT_COPY)
#define do_jump_when_non_zero(N, L)   do_cond_jump(N,L,1,DO_POP|DO_NOT_COPY)

Typedefs

typedef void(* cleanup_func )(void *)

Functions

void upd_int (int offset, INT32 tmp)
INT32 read_int (int offset)
int alloc_label (void)
int do_jump (int token, INT32 lbl)
int do_branch (INT32 lbl)
void low_insert_label (int lbl)
int ins_label (int lbl)
void do_pop (int x)
void do_pop_mark (void *ignored)
void do_pop_to_mark (void *ignored)
void do_cleanup_synch_mark (void)
void do_escape_catch (void)
int do_docode (node *n, int flags)
void do_cond_jump (node *n, int label, int iftrue, int flags)
int generate_call_function (node *n)
int do_lfun_call (int id, node *args)
INT32 do_code_block (node *n)
INT32 docode (node *n)

Define Documentation

#define BLOCK_BEGIN
 

#define BLOCK_END
 

#define BUF   ((p_instr *)instrbuf.s.str)
 

#define CURRENT_INSTR   ((long)instrbuf.s.len / (long)sizeof(p_instr))
 

#define DO_CODE_BLOCK  )     do_pop(do_docode((X),DO_NOT_COPY | DO_POP ))
 

#define do_jump_when_non_zero N,
 )     do_cond_jump(N,L,1,DO_POP|DO_NOT_COPY)
 

#define do_jump_when_zero N,
 )     do_cond_jump(N,L,0,DO_POP|DO_NOT_COPY)
 

#define LBLCACHESIZE   4711
 

#define MAX_UNWIND   100
 

#define POP_AND_DO_CLEANUP
 

Value:

do_pop(current_stack_depth - cleanup_frame__.stack_depth);              \
  cleanup_frame__.cleanup(cleanup_frame__.cleanup_arg);                 \
  POP_AND_DONT_CLEANUP

#define POP_AND_DONT_CLEANUP
 

Value:

if (current_label->cleanups == &cleanup_frame__)                        \
    current_label->cleanups = cleanup_frame__.prev;                     \
  else {                                                                \
    DO_IF_DEBUG(                                                        \
      if (current_label->prev->cleanups != &cleanup_frame__)            \
        Pike_fatal("Cleanup frame lost from statement_label cleanup list.\n");\
    )                                                                   \
    current_label->prev->cleanups = cleanup_frame__.prev;               \
  }                                                                     \
} while (0)

#define POP_STATEMENT_LABEL
 

Value:

current_label = new_label__.prev;                                       \
  DO_IF_DEBUG(                                                          \
    if (new_label__.cleanups &&                                         \
        new_label__.cleanups != (void *)(ptrdiff_t) -1)                 \
      Pike_fatal("Cleanup frames still left in statement_label.\n"));   \
} while (0)

#define PUSH_CLEANUP_FRAME func,
arg   ) 
 

Value:

do {                            \
  struct cleanup_frame cleanup_frame__;                                 \
  cleanup_frame__.cleanup = (cleanup_func) (func);                      \
  cleanup_frame__.cleanup_arg = (void *)(ptrdiff_t) (arg);              \
  cleanup_frame__.stack_depth = current_stack_depth;                    \
  DO_IF_DEBUG(                                                          \
    if (current_label->cleanups == (void *)(ptrdiff_t) -1)              \
      Pike_fatal("current_label points to an unused statement_label.\n");       \
  )                                                                     \
  if (current_label->break_label == -2) {                               \
    DO_IF_DEBUG(                                                        \
      if (current_label->prev->break_label == -2)                       \
        Pike_fatal("Found two open statement_label entries in a row.\n");       \
    )                                                                   \
    cleanup_frame__.prev = current_label->prev->cleanups;               \
    current_label->prev->cleanups = &cleanup_frame__;                   \
  }                                                                     \
  else {                                                                \
    cleanup_frame__.prev = current_label->cleanups;                     \
    current_label->cleanups = &cleanup_frame__;                         \
  }

#define PUSH_STATEMENT_LABEL
 

Value:

do {                                    \
  struct statement_label new_label__;                                   \
  new_label__.prev = current_label;                                     \
  if (current_label->break_label != -2) {                               \
    /* Only cover the current label if it's closed. */                  \
    new_label__.name = 0;                                               \
    new_label__.break_label = new_label__.continue_label = -1;          \
    new_label__.emit_break_label = 0;                                   \
    new_label__.cleanups = 0;                                           \
    new_label__.stack_depth = current_stack_depth;                      \
    current_label = &new_label__;                                       \
  }                                                                     \
  else {                                                                \
    DO_IF_DEBUG(                                                        \
      new_label__.cleanups = (void *)(ptrdiff_t) -1;                    \
      new_label__.stack_depth = current_stack_depth;                    \
    )                                                                   \
    current_label->stack_depth = current_stack_depth;                   \
  }


Typedef Documentation

typedef void(* cleanup_func)(void *)
 


Function Documentation

int alloc_label void   ) 
 

int do_branch INT32  lbl  ) 
 

void do_cleanup_synch_mark void   ) 
 

INT32 do_code_block node n  ) 
 

void do_cond_jump node n,
int  label,
int  iftrue,
int  flags
 

int do_docode node n,
int  flags
 

void do_escape_catch void   ) 
 

int do_jump int  token,
INT32  lbl
 

int do_lfun_call int  id,
node args
 

void do_pop int  x  ) 
 

void do_pop_mark void *  ignored  ) 
 

void do_pop_to_mark void *  ignored  ) 
 

INT32 docode node n  ) 
 

int generate_call_function node n  ) 
 

int ins_label int  lbl  ) 
 

void low_insert_label int  lbl  ) 
 

INT32 read_int int  offset  ) 
 

void upd_int int  offset,
INT32  tmp
 


Generated on Fri Jul 22 23:44:28 2005 for Pike by  doxygen 1.3.9.1