Skip to content

Commit

Permalink
Update on "[compiler] General-purpose function outlining"
Browse files Browse the repository at this point in the history
Implements general-purpose function outlining. Specifically, anonymous function expressions which have no dependencies/context variables are extracted into named top-level functions. The original function expression is replaced with a `LoadGlobal` of the generated name.

Note that the architecture is designed to allow very general purpose forms of outlining, though we currently are very conservative in what we outline. Specifically, the outlining allows annotating functions with an optional ReactiveFunctionType, which if set will cause the outlined function to get compiled as that type. So we could for example outline a helper hook or helper component, set the type, and then have the hook/component get memoized as well. For now though we just outline with no type set, and generate the function as-is without running it through compilation.

[ghstack-poisoned]
  • Loading branch information
josephsavona committed Jul 15, 2024
2 parents b78cd6e + aa62384 commit 28278fc
Show file tree
Hide file tree
Showing 45 changed files with 1,984 additions and 497 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
steps:
- checkout
- setup_node_modules
- run: yarn build
- run: yarn build --ci=circleci
- persist_to_workspace:
root: .
paths:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/compiler_playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
branches: [main]
pull_request:
paths:
- "compiler/**"
- compiler/**
- .github/workflows/compiler-playground.yml

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles

defaults:
run:
working-directory: compiler
Expand All @@ -20,8 +23,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "yarn"
node-version: 18.20.1
cache: yarn
cache-dependency-path: compiler/yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/compiler_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
TZ: /usr/share/zoneinfo/America/Los_Angeles

defaults:
run:
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/compiler_typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
branches: [main]
pull_request:
paths:
- "compiler/**"
- compiler/**
- .github/workflows/compiler-typescript.yml

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles

defaults:
run:
working-directory: compiler
Expand All @@ -31,8 +34,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "yarn"
node-version: 18.20.1
cache: yarn
cache-dependency-path: compiler/yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
Expand All @@ -50,8 +53,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "yarn"
node-version: 18.20.1
cache: yarn
cache-dependency-path: compiler/yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
Expand All @@ -74,8 +77,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
cache: "yarn"
node-version: 18.20.1
cache: yarn
cache-dependency-path: compiler/yarn.lock
- name: Restore cached node_modules
uses: actions/cache@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/devtools_check_repro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
issue_comment:
types: [created, edited]

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles

jobs:
check-repro:
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 28278fc

Please sign in to comment.