Commit Graph

1455 Commits

Author SHA1 Message Date
Jaroslav Tulach
c3456ad2df
Eliminate Blanks inside of Type.Ascription (#11155) 2024-09-24 08:57:27 +02:00
Jaroslav Tulach
c6d18576cc
Initialize Enso Terminal in a background thread (#11149) 2024-09-24 08:56:13 +02:00
Jaroslav Tulach
f05997d58c
Removing serialization metadata (#11128) 2024-09-19 15:44:42 +02:00
Jaroslav Tulach
37688033c8
Don't convert type to the same type (#11122) 2024-09-18 18:15:58 +02:00
Hubert Plociniczak
862100c7c0
More info when we fail to log AssertError (#11113)
Motivation:
```
Caused by: java.lang.AssertionError: No polyglot context is entered. A language or context reference must not be used if there is no polyglot context entered.
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals.assertValidGet(PolyglotFastThreadLocals.java:481)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals$ContextReferenceImpl.get(PolyglotFastThreadLocals.java:513)
 	at org.enso.runtime/org.enso.interpreter.runtime.EnsoContext.get(EnsoContext.java:246)
	at org.enso.runtime/org.enso.interpreter.runtime.error.PanicException.computeMessage(PanicException.java:90)
```
2024-09-17 23:20:14 +02:00
Dmitry Bushev
9179dff89f
Move execution environment from State to EnsoContext (#11075)
related #10719

Changelog:
- refactor: move execution environment from `State` to `EnsoContext`
2024-09-17 20:50:03 +00:00
Dmitry Bushev
8e0095e1f8
Stack Overflow Error not shown in GUI (#11064)
close #8648

Changelog:
- update: handle null messages in execution exceptions
2024-09-17 18:43:35 +00:00
Hubert Plociniczak
031300dfb3
Don't NPE when Throwable is missing message (#11102)
Looks like `Throwable` thrown by the execution may be missing a message,
which later crashes when we want to send it over the wire.
Added some guards to prevent NPE.
2024-09-17 16:37:38 +02:00
Pavel Marek
3dd0fb95ae
Better error message for unresolved symbol (#11008)
* Add failing tests

* ExtensiomMethod resolution in the current module might be an error in GlobalNames

* Add another successful test

* Fix compilation error test

* Fix compilation of RedShift_Spec - `setup` is provided in compile scope
2024-09-17 15:38:31 +02:00
Jaroslav Tulach
f2a809c4e1
Avoid dependency on org.graalvm.collections (#11107)
I am trying to compile Enso with GraalVM 24.2.0 snapshot to verify that https://github.com/oracle/graal/pull/8266 changes would work for Enso. Among the problems I am facing is a dependency on `org.graalvm.collections` because of using `Pair`. I don't think we need such dependency. Let's avoid it by using our own `record` with two components.
2024-09-17 11:25:18 +00:00
Jaroslav Tulach
a6fbdb11ce
Avoid using assert in Scala, use assertInJvm to elide it in production (#11027)
Fixes #11022 and in general fixes #5787 by avoiding calls to Scala's `assert` function and using regular one written in Java that uses `assert` keyword and is thus sensitive to `-ea` command line option of the JVM. Use `assertInJvm` in newly written Scala code to get typical JVM behavior on `assert`.
2024-09-16 06:32:47 +00:00
Dmitry Bushev
e77a6067a0
Fix cached method pointers in expression updates (#11060)
close #11028

Changelog:
- update: hide cached method pointer info in expression updates of evaluated values

# Important Notes
https://github.com/user-attachments/assets/861bb2c8-7613-4fcf-a976-0e37acff4ec0
2024-09-13 11:02:30 +00:00
Dmitry Bushev
bea9e068b4
Remove pool of FileManager actors (#11036)
close #10970

Changelog:
- remove: FileManager actors pool

Language Server executes IO on a separate thread pool for blocking operations and does not block the actor
2024-09-11 08:15:54 +00:00
Jaroslav Tulach
8b5c6338f7
Log details when to_display_text invocation fails (#11025)
Closes #10770 by dumping out more information when `to_display_text` invocations fails.
2024-09-11 03:18:06 +00:00
Dmitry Bushev
ab0a5e0c36
Improve the speed of preorder operation on IR (#11019)
close #10537

Changelog:
- add: implement `IR.preorder` method with callback
- update: update `IR.preorder` method usages

# Important Notes
Shows ~10% speed improvement during the compilation
2024-09-10 14:47:50 +00:00
Hubert Plociniczak
62e15696ec
Re-compile module if IdMap is present (#11032)
Loading IR caches and IdMap for a module don't play very well. Rather
than complicating logic and introducing yet another re-compilation
request let's not even attempt to deserialize a module if IdMap is
present. The cost of compiling a single module (right now containing the
project itself) is negligble, compared to a possibility of bugs that
we've encountered so far.
2024-09-10 16:24:57 +02:00
Jaroslav Tulach
93252ee358
Avoid AliasAnalysis for Hello_World.enso (#10996) 2024-09-09 14:21:22 +02:00
Pavel Marek
19ff2a2bb7
Prepare for JPMS - rename packages (#10974)
* Rename packages in logging-utils-akka

* Migrate buildInfo to Java

* Rename packages in logging

* Rename package in scala-yaml

* No usage of CompilerDirectives inside pkg

* log errors of initialization of directory watcher

* HashCodeNode does not use com.google.common.base.Objects

* Rename rest of the packages

* fmt

* Fix dependencies on version-output

* Add necessary dependencies to testkit

* Rename instruments in runtime-fat-jar module-info

* Fix compilation errors because of BuildVersion

* Fix logger renames

* Use java.util.List directly

* Fixes after merge

* Improve error message in NativeLauncherSpec

* Fix logger renames

* Fix json version formatting

* Revert "No usage of CompilerDirectives inside pkg"

This reverts commit cc7e078416.

* fmt
2024-09-06 10:27:59 +02:00
Dmitry Bushev
6c80f8f05e
Clear caches from the runtime hook (#10954)
close #10897

Changelog:
- add: implement `RuntimeHooks` to defer some logic until the program execution happens.
2024-09-05 17:15:13 +00:00
Jaroslav Tulach
2fc553065f
Get ready for python and js being optional when running test/Base_Tests (#10975)
Let's modify the `Base_Tests` to be able to succeed without JavaScript being installed - **done** in 3298b07dca
2024-09-05 13:00:44 +00:00
Jaroslav Tulach
d37b8f3786
Provide names of local variables via FramePointerAnalysis (#10906) 2024-09-05 10:02:35 +02:00
Hubert Plociniczak
8b30998afb
Reduce akka logs in PM and LS (#10967)
* Reduce akka logs in PM and LS

After #10905 we suddenly got a lot of (useless) logs from akka in
project-manager and language-server. After some investigation it turned
out that akka-typed had a special configuration to enable logging in
akka using slf4j.
As we don't need the whole library for that I only stole the
configuration.

* nit

* licensing

* missing license files
2024-09-04 16:58:21 +02:00
Hubert Plociniczak
ca2ab1ee02
Re-enable IR caching in Language Server (#10960)
* Re-enable IR caching in Language Server

When an IR loaded from cache is being run through the same passes,
"interesting" errors may happen. We must ensure that IR is not run
through phases that have already done their transformations.

With this change, I'm no longer seeing failures after project startup.

* resetScope is also obsolete

* address PR review
2024-09-04 16:44:37 +02:00
Dmitry Bushev
bc3ab2c7e1
Allow empty body blocks with comments (#10969)
close #10849

Changelog:
- update: empty body blocks return an `Empty` node resulting in `Nothing`
2024-09-04 11:51:15 +00:00
Hubert Plociniczak
124147d1c0
Temporary workaround for #10921 (#10931)
Disabling caching as it seems that loading BindingsMap breaks things.
2024-08-30 18:10:25 +01:00
Hubert Plociniczak
1e6e69b539
Akka-related startup improvements (#10905)
* Akka-related startup improvements

Realized that Akka Typed and Spray were not used **at all** yet there
were in the list of dependencies.
Additionally, the former would also show up in the list of Akka's
library-extensions, initialized on startup.

* Hardcode list of library extensions

Hardcoding a list of library extensions is not recommended but I don't
see any other way of disabling expensive Serialization extension, which
we don't seem to use anyway.

* fmt

* licensing update
2024-08-29 20:43:37 +02:00
Jaroslav Tulach
339c275338
Benchmark and speed processing of polyglot java imports up (#10899) 2024-08-29 17:20:53 +02:00
Jaroslav Tulach
1500849c32
When there are no pendingItems for a KEEP_ALIVE period, stop RequestQueue observer thread (#10890) 2024-08-27 10:10:07 +02:00
Jaroslav Tulach
e9d3f59a91
Speeding up RuntimeVisualizationsTest by one minute (#10891) 2024-08-24 11:18:02 +02:00
Jaroslav Tulach
b6f0675563
IO.print without new line (#10858) 2024-08-24 07:00:16 +02:00
Hubert Plociniczak
7dc48b390e
Enable IR caches in Language Server (#10880) 2024-08-23 21:32:09 +00:00
Dmitry Bushev
09722b36dc
Provide missing arguments when stepping into a function (#10879)
close #10792

Changelog:
- update: replace missing arguments with `Nothing` when schedule a function execution in interactive mode
2024-08-23 19:13:58 +00:00
Hubert Plociniczak
3d23e22c6f
Ensure execution is scheduled after compilation (#10883)
Scheduling of jobs is asynchronous and nothing prevents it from scheduling execution before compilation leading to stale nodes in GUI. The scenario is easily reproducible by adding a `Thread.sleep` before `EnsureCompiledJob` requests compilation locks.

This change ensures that execution is only scheduled after compilation is finished, when an edit request is being processed.

# Important Notes
This fix was prompted by me getting random stale nodes after edits:
![Screenshot from 2024-08-23 16-53-26](https://github.com/user-attachments/assets/2b017539-c4bf-4d42-b597-216d887a4f4c)
(it would never recover unless another edit was made)
2024-08-23 18:18:59 +00:00
Dmitry Bushev
3bfe963e32
Lazy Diagnostic storage allocation (#10852)
close #10727



Changelog:
- add: implement lazy allocation of `DiagnosticStorage` objects
- update: compiler phases to make sure they don't allocate redundant `DiagnosticStorage` objects
- update: cleanup `DiagnosticStorage` class

# Important Notes
As a result, all 10MB of redundant `DiagnosticStorage` allocations are gone

#### Before
![2024-08-21-170148_2092x171_scrot](https://github.com/user-attachments/assets/c1fd34d5-019d-472f-b523-a5c31b87f454)

#### After
![2024-08-21-170058_1693x131_scrot](https://github.com/user-attachments/assets/10d71d81-42b7-4b3c-a49f-ca6267bc6ccf)
2024-08-23 17:48:25 +00:00
Hubert Plociniczak
6b0194c98b
Ensure clients get write capability (#10872)
When Ydoc requests to open file and encounters a timeout, it will
attempt to retry the request. At least that's the behaviour since
 #10787.
Unfortunately, the write lock on the file might be already held and
identified by the client id and actor reference. The latter is always
determined by the request and therefore spurious. The same client should
always be given the same capability, even on retries.
2024-08-22 18:45:14 +02:00
Hubert Plociniczak
a65383a47b
Avoid copying IR nodes when no change is performed in passes (#10839)
* Reduce amount of IR copying

This PR ensures that we only perform IR copying when actually needed,
i.e. when one of the fields has changed.
Most of the changes should not be controversial except for equality
change in MetadataStorage. Without it, an empty pass metadata would be
treated as equal, therefore preventing duplication from happening.

* fmt

* missed a few spots

* Optimizations to copying

Avoid expensive computations for static methods.

* Avoid unnecessary unapply calls
2024-08-21 18:20:03 +02:00
Jaroslav Tulach
e5f865f1df
Print out warnings associated with local variables (#10842)
Fixes #9749 by:
- [x] Adding `fn` option to `enso-debug-server` instrument - eb3b76e
- [x] Print warnings (if any) to stderr - 4fda04b
- [x] Improving output of `:list` to print out warnings - dbe3c45480
- [x] Print errors to stderr - 1312546
- [x] Exiting on `DataflowError` - 2cc7ef5 and e6fbf73
- [x] Using all of that inside of `runner/*Main` - 7df58ef

The core of the change is in instrumentation that wraps the `main` method and at its end checks for _warnings or errors_ among local variables. When an error is found, it wraps the original return value of `main` with a proxy that delegates to the original value, but also pretends to be _exit exception_ with exit code 173. That one is detected in `Main` launcher to exit the process with exit code 173.

# Important Notes
As a side-effect of this change, one can request an invocation of REPL at the end of any method just by providing a property to the VM:
```bash
$ enso --vm.D=polyglot.enso-debug-server.method-break-point=err_test.main --run err_test.enso --repl
```
stops at the end of `main` method of `err_test.enso` file.
2024-08-21 07:00:54 +00:00
Jaroslav Tulach
384e01903a
Delay loading of AliasAnalysis data (#10837)
Continuation of #10729 and a step towards #10833 to actually speed things up by 10% by delaying loading of `AliasAnalysis` data.
2024-08-19 09:33:05 +00:00
Pavel Marek
53e99809e2
Store FramePointer in IR (#10729)
* Add stub of FramePointerAnalysis pass

* Add stub of FramePointerAnalysisTest

* Add more framepointer tests

* FramePointer has constructor for better debugging

* Update tests - FramePointer metadata is also in Info.Def

* FramePointerAnalysis traverses the whole IR.

* Fix test - check for metadata

* Reorder methods in FramePointerAnalysis

* Fix argument processing

* Improve some toString methods for debugging

* Fix parent levels in tests

* FramePointerAnalysis does not copy IRs

* FramePointerAnalysis metadata is Persistable

* FramePointerAnalysis attaches metadata to atom constructors

* Synthetic self argument is handled specially

* IRDumperPass is run as the last compiler pass

This ensure that one can see all the metadata on the IR.

* IRDumper can dump alias analysis metadata

* FramePointerMeta has meaningful toString

* FramePointerAnalysis process case expressions

* Fix javadoc links

* FramePointer is attached to GenericAnnotation expression

* IRDumper handles case type patterns

* FramePointer is attached to argument default value expressions

* Add test for default argument value metadata

* Attach frame pointer to default value expressions even if they have no alias graph

* FramePointerAnalysis can run inline on expression

* Fixes after rebase

* Fix annotation processing

* Add tests for no frame pointers on global symbol usages

* Do not use AliasAnalysis in IrToTruffle.

Also refactor NameResolutionAlgorithm to not use AliasMetadata

* Remove unused methods from LocalScope

* Remove unused import

* fmt

* Fix scala.MatchError for case patterns

* Do not use absolute code locations in the test.

Test on Windows fails because of different length of new lines.
2024-08-16 14:28:37 +02:00
Jaroslav Tulach
8e765953a4
Detect outdated launcher (#10779) 2024-08-16 07:37:04 +00:00
James Dunkerley
422fa8c16b
Adding support for creating Atoms in expressions (#10820)
- Enables the `..` autoscoping style for creating Atoms in expressions.
- Add type checking to methods in columns.
- Auto wrap returns from method in expressions into a column as needed.
- Remove `Time_Period.Day` to remove confusion..
2024-08-15 15:52:30 +00:00
GregoryTravis
e836373d9b
Mixed Decimal/Float operations throw error or attach warning (#10725) 2024-08-14 16:45:28 +00:00
Hubert Plociniczak
f8eb922c9d
Cache self argument (#10785)
In order for widgets not to invalidate expression's results and trigger computations, we now cache self argument to which visualizations should be attached to.

It should help with #10730 but there is still a bug in GUI.
2024-08-14 10:43:33 +00:00
Radosław Waśko
fc3ac6ced1
Various fixes to visualizations (#10745)
- Closes #10716 by un-marking the `Snowflake_Connection` as `private`.
- Does the same to `SQLServer_Connection`.
- Makes sure that `Snowflake_Connection` has correct visualization and enables links for it.
- Adds a fallback in `to_default_visualization_data` and in Table's `prepare_visualization` so that if `to_js_object` of a given type is malformed, we still get some kind of visualization + debug info about the underlying error.
2024-08-13 15:20:55 +00:00
Pavel Marek
3ff5281722
Add --vm.D cmdline option (#10798)
* Add --vm.D cmdline option

* EngineMainTest uses TemporaryFolder rule

* Test system properties set

* Add note about ignored --jvm option

* Ignore --vm.D options in --jvm mode
2024-08-13 13:28:43 +02:00
Hubert Plociniczak
ff7e31c237
Reducing memory leaks in runtime-integration-tests (#10793)
Inspired by the revert done in https://github.com/enso-org/enso/pull/10778, started looking into apparent memory leaks in `runtime-integration-tests`, written in Java.

Initial state:
![Screenshot from 2024-08-09 14-36-29](https://github.com/user-attachments/assets/39abd48f-503b-49d8-af97-da051352c70d)

After:
![Screenshot from 2024-08-12 16-33-40](https://github.com/user-attachments/assets/2bf4cc2d-7e0e-4d22-8810-c2e7e5c3b065)

# Important Notes
Some remaining issues:
- [ ] [TCK tests](https://github.com/enso-org/enso/tree/develop/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/tck) appear to have some memory leaks but we are essentially enabling them via simple inheritance
- [ ] [RuntimeManagementTest](https://github.com/enso-org/enso/blob/develop/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/semantic/RuntimeManagementTest.scala) appears to be broken as it doesn't seem to shutdown properly created threads:
![Screenshot from 2024-08-12 16-29-09](https://github.com/user-attachments/assets/d90aca62-0562-4287-88b7-6d4719e5cf50)

Leaving this for now, as it will probably need to be taken care by initial authors of those tests, if possible. Plus this PR leaves tests in a much better state than before.
2024-08-13 08:01:31 +00:00
Pavel Marek
a79a393ed7
Flatten object hierarchy of AliasAnalysis metadata so it is accessible from Java (#10780)
Flatten hierarchy of alias analysis metadata (`or.genso.compiler.pass.alias.Info`) so that it is easily accessible from Java and rename it.

# Important Notes
- Rename `org.enso.compiler.alias.Graph.Occurence` to `org.enso.compiler.alias.graph.GraphOccurence` and flatten the hierarchy.
- Rename `org.enso.compiler.pass.alias.Info` to `org.enso.compiler.pass.alias.AliasMetadata` and flatten the hierarchy.
2024-08-12 15:03:41 +00:00
Hubert Plociniczak
0f5a3a78b1
Revert "Import all available libraries in --repl mode (#10746)" (#10778)
* Revert "Import all available libraries in --repl mode (#10746)"

This reverts commit 71285e6ff8.

* trigger build
2024-08-09 14:38:05 +02:00
Jaroslav Tulach
8de4b8c9a5
Appending warning to DataflowError is noop (#10765) 2024-08-09 08:39:31 +00:00
Pavel Marek
c2c6712b77
WithWarnings uses EnsoHashMap to speed things up (#10555)
Majority of warnings handling is now done via newly introduced nodes. Moreover, the underlying representation of warnings storage in `WithWarnings` was changed from `Warning[]` to `EnsoHashMap`.

# Important Notes
- Remove `ArrayRope`.
2024-08-07 15:29:57 +00:00
Jaroslav Tulach
71285e6ff8
Import all available libraries in --repl mode (#10746)
Continuation of REPL work (#10709): Import all available libraries when running `--repl`.
2024-08-07 07:36:39 +00:00
Kaz Wesley
e47bdd3e17
Implement full new-lambda syntax (#10756)
Implement full `ArgumentDefinition` syntax for new-lambda arguments, e.g `\a=1 (b:Integer = 23)-> a + b`; add backend support for new lambdas.

Emit an error when any syntactic operator is used outside of its associated syntax (fixes #10473).

Phase out complex arguments for old-lambdas: It is now a syntax error to specify default arguments for an old-lambda. This capability had no usage in real code; affected tests have been updated to test new lambdas. For now, old lambdas can continue to be used with simple arguments; if default arguments are desired, a new-style lambda can be used.
2024-08-06 17:02:32 +00:00
Pavel Marek
f0de43a970
Add org.enso.compiler.dumpIr system prop (#10740)
Working on compiler IR is a daunting task. I have therefore added a new system property `enso.compiler.dumpIr` that will help with that. It dumps the encountered IRs to `ir-dumps` directory in the [GraphViz](www.graphviz.org) format. More info in updated docs.

Note that all the functionality to dump IRs to `dot` files was already implemented. This PR just adds the command line option and updates docs.

# Important Notes
- `--dump-graphs` cmd line option is removed as per [Jaroslav's request](https://github.com/enso-org/enso/pull/10740#pullrequestreview-2216676140).
- To dump graphs, use `-Dgraal.Dump=Truffle:2` system property passed via `JAVA_OPTS` env var.

If you run `env JAVA_OPTS='-Denso.compiler.dumpIr=true' enso --run tmp.enso` where `tmp.enso` is, e.g.:
```
from Standard.Base import all
main = 42
```
You will then have something like:
```
$ ls ir-dumps
Standard.Base.Data.Filter_Condition.dot     Standard.Base.Data.Time.dot              Standard.Base.System.Advanced.dot       Standard.Base.Warning.dot
Standard.Base.Data.Locale.dot               Standard.Base.Enso_Cloud.Enso_File.dot   Standard.Base.System.File.Advanced.dot  tmp.dot
Standard.Base.Data.Numeric.dot              Standard.Base.Errors.dot                 Standard.Base.System.File.dot
Standard.Base.Data.Numeric.Internal.dot     Standard.Base.Network.HTTP.Internal.dot  Standard.Base.System.File.Generic.dot
Standard.Base.Data.Text.Regex.Internal.dot  Standard.Base.Runtime.dot                Standard.Base.System.Internal.dot
```
You can then visualize any of these with `dot -Tsvg -O ir-dumps/tmp.dot`.

An example how that could look like is
![image.svg](https://github.com/user-attachments/assets/26ab8415-72cf-46da-bc63-f475e9fa628e)
2024-08-06 12:00:27 +00:00
Kaz Wesley
aafdef1aeb
Improve parser contextualization (#10734) 2024-08-05 15:46:58 +00:00
Radosław Waśko
4b35e0a99e
Propagate FS errors when creating a new project (#10708)
- Part of #10662
2024-08-05 10:58:03 +00:00
Radosław Waśko
9b2f611402
Relative paths are relative to current project locally and in Cloud (#10660)
- Close #10622
- Changes `project-manager` and `ensoup` launcher to run the engine/language-server with working directory set to the directory containing currently running project.
- If the working directory is _not_ "the directory containing currently running project", a warning is written to logs. This can happen if the raw `/bin/enso` engine runner is used in a different directory.
- In the Cloud, the `File.new` interprets relative paths as cloud paths relative to the Cloud directory containing the current project. Absolute paths are unaffected.
2024-07-31 09:43:17 +00:00
Hubert Plociniczak
d43ad7ce13
Disable linting passes for IDE and repl (#10705)
There is no need to generate unused variables warnings or other linting for IDE and repl users. By default linting is enabled during compilation and for those use-cases it is now disabled via runtime options.

Closes #9883
2024-07-31 08:49:45 +00:00
Jaroslav Tulach
b9214f052c
Must specify --repl to enable debug server (#10709) 2024-07-29 18:29:55 +02:00
Jaroslav Tulach
07bc728b6d
Avoid race condition in GC_Example test (#10665)
Re-enables https://github.com/enso-org/enso/pull/10602/files#r1690919173 - uses `IO.println` to allow us to see what the CI actually does.
2024-07-29 09:37:21 +00:00
Jaroslav Tulach
cb72487cc9
ContextFactory reused to initialize language-server context (#10670) 2024-07-29 09:49:14 +02:00
Hubert Plociniczak
73cb5d1dd7
Don't report stacktraces for interruptions (#10698)
Interruptions are OK now and shouldn't be reported as a warning.
This is confusing to devs.
2024-07-28 16:41:53 +02:00
Dmitry Bushev
9e19009158
When reopening a project no dynamic widgets available (#10674)
close #10595

Changelog:
- fix: storing IdMap from the request
- update: apply updated external ids after loading the module from cache
- update: simplify the node invalidation logic

# Important Notes
https://github.com/user-attachments/assets/c93df161-3bc5-4ecf-8696-239a2498dfb8
2024-07-27 08:21:05 +00:00
GregoryTravis
f0e9616d39
Implement Runtime.Context.Dataflow_Stack_Trace for dataflow errors thrown from Enso (#9625) 2024-07-26 19:20:41 +00:00
Hubert Plociniczak
0f055c7fb3
Additional info to debug AccessDenied problems (#10663)
Plain `Storage failure [AccessDenied].` was rather uninformative when it comes to debugging the underlying problem.
Added more detailed error messages and runners' failures should now sometimes print a detailed message.
References #10662.
2024-07-26 16:01:44 +00:00
Pavel Marek
f849634db3
Atom fields are visible in debugger (#10661)
Atom fields are now visible in the debugger (both chrome inspector and VSCode's debug adapter protocol):
![image](https://github.com/user-attachments/assets/c3d19475-c271-46b6-a44e-e9aebf414b8d)
2024-07-26 06:54:39 +00:00
Dmitry Bushev
2e56ffa63a
More detailed logs for locking logic (#10656)
related: #10595

Locking log message now always includes the caller class.
2024-07-25 12:10:12 +00:00
Kaz Wesley
8b48637691
Provide syntax warnings to Java (#10645)
Translate syntax warnings and attach to IR when translating operator applications.

We should ensure that all Trees are checked for warnings and every warning is attached to some IR. That would require a bit of refactoring: In TreeToIr, we could define helpers wrapping every IR constructor and accepting a `Tree` parameter. The `Tree` could be used to populate the `IdentifiedLocation` when constructing the IR type, and then to attach all warnings after constructing the IR object.

# Important Notes
- Update JNI dependency.
- Introduces a `cargo bench` runner for parser.
2024-07-24 17:54:23 +00:00
Jaroslav Tulach
c6da3a93ba
Treat WithWarnings via dedicated @Specialization (#10650) 2024-07-24 15:31:27 +02:00
Kaz Wesley
e5b85bf16e
Space-precedence does not apply to value-level operators (#10597)
In a sequence of value-level operators, whitespace does not affect relative precedence. Functional operators still follow the space-precedence rules.

The "functional" operators are: `>> << |> |>> <| <<| : .`, application, and any operator containing `<-` or `->`. All other operators are considered value-level operators.

Asymmetric whitespace can still be used to form *operator sections* of value-level operators, e.g. `+2 * 3` is still equivalent to `x -> (x+2) * 3`.

Precedence of application is unchanged, so `f x+y` is still equivalent to `f (x + y)` and `f x+y * z` is still equivalent to `(f (x + y)) * z`.

Any attempt to use spacing to override value-level operator precedence will be caught by the new enso linter. Mixed spacing (for clarity) in value-operator expressions is allowed, as long as it is consistent with the precedences of the operators.

Closes #10366.

# Important Notes
Precedence warnings:
- The parser emits a warning if the whitespace in an expression is inconsistent with its effective precedence.
- A new enso linter can be run with `./run libraries lint`. It parses all `.enso` files in `distribution/lib` and `test`, and reports any errors or warnings. It can also be run on individual files: `cargo run --release --bin check_syntax -- file1 file2...` (the result may be easier to read than the `./run` output).
- The linter is also run as part of `./run lint`, so it is checked in CI.

Additional language change:
- The exponentiation operator (`^`) now has higher precedence than the multiplication class (`*`, `/`, `%`). This change did not affect any current enso files.

Library changes:
- The libraries have been updated. The new warnings were used to identify all affected code; the changes themselves have not been programmatically verified (in many cases their equivalence relies on the commutativity of string concatenation).
2024-07-24 10:55:44 +00:00
Hubert Plociniczak
aae8370977
Disable Graal-based Ydoc temporarily (#10627)
Graal Ydoc implementation is currently not being used locally or in the cloud and giving an impression of a slower startup.
Plus it appears that there some issues in the local connection as well.
To limit the impact of it now, let's make it controllable by the same env variable as GUI is.
2024-07-23 12:29:26 +00:00
Adam Obuchowicz
71bae7e4b0
initProtocol endpoint returns success when already initialized (#10542)
* initProtocol endpoint returns success when already initialized

* Fix test

* Docs and return error when clientId differs

* fmt

* fix: session management test

* misc: json connection controller

---------

Co-authored-by: Dmitry Bushev <bushevdv@gmail.com>

Issue with Vector nothing to do with this.
2024-07-23 07:45:53 +01:00
Jaroslav Tulach
b6bbfc5cda
Prevent re-entrant execution of finalizers (#10602)
Fixes #10211 by avoiding re-entrant execution of finalizers.
2024-07-22 20:11:54 +00:00
Jaroslav Tulach
c0f5759e07
Speeding up Ordering_Comparator (#10593) 2024-07-19 04:08:53 +02:00
Pavel Marek
451d7cb452
System.exit does proper context hard exit. (#10363)
The `System.exit 42` component is treated the same way as any other Panic error - it does not interfere with other component evaluation:
![image](https://github.com/user-attachments/assets/516490b5-755f-453e-8dc9-744437dc51bd)

After removing the `System.exit 42` component, the workflow works as expected. I have also tried opening the project with the component and then removing it.
2024-07-18 18:10:36 +00:00
Jaroslav Tulach
c20eab2af9
Detect compilation while benchmarking (#10574)
Enables `engine.TruffleCompilation` in `std-benchmarks`, collects the logs and dumps compilation into to `System.err` when a benchmark is influenced by dynamic compilation.
2024-07-18 15:49:16 +00:00
Kaz Wesley
4cff789b69
Refactor precedence for whitespace changes (#10569)
Single-phase whitespace-aware precedence resolution.

#### Performance
![newplot(4)](https://github.com/user-attachments/assets/9822b0dc-17c3-4d2d-adf7-eb8b1c240522)
Since this is a major refactor of the core of the parser, I benchmarked it; it's about 3% faster.

# Important Notes
- Move operator-identifier recognition to lexer.
- Move compound-token assembly out of precedence resolver
2024-07-18 15:48:20 +00:00
Radosław Waśko
4e310d723d
Refactor: split IrToTruffle::processModule into smaller sub-methods (#10587)
- This PR only re-arranges code, splitting the **huge** `processModule` function into a few smaller ones.
- I decided to do it, because when I was working with `processModule` on #9812 I was constantly getting lost in this huge method (this **one** method had 570 lines!) - there is too much happening at once there. Now it's been split into smaller methods, each dealing with one thing.
2024-07-18 12:14:11 +00:00
Hubert Plociniczak
700a638f1e
Ignore ProcessBuilder logs (#10578) 2024-07-17 21:38:16 +00:00
Hubert Plociniczak
39898da664
Reduce the number of log INFO events (#10500)
Reducing the number of log events that we spam regular users. Not the last PR in that area, but already a progress.
Also replaced `fileWalk` with a stream approach hoping that maybe it is a bit more stable on Windows.
2024-07-17 14:29:48 +00:00
Jaroslav Tulach
a33f632a73
Make EnsoOutputStream fast again! (#10559)
Will fix #10550 by properly using `@TruffleBoundary` annotation
2024-07-16 17:30:56 +00:00
Jaroslav Tulach
c367e76e44
Renaming launcher executable to ensoup (#10535)
Closes #10476.

# Important Notes
Let's see what exactly fails on the CI and fix that then...
2024-07-16 14:30:23 +00:00
Hubert Plociniczak
a992c8aa4f
Fix context lock removal (#10273)
* Fix context lock removal

Removal of context lock assumed that one still holds a lock on it. This
is no longer the case when using a `withContextLock` block that
correctly manages the resource. This change fixes the
`IllegalMonitorStateException`.
Closes #10354.

* address review

* Add missing file

* Hiding ContextLock internals from other than ReentrantLocking classes

---------

Co-authored-by: Jaroslav Tulach <jaroslav.tulach@enso.org>
2024-07-16 09:58:03 +02:00
Hubert Plociniczak
e585904291
Mitigate Language Server visualizations DOS scenario on startup (#10549)
* Mitiigate LS DDOS scenario on startup

For a medium-size project with a lot of visualizations, Language Server
will be flooded with visualization requests on startup. Due to an
existing limit for the job execution engine, some of those requests
might have been silently dropped.
This change lifts that limit until a better fix can be invented.

Additionally, a slow startup might lead to a timeout when serving open
file request. This change adds some retries as a fallback
mechanism/progress monitoring.

* add runtime-fat-jar to a list of aggregates
2024-07-15 16:45:07 +02:00
Pavel Marek
79a1fdbed5
Add ExportImportResolutionBenchmark (#10043)
Vast majority of CPU time in ExportsResolution is spent in [BindingsMap.SymbolRestriction.optimize](9a37357247/engine/runtime-compiler/src/main/scala/org/enso/compiler/phase/ExportsResolution.scala (L173)). #10369 dealt with this. This PR only adds the `ExportImportResolutionBenchmark`.

# Important Notes
- Introduce new [ExportImportResolutionBenchmark](9e70f675d8/engine/runtime-benchmarks/src/main/java/org/enso/compiler/benchmarks/exportimport/ExportImportResolutionBenchmark.java) that measures the performance of import and export resolution only.
- Note that the already existing [ImportStandardLibrariesBenchmark](4d49b00375/engine/runtime-benchmarks/src/main/java/org/enso/compiler/benchmarks/module/ImportStandardLibrariesBenchmark.java) is probably fine for the purpose, but I just wanted to be sure that **ONLY** the import/export resolution is measured and nothing else, so I have isolated that into a new benchmark.
2024-07-15 10:38:05 +00:00
Jaroslav Tulach
aaa3495546
engine-runner shall not depend on language-server (#10536) 2024-07-12 17:17:07 +02:00
Pavel Marek
0f9852aab2
Replace all from ... export all with explicit exports (#10369)
Replace all exports with explicit exports.
2024-07-11 19:34:25 +02:00
Jaroslav Tulach
077b86f98c
Speed up EnsoInputStream again (#10515)
Fix #10503 by creating a benchmark and then speeding it up by making sure usage of `InteropLibrary` reminds in partially evaluated code and isn't hidden behind `@TruffleBoundary`.
2024-07-11 10:08:26 +00:00
Jaroslav Tulach
220b40a1cd
Enforce conversion method return type & introduce Comparable.new (#10468) 2024-07-11 06:58:51 +02:00
Adam Obuchowicz
60c1a0e1f6
Record control tweaks (#10509)
Fixes #10388

[Screencast from 2024-07-10 13-55-46.webm](https://github.com/enso-org/enso/assets/3919101/4ad7c039-84f6-4e42-aad9-5e287ccd88bb)

# Important Notes
Also, removed unnecessary  setExecutionEnvironment call on startup
2024-07-10 20:19:23 +00:00
James Dunkerley
4b3e4ae15e
Rename Map to Dictionary and Set to Hashset. (#10474)
- Rename `Map` to `Dictionary`.
- Rename `Set` to `Hashset`.
- Add a deprecated place holder for the static method of `Map`.
2024-07-09 09:12:23 +00:00
Hubert Plociniczak
53eec66eda
Low-hanging perf improvements (#10462)
- avoid loading shapeless for the sole purpose of having a compile-time
type inequality
- don't use `sys.env` to avoid some Scala conversions
- lazy initialization of fields

# Important Notes
On a slow machine, so easier to spot.

![Screenshot from 2024-07-05 16-15-06](https://github.com/enso-org/enso/assets/292128/a07f42c5-9bee-492b-aad1-46fab7b6476f)
![Screenshot from 2024-07-05 18-14-53](https://github.com/enso-org/enso/assets/292128/694c4fb1-dfda-4629-8bd3-21c765612ec3)
2024-07-08 09:05:11 +00:00
Jaroslav Tulach
515d8238bb
Support for --jvm option in Enso runner (#10374)
Addresses one of two concerns of #5298 - adds support for `--jvm` argument to allow us to switch from _native image_ built Enso binary (as developed by #10126) to regular JVM based Enso execution. This change _doesn't affect production builds_. The _native executable_ continues to be only built by `engine-runner/buildNativeImage` which is tested on CI, but not in the production jobs.
2024-07-06 07:02:20 +00:00
James Dunkerley
c2c4b95116
Final step removing the Problem_Behavior publishing. (#10461)
- Remove publishing the constructors.
- Fix any missed use in libs.
- Alter tests to generally use auto-scoped calls.
- `on_incomparable` to `on_problems`.
2024-07-05 18:41:36 +00:00
Hubert Plociniczak
9449bf3ef5
Amortize the startup cost of some components (#10451)
Building Engine, Context, ApplicationConfig and Ydoc was a adding a rather large delay during the initial startup step as all of those were blocking operations.
Moving all of those to the resource initialization step hopes to amortize some of that cost since it can be done in parallel. Had to add a `ComponentSupervisor` (open for a different name suggestion) to ensure that such delayed components are properly closed on shutdown.

# Important Notes
Adding Ydoc has added a visible delay during startup. I'm hoping that we can amortize some of that with this PR:
![Screenshot from 2024-07-05 11-12-19](https://github.com/enso-org/enso/assets/292128/fd52f749-b2cb-414d-bd2a-847ea867026c)

Now:
![Screenshot from 2024-07-05 11-25-58](https://github.com/enso-org/enso/assets/292128/9e7c96c9-ee47-46c3-9bdb-8f96bbc4a68f)
2024-07-05 11:50:56 +00:00
Hubert Plociniczak
c54c3b7e9d
Eliminate circe-yaml dependency (#10326)
* Eliminating circe-yaml

This change adds our very-own YAML parser on top of SnakeYAML. Compared
to Circe parser on top of SnakeYAML. The advantage? In some not-so-distant
future we might actually get rid of circe and the related performance
issues.

The logic is similar to what circe does i.e. analyzing SnakeYAML to
build our own structure.
This change is not complete, as there are still some tests failing, but
most common Configs are already parseable.
We _could_ auto-generate some of the code but still some of the logic
would have to be tweaked by hand; the current logic has a number of
special cases, as I found out the hard way.

* wip: more tests passing

* Fix remaining tests in ConfigSpec

* Fixing YAML decoder for editions

Dropping circe as a decoder for Editions revealed some problems. Turns
out the current implementation had even more special cases to deal with.

* nit

* Allow for empty exports

* Mostly complete encodin part

Replaced almost all `toYAML` locations with SnakeYAML equivalent.
The encoding has to use Java collections for which there exists a
built-in support. If we were to use Scala collections we would have to
deal with tagging, at the very least.

* Remove the last remaining Circe's YAML parser

* Bug fix + further loop optimization

* removal of some dependencies

* Remove circe-yaml

Added a custom SnakeYAML Node updater to mimick the JSON -> YAML -> JSON
conversion needed for updating fields. The algorithm recursively follows
the key-path and inserts the desired Node. This is not a performance
oriented code on purpose.

* Fix compilation issues

`circe-core` was marked as `provided` but no one eventually included it
in the final jar, hence `NoClassFoundException`.

* fix licensing

* Removing obsolete circe definitions

* fmt

* nits

* s/SnakeYamlDecoder/YamlDecoder

* fmt

* Partial revert, PM needs JSON decoders/encoders

* style

* incremental compilation gone wrong
2024-07-05 09:32:45 +02:00
James Dunkerley
0661f17d1c
Tune Text.trim, fix for Text.split (#10445)
- Rename `Location.Start` to `Location.Left`.
- Rename `Location.End` to `Location.Right`.
- Use auto-scoping for `Location`.
- Tune widgets for `Text.trim`.
- Correct signature of `Text.split`.
- Adjist `generateLocallyUniqueIdent` to not fail on bad signature.
2024-07-04 22:24:56 +00:00
Jaroslav Tulach
5e3a5b7751
Disable UpdatingEditionProvider when running Enso CLI (#10408) 2024-07-03 07:33:01 +02:00
Jaroslav Tulach
489de72828
getPublicTruffleFile may yield an exception (#10380) 2024-06-28 09:58:50 +02:00
Radosław Waśko
db4f7ab3b5
Fixing Database tests and Snowflake Dialect - part 2 out of ... (#10319)
- Part of #9486
- Fixing our tests to not rely on deterministic ordering of created Tables in Database backends
- Before, SQLite and Postgres used to mostly return rows in the order they were inserted in, but Snowflake does not.
- Fixing various parts of Snowflake dialect.
2024-06-27 14:54:00 +00:00
Pavel Marek
9010cf93be
Extension methods can be exported by name (#10274)
Ultimately, we want to forbid the `from ... export all` syntax. This PR starts by providing a way to explicitly export extension and conversion methods by name.

Stdlib code will be modified in upcoming PR.

# Important Notes
A single name can refer to multiple extension or conversion methods. Exports are not qualified. For example,
```
type My_Type
type Other_Type
My_Type.ext_method x = x
Other_Type.ext_method x = x
```
```
from project.Mod export ext_method
```
will export both `My_Type.ext_method` and `Other_Type.ext_method`.
2024-06-25 12:08:22 +00:00