fix: key the persistent code cache on the language level - #57
Merged
marevol merged 1 commit intoAug 28, 2026
Merged
Conversation
A script compiled under --language=es6 was served back to an --language=es5 run,
which then executed syntax es5 cannot parse:
// over the 1000 character store threshold
var f = (a) => a * 3;
print("arrow result: " + f(1));
sai --language=es6 --persistent-code-cache big.js arrow result: 3
sai --language=es5 --persistent-code-cache big.js arrow result: 3
sai --language=es5 big.js SyntaxError: Expected ; but found =>
The store directory is named after a digest of the sai jar, with "_opt" appended
for optimistic types. The language level appeared nowhere in it, and
Context.compile consults the store before the source is parsed, so the entry was
found and the parser never ran.
The same hole exists for -scripting and --no-syntax-extensions and predates this
series, but --language is the axis the series turns on: es5 behaviour being
unchanged is the whole guarantee, and this broke it. So "_es6" now goes into the
directory name beside "_opt".
getCodeCachePath in the test grew the same distinction, or it could have handed
an es6 directory to a test asking for the es5 one.
./gradlew build testOptimistic testPessimistic:
suite before after
test 665, 0 fail 666, 0 fail
testOptimistic 1717, 0 fail 1718, 0 fail
testPessimistic 1717, 0 fail 1718, 0 fail
marevol
force-pushed
the
es6/fix-code-cache-language
branch
from
August 28, 2026 05:11
35e6a8f to
e7b91da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #56.
A script compiled under
--language=es6was served back to an--language=es5run, which then executed syntax es5 cannot parse:sai --language=es6 --persistent-code-cache big.jsarrow result: 3sai --language=es5 --persistent-code-cache big.jsarrow result: 3sai --language=es5 big.jsSyntaxError: Expected ; but found =>The store directory is named after a digest of the sai jar, with
_optappended for optimistic types. The language level appeared nowhere in it, andContext.compileconsults the store before the source is parsed, so the entry was found and the parser never ran.The same hole exists for
-scriptingand--no-syntax-extensionsand predates this series, but--languageis the axis the series turns on: es5 behaviour being unchanged is the whole guarantee, and this broke it. So_es6now goes into the directory name beside_opt.getCodeCachePathin the test grew the same distinction, or it could have handed an es6 directory to a test asking for the es5 one.Verification
./gradlew build testOptimistic testPessimistic