Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/github/ruby.git
* gc.c: move rb_objspace_t:π:gc_stressfull after during_gc
to make accesssing both parameters easy. * gc.c (heap_get_freeobj): add LIKELY() hint. * gc.c (heap_get_freeobj_from_next_freepage): ditto. * gc.c (newobj_of): check both parameters at once for exceptional case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
ddac04d2c2
ΠΠΎΠΌΠΌΠΈΡ
3238a4a729
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue Sep 9 14:09:36 2014 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c: move rb_objspace_t::flags::gc_stressfull after during_gc
|
||||
to make accesssing both parameters easy.
|
||||
|
||||
* gc.c (heap_get_freeobj): add LIKELY() hint.
|
||||
|
||||
* gc.c (heap_get_freeobj_from_next_freepage): ditto.
|
||||
|
||||
* gc.c (newobj_of): check both parameters at once for exceptional
|
||||
case.
|
||||
|
||||
Tue Sep 9 13:51:32 2014 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c: add rb_objspace_t::flags::gc_stressfull and
|
||||
|
|
12
gc.c
12
gc.c
|
@ -464,11 +464,11 @@ typedef struct rb_objspace {
|
|||
|
||||
struct {
|
||||
enum gc_stat stat : 2;
|
||||
unsigned int gc_stressfull: 1;
|
||||
unsigned int immediate_sweep : 1;
|
||||
unsigned int dont_gc : 1;
|
||||
unsigned int dont_incremental : 1;
|
||||
unsigned int during_gc : 1;
|
||||
unsigned int gc_stressfull: 1;
|
||||
#if USE_RGENGC
|
||||
unsigned int during_minor_gc : 1;
|
||||
#endif
|
||||
|
@ -1538,7 +1538,7 @@ heap_get_freeobj_from_next_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
struct heap_page *page;
|
||||
RVALUE *p;
|
||||
|
||||
while (heap->free_pages == NULL) {
|
||||
while (UNLIKELY(heap->free_pages == NULL)) {
|
||||
heap_prepare(objspace, heap);
|
||||
}
|
||||
page = heap->free_pages;
|
||||
|
@ -1558,7 +1558,7 @@ heap_get_freeobj(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
RVALUE *p = heap->freelist;
|
||||
|
||||
while (1) {
|
||||
if (p) {
|
||||
if (LIKELY(p != NULL)) {
|
||||
heap->freelist = p->as.free.next;
|
||||
return (VALUE)p;
|
||||
}
|
||||
|
@ -1594,17 +1594,19 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
|
|||
rb_objspace_t *objspace = &rb_objspace;
|
||||
VALUE obj;
|
||||
|
||||
if (UNLIKELY(during_gc)) {
|
||||
if (UNLIKELY(during_gc || ruby_gc_stressfull)) {
|
||||
if (during_gc) {
|
||||
dont_gc = 1;
|
||||
during_gc = 0;
|
||||
rb_bug("object allocation during garbage collection phase");
|
||||
}
|
||||
|
||||
if (UNLIKELY(ruby_gc_stressfull)) {
|
||||
if (ruby_gc_stressfull) {
|
||||
if (!garbage_collect(objspace, FALSE, FALSE, FALSE, GPR_FLAG_NEWOBJ)) {
|
||||
rb_memerror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
obj = heap_get_freeobj(objspace, heap_eden);
|
||||
|
||||
|
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅