From f363bbdf1042562e40aaccbd1bdd7b783c096ff0 Mon Sep 17 00:00:00 2001
From: ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Thu, 29 Oct 2015 22:43:45 +0000
Subject: * insns.def (getinlinecache/setinlinecache): compare ic->ic_cref and 
  current cref only when cached CREF list includes singleton class.

  Singleton classes have own namespaces, so that we need to check
  cref as a key (#10943).

  However, if current CREF list does not include singleton class,
  no need to check CREF beacuse it should be same name space.

* vm_insnhelper.c (vm_get_const_key_cref): add a function returns
  CREF only when it includes singleton class.

* vm_core.h: constify iseq_inline_cache_entry::ic_cref.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 insns.def | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index 6b3f6dcf7e..563266bf22 100644
--- a/insns.def
+++ b/insns.def
@@ -1164,7 +1164,7 @@ getinlinecache
 (VALUE val)
 {
     if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE() &&
-	ic->ic_cref == rb_vm_get_cref(GET_EP())) {
+	(ic->ic_cref == NULL || ic->ic_cref == rb_vm_get_cref(GET_EP()))) {
 	val = ic->ic_value.value;
 	JUMP(dst);
     }
@@ -1188,7 +1188,7 @@ setinlinecache
     VM_ASSERT(ic->ic_value.value != Qundef);
     ic->ic_value.value = val;
     ic->ic_serial = GET_GLOBAL_CONSTANT_STATE() - ruby_vm_const_missing_count;
-    ic->ic_cref = rb_vm_get_cref(GET_EP());
+    ic->ic_cref = vm_get_const_key_cref(GET_EP());
     ruby_vm_const_missing_count = 0;
 }
 
-- 
cgit v1.2.3

