Граф коммитов

1621 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada f3c81b4e90
Frozen objects in WeakMap
* gc.c (wmap_aset): bypass check for frozen and allow frozen
  object in WeakMap.  [Bug #13498]
2019-06-23 00:31:16 +09:00
Nobuyoshi Nakada ab6d8d0b65
Adjust indent 2019-06-19 20:40:49 +09:00
Samuel Williams d17344cfc5 Remove IA64 support. 2019-06-19 23:30:04 +12:00
Samuel Williams 3e5b885cd2 Rework debug conditional. 2019-06-19 20:39:10 +12:00
Samuel Williams b24603adff Move vm stack init into thread. 2019-06-19 20:39:10 +12:00
Nobuyoshi Nakada 09a2189c1b
Adjust indent 2019-06-07 01:56:31 +09:00
Aaron Patterson c9b74f9fd9
Pin keys in "compare by identity" hashes
Hashes that compare by identity care about the location of the object in
memory.  Since they care about the memory location, we can't let them
move.
2019-06-03 15:15:48 -07:00
Aaron Patterson 790a1b1790
object id is stable now for all objects, so we can let hash keys move 2019-06-03 13:38:47 -07:00
Aaron Patterson 2de3d92844
allow objects in imemo envs to move 2019-06-03 13:38:47 -07:00
NAKAMURA Usaku ca22cccc14
get rid of a warning of VC++ 2019-06-04 03:52:53 +09:00
Koichi Sasada c280519256 remove `rb_objspace_pinned_object_p()`
Nobody uses this function other than gc.c. We only need
RVALUE_PINNED().
2019-06-03 15:40:38 +09:00
git 106843d839 * expand tabs. 2019-05-30 17:12:53 +09:00
Koichi Sasada 5fc9f0008f reorder bitmap clearing. 2019-05-30 17:12:26 +09:00
Koichi Sasada dd63d7da61 move pinned_bits[] position in struct heap_page.
pinned_bits are not used frequently (only GC.compact use it) so
move it at the end of struct heap_page.
2019-05-30 09:10:17 +01:00
Koichi Sasada e15de86583 introduce `during_compacting` flag.
Usually PINNED_BITS are not needed (only for GC.compact need it)
so skip updating PINNED_BITS if the marking is not by GC.compact.
2019-05-30 16:52:42 +09:00
Takashi Kokubun 797d7efde1
Prevent MJIT compilation from running while moving
pointers.

Instead of 4fe908c164, just locking the MJIT
worker may be fine for this case. And also we might have the same issue
in all `gc_compact_after_gc` calls.
2019-05-29 08:56:27 +09:00
Takashi Kokubun 462a63c39e
Drop MJIT debug code from GC.compact
As ko1 added some improvements on GC.compact, I want to check if it
solved the problem too.
2019-05-29 05:10:12 +09:00
Koichi Sasada 8a2b497e3b remove obsolete rb_gc_finalize_deferred().
rb_gc_finalize_deferred() is remained for compatibility with
C-extensions. However, this function is no longer working
from Ruby 2.4 (crash with SEGV immediately).
So remove it completely.
2019-05-28 15:57:20 +09:00
Koichi Sasada f3bddc103d use malloc() instead of calloc().
Here malloc() is enough because all elements of the page_list
will be overwrite.
2019-05-28 11:44:08 +09:00
Koichi Sasada f9401d5d44 should skip T_ZOMBIE here. 2019-05-28 11:44:08 +09:00
Koichi Sasada 2229acaa54 should use heap_eden->total_pages.
The size of page_list is heap_eden->total_pages, but
init_cursors() assumes the size of page_list is `heap_allocated_pages`.
This patch fix it.
2019-05-28 11:44:08 +09:00
Koichi Sasada 7f211bfe6c use only eden_heaps on GC.compact.
`heap_pages_sorted` includes eden and tomb pages, so we should not
use tomb pages for GC.compact (or we should move all of tomb pages
into eden pages). Now, I choose only eden pages. If we allow to
move Zombie objects (objects waiting for finalizers), we should
use both type of pages (TODO).
2019-05-28 10:31:02 +09:00
Koichi Sasada cfd839c140 Suppress warning (uninitialized variable). 2019-05-28 10:31:02 +09:00
Koichi Sasada b3602f1d20 check the object is in tomb_heap. 2019-05-27 08:19:30 +01:00
Koichi Sasada 35146c4368 add a space between type and others 2019-05-27 08:12:30 +01:00
Koichi Sasada b3a6469e46 add a line break for each error message 2019-05-27 08:09:47 +01:00
Koichi Sasada 6c1a07555c fix GC.verify_internal_consistency.
Fix debug output to dump more useful information on GC.compact
debugging.

check_rvalue_consistency_force() now accepts `terminate` flag
to terminate a program with rb_bug() or only print error message.
GC.verify_internal_consistency use this flag (== FALSE) to dump
all of debug output.
2019-05-27 14:53:38 +09:00
Koichi Sasada 61da57c76a is_pointer_to_heap() checks also tomb or not.
is_pointer_to_heap(obj) checks this obj belong to a heap page.
However, this function returns TRUE even if the page is tomb page.
This is re-commit of [712c027524].

heap_page_add_freeobj() should not use is_pointer_to_heap(), but
should check more explicitly.
2019-05-27 14:53:37 +09:00
git a4da223c9a * expand tabs. 2019-05-24 19:00:50 +09:00
Kazuhiro NISHIYAMA 6ae9d5c85f
Revert "check it in eden or tomb."
This reverts commit 712c027524.
2019-05-24 18:59:58 +09:00
Koichi Sasada b0a4d81fc3 check RVALUE on verifier.
GC.verify_internal_consistency() checks health of each RVALUE with
check_rvalue_consistency(). However, this function is enabled
only on debug environment (RGENGC_CHECK_MODE>1). So introduce
new function check_rvalue_consistency_force() and use it
in GC.verify_internal_consistency.
2019-05-24 17:52:58 +09:00
Koichi Sasada 712c027524 check it in eden or tomb.
is_pointer_to_heap() checks if it is in valid pointer to the
RVALUE in any heap_page_body. However, it returns true if it
points tomb pages. This patch check it points to eden pages.
2019-05-24 17:35:22 +09:00
Koichi Sasada 10927b5925 add separation char on rb_obj_info(imemo obj) 2019-05-24 17:08:15 +09:00
Takashi Kokubun 4fe908c164
gc.c: Try pausing MJIT worker during GC.verify_compaction_references
for debugging
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2048247
2019-05-23 07:53:42 -07:00
Koichi Sasada dc95b57a68 add verifier before compact 2019-05-23 17:31:14 +09:00
Urabe, Shyouhei 763989c6c5 prefix ASAN related inline functions asan_
requested by Ko1.
2019-05-23 17:24:53 +09:00
Koichi Sasada 6be0ab73c3 gc_pin() doesn't check is_markable_object().
Caller of gc_pin() should check it is a mark-able object.
So gc_pin() doesn't need to check it. With this fix,
we can refactoring around it.
2019-05-23 16:58:21 +09:00
Koichi Sasada 4814f17361 skip zombies.
rb_gc() no longer invokes finalizers, so there are T_ZOMBE objects.
2019-05-23 13:21:40 +09:00
Koichi Sasada 02973d3ba8 pin `maybe` pointers.
Objects pointed by "maybe" pointers because of conservative marking
should be pinned down.
2019-05-23 11:42:15 +09:00
Koichi Sasada 136ae55892 Do not kick finalizers on rb_gc().
rb_gc() kicks gc_finalize_deferred(), which invokes finalizers.
This means that any Ruby program can be run this point and
it may be thread switching points and so on.

However, it is difficult to think it invokes any Ruby programs.
For example, `GC.compact` use `rb_gc()` to implement it, howver,
any Ruby program must not be run on this timing.

For this reason (it is difficult to image it run any Ruby program),
I removed `gc_finalize_deferred()` line in rb_gc().

This patch solves GC.compact issue.
[Bug #15809] and re-enable GC.compact test.
2019-05-23 11:26:33 +09:00
git 2fb69b3296 * expand tabs. 2019-05-22 16:54:47 +09:00
Nobuyoshi Nakada 32dd1a798a
gc.c: revert b00f280d4b "Eagerly name modules and classes"
* gc.c (rb_raw_obj_info): new string objects cannot allocate to
  create new class path name during GC.
2019-05-22 16:52:19 +09:00
Alan Wu b00f280d4b
Eagerly name modules and classes
* variable.c: make the hidden ivars `classpath` and `tmp_classpath` the source
  of truth for module and constant names. Assign to them when modules are bind
  to constants.

* variable.c: remove references to module name cache, as what used to be the cache
  is now the source of truth. Remove rb_class_path_no_cache().

* variable.c: remove the hidden ivar `classid`. This existed for the purposes of
  module name search, which is now replaced. Also, remove the associated
  rb_name_class().

* class.c: use rb_set_class_path_string to set the name of Object during boot.
  Must use a fstring as this runs before rb_cString is initialized and
  creating a normal string leads to a VALUE without a class.

* spec/ruby/core/module/name_spec.rb: add a few specs to specify what happens
  to Module#name across multiple operations. These specs pass without other
  code changes in this commit.

[Feature #15765]
2019-05-22 15:46:47 +09:00
Koichi Sasada 7ff4abe650 unify normal and verify ver. 2019-05-21 07:45:21 +01:00
git 583ecd5fc5 * expand tabs. 2019-05-20 22:08:27 +09:00
Nobuyoshi Nakada e83f10b368
Get rid of undefined behavior that source and destination buffers overlap 2019-05-20 21:58:06 +09:00
Aaron Patterson 154a67f140
Rename rb_gc_new_location to rb_gc_location
The function will return new or existing locations depending on whether
or not the object actually moved, so give it a more appropriate name.
2019-05-18 12:24:28 +03:00
Kazuhiro NISHIYAMA bbb84a16fa
Add fall through comment for Coverity Scan 2019-05-18 14:20:33 +09:00
Aaron Patterson ea3e7e2685
Prevent Dynamic -> Static symbols from moving
If a dynamic symbol has been converted to a static symbol, it gets added
to the global ID list and should no longer move.  C extensions can pass
symbols to rb_sym2id and those symbols should no longer be movable.
When the symbol is passed to rb_sym2id, the `id` member is set, so we
can use its existence to prevent movement.
2019-05-17 17:08:31 +03:00
Koichi Sasada 88449100bc don't need to sweep rest.
`transient_heap_evacuate()` disables GC using `rb_gc_disable()`
to prohibt GC invocation because of new allocation for evacuated
memory. However, `rb_gc_disable()` sweep all rest of unswept pages.
We don't need to cancel lazy sweep so this patch introduce
`rb_gc_disable_no_rest()` which doesn't cancel lazy sweep.
2019-05-16 17:18:50 +09:00