Skip to content

Commit

Permalink
Remove Rubinius-related code
Browse files Browse the repository at this point in the history
* Fixes #972
  • Loading branch information
eregon committed Dec 21, 2022
1 parent 6beb332 commit 6e3821b
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please fill following if applicable, delete otherwise: -->
```
* Operating system: linux / mac / win
* Ruby implementation: Ruby / JRuby / TruffleRuby / Rubinius
* Ruby implementation: Ruby / JRuby / TruffleRuby
* `concurrent-ruby` version: x.y.z
* `concurrent-ruby-ext` installed: yes / no
* `concurrent-ruby-edge` used: yes / no
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ You can also get started by triaging issues which may include reproducing bug re
## Thread Safety

*Concurrent Ruby makes one of the strongest thread safety guarantees of any Ruby concurrency
library, providing consistent behavior and guarantees on all four of the main Ruby interpreters
(MRI/CRuby, JRuby, Rubinius, TruffleRuby).*
library, providing consistent behavior and guarantees on all three main Ruby interpreters
(MRI/CRuby, JRuby, TruffleRuby).*

Every abstraction in this library is thread safe. Specific thread safety guarantees are documented
with each abstraction.
Expand All @@ -58,9 +58,9 @@ other Ruby library, many of which support the mantra of
Concurrent Ruby is also the only Ruby library which provides a full suite of thread safe and
immutable variable types and data structures.

We've also initiated discussion to document [memory model](docs-source/synchronization.md) of Ruby which
would provide consistent behaviour and guarantees on all four of the main Ruby interpreters
(MRI/CRuby, JRuby, Rubinius, TruffleRuby).
We've also initiated discussion to document the [memory model](docs-source/synchronization.md) of Ruby which
would provide consistent behaviour and guarantees on all three main Ruby interpreters
(MRI/CRuby, JRuby, TruffleRuby).

## Features & Documentation

Expand Down Expand Up @@ -263,9 +263,6 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
* Latest JRuby 9000
* Latest TruffleRuby

The legacy support for Rubinius is kept for the moment but it is no longer maintained and is liable to be removed. If you would like to help
please respond to [#739](https://github.com/ruby-concurrency/concurrent-ruby/issues/739).

## Usage

Everything within this gem can be loaded simply by requiring it:
Expand Down
10 changes: 0 additions & 10 deletions lib/concurrent-ruby/concurrent/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ class JRubyArray < ::Array
end
JRubyArray

when Concurrent.on_rbx?
require 'monitor'
require 'concurrent/thread_safe/util/data_structures'

class RbxArray < ::Array
end

ThreadSafe::Util.make_synchronized_on_rbx RbxArray
RbxArray

when Concurrent.on_truffleruby?
require 'concurrent/thread_safe/util/data_structures'

Expand Down
16 changes: 0 additions & 16 deletions lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,6 @@ class TruffleRubyAtomicReference < TruffleRuby::AtomicReference
alias_method :swap, :get_and_set
end
TruffleRubyAtomicReference
when Concurrent.on_rbx?
# @note Extends `Rubinius::AtomicReference` version adding aliases
# and numeric logic.
#
# @!visibility private
# @!macro internal_implementation_note
class RbxAtomicReference < Rubinius::AtomicReference
alias_method :_compare_and_set, :compare_and_set
include AtomicDirectUpdate
include AtomicNumericCompareAndSetWrapper
alias_method :value, :get
alias_method :value=, :set
alias_method :swap, :get_and_set
alias_method :compare_and_swap, :compare_and_set
end
RbxAtomicReference
else
MutexAtomicReference
end
Expand Down
9 changes: 0 additions & 9 deletions lib/concurrent-ruby/concurrent/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ class JRubyHash < ::Hash
end
JRubyHash

when Concurrent.on_rbx?
require 'monitor'
require 'concurrent/thread_safe/util/data_structures'

class RbxHash < ::Hash
end
ThreadSafe::Util.make_synchronized_on_rbx RbxHash
RbxHash

when Concurrent.on_truffleruby?
require 'concurrent/thread_safe/util/data_structures'

Expand Down
14 changes: 8 additions & 6 deletions lib/concurrent-ruby/concurrent/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ module Collection
when Concurrent.on_cruby?
require 'concurrent/collection/map/mri_map_backend'
MriMapBackend
when Concurrent.on_truffleruby? && defined?(::TruffleRuby::ConcurrentMap)
require 'concurrent/collection/map/truffleruby_map_backend'
TruffleRubyMapBackend
when Concurrent.on_truffleruby? || Concurrent.on_rbx?
require 'concurrent/collection/map/atomic_reference_map_backend'
AtomicReferenceMapBackend
when Concurrent.on_truffleruby?
if defined?(::TruffleRuby::ConcurrentMap)
require 'concurrent/collection/map/truffleruby_map_backend'
TruffleRubyMapBackend
else
require 'concurrent/collection/map/atomic_reference_map_backend'
AtomicReferenceMapBackend
end
else
warn 'Concurrent::Map: unsupported Ruby engine, using a fully synchronized Concurrent::Map implementation'
require 'concurrent/collection/map/synchronized_map_backend'
Expand Down
10 changes: 0 additions & 10 deletions lib/concurrent-ruby/concurrent/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ class JRubySet < ::Set

JRubySet

when Concurrent.on_rbx?
require 'monitor'
require 'concurrent/thread_safe/util/data_structures'

class RbxSet < ::Set
end

ThreadSafe::Util.make_synchronized_on_rbx RbxSet
RbxSet

when Concurrent.on_truffleruby?
require 'concurrent/thread_safe/util/data_structures'

Expand Down
2 changes: 0 additions & 2 deletions lib/concurrent-ruby/concurrent/synchronization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

require 'concurrent/synchronization/mri_object'
require 'concurrent/synchronization/jruby_object'
require 'concurrent/synchronization/rbx_object'
require 'concurrent/synchronization/truffleruby_object'
require 'concurrent/synchronization/object'
require 'concurrent/synchronization/volatile'

require 'concurrent/synchronization/abstract_lockable_object'
require 'concurrent/synchronization/mutex_lockable_object'
require 'concurrent/synchronization/jruby_lockable_object'
require 'concurrent/synchronization/rbx_lockable_object'

require 'concurrent/synchronization/lockable_object'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module Synchronization
MutexLockableObject
when Concurrent.on_jruby?
JRubyLockableObject
when Concurrent.on_rbx?
RbxLockableObject
when Concurrent.on_truffleruby?
MutexLockableObject
else
Expand Down
2 changes: 0 additions & 2 deletions lib/concurrent-ruby/concurrent/synchronization/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module Synchronization
MriObject
when Concurrent.on_jruby?
JRubyObject
when Concurrent.on_rbx?
RbxObject
when Concurrent.on_truffleruby?
TruffleRubyObject
else
Expand Down

This file was deleted.

49 changes: 0 additions & 49 deletions lib/concurrent-ruby/concurrent/synchronization/rbx_object.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/concurrent-ruby/concurrent/synchronization/volatile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module Synchronization
MriAttrVolatile
when Concurrent.on_jruby?
JRubyAttrVolatile
when Concurrent.on_rbx?
RbxAttrVolatile
when Concurrent.on_truffleruby?
TruffleRubyAttrVolatile
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,7 @@ module Util
# @!visibility private
module CheapLockable
private
if Concurrent.on_rbx?
# Making use of the Rubinius' ability to lock via object headers to avoid the overhead of the extra Mutex objects.
def cheap_synchronize
Rubinius.lock(self)
begin
yield
ensure
Rubinius.unlock(self)
end
end

def cheap_wait
wchan = Rubinius::Channel.new

begin
waiters = @waiters ||= []
waiters.push wchan
Rubinius.unlock(self)
signaled = wchan.receive_timeout nil
ensure
Rubinius.lock(self)

unless signaled or waiters.delete(wchan)
# we timed out, but got signaled afterwards (e.g. while waiting to
# acquire @lock), so pass that signal on to the next waiter
waiters.shift << true unless waiters.empty?
end
end

self
end

def cheap_broadcast
waiters = @waiters ||= []
waiters.shift << true until waiters.empty?
self
end
elsif Concurrent.on_jruby?
if Concurrent.on_jruby?
# Use Java's native synchronized (this) { wait(); notifyAll(); } to avoid the overhead of the extra Mutex objects
require 'jruby'

Expand Down
37 changes: 0 additions & 37 deletions lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,43 +37,6 @@ def #{method}(*args)
end
end

def self.make_synchronized_on_rbx(klass)
klass.class_eval do
private

def _mon_initialize
@_monitor ||= Monitor.new # avoid double initialisation
end

def self.new(*args)
obj = super(*args)
obj.send(:_mon_initialize)
obj
end
end

klass.superclass.instance_methods(false).each do |method|
case method
when :new_range, :new_reserved
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args)
obj = super
obj.send(:_mon_initialize)
obj
end
RUBY
else
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args)
monitor = @_monitor
monitor or raise("BUG: Internal monitor was not properly initialized. Please report this to the concurrent-ruby developers.")
monitor.synchronize { super }
end
RUBY
end
end
end

def self.make_synchronized_on_truffleruby(klass)
klass.superclass.instance_methods(false).each do |method|
klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
Expand Down
Loading

0 comments on commit 6e3821b

Please sign in to comment.