Skip to content

Commit 5d68364

Browse files
committed
Rename Primitive.object_equal to Primitive.equal?
1 parent 969e184 commit 5d68364

27 files changed

+59
-59
lines changed

lib/mri/monitor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def initialize(...)
241241
# Initializes the MonitorMixin after being included in a class or when an
242242
# object has been extended with the MonitorMixin
243243
def mon_initialize
244-
if defined?(@mon_mutex) && Primitive.object_equal(@mon_mutex_owner_object, self)
244+
if defined?(@mon_mutex) && Primitive.equal?(@mon_mutex_owner_object, self)
245245
raise ThreadError, 'already initialized'
246246
end
247247
@mon_mutex = Thread::Mutex.new

lib/truffle/truffle/cext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ def rb_protect(function, arg, write_status, status)
10591059
res = Truffle::Interop.execute_without_conversion(function, arg)
10601060
end
10611061

1062-
unless Primitive.object_equal(nil, e)
1062+
unless Primitive.equal?(nil, e)
10631063
store_exception(e)
10641064
pos = extract_tag(e)
10651065
Primitive.thread_set_exception(extract_ruby_exception(e))

src/main/java/org/truffleruby/core/support/TypeNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ protected RubyClass classOf(Object object,
103103
}
104104
}
105105

106-
@Primitive(name = "object_equal")
107-
public abstract static class ObjectEqualNode extends PrimitiveArrayArgumentsNode {
106+
@Primitive(name = "equal?")
107+
public abstract static class EqualPrimitiveNode extends PrimitiveArrayArgumentsNode {
108108
@Specialization
109-
protected boolean objectEqual(Object a, Object b,
109+
protected boolean equal(Object a, Object b,
110110
@Cached ReferenceEqualNode referenceEqualNode) {
111111
return referenceEqualNode.executeReferenceEqual(a, b);
112112
}

src/main/ruby/truffleruby/core/argf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ARGFClass
5959
# @see #advance!
6060
#
6161
def initialize(argv = ARGV, *others)
62-
@argv = Primitive.object_equal(argv, ARGV) ? ARGV : [argv, *others]
62+
@argv = Primitive.equal?(argv, ARGV) ? ARGV : [argv, *others]
6363
@lineno = 0
6464
# Setting $. sets ARGF.last_lineno, but does not set
6565
# ARGF.lineno, Almost every operation that sets lineno also sets

src/main/ruby/truffleruby/core/array.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def -(other)
8484

8585
def <=>(other)
8686
other = Truffle::Type.rb_check_convert_type other, Array, :to_ary
87-
return 0 if Primitive.object_equal(self, other)
87+
return 0 if Primitive.equal?(self, other)
8888
return nil if Primitive.nil? other
8989

9090
total = other.size
@@ -125,7 +125,7 @@ def ==(other)
125125
return result
126126
end
127127

128-
return true if Primitive.object_equal(self, other)
128+
return true if Primitive.equal?(self, other)
129129
unless Primitive.is_a?(other, Array)
130130
return false unless other.respond_to? :to_ary
131131
return other == self
@@ -381,7 +381,7 @@ def eql?(other)
381381
return result
382382
end
383383

384-
return true if Primitive.object_equal(self, other)
384+
return true if Primitive.equal?(self, other)
385385
return false unless Primitive.is_a?(other, Array)
386386
return false if size != other.size
387387

src/main/ruby/truffleruby/core/comparable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
module Comparable
3030
def ==(other)
31-
return true if Primitive.object_equal(self, other)
31+
return true if Primitive.equal?(self, other)
3232

3333
return false if Truffle::ThreadOperations.detect_pair_recursion(self, other) do
3434
unless comp = (self <=> other)

src/main/ruby/truffleruby/core/complex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def rationalize(eps = nil)
268268
def to_s
269269
result = real.to_s
270270

271-
if imag < 0 || Primitive.object_equal(imag, -0.0)
271+
if imag < 0 || Primitive.equal?(imag, -0.0)
272272
result << '-'
273273
else
274274
result << '+'

src/main/ruby/truffleruby/core/dir.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def glob(pattern, flags = 0, base: nil, sort: true, &block)
266266

267267
matches = []
268268
index = 0
269-
flags |= File::FNM_GLOB_NOSORT if Primitive.object_equal(sort, false)
269+
flags |= File::FNM_GLOB_NOSORT if Primitive.equal?(sort, false)
270270

271271
normalized_base = if Primitive.nil? base
272272
nil

src/main/ruby/truffleruby/core/env.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def rehash
243243
end
244244

245245
def replace(other)
246-
return self if Primitive.object_equal(self, other)
246+
return self if Primitive.equal?(self, other)
247247
other = Truffle::Type.rb_convert_type(other, Hash, :to_hash)
248248
keys_to_delete = keys
249249
other.each do |k, v|
@@ -295,7 +295,7 @@ def to_h
295295
end
296296

297297
def update(other)
298-
return self if Primitive.object_equal(self, other)
298+
return self if Primitive.equal?(self, other)
299299
other = Truffle::Type.rb_convert_type(other, Hash, :to_hash)
300300
if block_given?
301301
other.each do |k, v|

src/main/ruby/truffleruby/core/exception.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class << self
8787

8888
def exception(message = nil)
8989
# As strange as this may seem, this is actually the protocol that CRuby implements
90-
if message and !Primitive.object_equal(message, self)
90+
if message and !Primitive.equal?(message, self)
9191
copy = clone # note: rb_obj_clone() in CRuby
9292
Primitive.exception_set_message copy, message
9393
copy
@@ -99,7 +99,7 @@ def exception(message = nil)
9999
def self.to_tty?
100100
# Whether $stderr refers to the original STDERR and STDERR is a tty.
101101
# When using polyglot stdio, we cannot know and assume false.
102-
Primitive.object_equal($stderr, STDERR) && !STDERR.closed? &&
102+
Primitive.equal?($stderr, STDERR) && !STDERR.closed? &&
103103
(!Truffle::Boot.get_option('polyglot-stdio') && STDERR.tty?)
104104
end
105105
end
@@ -282,7 +282,7 @@ def self.new(*args)
282282
#
283283
# Otherwise it's called on a Errno subclass and just helps setup
284284
# a instance of the subclass
285-
if Primitive.object_equal(self, SystemCallError)
285+
if Primitive.equal?(self, SystemCallError)
286286
case args.size
287287
when 1
288288
if Primitive.is_a?(args.first, Integer)
@@ -326,7 +326,7 @@ def self.new(*args)
326326

327327
if defined?(self::Errno) && Primitive.is_a?(self::Errno, Integer)
328328
error = SystemCallError.errno_error(self, message, self::Errno, location)
329-
if error && Primitive.object_equal(Primitive.object_class(error), self)
329+
if error && Primitive.equal?(Primitive.object_class(error), self)
330330
return error
331331
end
332332
end

0 commit comments

Comments
 (0)