Skip to content

Start the language server from a JDK-managed AppCDS archive - #153

Merged
Frotty merged 1 commit into
masterfrom
appcds-language-server
Oct 8, 2026
Merged

Frotty merged 1 commit into
masterfrom
appcds-language-server

Conversation

@Frotty

@Frotty Frotty commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

What

The language server now starts with -XX:+AutoCreateSharedArchive and an AppCDS archive next to the compiler jar. The JVM writes it when the first session ends (about 1.2 s more, once, 28 MB) and the sessions after it start from it.

Language server start to the initial build being ready, interleaved, median of four starts:

before after
small project (stdlib, one file) 4.39 s 3.71 s (−16%)
castle fight (428 files) 18.98 s 17.28 s (−9%)

It does nothing for a warm run in an open session (the server JVM is already warm); it is startup only.

It needs the base archive of the runtime. The distribution never had one, which is why the AppCDS archive the compiler build tried to ship was never made; the companion PR in WurstScript builds it (jlink --generate-cds-archive) and drops the dead task. Without it the JVM runs as before, nothing breaks.

Why appCdsJvmOptions does more than add the flags

Two things the JVM gets wrong, both seen while testing with the real distribution:

  • It never replaces an archive that no longer fits. After an update (new jar) or a changed runtime it silently ignores the old archive and does not write a new one, so the server would stay without for good. The archive is named after runtime, jar path, size and modification time, and archives of others are removed.
  • It ends with a crash status (0xC0000409 on Windows) when it cannot write the archive. No options are passed when a probe file cannot be written next to the jar.

-Xlog:disable keeps JVM messages about the archive off stdout, which is the protocol stream. Two first sessions at once (two windows) both end cleanly and leave a valid archive.

Tests

  • npm run test:appcds (in npm test): the options, the archive name changing with jar and runtime, old archives removed and other files kept, no options for an unwritable folder or a missing jar.
  • node scripts/test-lsp-appcds.js <compiler.jar> <java> (opt-in, like test-lsp-readiness.js): starts the real server three times; first session writes the archive, second leaves it, an updated jar gets a new one. Run against the distribution built from the WurstScript PR.
  • tsc, eslint, test-language-features, test-diagnostics pass (with the pinned dependencies; an old node_modules with vscode-languageclient 9 fails the client 10 test and tsc on master too).

Companion: wurstscript/WurstScript#1386 (base archive in the runtime).

The server now starts with -XX:+AutoCreateSharedArchive and an archive next to
the compiler jar: the JVM writes it when the first session ends (about 1.2 s
more, once), and the sessions after it start from it. Language server start to
ready, median of four starts: 4.39 s to 3.71 s on a small project, 18.98 s to
17.28 s on castle fight. It needs the base archive of the runtime, which the
distribution of the compiler now builds (jlink --generate-cds-archive); without
one the JVM runs as before.

Two things the JVM does not handle, so appCdsJvmOptions does:
- an archive for another jar, or another runtime, is ignored but never
  replaced, so an update would leave the server without one. The archive is
  named after the runtime, jar path, size and modification time, and the
  archives of others are removed;
- when it cannot write the archive the JVM ends with a crash status. No
  options when a probe file cannot be written next to the jar.

-Xlog:disable keeps JVM messages about the archive off stdout, which is the
protocol stream. Two first sessions at once both end cleanly and leave a valid
archive.

test:appcds covers the options; scripts/test-lsp-appcds.js (opt-in, needs a
built compiler distribution like test-lsp-readiness.js) starts the real server
three times: first session writes the archive, the second leaves it, an updated
jar gets a new one.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T10:51:20.544510Z 91add18 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit afa419b into master Oct 8, 2026
1 check passed
@Frotty
Frotty deleted the appcds-language-server branch October 8, 2026 12:43
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.

1 participant