Skip to content

Commit

Permalink
Merge #797
Browse files Browse the repository at this point in the history
797: Version 0.13.0 r=Marwes a=Marwes

<a name="v0.13.0"></a>
## v0.13.0 (2019-10-27)

This version mostly contains performance improvements, both during compilation and execution. The most notable of which is that gluon now has function inlining and constant folding. This lets simple calls like `1 + 2` be optimized into `3` at compile time and `x + 1` are now compiled as the primitive addition instruction instead of calling `std.int.num.(+)` first. Optimizations is enabled by default but can be disabled via the ´optimize` compiler setting. Together with some other optimizations, the factorial tests have received a 4x speedup. There are still more work to do on optimizing the virtual machine however as lua still comes out ahead by another 4x speedup.

Some breaking changes have occurred, the `gluon::Compiler` struct is no more. Instead, all it's methods are exposed via the `gluon::ThreadExt` trait which are implemented on `Thread/RootedThread` which should make it much easier to use.

```rust
Compiler::new().run_expr(&vm, ...)
// Change to
use gluon::ThreadExt;
vm.run_expr(...)
```

The compilation process has been largely rewritten and is now built on top of https://github.com/salsa-rs/salsa which enables better control over how compilation steps are cached. This may lead to some regressions in memory usage (please report!) but should also allow for less memory usage in the long run for apps that needs it as well.

In the language itself, the most significant addition is the `std.effect.io` module. This is an exact mirror of `std.io` but it uses effects which fixes the annoyance of having to write `lift` to move `IO` actions into `Eff` everywhere.

#### Performance

*   Only do one hash lookup when creating a Symbol ([a709c71](a709c71))
*   Shrink Type's size to 48 bytes (from 64) ([178180f](178180f))
*   Avoid RefCell in Fixed* structurs (-1%) ([de32dbd](de32dbd))
*   Avoid recursion in implicits.rs ([89eb836](89eb836))
*   Only mark types with unbound generics as HAS_GENERICS ([3d835a8](3d835a8))
*   Avoid computing the plain name in name_eq (-3%) ([a7ac9f8](a7ac9f8))
* **check:**
  *  Use RefCell::get_mut when possible ([1244143](1244143))
  *  Remove redundant operations in union ([f3d4203](f3d4203))
  *  No need to lookup the type again before querying the level ([5e4efe3](5e4efe3))
  *  Remove some branches in the occurs check¨ ([03e7c3b](03e7c3b))
  *  Only initialize the variable generator when it is necessary (-3%) ([793b658](793b658))
  *  Only do one lookup/insertion on the implicit definition map ([0ea13ff](0ea13ff))
  *  Narrow down the implicit partitioning further (-10%) ([a9c965b](a9c965b))
  *  Avoid looking through metadata when checking for an implicit type ([4a3662e](4a3662e))
  *  Only add implicit fields if the binding is implicit ([da861eb](da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **optimize:**  Allocate core syntax directly into arenas ([723ec4d](723ec4d))
* **parser:**
  *  Shrink the Token type and remove it's need to Drop ([3016f25](3016f25))
  *  Simplify tokenization iterators ([c7061c7](c7061c7))
* **vm:**
  *  Add function inlining ([5093137](5093137))
  *  Eliminate redundant match expressions ([945fb83](945fb83))
  *  Implement inter-module dead code elimination ([ab1b1b8](ab1b1b8))
  *  Avoid tracing global values unless we are in the root gc (-7%) ([48a5313](48a5313))
  *  Avoid the bounds check when fetching instructions ([c2778e7](c2778e7))
  *  Faster updates to the stack frame ([2b94a3a](2b94a3a))
  *  Cache the frame offset for the stack (-20%) ([0469cb2](0469cb2))
  *  Copy instead of clone unrooted gc values ([a0396f4](a0396f4))

#### Breaking Changes

*   Replace Compiler with the ThreadExt trait ([c16132e](c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **check:**  Only add implicit fields if the binding is implicit ([da861eb](da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))

#### Bug Fixes

*   Don't leak implicit bindings into adjacent scopes ([5681ffc](5681ffc), closes [#783](#783))
*   ignore formatting in std.test due to a bug ([bdccee6](bdccee6))
*   rerefix formatting ([3116616](3116616))
*   refix formatting ([fcb7f0b](fcb7f0b))
*   fix formatting and apply naming suggesions ([6bb0d87](6bb0d87))
*   Make the behaviour consistent for `Show Char` ([0ff8987](0ff8987))
*   Avoid infinite loops/extremely slow optimization ([dc7ec72](dc7ec72))
*   Expand macros inside macros ([5a29433](5a29433))
*   Invalidate text properly so rexpect tests work ([92e4508](92e4508))
*   Don't depend on ansi_term in windows to make windows 7 work ([58e2a8b](58e2a8b), closes [#777](#777))
*   Add tests and fix the regression with clone_userdata ([df07872](df07872))
*   Ensure that threads are dropped when using child threads ([b9efb51](b9efb51))
* **check:**  Handle aliases better in `do` ([770e52e](770e52e), closes [#766](#766))
* **repl:**  make the REPL respect --no-std ([e797470](e797470))
* **std:**  export missing assertions in std.test ([41f4fc5](41f4fc5))
* **vm:**
  *  Don't (rust) panic in string.split_at ([50f937b](50f937b), closes [#757](#757))
  *  Accept trailing comma in record macros ([f35c0b9](f35c0b9), closes [#770](#770))

#### Features

*   Use implicit Monoids in std.foldable ([295b8c3](295b8c3))
*   Add a mutable string type to the ST monad ([9ec946b](9ec946b))
*   Allow attributes to be specified on fields inside types ([fb35db5](fb35db5))
*   Provide std.effect.io as a mirror of std.io ([66e49b3](66e49b3))
*   Replace Compiler with the ThreadExt trait ([c16132e](c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
*   Use salsa for incremental compilation ([7bc8253](7bc8253))
*   Add history hints and bracket highlight to the REPL ([10ef8cd](10ef8cd))
*   Use line/column numbers in lambda names ([201fdfb](201fdfb))
* **codegen:**  Map Rust's struct enums to records in Gluon. ([afb682e](afb682e))
* **repl:**  add --no-std option to gluon.exe ([f2c1819](f2c1819))
* **std:**
  *  add ordering assertions ([3efac99](3efac99))
  *  add a few functions to std.test & std.effect.error ([58e0043](58e0043))
* **vm:**  Make macro errors implement PartialEq, Eq, Hash and Clone ([039825a](039825a))

Co-authored-by: Markus Westerlind <marwes91@gmail.com>
  • Loading branch information
bors[bot] and Marwes authored Oct 27, 2019
2 parents 27d9923 + cd03fd2 commit 9f00ec8
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 96 deletions.
81 changes: 81 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
<a name="v0.13.0"></a>
## v0.13.0 (2019-10-27)


#### Performance

* Only do one hash lookup when creating a Symbol ([a709c712](https://github.com/gluon-lang/gluon/commit/a709c7120ff151d368128cf7c0a89d667c91015c))
* Shrink Type's size to 48 bytes (from 64) ([178180f8](https://github.com/gluon-lang/gluon/commit/178180f8b4555c8ae831d428fc464cb0a4179455))
* Avoid RefCell in Fixed* structurs (-1%) ([de32dbd6](https://github.com/gluon-lang/gluon/commit/de32dbd631beb0958c7c0fcb655807fda874a2a7))
* Avoid recursion in implicits.rs ([89eb836a](https://github.com/gluon-lang/gluon/commit/89eb836afbd2e5d43324c141fad52b761816c754))
* Only mark types with unbound generics as HAS_GENERICS ([3d835a8a](https://github.com/gluon-lang/gluon/commit/3d835a8adaf2b3c63ef31d512780c9b6de2be5d8))
* Avoid computing the plain name in name_eq (-3%) ([a7ac9f80](https://github.com/gluon-lang/gluon/commit/a7ac9f800d7f1ad944d81140dfe6be99d59f7943))
* **check:**
* Use RefCell::get_mut when possible ([12441438](https://github.com/gluon-lang/gluon/commit/1244143838ed56fcc7d257ef6f9288d38754f60d))
* Remove redundant operations in union ([f3d4203a](https://github.com/gluon-lang/gluon/commit/f3d4203a44074467e40240afc2cbf5547403efcc))
* No need to lookup the type again before querying the level ([5e4efe37](https://github.com/gluon-lang/gluon/commit/5e4efe37386f4d937fa8afa8b8d06b4aed7c738e))
* Remove some branches in the occurs check¨ ([03e7c3b4](https://github.com/gluon-lang/gluon/commit/03e7c3b4b22e5abd53b2af64f09849ba0ca43b32))
* Only initialize the variable generator when it is necessary (-3%) ([793b6580](https://github.com/gluon-lang/gluon/commit/793b658082f71f016655f7f4f3e44432814116fa))
* Only do one lookup/insertion on the implicit definition map ([0ea13ff1](https://github.com/gluon-lang/gluon/commit/0ea13ff1923527bbc69a5fa44ce905fe2a4c593d))
* Narrow down the implicit parititioning further (-10%) ([a9c965b4](https://github.com/gluon-lang/gluon/commit/a9c965b418cbff642d5c8a0c9c3c7821b610eb12))
* Avoid looking through metadata when checking for an implicit type ([4a3662e9](https://github.com/gluon-lang/gluon/commit/4a3662e9e108b902ed61f17d9e2da204d29e54bf))
* Only add implicit fields if the binding is implicit ([da861eba](https://github.com/gluon-lang/gluon/commit/da861ebad00a6f336d7fc7cbc99bf8703cd4b567), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **optimize:** Allocate core syntax directly into arenas ([723ec4d6](https://github.com/gluon-lang/gluon/commit/723ec4d6e2026865ac3cfca29253786dc6bbee49))
* **parser:**
* Shrink the Token type and remove it's need to Drop ([3016f251](https://github.com/gluon-lang/gluon/commit/3016f251b35f01da81ab8ea51e2ea8f62c1ac870))
* Simplify tokenization iterators ([c7061c7b](https://github.com/gluon-lang/gluon/commit/c7061c7bef60b3ab3367dd06399d3bf5b8deae84))
* **vm:**
* Add function inlining ([5093137a](https://github.com/gluon-lang/gluon/commit/5093137a42f2b9ad757f5b712ad9a1a192b22b5e))
* Eliminate redundant match expressions ([945fb83d](https://github.com/gluon-lang/gluon/commit/945fb83df71a2fdca4353aedf9ff1349aa53ea01))
* Implement inter-module dead code elimination ([ab1b1b80](https://github.com/gluon-lang/gluon/commit/ab1b1b806fa4a99f1955ff1a2896b81cdd7b016d))
* Avoid tracing global values unless we are in the root gc (-7%) ([48a5313e](https://github.com/gluon-lang/gluon/commit/48a5313ebea8751a3815d2664a1ab001b399a8cb))
* Avoid the bounds check when fetching instructions ([c2778e7f](https://github.com/gluon-lang/gluon/commit/c2778e7fda9f424d710e9ac96f0d10051766e6f1))
* Faster updates to the stack frame ([2b94a3af](https://github.com/gluon-lang/gluon/commit/2b94a3af600a8bea64478384535fe378ba74a08d))
* Cache the frame offset for the stack (-20%) ([0469cb2e](https://github.com/gluon-lang/gluon/commit/0469cb2ef5bad94c3d52b52fd8186aa424c035e5))
* Copy instead of clone unrooted gc values ([a0396f40](https://github.com/gluon-lang/gluon/commit/a0396f4039641ad228b3cce2b0bfa0f443742c57))

#### Breaking Changes

* Replace Compiler with the ThreadExt trait ([c16132eb](https://github.com/gluon-lang/gluon/commit/c16132eb2c817926aba6a89b33f63b917bb71458), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **check:** Only add implicit fields if the binding is implicit ([da861eba](https://github.com/gluon-lang/gluon/commit/da861ebad00a6f336d7fc7cbc99bf8703cd4b567), breaks [#](https://github.com/gluon-lang/gluon/issues/))

#### Bug Fixes

* Don't leak implicit bindings into adjacent scopes ([5681ffc5](https://github.com/gluon-lang/gluon/commit/5681ffc5c611dfbad235256f053b11525b91542c), closes [#783](https://github.com/gluon-lang/gluon/issues/783))
* ignore formatting in std.test due to a bug ([bdccee6f](https://github.com/gluon-lang/gluon/commit/bdccee6f53411d113b9bd8dd1e89cbb5dff9ace4))
* rerefix formatting ([31166161](https://github.com/gluon-lang/gluon/commit/31166161c78e4f38dca50daa695c0af994d70bbe))
* refix formatting ([fcb7f0bb](https://github.com/gluon-lang/gluon/commit/fcb7f0bb56343f314b3d126b5ebfa95f572f9ee0))
* fix formatting and apply naming suggesions ([6bb0d87c](https://github.com/gluon-lang/gluon/commit/6bb0d87cabf329f0a2585efd0e8daec4eca2c3ca))
* Make the behaviour consistent for `Show Char` ([0ff89870](https://github.com/gluon-lang/gluon/commit/0ff89870fe064c3b8c524e862f07a5faaa85dd14))
* Avoid infinite loops/extremely slow optimization ([dc7ec72a](https://github.com/gluon-lang/gluon/commit/dc7ec72ab053de68533f794621ea756fe66c35b0))
* Expand macros inside macros ([5a294330](https://github.com/gluon-lang/gluon/commit/5a2943300b9010acf3913c535c983f10af4c9ec7))
* Invalidate text properly so rexpect tests work ([92e45081](https://github.com/gluon-lang/gluon/commit/92e4508172607ae99e3de5d75a3874832682c470))
* Don't depend on ansi_term in windows to make windows 7 work ([58e2a8b9](https://github.com/gluon-lang/gluon/commit/58e2a8b940f89abcdaaf0e0beafcc9f6bf04cabf), closes [#777](https://github.com/gluon-lang/gluon/issues/777))
* Add tests and fix the regression with clone_userdata ([df078725](https://github.com/gluon-lang/gluon/commit/df078725965297c2920403d5ffc1c230273058d5))
* Ensure that threads are dropped when using child threads ([b9efb513](https://github.com/gluon-lang/gluon/commit/b9efb513527c0ce51eef648f69b48e2252929365))
* **check:** Handle aliases better in `do` ([770e52ea](https://github.com/gluon-lang/gluon/commit/770e52ea202d9fe1648b36f90cb9bab64d09b906), closes [#766](https://github.com/gluon-lang/gluon/issues/766))
* **repl:** make the REPL respect --no-std ([e7974706](https://github.com/gluon-lang/gluon/commit/e79747067ca6538581ee4c3d2fe6631a087db53d))
* **std:** export missing assertions in std.test ([41f4fc52](https://github.com/gluon-lang/gluon/commit/41f4fc524c00243b71a1fce01a134a2a08ce145f))
* **vm:**
* Don't (rust) panic in string.split_at ([50f937b3](https://github.com/gluon-lang/gluon/commit/50f937b3598adc52f8ec5eec19f6701d38c2fd38), closes [#757](https://github.com/gluon-lang/gluon/issues/757))
* Accept trailing comma in record macros ([f35c0b96](https://github.com/gluon-lang/gluon/commit/f35c0b96c255d209daf3b9e33362af4c5e1cdb38), closes [#770](https://github.com/gluon-lang/gluon/issues/770))

#### Features

* Use implicit Monoids in std.foldable ([295b8c3d](https://github.com/gluon-lang/gluon/commit/295b8c3dfc3db3e4d5bd17e5b14ed4fdf4eb0362))
* Add a mutable string type to the ST monad ([9ec946b4](https://github.com/gluon-lang/gluon/commit/9ec946b418842c6ac136406230d96e102d86b7fe))
* Allow attributes to be specified on fields inside types ([fb35db51](https://github.com/gluon-lang/gluon/commit/fb35db5153161d1ee393ae29bc9adfc1db553458))
* Provide std.effect.io as a mirror of std.io ([66e49b37](https://github.com/gluon-lang/gluon/commit/66e49b37196db18c36909900c46ccdc69254a7b0))
* Replace Compiler with the ThreadExt trait ([c16132eb](https://github.com/gluon-lang/gluon/commit/c16132eb2c817926aba6a89b33f63b917bb71458), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* Use salsa for incremental compilation ([7bc82532](https://github.com/gluon-lang/gluon/commit/7bc82532f5aa7f9787d385ce97f0a769594b8064))
* Add history hints and bracket highlight to the REPL ([10ef8cdf](https://github.com/gluon-lang/gluon/commit/10ef8cdf39baa5ad0cc7dd6817e59b8ea04f028f))
* Use line/column numbers in lambda names ([201fdfb9](https://github.com/gluon-lang/gluon/commit/201fdfb9ed132adfca8055abae84a9ea8f00dcf8))
* **codegen:** Map Rust's struct enums to records in Gluon. ([afb682e5](https://github.com/gluon-lang/gluon/commit/afb682e55d6115748a9861ff3086c934fe74afcf))
* **repl:** add --no-std option to gluon.exe ([f2c1819f](https://github.com/gluon-lang/gluon/commit/f2c1819f9fc5ba3cb8d5d005b5ae61c1c74af658))
* **std:**
* add ordering assertions ([3efac996](https://github.com/gluon-lang/gluon/commit/3efac9963deb031e78462d00e49d090ab911cbd4))
* add a few functions to std.test & std.effect.error ([58e00431](https://github.com/gluon-lang/gluon/commit/58e00431a815ebdd7dae94a4d58a0c621d22aafd))
* **vm:** Make macro errors implement PartialEq, Eq, Hash and Clone ([039825ab](https://github.com/gluon-lang/gluon/commit/039825abebc4fcd445c08574bd3cc0dd6f97a69f))



<a name="v0.12.0"></a>
## v0.12.0 (2019-07-06)

Expand Down
88 changes: 44 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gluon"
version = "0.12.0" # GLUON
version = "0.13.0" # GLUON
authors = ["Markus <marwes91@gmail.com>"]
build = "build.rs"
edition = "2018"
Expand All @@ -25,12 +25,12 @@ name = "gluon"
path = "src/lib.rs"

[dependencies]
gluon_base = { path = "base", version = "0.12.0" } # GLUON
gluon_check = { path = "check", version = "0.12.0" } # GLUON
gluon_parser = { path = "parser", version = "0.12.0" } # GLUON
gluon_codegen = { path = "codegen", version = "0.12.0" } # GLUON
gluon_vm = { path = "vm", version = "0.12.0", default-features = false } # GLUON
gluon_format = { path = "format", version = "0.12.0", default-features = false } # GLUON
gluon_base = { path = "base", version = "0.13.0" } # GLUON
gluon_check = { path = "check", version = "0.13.0" } # GLUON
gluon_parser = { path = "parser", version = "0.13.0" } # GLUON
gluon_codegen = { path = "codegen", version = "0.13.0" } # GLUON
gluon_vm = { path = "vm", version = "0.13.0", default-features = false } # GLUON
gluon_format = { path = "format", version = "0.13.0", default-features = false } # GLUON

log = "0.4"
quick-error = "1.0.0"
Expand Down Expand Up @@ -63,7 +63,7 @@ rand = { version = "0.7", optional = true }
rand_xorshift = { version = "0.2", optional = true }

[build-dependencies]
gluon_base = { path = "base", version = "0.12.0" } # GLUON
gluon_base = { path = "base", version = "0.13.0" } # GLUON

itertools = "0.8"
little-skeptic = { version = "0.15.0", optional = true }
Expand Down Expand Up @@ -91,8 +91,8 @@ bincode = "1"

pulldown-cmark = "0.6"

gluon_completion = { path = "completion", version = "0.12.0" } # GLUON
gluon_codegen = { path = "codegen", version = "0.12.0" } # GLUON
gluon_completion = { path = "completion", version = "0.13.0" } # GLUON
gluon_codegen = { path = "codegen", version = "0.13.0" } # GLUON

[features]
default = ["regex", "random"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Gluon requires a recent Rust compiler to build (1.9.0 or later) and is available

```toml
[dependencies]
gluon = "0.12.0"
gluon = "0.13.0"
```

### Other languages
Expand Down
2 changes: 1 addition & 1 deletion base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gluon_base"
version = "0.12.0" # GLUON
version = "0.13.0" # GLUON
authors = ["Markus <marwes91@gmail.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url = "https://docs.rs/gluon_base/0.12.0")] // # GLUON
#![doc(html_root_url = "https://docs.rs/gluon_base/0.13.0")] // # GLUON
#![allow(unknown_lints)]
//! The base crate contains pervasive types used in the compiler such as type representations, the
//! AST and some basic containers.
Expand Down
Loading

0 comments on commit 9f00ec8

Please sign in to comment.