summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-15 14:59:41 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-15 14:59:41 +0000
commitc330876d7c5065f89234becc5125426d0d136bdc (patch)
treed7a65121d7250d0137a2c75d7b7d454737815e7d /vm_core.h
parentd3cbda6e8dc5732f64b06cacb4c137f01ebe0461 (diff)
* method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
method management. This change affect some VM control stack structure. * vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto. and make some refactoring. * insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto. * vm_core.h, compile.c (iseq_specialized_instruction): remove VM_CALL_SEND_BIT. use another optimization tech for Kernel#send. * node.h: remove unused node types. * ext/objspace/objspace.c (count_nodes): ditto. * gc.c: add mark/free functions for method entry. * include/ruby/intern.h: remove decl of rb_define_notimplement_method_id(). nobody can use it because noex is not opend. * iseq.c (iseq_mark): fix to check ic_method is available. * iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h39
1 files changed, 17 insertions, 22 deletions
diff --git a/vm_core.h b/vm_core.h
index 799ac52b89..9ff652e57a 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -21,6 +21,7 @@
#include "debug.h"
#include "vm_opts.h"
#include "id.h"
+#include "method.h"
#if defined(_WIN32)
#include "thread_win32.h"
@@ -92,6 +93,8 @@
typedef unsigned long rb_num_t;
+/* iseq data type */
+
struct iseq_compile_data_ensure_node_stack;
typedef struct rb_compile_option_struct {
@@ -109,12 +112,8 @@ typedef struct rb_compile_option_struct {
struct iseq_inline_cache_entry {
long ic_vmstat;
VALUE ic_class;
- union {
- NODE *method;
- VALUE value;
- } value;
-#define ic_value value.value
-#define ic_method value.method
+ VALUE ic_value;
+ rb_method_entry_t *ic_method;
#define ic_index ic_vmstat
};
@@ -234,8 +233,6 @@ enum ruby_special_exceptions {
ruby_special_error_count
};
-typedef struct rb_iseq_struct rb_iseq_t;
-
#define GetVMPtr(obj, ptr) \
GetCoreDataFromValue(obj, rb_vm_t, ptr)
@@ -296,8 +293,7 @@ typedef struct {
VALUE *dfp; /* cfp[7] / block[2] */
rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
VALUE proc; /* cfp[9] / block[4] */
- ID method_id; /* cfp[10] saved in special case */
- VALUE method_class; /* cfp[11] saved in special case */
+ const rb_method_entry_t *me;/* cfp[10] */
} rb_control_frame_t;
typedef struct rb_block_struct {
@@ -359,7 +355,7 @@ typedef struct rb_thread_struct
int state;
/* for rb_iterate */
- rb_block_t *passed_block;
+ const rb_block_t *passed_block;
/* for load(true) */
VALUE top_self;
@@ -464,11 +460,6 @@ RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
/* each thread has this size stack : 128KB */
#define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
-struct global_entry {
- struct global_variable *var;
- ID id;
-};
-
#define GetProcPtr(obj, ptr) \
GetCoreDataFromValue(obj, rb_proc_t, ptr)
@@ -500,6 +491,15 @@ typedef struct {
VALUE env;
} rb_binding_t;
+struct global_entry {
+ struct global_variable *var;
+ ID id;
+};
+
+struct global_entry *rb_global_entry(ID);
+VALUE rb_gvar_get(struct global_entry *);
+VALUE rb_gvar_set(struct global_entry *, VALUE);
+VALUE rb_gvar_defined(struct global_entry *);
/* used by compile time and send insn */
#define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
@@ -509,7 +509,6 @@ typedef struct {
#define VM_CALL_TAILCALL_BIT (0x01 << 5)
#define VM_CALL_TAILRECURSION_BIT (0x01 << 6)
#define VM_CALL_SUPER_BIT (0x01 << 7)
-#define VM_CALL_SEND_BIT (0x01 << 8)
#define VM_SPECIAL_OBJECT_VMCORE 0x01
#define VM_SPECIAL_OBJECT_CBASE 0x02
@@ -532,11 +531,9 @@ typedef struct {
/* other frame flag */
#define VM_FRAME_FLAG_PASSED 0x0100
-
#define RUBYVM_CFUNC_FRAME_P(cfp) \
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
-
/* inline cache */
typedef struct iseq_inline_cache_entry *IC;
@@ -584,9 +581,7 @@ extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
void rb_vm_bugreport(void);
-
/* functions about thread/vm execution */
-
VALUE rb_iseq_eval(VALUE iseqval);
VALUE rb_iseq_eval_main(VALUE iseqval);
void rb_enable_interrupt(void);
@@ -594,7 +589,7 @@ void rb_disable_interrupt(void);
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
- int argc, const VALUE *argv, rb_block_t *blockptr);
+ int argc, const VALUE *argv, const rb_block_t *blockptr);
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);