Project

General

Profile

« Previous | Next » 

Revision 3488eda4

Added by yui-knk (Kaneko Yuichiro) over 2 years ago

Fix gc_verify_internal_consistency error for pattern_matching in ripper

gc_verify_internal_consistency reports "found internal inconsistency"
for "test_pattern_matching.rb".

http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sp2-docker/4501173

Ruby's parser manages objects by two different ways.

  1. For parser
  • markable node holds objects
  • call RB_OBJ_WRITTEN with p->ast as parent
  • mark_ast_value marks objects
  1. For ripper
  • unmarkable node, NODE_RIPPER/NODE_CDECL, holds objects
  • call rb_ast_add_mark_object. This function calls rb_hash_aset then
    RB_OBJ_WRITTEN is called with mark_hash as parent
  • mark_hash marks objects

However in current pattern_matching implementation

  • markable node holds objects
  • call rb_ast_add_mark_object

This commit fix it to be #2.

This was inconsistency however always mark_hash is
made young by rb_ast_add_mark_object call then objects
are not collected.