Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

The below works under Java 8, but not 9:

$ java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode) $ script/nashornrepljs To quit, type: :cljs/quit cljs.user=> (require 'cljs.js) Function has more than 262143 program points cljs.user=> cljs.js nil

Likely closely related to CLJS-2530.

3 Answers

0 votes
by

Comment made by: mfikes

The JavaScript code produced for {{(dump-core)}} is evidently large enough to cause us to hit a limit that existed in JDK 8 but is now more easy to hit with JDK 9:

Specifically see

http://hg.openjdk.java.net/jdk9/jdk9/nashorn/file/17cc754c8936/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ProgramPoints.java#l57

and

http://hg.openjdk.java.net/jdk9/jdk9/nashorn/file/17cc754c8936/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java#l156

The limit in question was revised in this changeset http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/7cb19fa78763#l48.108

where {{CALLSITE_PROGRAM_POINT_SHIFT}} was increased from 11 to 14, reducing {{MAX_PROGRAM_POINT_VALUE}} from 21 bits to 18 bits. (2^18 - 1 = 262143)

This is associated with this ticket https://bugs.java.com/view_bug.do?bug_id=8139931

Note that if you read the comments in the JDK code, you can see that there is an assumption that a JavaScript method splitter will have taken a large function and broken it down to sufficiently small chunks to fit within the limits. Perhaps the function generated by ClojureScript isn't amenable to splitting.

0 votes
by

Comment made by: mfikes

With Java 10, perhaps another bit was used up:

$ java -version java version "10" 2018-03-20 Java(TM) SE Runtime Environment 18.3 (build 10+46) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode) $ clj -A:cljs/rel -re nashorn cljs.user=> (require 'cljs.js) Function has more than 131071 program points

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2531 (reported by mfikes)
...