1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test
Eileen M. Uchitelle 2088a45798
[Bug ] Set leaf false on opt_setinlinecache ()
This change fixes the bug described in https://bugs.ruby-lang.org/issues/17880.

Checking `ractor_shareable_p` will cause the method to call back into
Ruby. Anything calling this method can't be a leaf instruction,
otherwise it could crash. By adding `attr bool leaf = false` we no
longer crash because it marks the function as not a leaf.

Here's a simplified reproduction script:

```ruby
require "set"

class Id
  attr_reader :db_id
  def initialize(db_id)
    @db_id = db_id
  end

  def ==(other)
    other.class == self.class && other.db_id == db_id
  end
  alias_method :eql?, :==

  def hash
    10
  end

  def <=>(other)
    db_id <=> other.db_id if other.is_a?(self.class)
  end
end

class Namespace
  IDS = Set[
    Id.new(1).freeze,
    Id.new(2).freeze,
    Id.new(3).freeze,
    Id.new(4).freeze,
  ].freeze

  class << self
    def test?(id)
      IDS.include?(id)
    end
  end
end

p Namespace.test?(Id.new(1))
p Namespace.test?(Id.new(5))
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-14 17:34:57 -07:00
..
-ext-
base64
benchmark
bigdecimal
cgi
coverage
csv
date
did_you_mean
digest
drb
dtrace
erb
etc
excludes
fiber Suppress exception report in inner thread 2021-06-15 00:03:05 +09:00
fiddle [ruby/fiddle] Do not use a libdir for glibc, it breaks Linux PPC64 () 2021-05-18 12:48:40 +09:00
fileutils
fixtures/fake_sorted_set_gem
io
irb Set USE_COLORIZE to the default value in a test 2021-05-24 12:13:46 +09:00
json
lib Revert an accidentally commits at df86a13cc1 2021-05-17 15:28:47 +09:00
logger
mkmf
monitor Fix Monitor to lock per Fiber, like Mutex [Bug ] 2021-04-27 18:42:50 +02:00
net Promote net-smtp to the bundled gems 2021-05-27 14:42:11 +09:00
nkf
objspace test/objspace/test_objspace.rb: check stderr before stdout 2021-05-14 18:07:58 +09:00
open-uri Guard for the ftp protocol feature of OpenURI 2021-05-27 14:42:11 +09:00
openssl Defer to require prime for OpenSSL::TestBN 2021-05-27 14:42:11 +09:00
optparse [ruby/optparse] Add EditorConfig file 2021-04-28 11:56:15 +09:00
ostruct [lib/ostruct] Fix YAML test 2021-06-14 12:28:53 -04:00
pathname
psych [ruby/psych] Fix the test that does not work with libyaml-0.1.7 2021-06-08 08:12:27 +09:00
racc
rdoc [ruby/rdoc] Add an alias for test-unit with older versions of RubyGems 2021-06-02 11:35:45 +09:00
readline
reline
resolv Removed minitest/mock 2021-05-19 14:24:01 +09:00
rinda
ripper ripper: wrap endless method in bodystmt [Bug ] 2021-05-21 18:28:24 +09:00
ruby [Bug ] Set leaf false on opt_setinlinecache () 2021-06-14 17:34:57 -07:00
rubygems [rubygems/rubygems] Rename test/rubygems/test_{case,utilities}.rb to avoid "test_" prefix 2021-06-03 12:23:22 +09:00
socket Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661] 2021-05-21 18:26:07 +09:00
stringio
strscan [ruby/strscan] Fix segmentation fault of StringScanner#charpos when String#byteslice returns non string value [Bug ] () 2021-05-06 16:20:38 +09:00
syslog
uri [ruby/uri] Add tests for URI::RFC{2396,3986}_Parser#inspect 2021-04-22 14:54:37 +09:00
win32ole
yaml
zlib
runner.rb
test_abbrev.rb
test_delegate.rb
test_extlibs.rb
test_find.rb
test_forwardable.rb
test_ipaddr.rb
test_mutex_m.rb
test_observer.rb
test_open3.rb
test_pp.rb
test_prettyprint.rb
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb
test_set.rb
test_shellwords.rb
test_singleton.rb
test_sorted_set.rb
test_syslog.rb
test_tempfile.rb
test_time.rb
test_timeout.rb [ruby/timeout] Make Timeout::Error#exception with multiple arguments not ignore arguments 2021-05-06 16:49:26 +09:00
test_tmpdir.rb
test_trick.rb
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb