Skip to content

Commit c4ddf94

Browse files
committed
[Truffle] Add a new specialisation for Array#-, tons of extra specs pass.
1 parent 89b288b commit c4ddf94

File tree

13 files changed

+28
-29
lines changed

13 files changed

+28
-29
lines changed

core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,27 @@ public RubyArray subObjectIntegerFixnum(RubyArray a, RubyArray b) {
230230
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), sub, i);
231231
}
232232

233+
@Specialization
234+
public RubyArray sub(RubyArray a, RubyArray b) {
235+
notDesignedForCompilation();
236+
237+
final Object[] as = a.slowToArray();
238+
final Object[] bs = b.slowToArray();
239+
240+
final Object[] sub = new Object[a.getSize()];
241+
242+
int i = 0;
243+
244+
for (int n = 0; n < a.getSize(); n++) {
245+
if (!ArrayUtils.contains(bs, b.getSize(), as[n])) {
246+
sub[i] = as[n];
247+
i++;
248+
}
249+
}
250+
251+
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), sub, i);
252+
}
253+
233254
}
234255

235256
@CoreMethod(names = "*", minArgs = 1, maxArgs = 1, lowerFixnumParameters = 0)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
fails:The alias keyword operates on the object's metaclass when used in instance_eval
2-
fails:The alias keyword adds the new method to the list of public methods

spec/truffle/tags/language/class_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
fails:A class definition allows the declaration of class variables in a class method
2-
fails:An outer class definition contains the inner classes
32
fails(inherited):A class definition extending an object (sclass) allows accessing the block of the original scope
43
fails:A class definition extending an object (sclass) can use return to cause the enclosing method to return
54
fails:Reopening a class adds new methods to subclasses

spec/truffle/tags/language/constants_tags.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ fails:Module#public_constant marked constants in a class is defined? with A::B f
2929
fails:Literal (A::X) constant resolution with statically assigned constants searches a module included in the superclass
3030
fails:Constant resolution within methods with statically assigned constants searches a module included in the superclass
3131
fails:Literal (A::X) constant resolution with statically assigned constants searches a module included in the immediate class before the superclass
32-
fails:Constant resolution within methods with statically assigned constants searches a module included in the immediate class before the superclass
32+
fails:Constant resolution within methods with statically assigned constants searches a module included in the immediate class before the superclass
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
fails:A constant on a metaclass can be accessed via const_get
2-
fails:A constant on a metaclass cannot be accessed via object::CONST
32
fails:A constant on a metaclass raises a NameError for anonymous_module::CONST
43
fails(inherited):calling methods on the metaclass calls a method defined on the metaclass of the metaclass
5-
fails:A constant on a metaclass is not preserved when the object is duped
64
fails:A constant on a metaclass is not defined in the metaclass opener's scope
75
fails:self in a metaclass body (class << obj) raises a TypeError for numbers
86
fails:self in a metaclass body (class << obj) raises a TypeError for symbols
7+
fails:A constant on a metaclass is not preserved when the object is duped
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
fails(inherited):The DATA constant succeeds in locking the file DATA came from
2-
fails:The DATA constant does not exist when the main script contains no __END__
3-
fails:The DATA constant does not exist when an included file has a __END__

spec/truffle/tags/language/predefined_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fails:Global variable $" is read-only
3535
fails:Global variable $< is read-only
3636
fails:Global variable $FILENAME is read-only
3737
fails:Global variable $? is read-only
38-
fails:Global variable $? is thread-local
3938
fails:Global variable $-a is read-only
4039
fails:Global variable $-l is read-only
4140
fails:Global variable $-p is read-only

spec/truffle/tags/language/proc_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
fails:Regexps with back-references saves match data in the $~ pseudo-global variable
2-
fails:Regexps with back-references saves captures in numbered $[1-9] variables
31
fails:Regexps with back-references will not clobber capture variables across threads

spec/truffle/tags/language/regexp/encoding_tags.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ fails:Regexps with encoding modifiers supports /e (EUC encoding) with interpolat
33
fails:Regexps with encoding modifiers supports /e (EUC encoding) with interpolation /o
44
fails:Regexps with encoding modifiers uses EUC-JP as /e encoding
55
fails:Regexps with encoding modifiers preserves EUC-JP as /e encoding through interpolation
6-
fails:Regexps with encoding modifiers supports /n (No encoding) with interpolation
7-
fails:Regexps with encoding modifiers supports /n (No encoding) with interpolation /o
86
fails:Regexps with encoding modifiers uses US-ASCII as /n encoding if all chars are 7-bit
97
fails:Regexps with encoding modifiers uses ASCII-8BIT as /n encoding if not all chars are 7-bit
108
fails:Regexps with encoding modifiers preserves US-ASCII as /n encoding through interpolation if all chars are 7-bit
@@ -14,8 +12,9 @@ fails:Regexps with encoding modifiers supports /s (Windows_31J encoding) with in
1412
fails:Regexps with encoding modifiers supports /s (Windows_31J encoding) with interpolation and /o
1513
fails:Regexps with encoding modifiers uses Windows-31J as /s encoding
1614
fails:Regexps with encoding modifiers preserves Windows-31J as /s encoding through interpolation
17-
fails:Regexps with encoding modifiers supports /u (UTF8 encoding)
18-
fails:Regexps with encoding modifiers supports /u (UTF8 encoding) with interpolation
19-
fails:Regexps with encoding modifiers supports /u (UTF8 encoding) with interpolation and /o
2015
fails:Regexps with encoding modifiers uses UTF-8 as /u encoding
2116
fails:Regexps with encoding modifiers preserves UTF-8 as /u encoding through interpolation
17+
fails:Regexps with encoding modifiers supports /n (No encoding) with interpolation
18+
fails:Regexps with encoding modifiers supports /n (No encoding) with interpolation /o
19+
fails:Regexps with encoding modifiers supports /u (UTF8 encoding) with interpolation
20+
fails:Regexps with encoding modifiers supports /u (UTF8 encoding) with interpolation and /o

0 commit comments

Comments
 (0)