mirror of
https://github.com/enso-org/enso.git
synced 2024-12-25 03:43:41 +03:00
891eef0f92
There is an Unsafe.set_atom_field operation in Standard library. That operation allows one to create an infinite data structure. Store following program in ones.enso: ``` import Standard.Base.IO import Standard.Base.Runtime.Unsafe type Gen type Empty type Generator a:Int tail:Gen ones : Gen ones = g = Generator 1 Empty Unsafe.set_atom_field g 1 g g main = IO.println here.ones ``` running such program then leads to (probably expectable) stack overflow exception: ``` Execution finished with an error: Resource exhausted: Stack overflow at <enso> Any.to_text(Internal) ... at <enso> Any.to_text(Internal) at <enso> Any.to_text(Internal) at <enso> Any.to_text(Internal) at <enso> IO.println(Internal) at <enso> g.main(g.enso:15:5-24) ``` However the bigger problem is that it also crashes our debugger. While producing guest Stack overflow when the guest program is running maybe OK, crashing the engine doesn't seem tolerable. Try: ``` enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --inspect --run ones.enso ``` and navigate Chrome dev tools to the line 11 as shown on the attached picture. Stepping over that line generates following error: ``` at org.enso.interpreter.runtime.callable.atom.Atom.toString(Atom.java:84) at org.enso.interpreter.runtime.callable.atom.Atom.lambda$toString$0(Atom.java:79) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ``` Stack overflow in the engine when computing `Atom.toString()` - I want to prevent that. # Important Notes I am able to see a stacktrace in the debugger and I can _step in_ and _step over_, @kustosz: ![image](https://user-images.githubusercontent.com/26887752/176626989-fdc2979e-f86c-42bc-a4df-c533cf7a4839.png) However there are extra items like `case_branch` which I'd like to avoid, would you know how to do that? |
||
---|---|---|
.. | ||
language-server | ||
launcher/src | ||
polyglot-api/src | ||
runner | ||
runtime | ||
runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument | ||
runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument | ||
runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument | ||
runtime-language-epb/src/main/java/org/enso/interpreter/epb | ||
runtime-with-instruments/src/test | ||
README.md |
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.