Issue #16139 has been updated by nagachika (Tomoyuki Chikanaga).


I'd like to backport c14b67b2a8cf60b37cfb221d8b97c6eb91833522 into ruby_2_6 branch, but I got the following test failure with the changeset.

```
  1) Failure:
TestJIT#test_inlined_setivar_frozen [/Users/nagachika/opt/ruby-2.6/src/ruby_2_6/test/ruby/test_jit.rb:701]:
Expected 2 times of JIT success, but succeeded 1 times.

script:


class A
  def a
    @a = 1
  end
end

a = A.new
a.a
a.a
a.a
a.freeze
begin
  a.a
rescue FrozenError => e
  p e.class
end



stderr:

JIT success (179.3ms): a@-e:3 -> /var/folders/r1/f0zrvz7j1g13ctyj83wh_dcw0000gn/T//_ruby_mjit_p27759u0.c
Successful MJIT finish


..
<2> expected but was
<1>.

```

But the issue seems be fixed with reproduction script shown in description.

```
$ ./ruby -v --disable-gems --jit-min-calls=3 --jit-wait  a.rb
ruby 2.6.6p134 (2020-03-18 revision 67845) +JIT [x86_64-darwin18]
Traceback (most recent call last):
        1: from a.rb:12:in `<main>'
a.rb:3:in `a': can't modify frozen A (FrozenError)
```

Should I just change the parameter for assert_eval_with_jit with `succesess_count: 1` instead of 2? 
kokubun-san can you take a look into it?

----------------------------------------
Bug #16139: setinstancevariable on MJIT may not check frozen flag
https://bugs.ruby-lang.org/issues/16139#change-84699

* Author: k0kubun (Takashi Kokubun)
* Status: Closed
* Priority: Normal
* Assignee: k0kubun (Takashi Kokubun)
* ruby -v: ruby 2.7.0dev (2019-09-03T12:12:31Z master beaabd2308) [x86_64-linux]
* Backport: 2.5: DONTNEED, 2.6: REQUIRED
----------------------------------------
```
class A
  def a
    @a = 1
  end
end

a = A.new
a.a
a.a
a.a
a.freeze
a.a
```

## without JIT
```
$ ruby --disable-gems a.rb
Traceback (most recent call last):
        1: from a.rb:12:in `<main>'
a.rb:3:in `a': can't modify frozen A: #<A:0x00005601af0b0430 @a=1> (FrozenError)
```

## with JIT
```
$ ruby --disable-gems --jit-min-calls=3 --jit-wait a.rb
```
(no error)



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>