Skip to content

Commit

Permalink
POC of new expression-oriented inference model for memoization within…
Browse files Browse the repository at this point in the history
… control-flow (#589)

* [hir] Core data types and lowering for new model

* Handle more expressions, including using babel for binding resolution

* test setup with pretty printing of ir

* Basic codegen and improved pretty printing

* avoid else block when if has no fallthrough

* emit function declarations with mapped name/params

* start of scope analysis

* saving state pre-run

* add slightly more complex example and flush out lowering/printing (jsx, new, variables)

* Various improvements:
* Convert logical expressions (|| and &&) to control flow, accounting
  for lazy evaluation semantics.
* Handle expression statements
* Improve printing of HIR for unsupported node kinds
* Handle more cases of JSX by falling by to OtherStatement to wrap
  subtrees at coarse granularity.

* improve HIR printing, lowering of expression statements

* handle object expression printing

* improve IR model for values/places along w codegen

* more test cases

* start of mutability inference

* passable but still incorrect mutability inference

* improved mutability inference, should cover most cases now

* visualization of reference graph

* correctly flow mutability backwards (have to actually set the capability)

* separate visualization in output

* consolidate on frozen/readonly/mutable capabilities

* cleanup

* conditional reassignment test (not quite working)

* hack to output svg files for debugging

* handle conditional reassignment

* improve capture analysis

* treat jsx as (interior) mutable; handle memberexpression lvalues

* lots of comments; hook return is frozen

* update main comment

* inference for switch, which reveals a bug

* fix yarn.lock
  • Loading branch information
josephsavona authored and facebook-github-bot committed Mar 25, 2024
1 parent a33c0b8 commit 3158146
Show file tree
Hide file tree
Showing 58 changed files with 8,895 additions and 6 deletions.
3 changes: 3 additions & 0 deletions compiler/forget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/generator": "^7.19.0",
"@babel/parser": "^7.19.1",
"@babel/plugin-syntax-typescript": "^7.18.6",
"@babel/plugin-transform-block-scoping": "^7.18.9",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/traverse": "^7.19.1",
"@babel/types": "^7.19.0",
"@hpcc-js/wasm": "^1.15.0",
"@testing-library/react": "^13.4.0",
"@tsconfig/node16-strictest": "^1.0.3",
"@types/invariant": "^2.2.35",
Expand Down
Loading

0 comments on commit 3158146

Please sign in to comment.