Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# iseq.h

Go to the documentation of this file.

    00001 /**********************************************************************
    00002
    00003   iseq.h -
    00004
    00005   $Author: mame $
    00006   created at: 04/01/01 23:36:57 JST
    00007
    00008   Copyright (C) 2004-2008 Koichi Sasada
    00009
    00010 **********************************************************************/
    00011
    00012 #ifndef RUBY_COMPILE_H
    00013 #define RUBY_COMPILE_H
    00014
    00015 /* compile.c */
    00016 VALUE rb_iseq_compile_node(VALUE self, NODE *node);
    00017 int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
    00018 VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
    00019                              VALUE exception, VALUE body);
    00020
    00021 /* iseq.c */
    00022 VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
    00023 struct st_table *ruby_insn_make_insn_table(void);
    00024
    00025 #define ISEQ_TYPE_TOP    INT2FIX(1)
    00026 #define ISEQ_TYPE_METHOD INT2FIX(2)
    00027 #define ISEQ_TYPE_BLOCK  INT2FIX(3)
    00028 #define ISEQ_TYPE_CLASS  INT2FIX(4)
    00029 #define ISEQ_TYPE_RESCUE INT2FIX(5)
    00030 #define ISEQ_TYPE_ENSURE INT2FIX(6)
    00031 #define ISEQ_TYPE_EVAL   INT2FIX(7)
    00032 #define ISEQ_TYPE_MAIN   INT2FIX(8)
    00033 #define ISEQ_TYPE_DEFINED_GUARD INT2FIX(9)
    00034
    00035 #define CATCH_TYPE_RESCUE ((int)INT2FIX(1))
    00036 #define CATCH_TYPE_ENSURE ((int)INT2FIX(2))
    00037 #define CATCH_TYPE_RETRY  ((int)INT2FIX(3))
    00038 #define CATCH_TYPE_BREAK  ((int)INT2FIX(4))
    00039 #define CATCH_TYPE_REDO   ((int)INT2FIX(5))
    00040 #define CATCH_TYPE_NEXT   ((int)INT2FIX(6))
    00041
    00042 struct iseq_insn_info_entry {
    00043     unsigned short position;
    00044     unsigned short line_no;
    00045     unsigned short sp;
    00046 };
    00047
    00048 struct iseq_catch_table_entry {
    00049     VALUE type;
    00050     VALUE iseq;
    00051     unsigned long start;
    00052     unsigned long end;
    00053     unsigned long cont;
    00054     unsigned long sp;
    00055 };
    00056
    00057 #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
    00058
    00059 struct iseq_compile_data_storage {
    00060     struct iseq_compile_data_storage *next;
    00061     unsigned long pos;
    00062     unsigned long size;
    00063     char *buff;
    00064 };
    00065
    00066 struct iseq_compile_data {
    00067     /* GC is needed */
    00068     VALUE err_info;
    00069     VALUE mark_ary;
    00070     VALUE catch_table_ary;      /* Array */
    00071
    00072     /* GC is not needed */
    00073     struct iseq_label_data *start_label;
    00074     struct iseq_label_data *end_label;
    00075     struct iseq_label_data *redo_label;
    00076     VALUE current_block;
    00077     VALUE ensure_node;
    00078     VALUE for_iseq;
    00079     struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
    00080     int loopval_popped; /* used by NODE_BREAK */
    00081     int cached_const;
    00082     struct iseq_compile_data_storage *storage_head;
    00083     struct iseq_compile_data_storage *storage_current;
    00084     int last_line;
    00085     int last_coverable_line;
    00086     int flip_cnt;
    00087     int label_no;
    00088     int node_level;
    00089     const rb_compile_option_t *option;
    00090 };
    00091
    00092 /* defined? */
    00093 #define DEFINED_IVAR   INT2FIX(1)
    00094 #define DEFINED_IVAR2  INT2FIX(2)
    00095 #define DEFINED_GVAR   INT2FIX(3)
    00096 #define DEFINED_CVAR   INT2FIX(4)
    00097 #define DEFINED_CONST  INT2FIX(5)
    00098 #define DEFINED_METHOD INT2FIX(6)
    00099 #define DEFINED_YIELD  INT2FIX(7)
    00100 #define DEFINED_REF    INT2FIX(8)
    00101 #define DEFINED_ZSUPER INT2FIX(9)
    00102 #define DEFINED_FUNC   INT2FIX(10)
    00103
    00104 #endif /* RUBY_COMPILE_H */
    00105