aboutsummaryrefslogtreecommitdiffstats
path: root/yarvcore.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-07 01:25:05 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-07 01:25:05 +0000
commit44aef0b53f3e73ec987a668a3284d5e28bdb8121 (patch)
tree4cbe7f49ca7c1b4be5f345870ef3d99126803a31 /yarvcore.h
parent8ee7d0767f7940baeae60ffa95afde93f3378c93 (diff)
downloadruby-44aef0b53f3e73ec987a668a3284d5e28bdb8121.tar.gz
* this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting unused variables and removing yarv.h. This commit doesn't change any behavior of ruby/vm. * yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h). * error.c, eval_intern.h: include yarvcore.h instead yarv.h * rename some functions: * debug.[ch]: debug_*() -> ruby_debug_*() * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm() * iseq.c: node_name() -> ruby_node_name() * vm.c: yarv_check_redefinition_opt_method() -> rb_vm_check_redefinition_opt_method() * some refactoring with checking -Wall. * array.c: remove rb_ary_ptr() (unused) and remove unused local variables. * object.c: add a prototype of rb_mod_module_exec(). * eval_intern.h (ruby_cref): set it inline. * eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal(). * parse.y: add a prototype of rb_parse_in_eval() (in eval.c). * process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c). * thread.c: remove raw_gets() function (unused) and fix some format mismatch (format mismatchs have remained yet. this is todo). * thread.c (rb_thread_wait_fd_rw): fix typo on label name. * thread_pthread.ci: comment out codes with USE_THREAD_CACHE. * vm.c (rb_svar, rb_backref_get, rb_backref_get, rb_lastline_get, rb_lastline_set) : moved from yarvcore.c. * vm.c (yarv_init_redefined_flag): add a prototype and rename yarv_opt_method_table to vm_opt_method_table. * vm.c (rb_thread_eval): moved from yarvcore.c. * yarvcore.c: remove unused global variables and fix to use nsdr(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvcore.h')
-rw-r--r--yarvcore.h65
1 files changed, 51 insertions, 14 deletions
diff --git a/yarvcore.h b/yarvcore.h
index 25ea517a83..d47e6f03bb 100644
--- a/yarvcore.h
+++ b/yarvcore.h
@@ -470,17 +470,10 @@ typedef struct rb_thread_struct
} rb_thead_t;
/** node -> yarv instruction sequence object */
-VALUE iseq_compile(VALUE self, NODE *node);
-
-VALUE rb_iseq_new(NODE *node, VALUE name, VALUE file,
- VALUE parent, VALUE type);
-
-VALUE rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE file_name,
- VALUE parent, VALUE type, VALUE bopt);
-
-VALUE rb_iseq_new_with_opt(NODE *node, VALUE name, VALUE file,
- VALUE parent, VALUE type,
- const rb_compile_option_t *opt);
+VALUE rb_iseq_compile(VALUE self, NODE *node);
+VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
+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*);
/** disassemble instruction sequence */
VALUE ruby_iseq_disasm(VALUE self);
@@ -543,7 +536,7 @@ typedef struct {
#define VM_CALL_SUPER_BIT (0x01 << 7)
#define VM_CALL_SEND_BIT (0x01 << 8)
-/* inline method cache */
+/* inline (method|const) cache */
#define NEW_INLINE_CACHE_ENTRY() NEW_WHILE(Qundef, 0, 0)
#define ic_klass u1.value
#define ic_method u2.node
@@ -551,9 +544,12 @@ typedef struct {
#define ic_vmstat u3.cnt
typedef NODE *IC;
+void rb_vm_change_state();
+
typedef VALUE CDHASH;
+
#define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)p) & ~0x03))
#define GC_GUARDED_PTR_P(p) (((VALUE)p) & 0x01)
@@ -592,6 +588,7 @@ typedef VALUE CDHASH;
#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);
@@ -599,12 +596,52 @@ VALUE rb_proc_alloc(void);
/* for debug */
extern void vm_stack_dump_raw(rb_thead_t *, rb_control_frame_t *);
-#define SDR() vm_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
+#define SDR() vm_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
+void yarv_bug(void);
+
+
+/* functions about thread/vm execution */
+
+VALUE rb_thread_eval(rb_thead_t *th, VALUE iseqval);
+void rb_enable_interrupt(void);
+void rb_disable_interrupt(void);
+
+VALUE th_eval_body(rb_thead_t *th);
+VALUE th_set_eval_stack(rb_thead_t *, VALUE iseq);
+VALUE th_call_super(rb_thead_t *th, int argc, const VALUE *argv);
+VALUE th_invoke_proc(rb_thead_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv);
+VALUE th_make_proc(rb_thead_t *th, rb_control_frame_t *cfp, rb_block_t *block);
+VALUE th_make_env_object(rb_thead_t *th, rb_control_frame_t *cfp);
+VALUE th_backtrace(rb_thead_t *, int);
+
+VALUE th_invoke_yield(rb_thead_t *th, int argc, VALUE *argv);
+VALUE th_call0(rb_thead_t *th, VALUE klass, VALUE recv,
+ VALUE id, ID oid, int argc, const VALUE *argv,
+ NODE * body, int nosuper);
+
+int th_get_sourceline(rb_control_frame_t *);
+
+VALUE yarvcore_eval_parsed(NODE *node, VALUE file);
+VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line);
/* for thread */
-#include "yarv.h"
+#if RUBY_VM_THREAD_MODEL == 2
+extern rb_thead_t *yarvCurrentThread;
+extern rb_vm_t *theYarvVM;
+
+#define GET_VM() theYarvVM
+#define GET_THREAD() yarvCurrentThread
+#define rb_thread_set_current_raw(th) (yarvCurrentThread = th)
+#define rb_thread_set_current(th) do { \
+ rb_thread_set_current_raw(th); \
+ th->vm->running_thread = th; \
+} while (0)
+
+#else
+#error "unsupported thread model"
+#endif
#define GVL_UNLOCK_BEGIN() do { \
rb_thead_t *_th_stored = GET_THREAD(); \