| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Refactor `DeclEngine` for robustness and semantic consistency (#7704) ## Description This PR is a prerequisite for an upcoming performance optimization of the `DeclEngine`, aimed at additional removals of copied `TyDecl` entries from the `DeclEngine`. The PR: - properly implements `HasChanges` for `MaterializeConstGenerics::materialize_const_generics`. During compilation of the o2 `order-book` contract, this change removes 104 duplicated function decls and 894 duplicated struct decls. - removes `insert_arc` from the `DeclEngine`. The semantic of this method made no sense for its existing usages. In all usages, we were inserting an existing declaration gotten from the `DeclEngine` and just giving it a different `DeclId`. In other words, calling `DeclEngine::get_...` would for both `DeclId`s return exactly the same declaration. Additionally, all those usages were only in ABI declarations, for ABI's `TyImplItem::Fn/Constant/Type` where none of those can be modified afterwards in any way (e.g., we do not support them being generic in ABIs). As expected, removing `insert_arc` and replacing its returned `DeclRef` with the original didn't change semantic of any calls that were using it. - adds `insert_modified` method to the `DeclEngine` and forces `insert` to provide `ParsedDeclId`. Previous approach in which callers were responsible for either passing the `ParsedDeclId` for the first time or getting it by `get_parsed_decl_id` was both verbose and error-prone. There were cases in code, some even marked with TODO, where the `ParsedDeclId` was not provided when inserting a modified declaration, essentially inserting declarations that were not connected to their parsed equivalents. - adds `insert_dummy_func` method to the `DeclEngine` to clearly distinguish the only case in which a typed declaration does not have the corresponding parsed declaration. - fixes the bug of having two different fields for parsed const generics in the `DeclEngine`: `const_generic_parsed_decl_id_map` and `const_generic**s**_parsed_decl_id_map`. The plural version was used for writing and singular for reading, effectively resulting in const generics never having their corresponding parsed declarations attached. - wires all instances of `ConstGenericParameter` with their corresponding `ParsedDeclId`s. Previously this was done for const generics in functions and impls, but not in structs, enums, and traits. Additionally, the PR: - adds `run-tests.sh` and `just t` recipe for convenient running of the base set of Sway compiler tests. ## Checklist - [ ] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. | 28 天前 | |
Improve `asm` const propagation (#7550) ## Description This PR optimises `ASM` const propagation. That means that it tries to use as few registers as possible, hoping that their initialisation can be removed later with DCE and others... This is particularly useful on function calls, and indexing: 1 - On function calls we normally have something like ``` movi $r0 i0 move $$arg0 $r0 jal ... ``` We now replace this with: ``` movi $r0 i0 movi $$arg0 i0 jal ... ``` and let DCE kill the `movi $r0 i0` because is no longer neeed; 2 - Constant indexing like `something[0]` normally generates `addi` and `mul`, now these will be coalesced into a simple `movi` Gain on testing is huge because we tend to have tons of constants on tests... on real code like `O2`, we see more humble gains. ## $of and $err propagation Fixes https://github.com/FuelLabs/sway/issues/7570 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. | 5 个月前 | |
Code is not guaranteed to run on Rust 1.53 stable. (#794) | 4 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 28 天前 | ||
| 5 个月前 | ||
| 4 年前 |