Skip to content

Commit

Permalink
* vm.c: add a prefix "rb_" to exposed functions
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
ko1 committed Jan 19, 2009
1 parent 2aa6644 commit cf23d0f
Show file tree
Hide file tree
Showing 14 changed files with 92 additions and 77 deletions.
15 changes: 15 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Mon Jan 19 11:27:39 2009 Koichi Sasada <ko1@atdot.net>

* 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.

Mon Jan 19 11:22:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>

* ext/socket/rubysocket.h (rb_cUNIXSocket, rb_cUNIXServer),
Expand Down
6 changes: 3 additions & 3 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ int
rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
{
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
extern const void **vm_get_insns_address_table(void);
extern const void **rb_vm_get_insns_address_table(void);
#if OPT_DIRECT_THREADED_CODE
const void * const *table = vm_get_insns_address_table();
const void * const *table = rb_vm_get_insns_address_table();
#else
const void * const *table = vm_get_insns_address_table();
const void * const *table = rb_vm_get_insns_address_table();
#endif
int i;

Expand Down
8 changes: 4 additions & 4 deletions cont.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ cont_new(VALUE klass)
return cont;
}

void vm_stack_to_heap(rb_thread_t *th);
void rb_vm_stack_to_heap(rb_thread_t *th);

static VALUE
cont_capture(volatile int *stat)
Expand All @@ -256,7 +256,7 @@ cont_capture(volatile int *stat)
rb_thread_t *th = GET_THREAD(), *sth;
volatile VALUE contval;

vm_stack_to_heap(th);
rb_vm_stack_to_heap(th);
cont = cont_new(rb_cContinuation);
contval = cont->self;
sth = &cont->saved_thread;
Expand Down Expand Up @@ -785,7 +785,7 @@ rb_fiber_start(void)
th->local_svar = Qnil;

fib->status = RUNNING;
cont->value = vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0);
cont->value = rb_vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0);
}
TH_POP_TAG();

Expand All @@ -795,7 +795,7 @@ rb_fiber_start(void)
}
else {
th->thrown_errinfo =
vm_make_jump_tag_but_local_jump(state, th->errinfo);
rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
}
RUBY_VM_SET_INTERRUPT(th);
}
Expand Down
6 changes: 3 additions & 3 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static VALUE
rb_mod_nesting(void)
{
VALUE ary = rb_ary_new();
const NODE *cref = vm_cref();
const NODE *cref = rb_vm_cref();

while (cref && cref->nd_next) {
VALUE klass = cref->nd_clss;
Expand Down Expand Up @@ -280,7 +280,7 @@ rb_mod_nesting(void)
static VALUE
rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
{
const NODE *cref = vm_cref();
const NODE *cref = rb_vm_cref();
VALUE klass;
VALUE cbase = 0;
void *data = 0;
Expand Down Expand Up @@ -592,7 +592,7 @@ void
rb_need_block()
{
if (!rb_block_given_p()) {
vm_localjump_error("no block given", Qnil, 0);
rb_vm_localjump_error("no block given", Qnil, 0);
}
}

Expand Down
14 changes: 7 additions & 7 deletions eval_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ enum ruby_tag_type {
#define GET_THROWOBJ_CATCH_POINT(obj) ((VALUE*)RNODE((obj))->u2.value)
#define GET_THROWOBJ_STATE(obj) ((int)RNODE((obj))->u3.value)

#define SCOPE_TEST(f) (vm_cref()->nd_visi & (f))
#define SCOPE_CHECK(f) (vm_cref()->nd_visi == (f))
#define SCOPE_SET(f) (vm_cref()->nd_visi = (f))
#define SCOPE_TEST(f) (rb_vm_cref()->nd_visi & (f))
#define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
#define SCOPE_SET(f) (rb_vm_cref()->nd_visi = (f))

#define CHECK_STACK_OVERFLOW(cfp, margin) do \
if (((VALUE *)(cfp)->sp) + (margin) + sizeof(rb_control_frame_t) >= ((VALUE *)cfp)) { \
Expand Down Expand Up @@ -193,11 +193,11 @@ VALUE rb_make_exception(int argc, VALUE *argv);
NORETURN(void rb_fiber_start(void));

NORETURN(void rb_print_undef(VALUE, ID, int));
NORETURN(void vm_localjump_error(const char *,VALUE, int));
NORETURN(void vm_jump_tag_but_local_jump(int, VALUE));
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
NORETURN(void rb_vm_jump_tag_but_local_jump(int, VALUE));

VALUE vm_make_jump_tag_but_local_jump(int state, VALUE val);
NODE *vm_cref(void);
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
NODE *rb_vm_cref(void);
rb_control_frame_t *vm_get_ruby_level_caller_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
VALUE rb_obj_is_proc(VALUE);
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
Expand Down
2 changes: 1 addition & 1 deletion load.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ rb_load(VALUE fname, int wrap)
rb_exc_raise(GET_THREAD()->errinfo);
}
if (state) {
vm_jump_tag_but_local_jump(state, Qundef);
rb_vm_jump_tag_but_local_jump(state, Qundef);
}

if (!NIL_P(GET_THREAD()->errinfo)) {
Expand Down
20 changes: 10 additions & 10 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ binding_clone(VALUE self)
return bindval;
}

rb_control_frame_t *vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);

VALUE
rb_binding_new(void)
{
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
VALUE bindval = binding_alloc(rb_cBinding);
rb_binding_t *bind;

Expand All @@ -289,7 +289,7 @@ rb_binding_new(void)
}

GetBindingPtr(bindval, bind);
bind->env = vm_make_env_object(th, cfp);
bind->env = rb_vm_make_env_object(th, cfp);
return bindval;
}

Expand Down Expand Up @@ -385,7 +385,7 @@ proc_new(VALUE klass, int is_lambda)
}
}

procval = vm_make_proc(th, block, klass);
procval = rb_vm_make_proc(th, block, klass);

if (is_lambda) {
rb_proc_t *proc;
Expand Down Expand Up @@ -524,17 +524,17 @@ proc_call(int argc, VALUE *argv, VALUE procval)
}
}

return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
argc, argv, blockptr);
return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
argc, argv, blockptr);
}

VALUE
rb_proc_call(VALUE self, VALUE args)
{
rb_proc_t *proc;
GetProcPtr(self, proc);
return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
RARRAY_LEN(args), RARRAY_PTR(args), 0);
return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
RARRAY_LEN(args), RARRAY_PTR(args), 0);
}

VALUE
Expand All @@ -550,8 +550,8 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
block = &pass_proc->block;
}

return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
argc, argv, block);
return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
argc, argv, block);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
th->errinfo = Qnil;
th->local_lfp = proc->block.lfp;
th->local_svar = Qnil;
th->value = vm_invoke_proc(th, proc, proc->block.self,
RARRAY_LEN(args), RARRAY_PTR(args), 0);
th->value = rb_vm_invoke_proc(th, proc, proc->block.self,
RARRAY_LEN(args), RARRAY_PTR(args), 0);
}
else {
th->value = (*th->first_func)((void *)th->first_args);
Expand Down Expand Up @@ -647,7 +647,7 @@ thread_join(rb_thread_t *target_th, double delay)
/* */
}
else if (TYPE(target_th->errinfo) == T_NODE) {
rb_exc_raise(vm_make_jump_tag_but_local_jump(
rb_exc_raise(rb_vm_make_jump_tag_but_local_jump(
GET_THROWOBJ_STATE(err), GET_THROWOBJ_VAL(err)));
}
else {
Expand Down
Loading

0 comments on commit cf23d0f

Please sign in to comment.