Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting Gigantic EqualsNode into few Smaller Ones #6280

Merged
merged 23 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80fd070
Always try to resolve conversion for Any type
JaroslavTulach Apr 3, 2023
40cc46b
Make sure conversions fallback to Any for foreign objects and types
JaroslavTulach Apr 4, 2023
65e933e
Splitting the EqualsNode to two speeds the sieve benchmark
JaroslavTulach Apr 4, 2023
2e847e6
EqualsComplexNode shall in general delegate to simple EqualsNode
JaroslavTulach Apr 14, 2023
ca4d7b6
Comparing interop strings needs to be handled in EqualsNode
JaroslavTulach Apr 14, 2023
f6b43f7
Only when isPrimitive-ness differs we can conclude they aren't the same
JaroslavTulach Apr 14, 2023
e8a0c97
Dedicated node to compare atoms
JaroslavTulach Apr 14, 2023
6a9358a
Let HasCustomComparatorNode return the comparator to use
JaroslavTulach Apr 14, 2023
e45fc47
Merging with current develop branch
JaroslavTulach Apr 14, 2023
adb78d7
Delegate to custom comparators when they are provided
JaroslavTulach Apr 14, 2023
0195e6c
Treat InteropLibrary.isString as a primitive object
JaroslavTulach Apr 14, 2023
0d21a46
No need for InvokeAnyEqualsNode, EqualsNode handles all the cases
JaroslavTulach Apr 14, 2023
a30ab04
There should be no need for int, byte & co. specializations - such ty…
JaroslavTulach Apr 14, 2023
904055d
Implementing from conversion via Truffle nodes
JaroslavTulach Apr 14, 2023
1c69c34
Update engine/runtime/src/main/java/org/enso/interpreter/node/express…
JaroslavTulach Apr 14, 2023
dcd484b
Renaming to isNotPrimitive
JaroslavTulach Apr 14, 2023
a9787c6
Dropping Has and making CustomComparatorNode
JaroslavTulach Apr 15, 2023
1c7ac56
Define Any.== as a builtin
JaroslavTulach Apr 15, 2023
38ce191
test micro distribution has to use Any.== builtin
JaroslavTulach Apr 15, 2023
6a78062
Merging with changes on the develop branch
JaroslavTulach Apr 16, 2023
7c8730b
Convert interop values on the Enso boundary
JaroslavTulach Apr 16, 2023
04bdbff
Reverting no longer needed 2bf5256 as is builtin again
JaroslavTulach Apr 16, 2023
80eb323
Resolving conflicts with develop branch
JaroslavTulach Apr 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.enso.interpreter.runtime.error.WarningsLibrary;
import org.enso.interpreter.runtime.library.dispatch.TypesLibrary;
import org.enso.interpreter.runtime.scope.ModuleScope;
import org.enso.interpreter.runtime.state.State;

@GenerateUncached
public abstract class EqualsComplexNode extends Node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.enso.interpreter.runtime.callable.atom.Atom;
import org.enso.interpreter.runtime.callable.atom.AtomConstructor;
import org.enso.interpreter.runtime.data.text.Text;
import org.enso.interpreter.runtime.error.WarningsLibrary;
import org.enso.interpreter.runtime.number.EnsoBigInteger;

@BuiltinMethod(
Expand Down Expand Up @@ -73,11 +74,6 @@ boolean equalsBoolText(boolean self, Text other) {
return false;
}

@Specialization
boolean equalsByteByte(byte self, byte other) {
return self == other;
}

@Specialization
boolean equalsLongLong(long self, long other) {
return self == other;
Expand All @@ -88,11 +84,6 @@ boolean equalsLongBool(long self, boolean other) {
return false;
}

@Specialization
boolean equalsLongInt(long self, int other) {
return self == (long) other;
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
}

@Specialization
boolean equalsLongDouble(long self, double other) {
return (double) self == other;
Expand Down Expand Up @@ -122,11 +113,6 @@ boolean equalsDoubleBool(double self, boolean other) {
return false;
}

@Specialization
boolean equalsDoubleInt(double self, int other) {
return self == (double) other;
}

@Specialization
@TruffleBoundary
boolean equalsDoubleBigInt(double self, EnsoBigInteger other) {
Expand All @@ -138,21 +124,6 @@ boolean equalsDoubleText(double self, Text other) {
return false;
}

@Specialization
boolean equalsIntInt(int self, int other) {
return self == other;
}

@Specialization
boolean equalsIntLong(int self, long other) {
return (long) self == other;
}

@Specialization
boolean equalsIntDouble(int self, double other) {
return (double) self == other;
}

@Specialization
@TruffleBoundary
boolean equalsBigIntBigInt(EnsoBigInteger self, EnsoBigInteger otherBigInt) {
Expand Down Expand Up @@ -269,22 +240,26 @@ boolean equalsAtoms(Atom self, Atom other, @Cached EqualsAtomNode compare) {
return compare.execute(self, other);
}

@Specialization(guards = "isComplex(self, other, strings)")
@Specialization(guards = "isComplex(self, other, strings, warnings)")
boolean equalsComplex(
Object self, Object other,
@Cached EqualsComplexNode complex,
@CachedLibrary(limit = "10") InteropLibrary strings
@CachedLibrary(limit = "10") InteropLibrary strings,
@CachedLibrary(limit = "10") WarningsLibrary warnings
) {
return complex.execute(self, other);
}

static boolean isComplex(Object a, Object b, InteropLibrary strings) {
static boolean isComplex(Object a, Object b, InteropLibrary strings, WarningsLibrary warnings) {
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
if (a instanceof AtomConstructor && b instanceof AtomConstructor) {
return false;
}
if (a instanceof Atom && b instanceof Atom) {
return false;
}
if (warnings.hasWarnings(a) || warnings.hasWarnings(b)) {
return true;
}
return !isPrimitive(a, strings) && !isPrimitive(b, strings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testDateTimeEquality() {
public void testVectorsEquality() {
Object ensoVector =
unwrapValue(context, createValue(context, "[1,2,3]", "from Standard.Base.import all"));
Object javaVector = unwrapValue(context, context.asValue(List.of(1, 2, 3)));
Object javaVector = unwrapValue(context, context.asValue(List.of(1L, 2L, 3L)));
executeInContext(
context,
() -> {
Expand Down