00001
00002
00003
00004
00005
00006
00007
00008
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
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
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
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
00079 VALUE err_info;
00080 VALUE mark_ary;
00081 VALUE catch_table_ary;
00082
00083
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;
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 label_no;
00098 int node_level;
00099 const rb_compile_option_t *option;
00100 #if SUPPORT_JOKE
00101 st_table *labels_table;
00102 #endif
00103 };
00104
00105
00106
00107 enum defined_type {
00108 DEFINED_IVAR = 1,
00109 DEFINED_IVAR2,
00110 DEFINED_GVAR,
00111 DEFINED_CVAR,
00112 DEFINED_CONST,
00113 DEFINED_METHOD,
00114 DEFINED_YIELD,
00115 DEFINED_REF,
00116 DEFINED_ZSUPER,
00117 DEFINED_FUNC
00118 };
00119
00120 #define DEFAULT_SPECIAL_VAR_COUNT 2
00121
00122 #if defined __GNUC__ && __GNUC__ >= 4
00123 #pragma GCC visibility pop
00124 #endif
00125
00126 #endif
00127