Lines Matching refs:GC_G

172 #define GC_IDX2PTR(idx)      (GC_G(buf) + (idx))
173 #define GC_PTR2IDX(ptr) ((ptr) - GC_G(buf))
232 (GC_G(unused) != GC_INVALID)
239 (GC_G(first_unused) < GC_G(gc_threshold))
241 (GC_G(first_unused) != GC_G(buf_size))
291 #define GC_G(v) ZEND_TSRMG_FAST(gc_globals_offset, zend_gc_globals *, v) macro
293 #define GC_G(v) (gc_globals.v) macro
298 # define GC_BENCH_INC(counter) GC_G(counter)++
299 # define GC_BENCH_DEC(counter) GC_G(counter)--
301 if (GC_G(counter) > GC_G(peak)) { \
302 GC_G(peak) = GC_G(counter); \
396 ZEND_ASSERT(idx < GC_G(first_unused)); in gc_decompress()
410 idx = GC_G(unused); in gc_fetch_unused()
413 GC_G(unused) = GC_LIST2IDX(root->ref); in gc_fetch_unused()
419 root->ref = GC_IDX2LIST(GC_G(unused)); in gc_link_unused()
420 GC_G(unused) = GC_PTR2IDX(root); in gc_link_unused()
428 idx = GC_G(first_unused); in gc_fetch_next_unused()
429 GC_G(first_unused) = GC_G(first_unused) + 1; in gc_fetch_next_unused()
469 GC_G(num_roots)--; in gc_remove_from_roots()
535 if (GC_G(buf)) { in gc_reset()
536 GC_G(gc_active) = 0; in gc_reset()
537 GC_G(gc_protected) = 0; in gc_reset()
538 GC_G(gc_full) = 0; in gc_reset()
539 GC_G(unused) = GC_INVALID; in gc_reset()
540 GC_G(first_unused) = GC_FIRST_ROOT; in gc_reset()
541 GC_G(num_roots) = 0; in gc_reset()
543 GC_G(gc_runs) = 0; in gc_reset()
544 GC_G(collected) = 0; in gc_reset()
546 GC_G(collector_time) = 0; in gc_reset()
547 GC_G(dtor_time) = 0; in gc_reset()
548 GC_G(free_time) = 0; in gc_reset()
550 GC_G(dtor_idx) = GC_FIRST_ROOT; in gc_reset()
551 GC_G(dtor_end) = 0; in gc_reset()
552 GC_G(dtor_fiber) = NULL; in gc_reset()
553 GC_G(dtor_fiber_running) = false; in gc_reset()
556 GC_G(root_buf_length) = 0; in gc_reset()
557 GC_G(root_buf_peak) = 0; in gc_reset()
558 GC_G(zval_possible_root) = 0; in gc_reset()
559 GC_G(zval_buffered) = 0; in gc_reset()
560 GC_G(zval_remove_from_buffer) = 0; in gc_reset()
561 GC_G(zval_marked_grey) = 0; in gc_reset()
565 GC_G(activated_at) = zend_hrtime(); in gc_reset()
570 bool old_enabled = GC_G(gc_enabled); in gc_enable()
571 GC_G(gc_enabled) = enable; in gc_enable()
572 if (enable && !old_enabled && GC_G(buf) == NULL) { in gc_enable()
573 GC_G(buf) = (gc_root_buffer*) pemalloc(sizeof(gc_root_buffer) * GC_DEFAULT_BUF_SIZE, 1); in gc_enable()
574 GC_G(buf)[0].ref = NULL; in gc_enable()
575 GC_G(buf_size) = GC_DEFAULT_BUF_SIZE; in gc_enable()
576 GC_G(gc_threshold) = GC_THRESHOLD_DEFAULT; in gc_enable()
584 return GC_G(gc_enabled); in gc_enabled()
589 bool old_protected = GC_G(gc_protected); in gc_protect()
590 GC_G(gc_protected) = protect; in gc_protect()
596 return GC_G(gc_protected); in gc_protected()
603 if (GC_G(buf_size) >= GC_MAX_BUF_SIZE) { in gc_grow_root_buffer()
604 if (!GC_G(gc_full)) { in gc_grow_root_buffer()
606 GC_G(gc_active) = 1; in gc_grow_root_buffer()
607 GC_G(gc_protected) = 1; in gc_grow_root_buffer()
608 GC_G(gc_full) = 1; in gc_grow_root_buffer()
612 if (GC_G(buf_size) < GC_BUF_GROW_STEP) { in gc_grow_root_buffer()
613 new_size = GC_G(buf_size) * 2; in gc_grow_root_buffer()
615 new_size = GC_G(buf_size) + GC_BUF_GROW_STEP; in gc_grow_root_buffer()
620 GC_G(buf) = perealloc(GC_G(buf), sizeof(gc_root_buffer) * new_size, 1); in gc_grow_root_buffer()
621 GC_G(buf_size) = new_size; in gc_grow_root_buffer()
631 if (count < GC_THRESHOLD_TRIGGER || GC_G(num_roots) >= GC_G(gc_threshold)) { in gc_adjust_threshold()
633 if (GC_G(gc_threshold) < GC_THRESHOLD_MAX) { in gc_adjust_threshold()
634 new_threshold = GC_G(gc_threshold) + GC_THRESHOLD_STEP; in gc_adjust_threshold()
638 if (new_threshold > GC_G(buf_size)) { in gc_adjust_threshold()
641 if (new_threshold <= GC_G(buf_size)) { in gc_adjust_threshold()
642 GC_G(gc_threshold) = new_threshold; in gc_adjust_threshold()
645 } else if (GC_G(gc_threshold) > GC_THRESHOLD_DEFAULT) { in gc_adjust_threshold()
646 new_threshold = GC_G(gc_threshold) - GC_THRESHOLD_STEP; in gc_adjust_threshold()
650 GC_G(gc_threshold) = new_threshold; in gc_adjust_threshold()
662 if (GC_G(gc_enabled) && !GC_G(gc_active)) { in gc_possible_root_when_full()
691 GC_G(num_roots)++; in gc_possible_root_when_full()
703 if (UNEXPECTED(GC_G(gc_protected))) { in gc_possible_root()
727 GC_G(num_roots)++; in gc_possible_root()
760 GC_G(num_roots)++; in gc_extra_root()
786 if (UNEXPECTED(GC_G(first_unused) >= GC_MAX_UNCOMPRESSED)) { in gc_remove_from_buffer()
1173 if (GC_G(num_roots) + GC_FIRST_ROOT != GC_G(first_unused)) { in gc_compact()
1174 if (GC_G(num_roots)) { in gc_compact()
1176 gc_root_buffer *scan = GC_IDX2PTR(GC_G(first_unused) - 1); in gc_compact()
1177 gc_root_buffer *end = GC_IDX2PTR(GC_G(num_roots)); in gc_compact()
1202 GC_G(unused) = GC_INVALID; in gc_compact()
1203 GC_G(first_unused) = GC_G(num_roots) + GC_FIRST_ROOT; in gc_compact()
1214 last = GC_IDX2PTR(GC_G(first_unused)); in gc_mark_roots()
1387 end = GC_G(first_unused); in gc_scan_roots()
1400 while (idx != GC_G(first_unused)) { in gc_scan_roots()
1434 GC_G(num_roots)++; in gc_add_garbage()
1631 gc_root_buffer *last = GC_IDX2PTR(GC_G(first_unused)); in gc_collect_roots()
1649 end = GC_G(first_unused); in gc_collect_roots()
1829 GC_G(dtor_idx) = idx; in gc_call_destructors()
1838 if (UNEXPECTED(fiber != NULL && GC_G(dtor_fiber) != fiber)) { in gc_call_destructors()
1866 GC_G(dtor_fiber) = fiber; in gc_create_destructor_fiber()
1877 ZEND_ASSERT(!GC_G(dtor_fiber_running)); in gc_call_destructors_in_fiber()
1879 zend_fiber *fiber = GC_G(dtor_fiber); in gc_call_destructors_in_fiber()
1881 GC_G(dtor_idx) = GC_FIRST_ROOT; in gc_call_destructors_in_fiber()
1882 GC_G(dtor_end) = GC_G(first_unused); in gc_call_destructors_in_fiber()
1894 if (UNEXPECTED(GC_G(dtor_fiber_running))) { in gc_call_destructors_in_fiber()
1898 GC_G(dtor_fiber) = NULL; in gc_call_destructors_in_fiber()
1899 GC_G(dtor_idx)++; in gc_call_destructors_in_fiber()
1920 if (GC_G(num_roots) && GC_G(gc_active)) { in zend_gc_collect_cycles()
1925 if (GC_G(num_roots)) { in zend_gc_collect_cycles()
1936 if (GC_G(gc_active)) { in zend_gc_collect_cycles()
1937 GC_G(collector_time) += zend_hrtime() - start_time; in zend_gc_collect_cycles()
1942 GC_G(gc_runs)++; in zend_gc_collect_cycles()
1943 GC_G(gc_active) = 1; in zend_gc_collect_cycles()
1953 if (!GC_G(num_roots)) { in zend_gc_collect_cycles()
1957 GC_G(gc_active) = 0; in zend_gc_collect_cycles()
1961 end = GC_G(first_unused); in zend_gc_collect_cycles()
2018 GC_G(dtor_time) += zend_hrtime() - dtor_start_time; in zend_gc_collect_cycles()
2020 if (GC_G(gc_protected)) { in zend_gc_collect_cycles()
2023 GC_G(collector_time) += zend_hrtime() - start_time; in zend_gc_collect_cycles()
2077 GC_G(num_roots)--; in zend_gc_collect_cycles()
2083 GC_G(free_time) += zend_hrtime() - free_start_time; in zend_gc_collect_cycles()
2086 GC_G(collected) += count; in zend_gc_collect_cycles()
2088 GC_G(gc_active) = 0; in zend_gc_collect_cycles()
2106 GC_G(gc_active) = 1; in zend_gc_collect_cycles()
2108 GC_G(gc_active) = 0; in zend_gc_collect_cycles()
2110 GC_G(collector_time) += zend_hrtime() - start_time; in zend_gc_collect_cycles()
2116 status->active = GC_G(gc_active); in zend_gc_get_status()
2117 status->gc_protected = GC_G(gc_protected); in zend_gc_get_status()
2118 status->full = GC_G(gc_full); in zend_gc_get_status()
2119 status->runs = GC_G(gc_runs); in zend_gc_get_status()
2120 status->collected = GC_G(collected); in zend_gc_get_status()
2121 status->threshold = GC_G(gc_threshold); in zend_gc_get_status()
2122 status->buf_size = GC_G(buf_size); in zend_gc_get_status()
2123 status->num_roots = GC_G(num_roots); in zend_gc_get_status()
2124 status->application_time = zend_hrtime() - GC_G(activated_at); in zend_gc_get_status()
2125 status->collector_time = GC_G(collector_time); in zend_gc_get_status()
2126 status->dtor_time = GC_G(dtor_time); in zend_gc_get_status()
2127 status->free_time = GC_G(free_time); in zend_gc_get_status()
2221 fprintf(stderr, "Runs: %d\n", GC_G(gc_runs)); in gc_bench_print()
2222 fprintf(stderr, "Collected: %d\n", GC_G(collected)); in gc_bench_print()
2223 fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length)); in gc_bench_print()
2224 fprintf(stderr, "Root buffer peak: %d\n\n", GC_G(root_buf_peak)); in gc_bench_print()
2228 …err, "ZVAL %8d %8d %9d %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove… in gc_bench_print()
2243 zend_fiber *fiber = GC_G(dtor_fiber); in ZEND_FUNCTION()
2248 GC_G(dtor_fiber_running) = true; in ZEND_FUNCTION()
2250 idx = GC_G(dtor_idx); in ZEND_FUNCTION()
2251 end = GC_G(dtor_end); in ZEND_FUNCTION()
2259 GC_G(dtor_fiber_running) = false; in ZEND_FUNCTION()
2264 if (GC_G(dtor_fiber) == fiber) { in ZEND_FUNCTION()
2265 GC_G(dtor_fiber) = NULL; in ZEND_FUNCTION()