summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-15 14:56:05 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-15 14:56:05 (GMT)
commit14b8530454b1db7707c9475d027c26858eac817c (patch)
treee55f3e696ec42831ca1199eb6750303d3a94f562 /proc.c
parent4951f3b5e308ca02435ff9328f42f8ed9b0b0246 (diff)
proc.c: void env
* proc.c (rb_sym_to_proc): make void env. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/proc.c b/proc.c
index 24bd33a..eae5e74 100644
--- a/proc.c
+++ b/proc.c
@@ -57,9 +57,17 @@ proc_mark(void *ptr)
RUBY_MARK_LEAVE("proc");
}
+typedef struct {
+ rb_proc_t basic;
+ VALUE env[2]; /* specval, envval */
+} sym_proc_t;
+
static size_t
proc_memsize(const void *ptr)
{
+ const rb_proc_t *proc = ptr;
+ if (proc->block.ep == ((const sym_proc_t *)ptr)->env)
+ return sizeof(sym_proc_t);
return sizeof(rb_proc_t);
}
@@ -1060,9 +1068,12 @@ rb_sym_to_proc(VALUE sym)
}
else {
rb_proc_t *ptr;
+ sym_proc_t *symproc;
VALUE ifunc = (VALUE)IFUNC_NEW(rb_sym_proc_call, (VALUE)id, 0);
- proc = rb_proc_alloc(rb_cProc);
- ptr = RTYPEDDATA_DATA(proc);
+ proc = TypedData_Make_Struct(rb_cProc, sym_proc_t, &proc_data_type, symproc);
+ symproc->env[0] = VM_ENVVAL_BLOCK_PTR(0);
+ ptr = &symproc->basic;
+ ptr->block.ep = symproc->env;
ptr->block.iseq = (rb_iseq_t *)ifunc;
ptr->block.proc = ifunc;
aryp[index] = sym;