2006-12-31 10:02:22 -05:00
|
|
|
/**********************************************************************
|
|
|
|
|
2008-12-09 02:17:10 -05:00
|
|
|
vm_core.h -
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: 04/01/01 19:41:38 JST
|
|
|
|
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
Copyright (C) 2004-2007 Koichi Sasada
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
2008-01-18 03:56:11 -05:00
|
|
|
#ifndef RUBY_VM_CORE_H
|
|
|
|
#define RUBY_VM_CORE_H
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_THREAD_MODEL 2
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#include "ruby/ruby.h"
|
|
|
|
#include "ruby/st.h"
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
(node.h will be changed. Extensions should not depends on
this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 15:52:31 -04:00
|
|
|
#include "node.h"
|
2006-12-31 10:02:22 -05:00
|
|
|
#include "debug.h"
|
|
|
|
#include "vm_opts.h"
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
#include "id.h"
|
2009-07-15 10:59:41 -04:00
|
|
|
#include "method.h"
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-02-08 06:51:40 -05:00
|
|
|
#if defined(_WIN32)
|
2006-12-31 10:02:22 -05:00
|
|
|
#include "thread_win32.h"
|
|
|
|
#elif defined(HAVE_PTHREAD_H)
|
|
|
|
#include "thread_pthread.h"
|
|
|
|
#else
|
|
|
|
#error "unsupported thread type"
|
|
|
|
#endif
|
|
|
|
|
2009-09-18 03:29:17 -04:00
|
|
|
#ifndef ENABLE_VM_OBJSPACE
|
2009-09-19 04:46:48 -04:00
|
|
|
#ifdef _WIN32
|
|
|
|
/*
|
|
|
|
* TODO: object space indenpendent st_table.
|
|
|
|
* socklist needs st_table in rb_w32_sysinit(), before object space
|
|
|
|
* initialization.
|
|
|
|
* It is too early now to change st_hash_type, since it breaks binary
|
|
|
|
* compatibility.
|
|
|
|
*/
|
|
|
|
#define ENABLE_VM_OBJSPACE 0
|
|
|
|
#else
|
2009-09-18 03:29:17 -04:00
|
|
|
#define ENABLE_VM_OBJSPACE 1
|
|
|
|
#endif
|
2009-09-19 04:46:48 -04:00
|
|
|
#endif
|
2009-09-18 03:29:17 -04:00
|
|
|
|
2008-09-23 18:43:53 -04:00
|
|
|
#include <setjmp.h>
|
2006-12-31 10:02:22 -05:00
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#ifndef NSIG
|
2008-10-04 09:42:00 -04:00
|
|
|
# define NSIG (_SIGMAX + 1) /* For QNX */
|
2006-12-31 10:02:22 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define RUBY_NSIG NSIG
|
|
|
|
|
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
#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
|
|
|
|
|
2010-05-13 12:20:26 -04:00
|
|
|
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
|
|
|
|
#define USE_SIGALTSTACK
|
|
|
|
#endif
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/*****************/
|
|
|
|
/* configuration */
|
|
|
|
/*****************/
|
|
|
|
|
|
|
|
/* gcc ver. check */
|
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 2
|
|
|
|
|
|
|
|
#if OPT_TOKEN_THREADED_CODE
|
|
|
|
#if OPT_DIRECT_THREADED_CODE
|
|
|
|
#undef OPT_DIRECT_THREADED_CODE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else /* defined(__GNUC__) && __GNUC__ >= 2 */
|
|
|
|
|
|
|
|
/* disable threaded code options */
|
|
|
|
#if OPT_DIRECT_THREADED_CODE
|
|
|
|
#undef OPT_DIRECT_THREADED_CODE
|
|
|
|
#endif
|
|
|
|
#if OPT_TOKEN_THREADED_CODE
|
|
|
|
#undef OPT_TOKEN_THREADED_CODE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* call threaded code */
|
|
|
|
#if OPT_CALL_THREADED_CODE
|
|
|
|
#if OPT_DIRECT_THREADED_CODE
|
|
|
|
#undef OPT_DIRECT_THREADED_CODE
|
|
|
|
#endif /* OPT_DIRECT_THREADED_CODE */
|
|
|
|
#if OPT_STACK_CACHING
|
|
|
|
#undef OPT_STACK_CACHING
|
|
|
|
#endif /* OPT_STACK_CACHING */
|
|
|
|
#endif /* OPT_CALL_THREADED_CODE */
|
|
|
|
|
2010-01-05 00:59:23 -05:00
|
|
|
/* likely */
|
|
|
|
#if __GNUC__ >= 3
|
|
|
|
#define LIKELY(x) (__builtin_expect((x), 1))
|
|
|
|
#define UNLIKELY(x) (__builtin_expect((x), 0))
|
|
|
|
#else /* __GNUC__ >= 3 */
|
|
|
|
#define LIKELY(x) (x)
|
|
|
|
#define UNLIKELY(x) (x)
|
|
|
|
#endif /* __GNUC__ >= 3 */
|
|
|
|
|
2010-04-06 10:07:06 -04:00
|
|
|
#if __GNUC__ >= 3
|
|
|
|
#define UNINITIALIZED_VAR(x) x = x
|
|
|
|
#else
|
|
|
|
#define UNINITIALIZED_VAR(x) x
|
|
|
|
#endif
|
|
|
|
|
2008-05-22 23:23:08 -04:00
|
|
|
typedef unsigned long rb_num_t;
|
|
|
|
|
2009-07-15 10:59:41 -04:00
|
|
|
/* iseq data type */
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
struct iseq_compile_data_ensure_node_stack;
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
typedef struct rb_compile_option_struct {
|
2006-12-31 10:02:22 -05:00
|
|
|
int inline_const_cache;
|
|
|
|
int peephole_optimization;
|
2007-05-21 00:46:51 -04:00
|
|
|
int tailcall_optimization;
|
2006-12-31 10:02:22 -05:00
|
|
|
int specialized_instruction;
|
|
|
|
int operands_unification;
|
|
|
|
int instructions_unification;
|
|
|
|
int stack_caching;
|
2007-04-19 06:37:08 -04:00
|
|
|
int trace_instruction;
|
2008-04-14 01:34:04 -04:00
|
|
|
int debug_level;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
} rb_compile_option_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-07-13 05:30:23 -04:00
|
|
|
struct iseq_inline_cache_entry {
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
VALUE ic_vmstat;
|
2009-07-13 05:30:23 -04:00
|
|
|
VALUE ic_class;
|
2009-09-12 13:16:27 -04:00
|
|
|
union {
|
|
|
|
VALUE value;
|
|
|
|
rb_method_entry_t *method;
|
|
|
|
long index;
|
|
|
|
} ic_value;
|
2009-07-13 05:30:23 -04:00
|
|
|
};
|
|
|
|
|
2007-06-24 14:40:13 -04:00
|
|
|
#if 1
|
|
|
|
#define GetCoreDataFromValue(obj, type, ptr) do { \
|
|
|
|
ptr = (type*)DATA_PTR(obj); \
|
|
|
|
} while (0)
|
|
|
|
#else
|
|
|
|
#define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct(obj, type, ptr)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GetISeqPtr(obj, ptr) \
|
|
|
|
GetCoreDataFromValue(obj, rb_iseq_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_iseq_struct;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_iseq_struct {
|
2007-06-30 14:04:35 -04:00
|
|
|
/***************/
|
|
|
|
/* static data */
|
|
|
|
/***************/
|
|
|
|
|
|
|
|
VALUE type; /* instruction sequence type */
|
|
|
|
VALUE name; /* String: iseq name */
|
|
|
|
VALUE filename; /* file information where this sequence from */
|
2010-03-16 13:40:00 -04:00
|
|
|
VALUE filepath; /* real file path or nil */
|
2007-06-30 14:04:35 -04:00
|
|
|
VALUE *iseq; /* iseq (insn number and openrads) */
|
|
|
|
VALUE *iseq_encoded; /* encoded iseq */
|
|
|
|
unsigned long iseq_size;
|
2007-07-01 14:16:02 -04:00
|
|
|
VALUE mark_ary; /* Array: includes operands which should be GC marked */
|
2008-07-01 12:55:30 -04:00
|
|
|
VALUE coverage; /* coverage array */
|
2009-07-22 09:37:26 -04:00
|
|
|
unsigned short line_no;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* insn info, must be freed */
|
2007-07-01 14:16:02 -04:00
|
|
|
struct iseq_insn_info_entry *insn_info_table;
|
2009-07-03 05:35:08 -04:00
|
|
|
size_t insn_info_size;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-02-24 20:34:33 -05:00
|
|
|
ID *local_table; /* must free */
|
|
|
|
int local_table_size;
|
|
|
|
|
|
|
|
/* method, class frame: sizeof(vars) + 1, block frame: sizeof(vars) */
|
2008-12-09 02:17:10 -05:00
|
|
|
int local_size;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-07-13 05:30:23 -04:00
|
|
|
struct iseq_inline_cache_entry *ic_entries;
|
|
|
|
int ic_size;
|
|
|
|
|
2007-04-24 23:50:00 -04:00
|
|
|
/**
|
|
|
|
* argument information
|
|
|
|
*
|
2007-06-30 14:04:35 -04:00
|
|
|
* def m(a1, a2, ..., aM, # mandatory
|
|
|
|
* b1=(...), b2=(...), ..., bN=(...), # optinal
|
|
|
|
* *c, # rest
|
|
|
|
* d1, d2, ..., dO, # post
|
|
|
|
* &e) # block
|
2007-04-24 23:50:00 -04:00
|
|
|
* =>
|
|
|
|
*
|
2007-06-30 14:04:35 -04:00
|
|
|
* argc = M
|
|
|
|
* arg_rest = M+N+1 // or -1 if no rest arg
|
|
|
|
* arg_opts = N
|
|
|
|
* arg_opts_tbl = [ (N entries) ]
|
|
|
|
* arg_post_len = O // 0 if no post arguments
|
|
|
|
* arg_post_start = M+N+2
|
|
|
|
* arg_block = M+N + 1 + O + 1 // -1 if no block arg
|
|
|
|
* arg_simple = 0 if not simple arguments.
|
|
|
|
* = 1 if no opt, rest, post, block.
|
|
|
|
* = 2 if ambiguos block parameter ({|a|}).
|
|
|
|
* arg_size = argument size.
|
2007-04-24 23:50:00 -04:00
|
|
|
*/
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
int argc;
|
|
|
|
int arg_simple;
|
|
|
|
int arg_rest;
|
|
|
|
int arg_block;
|
|
|
|
int arg_opts;
|
2007-05-01 00:35:58 -04:00
|
|
|
int arg_post_len;
|
2007-06-24 03:29:21 -04:00
|
|
|
int arg_post_start;
|
|
|
|
int arg_size;
|
2007-07-01 14:16:02 -04:00
|
|
|
VALUE *arg_opt_table;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-07-03 05:35:08 -04:00
|
|
|
size_t stack_max; /* for stack overflow check */
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* catch table */
|
2007-07-01 14:16:02 -04:00
|
|
|
struct iseq_catch_table_entry *catch_table;
|
2006-12-31 10:02:22 -05:00
|
|
|
int catch_table_size;
|
|
|
|
|
|
|
|
/* for child iseq */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_iseq_struct *parent_iseq;
|
|
|
|
struct rb_iseq_struct *local_iseq;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-06-30 14:04:35 -04:00
|
|
|
/****************/
|
|
|
|
/* dynamic data */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
VALUE self;
|
2008-08-11 04:13:42 -04:00
|
|
|
VALUE orig; /* non-NULL if its data have origin */
|
2007-06-30 14:04:35 -04:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* block inlining */
|
2008-12-09 02:17:10 -05:00
|
|
|
/*
|
2007-12-24 21:17:16 -05:00
|
|
|
* NODE *node;
|
|
|
|
* void *special_block_builder;
|
|
|
|
* void *cached_special_block_builder;
|
|
|
|
* VALUE cached_special_block;
|
|
|
|
*/
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-06-30 14:04:35 -04:00
|
|
|
/* klass/module nest information stack (cref) */
|
|
|
|
NODE *cref_stack;
|
|
|
|
VALUE klass;
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* misc */
|
|
|
|
ID defined_method_id; /* for define_method */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
|
2007-06-30 14:04:35 -04:00
|
|
|
/* used at compile time */
|
2006-12-31 10:02:22 -05:00
|
|
|
struct iseq_compile_data *compile_data;
|
|
|
|
};
|
|
|
|
|
2008-06-15 05:17:06 -04:00
|
|
|
enum ruby_special_exceptions {
|
|
|
|
ruby_error_reenter,
|
|
|
|
ruby_error_nomemory,
|
|
|
|
ruby_error_sysstack,
|
|
|
|
ruby_special_error_count
|
|
|
|
};
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
#define GetVMPtr(obj, ptr) \
|
2007-06-24 14:40:13 -04:00
|
|
|
GetCoreDataFromValue(obj, rb_vm_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-09-18 03:29:17 -04:00
|
|
|
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
|
|
struct rb_objspace;
|
|
|
|
void rb_objspace_free(struct rb_objspace *);
|
|
|
|
#endif
|
|
|
|
|
2008-10-21 16:59:23 -04:00
|
|
|
typedef struct rb_vm_struct {
|
2006-12-31 10:02:22 -05:00
|
|
|
VALUE self;
|
|
|
|
|
2008-06-15 12:48:02 -04:00
|
|
|
rb_thread_lock_t global_vm_lock;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_thread_struct *main_thread;
|
|
|
|
struct rb_thread_struct *running_thread;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
st_table *living_threads;
|
|
|
|
VALUE thgroup_default;
|
|
|
|
|
* eval_method.c: renamed from vm_method.c. "vm_method.c" is included
by "vm.c".
* vm_eval.c: added. Some codes are moved from "eval.c"
* common.mk: fix for above changes.
* compile.c: make a vm_eval(0)
* eval.c, eval_error.c, eval_intern.h, eval_jump.c, proc.c, vm.c,
id.c, id.h, vm_core.h, vm_dump.c, vm_evalbody.c, vm_insnhelper.c,
blockinlining.c: fix for above changes. and do some refactoring.
this changes improve rb_yield() performance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 13:50:17 -04:00
|
|
|
int running;
|
2006-12-31 10:02:22 -05:00
|
|
|
int thread_abort_on_exception;
|
|
|
|
unsigned long trace_flag;
|
2008-06-12 09:01:38 -04:00
|
|
|
volatile int sleeper;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* object management */
|
|
|
|
VALUE mark_object_ary;
|
|
|
|
|
2008-06-15 05:17:06 -04:00
|
|
|
VALUE special_exceptions[ruby_special_error_count];
|
|
|
|
|
2007-02-13 21:19:02 -05:00
|
|
|
/* load */
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
VALUE top_self;
|
2008-04-30 05:03:03 -04:00
|
|
|
VALUE load_path;
|
2007-02-13 21:19:02 -05:00
|
|
|
VALUE loaded_features;
|
2007-05-03 09:19:11 -04:00
|
|
|
struct st_table *loading_table;
|
2008-12-09 02:17:10 -05:00
|
|
|
|
2007-02-13 21:19:02 -05:00
|
|
|
/* signal */
|
2008-09-04 00:22:04 -04:00
|
|
|
struct {
|
|
|
|
VALUE cmd;
|
|
|
|
int safe;
|
|
|
|
} trap_list[RUBY_NSIG];
|
2007-04-19 06:37:08 -04:00
|
|
|
|
|
|
|
/* hook */
|
|
|
|
rb_event_hook_t *event_hooks;
|
2008-04-26 23:20:35 -04:00
|
|
|
|
2008-06-09 00:20:07 -04:00
|
|
|
int src_encoding_index;
|
|
|
|
|
2008-06-09 01:18:03 -04:00
|
|
|
VALUE verbose, debug, progname;
|
2008-07-03 08:55:12 -04:00
|
|
|
VALUE coverages;
|
2008-06-09 01:18:03 -04:00
|
|
|
|
2010-05-05 13:51:21 -04:00
|
|
|
struct unlinked_method_entry_list_entry *unlinked_method_entry_list;
|
|
|
|
|
2008-04-26 23:20:35 -04:00
|
|
|
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
|
|
|
struct rb_objspace *objspace;
|
|
|
|
#endif
|
2008-10-21 16:59:23 -04:00
|
|
|
} rb_vm_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
typedef struct {
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
VALUE *pc; /* cfp[0] */
|
|
|
|
VALUE *sp; /* cfp[1] */
|
|
|
|
VALUE *bp; /* cfp[2] */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_iseq_t *iseq; /* cfp[3] */
|
2007-07-05 06:49:45 -04:00
|
|
|
VALUE flag; /* cfp[4] */
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
VALUE self; /* cfp[5] / block[0] */
|
|
|
|
VALUE *lfp; /* cfp[6] / block[1] */
|
|
|
|
VALUE *dfp; /* cfp[7] / block[2] */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
|
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 11:26:04 -05:00
|
|
|
VALUE proc; /* cfp[9] / block[4] */
|
2009-07-15 10:59:41 -04:00
|
|
|
const rb_method_entry_t *me;/* cfp[10] */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
} rb_control_frame_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2008-06-09 11:52:51 -04:00
|
|
|
typedef struct rb_block_struct {
|
2006-12-31 10:02:22 -05:00
|
|
|
VALUE self; /* share with method frame if it's only block */
|
|
|
|
VALUE *lfp; /* share with method frame if it's only block */
|
|
|
|
VALUE *dfp; /* share with method frame if it's only block */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_iseq_t *iseq;
|
2006-12-31 10:02:22 -05:00
|
|
|
VALUE proc;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
} rb_block_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
#define GetThreadPtr(obj, ptr) \
|
2007-06-24 14:40:13 -04:00
|
|
|
GetCoreDataFromValue(obj, rb_thread_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
enum rb_thread_status {
|
2006-12-31 10:02:22 -05:00
|
|
|
THREAD_TO_KILL,
|
|
|
|
THREAD_RUNNABLE,
|
|
|
|
THREAD_STOPPED,
|
2008-06-12 09:01:38 -04:00
|
|
|
THREAD_STOPPED_FOREVER,
|
2008-07-01 04:27:58 -04:00
|
|
|
THREAD_KILLED
|
2006-12-31 10:02:22 -05:00
|
|
|
};
|
|
|
|
|
2008-03-31 13:58:41 -04:00
|
|
|
typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_vm_tag {
|
2006-12-31 10:02:22 -05:00
|
|
|
rb_jmpbuf_t buf;
|
|
|
|
VALUE tag;
|
|
|
|
VALUE retval;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_vm_tag *prev;
|
2006-12-31 10:02:22 -05:00
|
|
|
};
|
|
|
|
|
2010-01-25 13:22:58 -05:00
|
|
|
struct rb_vm_protect_tag {
|
|
|
|
struct rb_vm_protect_tag *prev;
|
|
|
|
};
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_VALUE_CACHE_SIZE 0x1000
|
2007-05-23 22:47:22 -04:00
|
|
|
#define USE_VALUE_CACHE 0
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2008-05-29 21:52:38 -04:00
|
|
|
struct rb_unblock_callback {
|
|
|
|
rb_unblock_function_t *func;
|
|
|
|
void *arg;
|
|
|
|
};
|
|
|
|
|
2008-07-27 11:20:01 -04:00
|
|
|
struct rb_mutex_struct;
|
|
|
|
|
* common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
- make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
- make VM_CORE_H_INCLUDES variable (vm_core.h)
- simplify rules.
- make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
- rename vm_eval() to vm_exec_core().
- rename vm_eval_body() to vm_exec().
- cleanup include order.
* vm_method.c: fix comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-22 20:20:28 -04:00
|
|
|
typedef struct rb_thread_struct
|
2006-12-31 10:02:22 -05:00
|
|
|
{
|
|
|
|
VALUE self;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_vm_t *vm;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* execution information */
|
|
|
|
VALUE *stack; /* must free, must mark */
|
|
|
|
unsigned long stack_size;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_control_frame_t *cfp;
|
2006-12-31 10:02:22 -05:00
|
|
|
int safe_level;
|
|
|
|
int raised_flag;
|
2008-07-09 23:10:00 -04:00
|
|
|
VALUE last_status; /* $? */
|
2008-12-09 02:17:10 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* passing state */
|
|
|
|
int state;
|
|
|
|
|
|
|
|
/* for rb_iterate */
|
2009-07-15 10:59:41 -04:00
|
|
|
const rb_block_t *passed_block;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2010-05-05 13:51:21 -04:00
|
|
|
/* for bmethod */
|
|
|
|
const rb_method_entry_t *passed_me;
|
|
|
|
|
2007-02-25 11:29:26 -05:00
|
|
|
/* for load(true) */
|
|
|
|
VALUE top_self;
|
|
|
|
VALUE top_wrapper;
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* eval env */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_block_t *base_block;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
VALUE *local_lfp;
|
|
|
|
VALUE local_svar;
|
|
|
|
|
|
|
|
/* thread control */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_thread_id_t thread_id;
|
|
|
|
enum rb_thread_status status;
|
2006-12-31 10:02:22 -05:00
|
|
|
int priority;
|
2008-08-13 03:53:35 -04:00
|
|
|
int slice;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
native_thread_data_t native_thread_data;
|
2008-12-30 02:57:53 -05:00
|
|
|
void *blocking_region_buffer;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
VALUE thgroup;
|
|
|
|
VALUE value;
|
|
|
|
|
|
|
|
VALUE errinfo;
|
2007-04-02 08:54:42 -04:00
|
|
|
VALUE thrown_errinfo;
|
2006-12-31 10:02:22 -05:00
|
|
|
int exec_signal;
|
|
|
|
|
|
|
|
int interrupt_flag;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_thread_lock_t interrupt_lock;
|
2008-05-29 21:52:38 -04:00
|
|
|
struct rb_unblock_callback unblock;
|
2008-06-12 09:01:38 -04:00
|
|
|
VALUE locking_mutex;
|
2008-07-27 11:20:01 -04:00
|
|
|
struct rb_mutex_struct *keeping_mutexes;
|
2008-06-19 10:18:46 -04:00
|
|
|
int transition_for_lock;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_vm_tag *tag;
|
2010-01-25 13:22:58 -05:00
|
|
|
struct rb_vm_protect_tag *protect_tag;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
int parse_in_eval;
|
2008-07-01 12:55:30 -04:00
|
|
|
int mild_compile_error;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* storage */
|
|
|
|
st_table *local_storage;
|
|
|
|
#if USE_VALUE_CACHE
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
VALUE value_cache[RUBY_VM_VALUE_CACHE_SIZE + 1];
|
2006-12-31 10:02:22 -05:00
|
|
|
VALUE *value_cache_ptr;
|
|
|
|
#endif
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_thread_struct *join_list_next;
|
|
|
|
struct rb_thread_struct *join_list_head;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
VALUE first_proc;
|
|
|
|
VALUE first_args;
|
2007-02-05 07:21:01 -05:00
|
|
|
VALUE (*first_func)(ANYARGS);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* for GC */
|
|
|
|
VALUE *machine_stack_start;
|
|
|
|
VALUE *machine_stack_end;
|
2007-12-14 23:09:24 -05:00
|
|
|
size_t machine_stack_maxsize;
|
2007-06-14 04:35:20 -04:00
|
|
|
#ifdef __ia64
|
|
|
|
VALUE *machine_register_stack_start;
|
|
|
|
VALUE *machine_register_stack_end;
|
2007-12-14 23:09:24 -05:00
|
|
|
size_t machine_register_stack_maxsize;
|
2007-06-14 04:35:20 -04:00
|
|
|
#endif
|
2006-12-31 10:02:22 -05:00
|
|
|
jmp_buf machine_regs;
|
2007-05-02 05:59:38 -04:00
|
|
|
int mark_stack_len;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* statistics data for profiler */
|
|
|
|
VALUE stat_insn_usage;
|
|
|
|
|
2007-04-19 06:37:08 -04:00
|
|
|
/* tracer */
|
|
|
|
rb_event_hook_t *event_hooks;
|
|
|
|
rb_event_flag_t event_flags;
|
|
|
|
int tracing;
|
|
|
|
|
* cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 15:12:43 -04:00
|
|
|
/* fiber */
|
|
|
|
VALUE fiber;
|
|
|
|
VALUE root_fiber;
|
|
|
|
rb_jmpbuf_t root_jmpbuf;
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* misc */
|
|
|
|
int method_missing_reason;
|
|
|
|
int abort_on_exception;
|
2010-05-13 12:20:26 -04:00
|
|
|
#ifdef USE_SIGALTSTACK
|
|
|
|
void *altstack;
|
|
|
|
#endif
|
* common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
- make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
- make VM_CORE_H_INCLUDES variable (vm_core.h)
- simplify rules.
- make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
- rename vm_eval() to vm_exec_core().
- rename vm_eval_body() to vm_exec().
- cleanup include order.
* vm_method.c: fix comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-22 20:20:28 -04:00
|
|
|
} rb_thread_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
/* iseq.c */
|
2010-03-16 13:40:00 -04:00
|
|
|
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
|
|
|
|
VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE parent);
|
|
|
|
VALUE rb_iseq_new_main(NODE *node, VALUE filename, VALUE filepath);
|
|
|
|
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
|
|
|
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
|
2009-01-18 20:06:56 -05:00
|
|
|
VALUE rb_iseq_disasm(VALUE self);
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
int rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child);
|
* include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c,
yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline,
ruby_nerrs): purge global variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 04:12:18 -04:00
|
|
|
const char *ruby_node_name(int node);
|
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
int rb_iseq_first_lineno(rb_iseq_t *iseq);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2008-06-29 13:26:16 -04:00
|
|
|
RUBY_EXTERN VALUE rb_cISeq;
|
|
|
|
RUBY_EXTERN VALUE rb_cRubyVM;
|
|
|
|
RUBY_EXTERN VALUE rb_cEnv;
|
2008-06-30 23:05:58 -04:00
|
|
|
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
/* each thread has this size stack : 128KB */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
#define GetProcPtr(obj, ptr) \
|
2007-06-24 14:40:13 -04:00
|
|
|
GetCoreDataFromValue(obj, rb_proc_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
typedef struct {
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_block_t block;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
VALUE envval; /* for GC mark */
|
|
|
|
VALUE blockprocval;
|
|
|
|
int safe_level;
|
2007-08-19 00:02:21 -04:00
|
|
|
int is_from_method;
|
2006-12-31 10:02:22 -05:00
|
|
|
int is_lambda;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
} rb_proc_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
#define GetEnvPtr(obj, ptr) \
|
2007-06-24 14:40:13 -04:00
|
|
|
GetCoreDataFromValue(obj, rb_env_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
VALUE *env;
|
|
|
|
int env_size;
|
|
|
|
int local_size;
|
|
|
|
VALUE prev_envval; /* for GC mark */
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
rb_block_t block;
|
|
|
|
} rb_env_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
#define GetBindingPtr(obj, ptr) \
|
2007-06-24 14:40:13 -04:00
|
|
|
GetCoreDataFromValue(obj, rb_binding_t, ptr)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
VALUE env;
|
2010-05-09 14:41:51 -04:00
|
|
|
VALUE filename;
|
|
|
|
unsigned short line_no;
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
} rb_binding_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* used by compile time and send insn */
|
2007-01-05 19:24:59 -05:00
|
|
|
#define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
|
|
|
|
#define VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)
|
|
|
|
#define VM_CALL_FCALL_BIT (0x01 << 3)
|
|
|
|
#define VM_CALL_VCALL_BIT (0x01 << 4)
|
|
|
|
#define VM_CALL_TAILCALL_BIT (0x01 << 5)
|
|
|
|
#define VM_CALL_TAILRECURSION_BIT (0x01 << 6)
|
|
|
|
#define VM_CALL_SUPER_BIT (0x01 << 7)
|
2009-07-28 14:38:59 -04:00
|
|
|
#define VM_CALL_OPT_SEND_BIT (0x01 << 8)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-12-03 13:25:57 -05:00
|
|
|
#define VM_SPECIAL_OBJECT_VMCORE 0x01
|
|
|
|
#define VM_SPECIAL_OBJECT_CBASE 0x02
|
|
|
|
#define VM_SPECIAL_OBJECT_CONST_BASE 0x03
|
2008-06-30 23:05:58 -04:00
|
|
|
|
* vm.c, eval_intern.h (PASS_PASSED_BLOCK):
set a VM_FRAME_FLAG_PASSED flag to skip this frame when
searching ruby-level-cfp.
* eval.c, eval_intern.h, proc.c: fix to check cfp. if there is
no valid ruby-level-cfp, cause RuntimeError exception.
[ruby-dev:34128]
* vm_core.h, vm_evalbody.c, vm.c, vm_dump.c, vm_insnhelper.c,
insns.def: rename FRAME_MAGIC_* to VM_FRAME_MAGIC_*.
* KNOWNBUGS.rb, bootstraptest/test*.rb: move solved bugs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 17:46:43 -04:00
|
|
|
#define VM_FRAME_MAGIC_METHOD 0x11
|
|
|
|
#define VM_FRAME_MAGIC_BLOCK 0x21
|
|
|
|
#define VM_FRAME_MAGIC_CLASS 0x31
|
|
|
|
#define VM_FRAME_MAGIC_TOP 0x41
|
|
|
|
#define VM_FRAME_MAGIC_FINISH 0x51
|
|
|
|
#define VM_FRAME_MAGIC_CFUNC 0x61
|
|
|
|
#define VM_FRAME_MAGIC_PROC 0x71
|
|
|
|
#define VM_FRAME_MAGIC_IFUNC 0x81
|
|
|
|
#define VM_FRAME_MAGIC_EVAL 0x91
|
|
|
|
#define VM_FRAME_MAGIC_LAMBDA 0xa1
|
|
|
|
#define VM_FRAME_MAGIC_MASK_BITS 8
|
|
|
|
#define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))
|
|
|
|
|
|
|
|
#define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
|
|
|
|
|
|
|
|
/* other frame flag */
|
|
|
|
#define VM_FRAME_FLAG_PASSED 0x0100
|
|
|
|
|
|
|
|
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
|
|
|
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
|
|
|
|
2009-07-13 05:30:23 -04:00
|
|
|
/* inline cache */
|
|
|
|
typedef struct iseq_inline_cache_entry *IC;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2009-08-27 21:21:45 -04:00
|
|
|
extern VALUE ruby_vm_global_state_version;
|
|
|
|
|
|
|
|
#define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
|
|
|
|
#define INC_VM_STATE_VERSION() \
|
|
|
|
(ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
|
2007-03-18 23:58:57 -04:00
|
|
|
void rb_vm_change_state(void);
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
typedef VALUE CDHASH;
|
|
|
|
|
2007-07-01 14:16:02 -04:00
|
|
|
#ifndef FUNC_FASTCALL
|
|
|
|
#define FUNC_FASTCALL(x) x
|
|
|
|
#endif
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-07-01 14:16:02 -04:00
|
|
|
typedef rb_control_frame_t *
|
|
|
|
(FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
#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)
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#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) \
|
|
|
|
((rb_control_frame_t *)((th)->stack + (th)->stack_size))
|
|
|
|
#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
|
2006-12-31 10:02:22 -05:00
|
|
|
((void *)(ecfp) > (void *)(cfp))
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
|
|
|
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
|
|
|
|
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
|
|
|
(ptr && !RUBY_VM_IFUNC_P(ptr))
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
|
|
|
|
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
|
|
|
|
((rb_control_frame_t *)((VALUE *)(b) - 5))
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* VM related object allocate functions */
|
2008-05-22 12:19:14 -04:00
|
|
|
VALUE rb_thread_alloc(VALUE klass);
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
VALUE rb_proc_alloc(VALUE klass);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
/* for debug */
|
* vm_dump.c: add a prefix "rb_vmdebug_" to
vm_stack_dump_raw(), vm_stack_dump_raw_current(),
vm_env_dump_raw(), vm_proc_dump_raw(), vm_stack_dump_th(),
vm_debug_print_register(), vm_thread_dump_regs(),
vm_debug_print_pre(), vm_debug_print_post(),
vm_thread_dump_state().
This change also may affect core (in fact, user of
above functions may be only ko1).
* vm_core.h: ditto.
* vm_exec.h (SDR2): remove duplicate definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 21:09:43 -05:00
|
|
|
extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
|
|
|
|
#define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
|
|
|
|
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
|
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 00:25:46 -04:00
|
|
|
void rb_vm_bugreport(void);
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
|
|
|
|
/* functions about thread/vm execution */
|
2008-05-22 12:19:14 -04:00
|
|
|
VALUE rb_iseq_eval(VALUE iseqval);
|
2008-12-26 20:15:56 -05:00
|
|
|
VALUE rb_iseq_eval_main(VALUE iseqval);
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
void rb_enable_interrupt(void);
|
|
|
|
void rb_disable_interrupt(void);
|
2008-05-22 12:19:14 -04:00
|
|
|
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
|
|
|
|
* vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
vm_get_sourceline(), vm_cref(), vm_localjump_error(),
vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
This changes may affect only core because most of renamed functions
require a pointer of not-exposed struct such as rb_thread_t or NODE.
In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 21:38:11 -05:00
|
|
|
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
|
2009-07-15 10:59:41 -04:00
|
|
|
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
* vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
vm_get_sourceline(), vm_cref(), vm_localjump_error(),
vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
This changes may affect only core because most of renamed functions
require a pointer of not-exposed struct such as rb_thread_t or NODE.
In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 21:38:11 -05:00
|
|
|
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);
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
|
2009-01-11 20:43:23 -05:00
|
|
|
void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
|
|
|
|
int ruby_thread_has_gvl_p(void);
|
2009-02-01 17:36:15 -05:00
|
|
|
VALUE rb_make_backtrace(void);
|
2009-08-15 21:38:32 -04:00
|
|
|
typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
int rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg);
|
2009-02-13 01:25:59 -05:00
|
|
|
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
|
2010-05-13 00:09:26 -04:00
|
|
|
int rb_vm_get_sourceline(const rb_control_frame_t *);
|
2009-10-29 02:43:28 -04:00
|
|
|
VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method);
|
2009-01-11 20:43:23 -05:00
|
|
|
|
2007-11-20 05:47:53 -05:00
|
|
|
NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
|
|
|
|
|
2008-06-15 05:17:06 -04:00
|
|
|
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
2007-07-01 19:57:04 -04:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
/* for thread */
|
|
|
|
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
#if RUBY_VM_THREAD_MODEL == 2
|
2007-10-31 12:52:10 -04:00
|
|
|
RUBY_EXTERN rb_thread_t *ruby_current_thread;
|
2007-02-26 17:51:33 -05:00
|
|
|
extern rb_vm_t *ruby_current_vm;
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
|
2007-02-26 17:51:33 -05:00
|
|
|
#define GET_VM() ruby_current_vm
|
|
|
|
#define GET_THREAD() ruby_current_thread
|
2008-09-04 00:22:04 -04:00
|
|
|
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
|
* 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
2007-02-06 20:25:05 -05:00
|
|
|
#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
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-12-24 23:16:06 -05:00
|
|
|
#define RUBY_VM_SET_INTERRUPT(th) ((th)->interrupt_flag |= 0x02)
|
|
|
|
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ((th)->interrupt_flag |= 0x01)
|
2008-07-27 01:59:32 -04:00
|
|
|
#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
|
2007-12-24 23:16:06 -05:00
|
|
|
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
|
|
|
|
|
2009-06-08 12:14:06 -04:00
|
|
|
void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
|
|
|
|
void rb_threadptr_signal_exit(rb_thread_t *th);
|
|
|
|
void rb_threadptr_execute_interrupts(rb_thread_t *);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2010-01-23 15:18:36 -05:00
|
|
|
void rb_thread_lock_unlock(rb_thread_lock_t *);
|
|
|
|
void rb_thread_lock_destroy(rb_thread_lock_t *);
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_CHECK_INTS_TH(th) do { \
|
2008-09-26 08:38:38 -04:00
|
|
|
if (UNLIKELY(th->interrupt_flag)) { \
|
2009-06-08 12:14:06 -04:00
|
|
|
rb_threadptr_execute_interrupts(th); \
|
2006-12-31 10:02:22 -05:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
#define RUBY_VM_CHECK_INTS() \
|
|
|
|
RUBY_VM_CHECK_INTS_TH(GET_THREAD())
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2007-07-02 08:49:35 -04:00
|
|
|
/* tracer */
|
2009-07-05 01:04:41 -04:00
|
|
|
void
|
|
|
|
rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass);
|
2007-07-02 08:49:35 -04:00
|
|
|
|
|
|
|
#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
|
|
|
|
rb_event_flag_t wait_event__ = th->event_flags; \
|
|
|
|
if (UNLIKELY(wait_event__)) { \
|
|
|
|
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
|
2009-07-05 01:04:41 -04:00
|
|
|
rb_threadptr_exec_event_hooks(th, flag, self, id, klass); \
|
2007-07-02 08:49:35 -04:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2010-07-28 08:28:03 -04:00
|
|
|
#if defined __GNUC__ && __GNUC__ >= 4
|
|
|
|
#pragma GCC visibility push(default)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int rb_thread_check_trap_pending(void);
|
|
|
|
|
|
|
|
#if defined __GNUC__ && __GNUC__ >= 4
|
|
|
|
#pragma GCC visibility pop
|
|
|
|
#endif
|
|
|
|
|
2008-01-18 03:56:11 -05:00
|
|
|
#endif /* RUBY_VM_CORE_H */
|