mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 15429, 15471:
* gc.c (rb_newobj): prohibit call of rb_newobj() during gc. Submitted by Sylvain Joyeux [ruby-core:12099]. * ext/dl/ptr.c: do not use LONG2NUM() inside dlptr_free(). Slightly modified fix bassed on a patch by Sylvain Joyeux [ruby-core:12099] [ ruby-bugs-11859 ] [ ruby-bugs-11882 ] [ ruby-patches-13151 ]. * ext/dl/ptr.c (dlmem_each_i): typo fixed. a patch from IKOMA Yoshiki <ikoma@mb.i-chubu.ne.jp> in [ruby-dev:33776]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
465eec7158
commit
1454c9812b
4 changed files with 32 additions and 24 deletions
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
|||
Fri Jun 13 13:14:31 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/dl/ptr.c (dlmem_each_i): typo fixed. a patch from IKOMA
|
||||
Yoshiki <ikoma@mb.i-chubu.ne.jp> in [ruby-dev:33776].
|
||||
|
||||
Fri Jun 13 13:13:23 2008 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
|
||||
|
||||
* gc.c (rb_newobj): prohibit call of rb_newobj() during gc.
|
||||
Submitted by Sylvain Joyeux [ruby-core:12099].
|
||||
|
||||
* ext/dl/ptr.c: do not use LONG2NUM() inside dlptr_free().
|
||||
Slightly modified fix bassed on a patch by Sylvain Joyeux
|
||||
[ruby-core:12099] [ ruby-bugs-11859 ] [ ruby-bugs-11882 ]
|
||||
[ ruby-patches-13151 ].
|
||||
|
||||
Fri Jun 13 12:10:13 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/benchmark.rb (Job::Benchmark#item): fix typo.
|
||||
|
|
|
|||
36
ext/dl/ptr.c
36
ext/dl/ptr.c
|
|
@ -4,30 +4,22 @@
|
|||
|
||||
#include <ruby.h>
|
||||
#include <ctype.h>
|
||||
#include <version.h> /* for ruby version code */
|
||||
#include "st.h"
|
||||
#include "dl.h"
|
||||
|
||||
VALUE rb_cDLPtrData;
|
||||
VALUE rb_mDLMemorySpace;
|
||||
static VALUE DLMemoryTable;
|
||||
static st_table* st_memory_table;
|
||||
|
||||
#ifndef T_SYMBOL
|
||||
# define T_SYMBOL T_FIXNUM
|
||||
#endif
|
||||
|
||||
#if RUBY_VERSION_CODE < 171
|
||||
static VALUE
|
||||
rb_hash_delete(VALUE hash, VALUE key)
|
||||
{
|
||||
return rb_funcall(hash, rb_intern("delete"), 1, key);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
rb_dlmem_delete(void *ptr)
|
||||
{
|
||||
rb_secure(4);
|
||||
rb_hash_delete(DLMemoryTable, DLLONG2NUM(ptr));
|
||||
st_delete(st_memory_table, (st_data_t*)&ptr, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -37,7 +29,7 @@ rb_dlmem_aset(void *ptr, VALUE obj)
|
|||
rb_dlmem_delete(ptr);
|
||||
}
|
||||
else{
|
||||
rb_hash_aset(DLMemoryTable, DLLONG2NUM(ptr), DLLONG2NUM(obj));
|
||||
st_insert(st_memory_table, (st_data_t)ptr, (st_data_t)obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,8 +38,8 @@ rb_dlmem_aref(void *ptr)
|
|||
{
|
||||
VALUE val;
|
||||
|
||||
val = rb_hash_aref(DLMemoryTable, DLLONG2NUM(ptr));
|
||||
return val == Qnil ? Qnil : (VALUE)DLNUM2LONG(val);
|
||||
if(!st_lookup(st_memory_table, (st_data_t)ptr, &val)) return Qnil;
|
||||
return val == Qundef ? Qnil : val;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1010,20 +1002,18 @@ rb_dlptr_size(int argc, VALUE argv[], VALUE self)
|
|||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
dlmem_each_i(VALUE assoc, void *data)
|
||||
static int
|
||||
dlmem_each_i(void* key, VALUE value, void* arg)
|
||||
{
|
||||
VALUE key, val;
|
||||
key = rb_ary_entry(assoc, 0);
|
||||
val = rb_ary_entry(assoc, 1);
|
||||
rb_yield(rb_assoc_new(key,(VALUE)DLNUM2LONG(val)));
|
||||
VALUE vkey = DLLONG2NUM(key);
|
||||
rb_yield(rb_assoc_new(vkey, value));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_dlmem_each(VALUE self)
|
||||
{
|
||||
rb_iterate(rb_each, DLMemoryTable, dlmem_each_i, 0);
|
||||
st_foreach(st_memory_table, dlmem_each_i, 0);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
@ -1062,7 +1052,7 @@ Init_dlptr()
|
|||
rb_define_method(rb_cDLPtrData, "size=", rb_dlptr_size, -1);
|
||||
|
||||
rb_mDLMemorySpace = rb_define_module_under(rb_mDL, "MemorySpace");
|
||||
DLMemoryTable = rb_hash_new();
|
||||
rb_define_const(rb_mDLMemorySpace, "MemoryTable", DLMemoryTable);
|
||||
st_memory_table = st_init_numtable();
|
||||
rb_define_const(rb_mDLMemorySpace, "MemoryTable", Qnil); /* historical */
|
||||
rb_define_module_function(rb_mDLMemorySpace, "each", rb_dlmem_each, 0);
|
||||
}
|
||||
|
|
|
|||
3
gc.c
3
gc.c
|
|
@ -378,6 +378,9 @@ rb_newobj()
|
|||
{
|
||||
VALUE obj;
|
||||
|
||||
if (during_gc)
|
||||
rb_bug("object allocation during garbage collection phase");
|
||||
|
||||
if (!freelist) garbage_collect();
|
||||
|
||||
obj = (VALUE)freelist;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define RUBY_RELEASE_DATE "2008-06-13"
|
||||
#define RUBY_VERSION_CODE 186
|
||||
#define RUBY_RELEASE_CODE 20080613
|
||||
#define RUBY_PATCHLEVEL 174
|
||||
#define RUBY_PATCHLEVEL 175
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue