1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2010-11-03 01:01:12 +00:00
parent 2d189f672b
commit f6b2490fdb
4 changed files with 11 additions and 78 deletions

View file

@ -1,3 +1,7 @@
Wed Nov 3 08:58:59 2010 Koichi Sasada <ko1@atdot.net>
* gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.
Wed Nov 3 07:47:25 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/irb/ruby-lex.rb (RubyLex#identify_string): parse multiple

62
gc.c
View file

@ -1034,6 +1034,13 @@ heaps_increment(rb_objspace_t *objspace)
return FALSE;
}
int
rb_during_gc(void)
{
rb_objspace_t *objspace = &rb_objspace;
return during_gc;
}
#define RANY(o) ((RVALUE*)(o))
static VALUE
@ -1061,49 +1068,10 @@ rb_newobj_from_heap(rb_objspace_t *objspace)
return obj;
}
#if USE_VALUE_CACHE
static VALUE
rb_fill_value_cache(rb_thread_t *th)
{
rb_objspace_t *objspace = &rb_objspace;
int i;
VALUE rv;
/* LOCK */
for (i=0; i<RUBY_VM_VALUE_CACHE_SIZE; i++) {
VALUE v = rb_newobj_from_heap(objspace);
th->value_cache[i] = v;
RBASIC(v)->flags = FL_MARK;
}
th->value_cache_ptr = &th->value_cache[0];
rv = rb_newobj_from_heap(objspace);
/* UNLOCK */
return rv;
}
#endif
int
rb_during_gc(void)
{
rb_objspace_t *objspace = &rb_objspace;
return during_gc;
}
VALUE
rb_newobj(void)
{
#if USE_VALUE_CACHE || (defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE)
rb_thread_t *th = GET_THREAD();
#endif
#if USE_VALUE_CACHE
VALUE v = *th->value_cache_ptr;
#endif
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
rb_objspace_t *objspace = th->vm->objspace;
#else
rb_objspace_t *objspace = &rb_objspace;
#endif
if (during_gc) {
dont_gc = 1;
@ -1111,23 +1079,7 @@ rb_newobj(void)
rb_bug("object allocation during garbage collection phase");
}
#if USE_VALUE_CACHE
if (v) {
RBASIC(v)->flags = 0;
th->value_cache_ptr++;
}
else {
v = rb_fill_value_cache(th);
}
#if defined(GC_DEBUG)
printf("cache index: %d, v: %p, th: %p\n",
th->value_cache_ptr - th->value_cache, v, th);
#endif
return v;
#else
return rb_newobj_from_heap(objspace);
#endif
}
NODE*

16
vm.c
View file

@ -1709,18 +1709,6 @@ thread_free(void *ptr)
st_free_table(th->local_storage);
}
#if USE_VALUE_CACHE
{
VALUE *ptr = th->value_cache_ptr;
while (*ptr) {
VALUE v = *ptr;
RBASIC(v)->flags = 0;
RBASIC(v)->klass = 0;
ptr++;
}
}
#endif
if (th->vm && th->vm->main_thread == th) {
RUBY_GC_INFO("main thread\n");
}
@ -1796,10 +1784,6 @@ th_init2(rb_thread_t *th, VALUE self)
th->status = THREAD_RUNNABLE;
th->errinfo = Qnil;
th->last_status = Qnil;
#if USE_VALUE_CACHE
th->value_cache_ptr = &th->value_cache[0];
#endif
}
static void

View file

@ -365,9 +365,6 @@ struct rb_vm_protect_tag {
struct rb_vm_protect_tag *prev;
};
#define RUBY_VM_VALUE_CACHE_SIZE 0x1000
#define USE_VALUE_CACHE 0
struct rb_unblock_callback {
rb_unblock_function_t *func;
void *arg;
@ -437,10 +434,6 @@ typedef struct rb_thread_struct {
/* storage */
st_table *local_storage;
#if USE_VALUE_CACHE
VALUE value_cache[RUBY_VM_VALUE_CACHE_SIZE + 1];
VALUE *value_cache_ptr;
#endif
struct rb_thread_struct *join_list_next;
struct rb_thread_struct *join_list_head;