2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
#ifndef EVAL_INTERN_H_INCLUDED
|
|
|
|
#define EVAL_INTERN_H_INCLUDED
|
|
|
|
|
|
|
|
#define PASS_PASSED_BLOCK() \
|
|
|
|
(GET_THREAD()->passed_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 22:00:03 +03:00
|
|
|
GC_GUARDED_PTR_REF((rb_block_t *)GET_THREAD()->cfp->lfp[0]))
|
2006-12-31 18:02:22 +03:00
|
|
|
|
2007-06-10 07:06:15 +04:00
|
|
|
#include "ruby/ruby.h"
|
|
|
|
#include "ruby/node.h"
|
|
|
|
#include "ruby/util.h"
|
|
|
|
#include "ruby/signal.h"
|
* 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-07 04:25:05 +03:00
|
|
|
#include "yarvcore.h"
|
2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifndef EXIT_SUCCESS
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#endif
|
|
|
|
#ifndef EXIT_FAILURE
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
2007-06-10 07:06:15 +04:00
|
|
|
#include "ruby/st.h"
|
2006-12-31 18:02:22 +03:00
|
|
|
#include "dln.h"
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <crt_externs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Make alloca work the best possible way. */
|
|
|
|
#ifdef __GNUC__
|
|
|
|
# ifndef atarist
|
|
|
|
# ifndef alloca
|
|
|
|
# define alloca __builtin_alloca
|
|
|
|
# endif
|
|
|
|
# endif /* atarist */
|
|
|
|
#else
|
|
|
|
# ifdef HAVE_ALLOCA_H
|
|
|
|
# include <alloca.h>
|
|
|
|
# else
|
|
|
|
# ifdef _AIX
|
|
|
|
#pragma alloca
|
|
|
|
# else
|
|
|
|
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
|
|
|
void *alloca();
|
|
|
|
# endif
|
|
|
|
# endif /* AIX */
|
|
|
|
# endif /* HAVE_ALLOCA_H */
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
#ifndef HAVE_STRING_H
|
|
|
|
char *strrchr _((const char *, const char));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __BEOS__
|
|
|
|
#include <net/socket.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __MACOS__
|
|
|
|
#include "macruby_private.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __VMS
|
|
|
|
#include "vmsruby_private.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(setjmp) && defined(HAVE__SETJMP)
|
|
|
|
#define ruby_setjmp(env) _setjmp(env)
|
|
|
|
#define ruby_longjmp(env,val) _longjmp(env,val)
|
|
|
|
#else
|
|
|
|
#define ruby_setjmp(env) setjmp(env)
|
|
|
|
#define ruby_longjmp(env,val) longjmp(env,val)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#if defined(__VMS)
|
|
|
|
#pragma nostandard
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
Solaris sys/select.h switches select to select_large_fdset to support larger
|
|
|
|
file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
|
|
|
|
But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
|
|
|
|
So following definition is required to use select_large_fdset.
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_SELECT_LARGE_FDSET
|
|
|
|
#define select(n, r, w, e, t) select_large_fdset(n, r, w, e, t)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
* 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 23:12:43 +04:00
|
|
|
#define SAVE_ROOT_JMPBUF(th, stmt) do \
|
|
|
|
if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
|
|
|
|
stmt; \
|
|
|
|
} \
|
|
|
|
else { \
|
2007-06-05 21:55:07 +04:00
|
|
|
rb_fiber_start(); \
|
* 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 23:12:43 +04:00
|
|
|
} while (0)
|
|
|
|
|
2006-12-31 18:02:22 +03:00
|
|
|
#define TH_PUSH_TAG(th) do { \
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
rb_thread_t * const _th = th; \
|
* 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 22:00:03 +03:00
|
|
|
struct rb_vm_tag _tag; \
|
2006-12-31 18:02:22 +03:00
|
|
|
_tag.tag = 0; \
|
|
|
|
_tag.prev = _th->tag; \
|
|
|
|
_th->tag = &_tag;
|
|
|
|
|
|
|
|
#define TH_POP_TAG() \
|
|
|
|
_th->tag = _tag.prev; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define TH_POP_TAG2() \
|
|
|
|
_th->tag = _tag.prev
|
|
|
|
|
2007-04-25 05:35:13 +04:00
|
|
|
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
|
2006-12-31 18:02:22 +03:00
|
|
|
#define POP_TAG() TH_POP_TAG()
|
|
|
|
|
|
|
|
#define TH_EXEC_TAG() \
|
|
|
|
(FLUSH_REGISTER_WINDOWS, ruby_setjmp(_th->tag->buf))
|
|
|
|
|
|
|
|
#define EXEC_TAG() \
|
|
|
|
TH_EXEC_TAG()
|
|
|
|
|
|
|
|
#define TH_JUMP_TAG(th, st) do { \
|
|
|
|
ruby_longjmp(th->tag->buf,(st)); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define JUMP_TAG(st) TH_JUMP_TAG(GET_THREAD(), st)
|
|
|
|
|
|
|
|
#define TAG_RETURN 0x1
|
|
|
|
#define TAG_BREAK 0x2
|
|
|
|
#define TAG_NEXT 0x3
|
|
|
|
#define TAG_RETRY 0x4
|
|
|
|
#define TAG_REDO 0x5
|
|
|
|
#define TAG_RAISE 0x6
|
|
|
|
#define TAG_THROW 0x7
|
|
|
|
#define TAG_FATAL 0x8
|
|
|
|
#define TAG_CONTCALL 0x9
|
|
|
|
#define TAG_THREAD 0xa
|
|
|
|
#define TAG_MASK 0xf
|
|
|
|
|
|
|
|
#define SCOPE_TEST(f) \
|
|
|
|
(ruby_cref()->nd_visi & (f))
|
|
|
|
|
|
|
|
#define SCOPE_CHECK(f) \
|
|
|
|
(ruby_cref()->nd_visi == (f))
|
|
|
|
|
|
|
|
#define SCOPE_SET(f) \
|
|
|
|
{ \
|
|
|
|
ruby_cref()->nd_visi = (f); \
|
|
|
|
}
|
2007-02-08 09:48:34 +03:00
|
|
|
|
2006-12-31 18:02:22 +03:00
|
|
|
extern VALUE exception_error;
|
|
|
|
extern VALUE sysstack_error;
|
|
|
|
|
|
|
|
void rb_thread_cleanup _((void));
|
|
|
|
void rb_thread_wait_other_threads _((void));
|
|
|
|
|
2007-04-20 05:34:41 +04:00
|
|
|
int rb_sourceline(void);
|
|
|
|
const char *rb_sourcefile(void);
|
|
|
|
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
int thread_set_raised(rb_thread_t *th);
|
|
|
|
int thread_reset_raised(rb_thread_t *th);
|
2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
|
|
|
|
VALUE rb_make_exception _((int argc, VALUE *argv));
|
|
|
|
|
2007-06-05 21:55:07 +04:00
|
|
|
NORETURN(void rb_fiber_start(void));
|
|
|
|
|
2006-12-31 18:02:22 +03:00
|
|
|
NORETURN(void rb_raise_jump _((VALUE)));
|
|
|
|
NORETURN(void print_undef _((VALUE, ID)));
|
|
|
|
NORETURN(void th_localjump_error(const char *, VALUE, int));
|
|
|
|
NORETURN(void th_jump_tag_but_local_jump(int, VALUE));
|
|
|
|
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
VALUE th_compile(rb_thread_t *th, VALUE str, VALUE file, VALUE line);
|
2006-12-31 18:02:22 +03:00
|
|
|
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
NODE *th_get_cref(rb_thread_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp);
|
|
|
|
NODE *th_cref_push(rb_thread_t *th, VALUE, int);
|
|
|
|
NODE *th_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE * cref_stack);
|
2007-06-05 21:55:07 +04:00
|
|
|
VALUE th_make_jump_tag_but_local_jump(int state, VALUE val);
|
2006-12-31 18:02:22 +03: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 22:00:03 +03:00
|
|
|
static rb_control_frame_t *
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
th_get_ruby_level_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
|
2006-12-31 18:02:22 +03: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 22:00:03 +03:00
|
|
|
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
|
|
|
|
if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
|
2007-05-30 09:56:13 +04:00
|
|
|
return cfp;
|
2006-12-31 18:02:22 +03: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 22:00:03 +03:00
|
|
|
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
2006-12-31 18:02:22 +03:00
|
|
|
}
|
2007-05-30 09:56:13 +04:00
|
|
|
return 0;
|
2006-12-31 18:02:22 +03:00
|
|
|
}
|
|
|
|
|
* 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-07 04:25:05 +03:00
|
|
|
static inline NODE *
|
2006-12-31 18:02:22 +03:00
|
|
|
ruby_cref()
|
|
|
|
{
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
rb_thread_t *th = GET_THREAD();
|
* 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 22:00:03 +03:00
|
|
|
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
|
2006-12-31 18:02:22 +03:00
|
|
|
return th_get_cref(th, cfp->iseq, cfp);
|
|
|
|
}
|
|
|
|
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 09:37:46 +03:00
|
|
|
VALUE th_get_cbase(rb_thread_t *th);
|
* 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 22:00:03 +03:00
|
|
|
VALUE rb_obj_is_proc(VALUE);
|
* 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-07 04:25:05 +03:00
|
|
|
void rb_vm_check_redefinition_opt_method(NODE *node);
|
|
|
|
void rb_thread_terminate_all(void);
|
2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
#define ruby_cbase() th_get_cbase(GET_THREAD())
|
|
|
|
|
2007-04-19 14:37:08 +04:00
|
|
|
|
|
|
|
/* tracer */
|
|
|
|
static void inline
|
|
|
|
exec_event_hooks(rb_event_hook_t *hook, rb_event_flag_t flag, VALUE self, ID id, VALUE klass)
|
|
|
|
{
|
|
|
|
while (hook) {
|
2007-04-25 07:50:00 +04:00
|
|
|
if (flag & hook->flag) {
|
|
|
|
(*hook->func)(flag, hook->data, self, id, klass);
|
|
|
|
}
|
2007-04-19 14:37:08 +04:00
|
|
|
hook = hook->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
|
|
|
|
rb_event_flag_t wait_event__ = th->event_flags; \
|
|
|
|
if (UNLIKELY(wait_event__)) { \
|
2007-04-25 07:50:00 +04:00
|
|
|
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
|
|
|
|
VALUE self__ = (self), klass__ = (klass); \
|
|
|
|
ID id__ = (id); \
|
|
|
|
if (wait_event__ & flag) { \
|
|
|
|
exec_event_hooks(th->event_hooks, flag, self__, id__, klass__); \
|
|
|
|
} \
|
|
|
|
if (wait_event__ & RUBY_EVENT_VM) { \
|
|
|
|
exec_event_hooks(th->vm->event_hooks, flag, self__, id__, klass__); \
|
|
|
|
} \
|
2007-04-19 14:37:08 +04:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
2006-12-31 18:02:22 +03:00
|
|
|
#endif /* EVAL_INTERN_H_INCLUDED */
|