enso/engine
Pavel Marek f02213ae2b
Enable splitting for EqualsSimpleNode (#9268)
Fixes the regression introduced by #9070 in `org.enso.benchmarks.generated.Collections.list_meta_fold` benchmark.

# Important Notes
As can be seen on the graph in IGV:
![image](https://github.com/enso-org/enso/assets/14013887/31b6ceca-4909-4a8f-987f-b456b3fb0a1b)
For some reason, `EqualsSimpleNode` is POLYMORPHIC. That seems to be the most visible performance problem.

First, I tried to introduce `ConditionProfile` with:
```diff
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsNode.java
index b368fb7fe..57274b37e 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsNode.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsNode.java
@@ -9,6 +9,7 @@ import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ArityException;
import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.profiles.ConditionProfile;
import org.enso.interpreter.dsl.AcceptsError;
import org.enso.interpreter.dsl.BuiltinMethod;
import org.enso.interpreter.node.EnsoRootNode;
@@ -46,6 +47,7 @@ public final class EqualsNode extends Node {
@Child private EqualsSimpleNode node;
@Child private TypeOfNode types;
@Child private WithConversionNode convert;
+  private final ConditionProfile equalsProfile = ConditionProfile.create();

private static final EqualsNode UNCACHED =
new EqualsNode(EqualsSimpleNodeGen.getUncached(), TypeOfNode.getUncached(), true);
@@ -85,7 +87,7 @@ public final class EqualsNode extends Node {
public boolean execute(
VirtualFrame frame, @AcceptsError Object self, @AcceptsError Object other) {
var areEqual = node.execute(frame, self, other);
-    if (!areEqual) {
+    if (!equalsProfile.profile(areEqual)) {
var selfType = types.execute(self);
var otherType = types.execute(other);
if (selfType != otherType) {

```
But that did not resolve the issue.

My second attempt was to enable splitting for `EqualsSimpleNode` with `@com.oracle.truffle.api.dsl.ReportPolymorphism` annotation, which seems to resolve the issue. The benchmark is back to its original score, and `EqualsSimpleNode` is no longer POLYMORPHIC.
2024-03-05 11:00:16 +00:00
..
interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
language-server Synchronize suggestions loading after the reconnect 2 (#9142) 2024-02-23 11:18:01 +00:00
launcher/src Drop inefficient SemVer implementation (#9089) 2024-02-22 09:59:09 +00:00
polyglot-api/src Add support for positionalArgumentsExpressions of text visualizations (#9052) 2024-02-13 23:08:30 +00:00
runner Drop inefficient SemVer implementation (#9089) 2024-02-22 09:59:09 +00:00
runtime Enable splitting for EqualsSimpleNode (#9268) 2024-03-05 11:00:16 +00:00
runtime-benchmarks/src/main Autoscoped constructors (#9190) 2024-03-04 11:41:02 +00:00
runtime-compiler/src/main Add ascription type information to suggestions database (#9267) 2024-03-05 09:02:41 +00:00
runtime-fat-jar/src/main/java Edits are processed in the order of submission (#8787) 2024-01-22 23:05:41 +00:00
runtime-instrument-common/src Synchronize suggestions loading after the reconnect 2 (#9142) 2024-02-23 11:18:01 +00:00
runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument Introducing engine/runtime-compiler project (#8197) 2023-11-01 12:42:34 +01:00
runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument Edits are processed in the order of submission (#8787) 2024-01-22 23:05:41 +00:00
runtime-integration-tests/src/test Add ascription type information to suggestions database (#9267) 2024-03-05 09:02:41 +00:00
runtime-language-arrow/src Arrow language (#8512) 2024-01-12 18:19:36 +00:00
runtime-language-epb/src Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
runtime-parser/src Autoscoped constructors (#9190) 2024-03-04 11:41:02 +00:00
runtime-test-instruments/src/main/java Binary operator resolution based on that value (#8779) 2024-01-27 08:38:47 +01:00
README.md Add a markdown style guide (#1022) 2020-07-21 13:59:40 +01:00

The Enso Engine

The Enso engine is the codebase responsible for compiling and executing Enso code, as well as providing language server functionality to users of the language. It is subdivided into two major components:

  • Language Server: The Enso language service.
  • Polyglot API: The truffle-boundary safe API for communication between the language server and the runtime.
  • Runner: The command-line interface for Enso.
  • Runtime: The compiler and interpreter for Enso.