mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* env.h (SCOPE_CLONE): Introduce a new scope flag to prevent a
local_tbl region from getting freed many times; submitted by Chikanaga Tomoyuki <chikanag AT nippon-control-system.co.jp> in [ruby-dev:30460]. * eval.c (proc_invoke): Ditto. * gc.c (obj_free): Ditto. * parse.y (top_local_setup_gen): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
618510d30c
commit
deeafa0e17
5 changed files with 19 additions and 3 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Sat Mar 3 16:23:13 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* env.h (SCOPE_CLONE): Introduce a new scope flag to prevent a
|
||||||
|
local_tbl region from getting freed many times; submitted by
|
||||||
|
Chikanaga Tomoyuki <chikanag AT nippon-control-system.co.jp> in
|
||||||
|
[ruby-dev:30460].
|
||||||
|
|
||||||
|
* eval.c (proc_invoke): Ditto.
|
||||||
|
|
||||||
|
* gc.c (obj_free): Ditto.
|
||||||
|
|
||||||
|
* parse.y (top_local_setup_gen): Ditto.
|
||||||
|
|
||||||
Sat Mar 3 16:07:02 2007 Akinori MUSHA <knu@iDaemons.org>
|
Sat Mar 3 16:07:02 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* object.c (rb_obj_ivar_set): RDoc updated according to a
|
* object.c (rb_obj_ivar_set): RDoc updated according to a
|
||||||
|
|
1
env.h
1
env.h
|
@ -43,6 +43,7 @@ extern struct SCOPE {
|
||||||
#define SCOPE_MALLOC 1
|
#define SCOPE_MALLOC 1
|
||||||
#define SCOPE_NOSTACK 2
|
#define SCOPE_NOSTACK 2
|
||||||
#define SCOPE_DONT_RECYCLE 4
|
#define SCOPE_DONT_RECYCLE 4
|
||||||
|
#define SCOPE_CLONE 8
|
||||||
|
|
||||||
extern int ruby_in_eval;
|
extern int ruby_in_eval;
|
||||||
|
|
||||||
|
|
3
eval.c
3
eval.c
|
@ -8553,11 +8553,12 @@ proc_invoke(proc, args, self, klass)
|
||||||
if (klass) _block.frame.last_class = klass;
|
if (klass) _block.frame.last_class = klass;
|
||||||
_block.frame.argc = RARRAY(tmp)->len;
|
_block.frame.argc = RARRAY(tmp)->len;
|
||||||
_block.frame.flags = ruby_frame->flags;
|
_block.frame.flags = ruby_frame->flags;
|
||||||
if (_block.frame.argc && (ruby_frame->flags & FRAME_DMETH)) {
|
if (_block.frame.argc && DMETHOD_P()) {
|
||||||
NEWOBJ(scope, struct SCOPE);
|
NEWOBJ(scope, struct SCOPE);
|
||||||
OBJSETUP(scope, tmp, T_SCOPE);
|
OBJSETUP(scope, tmp, T_SCOPE);
|
||||||
scope->local_tbl = _block.scope->local_tbl;
|
scope->local_tbl = _block.scope->local_tbl;
|
||||||
scope->local_vars = _block.scope->local_vars;
|
scope->local_vars = _block.scope->local_vars;
|
||||||
|
scope->flags |= SCOPE_CLONE;
|
||||||
_block.scope = scope;
|
_block.scope = scope;
|
||||||
}
|
}
|
||||||
/* modify current frame */
|
/* modify current frame */
|
||||||
|
|
2
gc.c
2
gc.c
|
@ -1253,7 +1253,7 @@ obj_free(obj)
|
||||||
if (RANY(obj)->as.scope.local_vars &&
|
if (RANY(obj)->as.scope.local_vars &&
|
||||||
RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
|
RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
|
||||||
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
|
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
|
||||||
if (vars[0] == 0)
|
if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
|
||||||
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
|
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
|
||||||
if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
|
if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
|
||||||
RUBY_CRITICAL(free(vars));
|
RUBY_CRITICAL(free(vars));
|
||||||
|
|
3
parse.y
3
parse.y
|
@ -5727,7 +5727,8 @@ top_local_setup()
|
||||||
rb_mem_clear(ruby_scope->local_vars+i, len-i);
|
rb_mem_clear(ruby_scope->local_vars+i, len-i);
|
||||||
}
|
}
|
||||||
if (ruby_scope->local_tbl && ruby_scope->local_vars[-1] == 0) {
|
if (ruby_scope->local_tbl && ruby_scope->local_vars[-1] == 0) {
|
||||||
xfree(ruby_scope->local_tbl);
|
if (!(ruby_scope->flags & SCOPE_CLONE))
|
||||||
|
xfree(ruby_scope->local_tbl);
|
||||||
}
|
}
|
||||||
ruby_scope->local_tbl = local_tbl();
|
ruby_scope->local_tbl = local_tbl();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue