Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Introduce hir::Type | Aleksey Kladov | 2019-11-26 | 1 | -0/+10 |
| | | | | It should provide a convenient API over more low-level Ty | ||||
* | Fixme for union fields | Aleksey Kladov | 2019-11-25 | 1 | -0/+1 |
| | |||||
* | Fix hir for ast::UnionDef | Aleksey Kladov | 2019-11-25 | 1 | -18/+14 |
| | |||||
* | Merge #2396 | bors[bot] | 2019-11-24 | 1 | -6/+7 |
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2396: Switch to variant-granularity field type inference r=flodiebold a=matklad r? @flodiebold Previously, we had a `ty` query for each field. This PR switcthes to a query per struct, which returns an `ArenaMap` with `Ty`s. I don't know which approach is better. What is bugging me about the original approach is that, if we do all queries on the "leaf" defs, in practice we get a ton of queries which repeatedly reach into the parent definition to compute module, resolver, etc. This *seems* wasteful (but I don't think this is really what causes any perf problems for us). At the same time, I've been looking at Kotlin, and they seem to use the general pattern of analyzing the *parent* definition, and storing info about children into a `BindingContext`. I don't really which way is preferable. I think I want to try this approach, where query granularity generally mirrors the data granularity. The primary motivation for me here is probably just hope that we can avoid adding a ton of helpers to a `StructField`, and maybe in general avoid the need to switch to a global `StructField`, using `LocalStructFieldId` most of the time internally. For external API (ie, for `ra_ide_api`), I think we should continue with fine-grained `StructField::ty` approach, which internally fetches the table for the whole struct and indexes into it. In terms of actual memory savings, the results are as follows: ``` This PR: 142kb FieldTypesQuery (deps) 38kb FieldTypesQuery Status Quo: 208kb TypeForFieldQuery (deps) 18kb TypeForFieldQuery ``` Note how the table itself occupies more than twice as much space! I don't have an explanation for this: a plausible hypothesis is that single-field structs are very common and for them the table is a pessimisation. THere's noticiable wallclock time difference. Co-authored-by: Aleksey Kladov <[email protected]> | ||||
| * | Switch to variant-granularity field type inference | Aleksey Kladov | 2019-11-24 | 1 | -6/+7 |
| | | |||||
* | | Implement HasModule for AdtId | Aleksey Kladov | 2019-11-24 | 1 | -0/+10 |
|/ | |||||
* | Cleanup | Aleksey Kladov | 2019-11-24 | 1 | -6/+9 |
| | |||||
* | Simplify | Aleksey Kladov | 2019-11-24 | 1 | -15/+0 |
| | |||||
* | Switch to StaticLoc for statics | Aleksey Kladov | 2019-11-24 | 1 | -5/+32 |
| | |||||
* | Pull macro up | Aleksey Kladov | 2019-11-24 | 1 | -14/+1 |
| | |||||
* | Move ModuleSource back to hir | Aleksey Kladov | 2019-11-23 | 1 | -60/+2 |
| | |||||
* | Privatise nameres | Aleksey Kladov | 2019-11-23 | 1 | -3/+2 |
| | |||||
* | Rename CrateModuleId | Aleksey Kladov | 2019-11-23 | 1 | -3/+3 |
| | |||||
* | Move ImportId | Aleksey Kladov | 2019-11-23 | 1 | -0/+4 |
| | |||||
* | Get rid of DefDatabase2 | Aleksey Kladov | 2019-11-23 | 1 | -24/+21 |
| | |||||
* | Move docs to hir_def | Aleksey Kladov | 2019-11-23 | 1 | -0/+1 |
| | |||||
* | Move lang_items to hir_def | Aleksey Kladov | 2019-11-23 | 1 | -0/+1 |
| | |||||
* | Use attrs rather than syntax for lang items | Aleksey Kladov | 2019-11-23 | 1 | -1/+3 |
| | |||||
* | Move attrs query to hir_def | Aleksey Kladov | 2019-11-23 | 1 | -3/+30 |
| | |||||
* | More principled sources for enums and fields | Aleksey Kladov | 2019-11-22 | 1 | -1/+12 |
| | |||||
* | Move data to a single file | Aleksey Kladov | 2019-11-22 | 1 | -4/+1 |
| | |||||
* | Move FunctionData to hir_def | Aleksey Kladov | 2019-11-22 | 1 | -0/+1 |
| | |||||
* | Move TypeAlias to hir_def | Aleksey Kladov | 2019-11-22 | 1 | -0/+1 |
| | |||||
* | Move resolver to hir_def | Aleksey Kladov | 2019-11-21 | 1 | -0/+1 |
| | |||||
* | Move constants to new ID | Aleksey Kladov | 2019-11-20 | 1 | -5/+35 |
| | | | | This allows us to get rid of trait item index | ||||
* | Don't duplicate ContainerId type | Aleksey Kladov | 2019-11-20 | 1 | -22/+15 |
| | |||||
* | Switch type aliases to new sources | Aleksey Kladov | 2019-11-20 | 1 | -5/+43 |
| | |||||
* | Next gen IDs for functions | Aleksey Kladov | 2019-11-20 | 1 | -5/+61 |
| | | | | | | | | | | | | | | | | | The current system with AstIds has two primaraly drawbacks: * It is possible to manufacture IDs out of thin air. For example, it's possible to create IDs for items which are not considered in CrateDefMap due to cfg. Or it is possible to mixup structs and unions, because they share ID space. * Getting the ID of a parent requires a secondary index. Instead, the plan is to pursue the more traditional approach, where each items stores the id of the parent declaration. This makes `FromSource` more awkward, but also more correct: now, to get from an AST to HIR, we first do this recursively for the parent item, and the just search the children of the parent for the matching def | ||||
* | Move traits to hir_def | Aleksey Kladov | 2019-11-20 | 1 | -1/+2 |
| | |||||
* | Move Generics to hir_def | Aleksey Kladov | 2019-11-20 | 1 | -0/+24 |
| | |||||
* | Rename Source::ast -> Source::value | Aleksey Kladov | 2019-11-20 | 1 | -3/+3 |
| | |||||
* | Sourcify some things | Aleksey Kladov | 2019-11-15 | 1 | -6/+5 |
| | | | | | If we want to support macros properly, we need to get rid of those FileIds everywhere... | ||||
* | Remove old impls infrastructure | Aleksey Kladov | 2019-11-15 | 1 | -0/+13 |
| | |||||
* | Add ImplId | Aleksey Kladov | 2019-11-15 | 1 | -0/+12 |
| | |||||
* | Move body queries to hir_def | Aleksey Kladov | 2019-11-14 | 1 | -0/+10 |
| | |||||
* | Move definition of exprs to hir_def | Aleksey Kladov | 2019-11-12 | 1 | -0/+2 |
| | |||||
* | Unfork struct and union ids | Aleksey Kladov | 2019-11-09 | 1 | -12/+16 |
| | |||||
* | Restore crate_def_map marks | Aleksey Kladov | 2019-11-03 | 1 | -0/+2 |
| | |||||
* | Introduce ra_db::fixture fixture module | Aleksey Kladov | 2019-11-03 | 1 | -0/+3 |
| | | | | The goal here is to share more testing infrastructure between crates. | ||||
* | Move CrateDefMap to hir_def | Aleksey Kladov | 2019-11-03 | 1 | -2/+3 |
| | |||||
* | Move Source to hir_expand | Aleksey Kladov | 2019-11-02 | 1 | -16/+1 |
| | |||||
* | move struct & enum data to hir_def | Aleksey Kladov | 2019-10-31 | 1 | -0/+17 |
| | |||||
* | add ModuleDefId to hir_def | Aleksey Kladov | 2019-10-31 | 1 | -2/+56 |
| | |||||
* | move builtin types to hir_def | Aleksey Kladov | 2019-10-31 | 1 | -0/+1 |
| | |||||
* | move hygiene to hir_expand | Aleksey Kladov | 2019-10-30 | 1 | -1/+0 |
| | |||||
* | push name down to hir_expand | Aleksey Kladov | 2019-10-30 | 1 | -1/+0 |
| | |||||
* | push either to hir_expand | Aleksey Kladov | 2019-10-30 | 1 | -1/+0 |
| | |||||
* | refactor $crate handling | Aleksey Kladov | 2019-10-30 | 1 | -0/+1 |
| | | | | | Introduce proper hygiene module, which should grow quite a bit eventually. | ||||
* | move raw_items to hir_def | Aleksey Kladov | 2019-10-30 | 1 | -1/+94 |
| | |||||
* | Move ids to hir_def crate | Aleksey Kladov | 2019-10-30 | 1 | -1/+203 |
| |