Skip to content

Integrate JiT compilation into CLI runtime#2211

Open
rafal-hawrylak wants to merge 6 commits into
mainfrom
pr4c-jit-runtime
Open

Integrate JiT compilation into CLI runtime#2211
rafal-hawrylak wants to merge 6 commits into
mainfrom
pr4c-jit-runtime

Conversation

@rafal-hawrylak

Copy link
Copy Markdown
Collaborator

#2184 with extracted refactorings.

@rafal-hawrylak
rafal-hawrylak requested a review from a team as a code owner June 19, 2026 19:18
@rafal-hawrylak
rafal-hawrylak requested review from udim and removed request for a team June 19, 2026 19:18
@rafal-hawrylak

Copy link
Copy Markdown
Collaborator Author

Need to address: #2184 (comment)

@rafal-hawrylak

rafal-hawrylak commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

Need to address: #2184 (comment)

Solved in:

Comment thread cli/api/commands/jit/compiler.ts Outdated
Comment thread cli/api/commands/base_worker.ts Outdated
Comment thread cli/api/commands/build.ts Outdated
Comment thread cli/api/commands/base_worker.ts Outdated
Comment thread cli/api/commands/run.ts Outdated
Comment thread cli/api/commands/run.ts Outdated
Comment thread cli/api/utils/constants.ts Outdated
@rafal-hawrylak
rafal-hawrylak force-pushed the pr4c-jit-runtime branch 2 times, most recently from 289c1c2 to 60be915 Compare July 16, 2026 05:34
@rafal-hawrylak
rafal-hawrylak requested review from apilaskowski and ikholopov-omni and removed request for udim July 16, 2026 05:39
Comment thread cli/api/BUILD Outdated
Comment thread testing/test.ts Outdated
Comment thread cli/api/commands/run.ts Outdated
- base_worker: drop redundant undefined guard around clearTimeout
  (clearTimeout(undefined) is a documented no-op). Restore
  runWorker's timeoutMillis to a required number and drop the
  conditional setTimeout — matches main's contract; the earlier
  loosening to number|undefined let JiT workers run without any
  timeout when --jit-timeout was omitted.
- jit/compiler.ts: default timeoutMillis to
  DEFAULT_COMPILATION_TIMEOUT_MILLIS at the .compile() entry point
  (mirrors CompileChildProcess.compile), so JiT workers always
  have a timeout even without --jit-timeout.
- build.ts: replace unsafe (action as any).jitCode cast with a
  narrowing "jitCode" in action check.
- run.ts: flatten the outer try/catch that only wrapped the JiT-compile
  try; the JiT-compile block already has its own try/catch. Extract the
  action.tableType -> dataform.TableType mapping into tableTypeEnum.
  Use \${e?.message || String(e)} when formatting a JiT compilation
  error so an error thrown without a .message field still surfaces
  something readable rather than "undefined".
- constants.ts: revert DEFAULT_COMPILATION_TIMEOUT_MILLIS to 60000
  (main's value); the per-JiT timeout is configurable via
  --jit-timeout.
- compiler.ts: keep the Array.from(response) conversion (child.send
  uses JSON IPC by default, which serializes Uint8Array as
  {"0":n,...} and Buffer.from() rejects that) but add a comment
  documenting the constraint.
- BUILD: order load statements alphabetically to satisfy the
  buildifier out-of-order-load lint.
- testing/test.ts: revert DEFAULT_TIMEOUT_MILLIS from 300000 back to
  30000. The bump was unintended and would silently extend every
  test's per-case timeout to 5 minutes.
Each JiT compile registered a cancel handler on the Runner's EventEmitter
but never removed it once the compile finished. A run with N JiT actions
therefore accumulated N stale listeners and eventually tripped the default
MaxListenersExceededWarning threshold.

Register the handler through a local variable and remove it in a finally
block so successful and failed compiles both clean up. Also drops a stray
trailing-whitespace line from the dryRun compiledSql branch (comment #2).

@apilaskowski apilaskowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also wait for review by @ikholopov-omni

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants