summaryrefslogtreecommitdiffstats
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 07:49:45 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 07:49:45 +0000
commit619d86d0be63a32379200b64a56809745fb7e236 (patch)
tree1e92b71304d4cb6f6a37bee6b74d659ea43a5aad /vm_core.h
parentb1a4c1ea5d9b71e9748dc8d920184aae004dcf26 (diff)
downloadruby-619d86d0be63a32379200b64a56809745fb7e236.tar.gz
ruby-619d86d0be63a32379200b64a56809745fb7e236.tar.xz
ruby-619d86d0be63a32379200b64a56809745fb7e236.zip
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h. * class.c, common.mk: remove useless inclusion. * compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h. move some definitions from vm_core.h to iseq.h. * compile.c, iseq.c, vm.c: ditto. * eval.c, compile.c: move some functions for parser from eval.c to compile.c. * eval_intern.h, vm_core.h: move va_init_list() macro to vm_core.h. * iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added. * load.c, ruby.c: use rb_iseq_new_top() instead of rb_iseq_new() with ISEQ_TYPE_TOP constant directly. * proc.c: use rb_iseq_first_lineno() instead of accessing iseq structure. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h89
1 files changed, 10 insertions, 79 deletions
diff --git a/vm_core.h b/vm_core.h
index 947628408..87d1e4014 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -47,6 +47,14 @@
#define RUBY_NSIG NSIG
+#ifdef HAVE_STDARG_PROTOTYPES
+#include <stdarg.h>
+#define va_init_list(a,b) va_start(a,b)
+#else
+#include <varargs.h>
+#define va_init_list(a,b) va_start(a)
+#endif
+
/*****************/
/* configuration */
/*****************/
@@ -92,46 +100,6 @@
typedef unsigned long rb_num_t;
-#define ISEQ_TYPE_TOP INT2FIX(1)
-#define ISEQ_TYPE_METHOD INT2FIX(2)
-#define ISEQ_TYPE_BLOCK INT2FIX(3)
-#define ISEQ_TYPE_CLASS INT2FIX(4)
-#define ISEQ_TYPE_RESCUE INT2FIX(5)
-#define ISEQ_TYPE_ENSURE INT2FIX(6)
-#define ISEQ_TYPE_EVAL INT2FIX(7)
-#define ISEQ_TYPE_DEFINED_GUARD INT2FIX(8)
-
-#define CATCH_TYPE_RESCUE INT2FIX(1)
-#define CATCH_TYPE_ENSURE INT2FIX(2)
-#define CATCH_TYPE_RETRY INT2FIX(3)
-#define CATCH_TYPE_BREAK INT2FIX(4)
-#define CATCH_TYPE_REDO INT2FIX(5)
-#define CATCH_TYPE_NEXT INT2FIX(6)
-
-struct iseq_insn_info_entry {
- unsigned short position;
- unsigned short line_no;
- unsigned short sp;
-};
-
-struct iseq_catch_table_entry {
- VALUE type;
- VALUE iseq;
- unsigned long start;
- unsigned long end;
- unsigned long cont;
- unsigned long sp;
-};
-
-#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
-
-struct iseq_compile_data_storage {
- struct iseq_compile_data_storage *next;
- unsigned long pos;
- unsigned long size;
- char *buff;
-};
-
struct iseq_compile_data_ensure_node_stack;
typedef struct rb_compile_option_struct {
@@ -146,31 +114,6 @@ typedef struct rb_compile_option_struct {
int debug_level;
} rb_compile_option_t;
-struct iseq_compile_data {
- /* GC is needed */
- VALUE err_info;
- VALUE mark_ary;
- VALUE catch_table_ary; /* Array */
-
- /* GC is not needed */
- struct iseq_label_data *start_label;
- struct iseq_label_data *end_label;
- struct iseq_label_data *redo_label;
- VALUE current_block;
- VALUE loopval_popped; /* used by NODE_BREAK */
- VALUE ensure_node;
- VALUE for_iseq;
- struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
- int cached_const;
- struct iseq_compile_data_storage *storage_head;
- struct iseq_compile_data_storage *storage_current;
- int last_line;
- int flip_cnt;
- int label_no;
- int node_level;
- const rb_compile_option_t *option;
-};
-
#if 1
#define GetCoreDataFromValue(obj, type, ptr) do { \
ptr = (type*)DATA_PTR(obj); \
@@ -505,6 +448,7 @@ typedef struct rb_thread_struct
/* iseq.c */
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
+VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent);
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
@@ -512,6 +456,7 @@ VALUE ruby_iseq_disasm(VALUE self);
VALUE ruby_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
const char *ruby_node_name(int node);
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
+int rb_iseq_first_lineno(rb_iseq_t *iseq);
RUBY_EXTERN VALUE rb_cISeq;
RUBY_EXTERN VALUE rb_cRubyVM;
@@ -617,8 +562,6 @@ typedef rb_control_frame_t *
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)p) & ~0x03))
#define GC_GUARDED_PTR_P(p) (((VALUE)p) & 0x01)
-#define RUBY_VM_METHOD_NODE NODE_METHOD
-
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) (cfp+1)
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) (cfp-1)
#define RUBY_VM_END_CONTROL_FRAME(th) \
@@ -638,18 +581,6 @@ typedef rb_control_frame_t *
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
((rb_control_frame_t *)((VALUE *)(b) - 5))
-/* defined? */
-#define DEFINED_IVAR INT2FIX(1)
-#define DEFINED_IVAR2 INT2FIX(2)
-#define DEFINED_GVAR INT2FIX(3)
-#define DEFINED_CVAR INT2FIX(4)
-#define DEFINED_CONST INT2FIX(5)
-#define DEFINED_METHOD INT2FIX(6)
-#define DEFINED_YIELD INT2FIX(7)
-#define DEFINED_REF INT2FIX(8)
-#define DEFINED_ZSUPER INT2FIX(9)
-#define DEFINED_FUNC INT2FIX(10)
-
/* VM related object allocate functions */
/* TODO: should be static functions */
VALUE rb_thread_alloc(VALUE klass);