diff --git a/ChangeLog b/ChangeLog index ba781632de..bf0b19059f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Nov 3 08:58:59 2010 Koichi Sasada + + * gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option. + Wed Nov 3 07:47:25 2010 Yukihiro Matsumoto * lib/irb/ruby-lex.rb (RubyLex#identify_string): parse multiple diff --git a/gc.c b/gc.c index a26a1965a2..a0f8527c88 100644 --- a/gc.c +++ b/gc.c @@ -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; ivalue_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* diff --git a/vm.c b/vm.c index 7387656136..980e7eab9f 100644 --- a/vm.c +++ b/vm.c @@ -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 diff --git a/vm_core.h b/vm_core.h index f0e72ef3e7..1ea9413b71 100644 --- a/vm_core.h +++ b/vm_core.h @@ -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;