Ruby 1.9.3p327(2012-11-10revision37606)
|
00001 /********************************************************************** 00002 00003 iseq.h - 00004 00005 $Author: akr $ 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 #if defined __GNUC__ && __GNUC__ >= 4 00016 #pragma GCC visibility push(default) 00017 #endif 00018 00019 /* compile.c */ 00020 VALUE rb_iseq_compile_node(VALUE self, NODE *node); 00021 int rb_iseq_translate_threaded_code(rb_iseq_t *iseq); 00022 VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, 00023 VALUE exception, VALUE body); 00024 00025 /* iseq.c */ 00026 VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); 00027 VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); 00028 struct st_table *ruby_insn_make_insn_table(void); 00029 00030 /* proc.c */ 00031 rb_iseq_t *rb_method_get_iseq(VALUE body); 00032 rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc); 00033 00034 struct rb_compile_option_struct { 00035 int inline_const_cache; 00036 int peephole_optimization; 00037 int tailcall_optimization; 00038 int specialized_instruction; 00039 int operands_unification; 00040 int instructions_unification; 00041 int stack_caching; 00042 int trace_instruction; 00043 int debug_level; 00044 }; 00045 00046 struct iseq_insn_info_entry { 00047 unsigned short position; 00048 unsigned short line_no; 00049 unsigned short sp; 00050 }; 00051 00052 struct iseq_catch_table_entry { 00053 enum catch_type { 00054 CATCH_TYPE_RESCUE, 00055 CATCH_TYPE_ENSURE, 00056 CATCH_TYPE_RETRY, 00057 CATCH_TYPE_BREAK, 00058 CATCH_TYPE_REDO, 00059 CATCH_TYPE_NEXT 00060 } type; 00061 VALUE iseq; 00062 unsigned long start; 00063 unsigned long end; 00064 unsigned long cont; 00065 unsigned long sp; 00066 }; 00067 00068 #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512) 00069 00070 struct iseq_compile_data_storage { 00071 struct iseq_compile_data_storage *next; 00072 unsigned long pos; 00073 unsigned long size; 00074 char *buff; 00075 }; 00076 00077 struct iseq_compile_data { 00078 /* GC is needed */ 00079 VALUE err_info; 00080 VALUE mark_ary; 00081 VALUE catch_table_ary; /* Array */ 00082 00083 /* GC is not needed */ 00084 struct iseq_label_data *start_label; 00085 struct iseq_label_data *end_label; 00086 struct iseq_label_data *redo_label; 00087 VALUE current_block; 00088 VALUE ensure_node; 00089 VALUE for_iseq; 00090 struct iseq_compile_data_ensure_node_stack *ensure_node_stack; 00091 int loopval_popped; /* used by NODE_BREAK */ 00092 int cached_const; 00093 struct iseq_compile_data_storage *storage_head; 00094 struct iseq_compile_data_storage *storage_current; 00095 int last_line; 00096 int last_coverable_line; 00097 int flip_cnt; 00098 int label_no; 00099 int node_level; 00100 const rb_compile_option_t *option; 00101 #if SUPPORT_JOKE 00102 st_table *labels_table; 00103 #endif 00104 }; 00105 00106 /* defined? */ 00107 00108 enum defined_type { 00109 DEFINED_IVAR = 1, 00110 DEFINED_IVAR2, 00111 DEFINED_GVAR, 00112 DEFINED_CVAR, 00113 DEFINED_CONST, 00114 DEFINED_METHOD, 00115 DEFINED_YIELD, 00116 DEFINED_REF, 00117 DEFINED_ZSUPER, 00118 DEFINED_FUNC 00119 }; 00120 00121 #if defined __GNUC__ && __GNUC__ >= 4 00122 #pragma GCC visibility pop 00123 #endif 00124 00125 #endif /* RUBY_COMPILE_H */ 00126