Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
eb7d048
ugh, bring it back
swannodette Jul 29, 2025
3105284
- remove old ObjMap
swannodette Jul 29, 2025
dba928b
fix all the ObjMap ctor sites
swannodette Jul 30, 2025
db62937
check for :lite-mode? - emit Vector if set
swannodette Jul 30, 2025
85a3620
:lite-mode? -> :lite-mode
swannodette Jul 30, 2025
930fbef
update HashMap and Set
swannodette Jul 30, 2025
71b1e99
no .toString for :lite-mode, pay for what you use
swannodette Jul 30, 2025
90945e6
- something weird about simple-hash-map, leave a note
swannodette Jul 30, 2025
d3beffe
:lite-mode path for maps
swannodette Jul 30, 2025
4e3f244
always elide toString Object methods in :lite-mode
swannodette Jul 30, 2025
ac11735
assoc directly reference array-map, replace w/ literal
swannodette Jul 30, 2025
42bb870
add simple-vector for now, might need to compiler support soon, but c…
swannodette Jul 30, 2025
ac61da8
- formatting
swannodette Jul 30, 2025
e0fb270
- formatting
swannodette Jul 30, 2025
ae604a4
- formatting
swannodette Jul 30, 2025
f329097
- modernize HashMap
swannodette Jul 30, 2025
de3b500
- fix bootstrapped
swannodette Jul 30, 2025
2940738
LITE_MODE goog-define so we can elide chunked logic from std lib
swannodette Jul 30, 2025
d1a6b1d
fix MapEntry construction
swannodette Jul 30, 2025
fa643f1
->> to core/->>
swannodette Jul 30, 2025
d975d25
remove call to vec from simple-vector
swannodette Jul 30, 2025
614d180
add simple-vec
swannodette Jul 31, 2025
2d34791
implement the transient protocols as identity and the standard ops. i…
swannodette Jul 31, 2025
f67fb7b
sketch for vector and vec replace compiler passes
swannodette Jul 31, 2025
d9eb63e
move lite-mode? predicate into the analyzer
swannodette Jul 31, 2025
23492ae
fix pass, add lite-mode tests
swannodette Jul 31, 2025
94c1886
for fn invokes to be replace we also need to update :info
swannodette Jul 31, 2025
c31e77c
`vector` is an inlining macro, so can't handle it only as a pass - ne…
swannodette Aug 1, 2025
4f4842a
handle sets
swannodette Aug 1, 2025
5873009
avoid lazyseq stuff in HashMap impl
swannodette Aug 1, 2025
9a2c2e8
typos
swannodette Aug 1, 2025
c81817a
avoid full blown map entry
swannodette Aug 1, 2025
6ce216c
- more std-lib avoidance, micro sizing opts
swannodette Aug 1, 2025
a2373cb
- use kv-reduce to save some more space
swannodette Aug 1, 2025
1967067
- formatting
swannodette Aug 1, 2025
67ee02b
- before core fns knew about the ObjMap key rep - now it needs to be …
swannodette Aug 3, 2025
28f5133
- lite testing wip
swannodette Aug 3, 2025
c447abb
- cannot pass arrays to ci-reduce, use array-reduce
swannodette Aug 3, 2025
8246266
- fix simple-map-entryff call
swannodette Aug 3, 2025
73c5b89
- missing declare
swannodette Aug 3, 2025
393a594
- simple-map-entry needs to satisfy IVector and IIndexed
swannodette Aug 3, 2025
8eae380
- remove doseq from printing
swannodette Aug 4, 2025
5611cd5
- obj-map is definitely incomplete, but fix the obvious problem now
swannodette Aug 4, 2025
e4bc146
- simple-map-entry IEquiv
swannodette Aug 4, 2025
dadba06
- test-obj-map in collections test
swannodette Aug 4, 2025
2b4a937
- fix up HashMap issues
swannodette Aug 5, 2025
a656eca
- test ObjMap & HashMap
swannodette Aug 5, 2025
4de7a71
- fix simple hash-map
swannodette Aug 5, 2025
3ceb397
- add toString methods
swannodette Aug 5, 2025
bc0ebad
- cleanup collections test
swannodette Aug 5, 2025
fea514f
- add lite collections assertions, cleanup
swannodette Aug 5, 2025
5e99038
- add lite test action
swannodette Aug 5, 2025
6656190
- :elide-to-string compiler flag
swannodette Aug 5, 2025
b017493
Merge branch 'master' into cljs-light
swannodette Aug 6, 2025
515edb4
- (.-length array) -> (alength array)
swannodette Aug 6, 2025
652cda9
- simple-vector needs to clone the underlying array
swannodette Aug 6, 2025
a9a1d0c
- fix Vector -lookup
swannodette Aug 6, 2025
428618b
- fix Vector -assoc, check key type
swannodette Aug 6, 2025
bf2c2fe
- add simple set test
swannodette Aug 6, 2025
a3832e4
Merge branch 'master' into cljs-light
swannodette Aug 6, 2025
20a32cb
- fix -count on sets
swannodette Aug 12, 2025
265474b
- -iterator impl for lite maps
swannodette Aug 12, 2025
be48b18
- add simple-map-entry tests
swannodette Aug 12, 2025
4f042fb
- another assertion
swannodette Aug 12, 2025
4879df1
- try hashing a vector, not hashing properly in CI is very weird
swannodette Aug 12, 2025
650fe98
- Vector, throw if out of bounds
swannodette Aug 12, 2025
813e65a
simple vector missing IKVReduce & IComparable impls
swannodette Aug 27, 2025
db9b5a4
fix simple vector hash
swannodette Aug 30, 2025
ba118da
one more failing cljs.core-test around map entries
swannodette Sep 6, 2025
838046a
- add working test
swannodette Sep 6, 2025
82d2bac
simple-map-entry missing ISequential marker protocol
swannodette Sep 6, 2025
c865113
add ICloneable to light types, more tests
swannodette Sep 12, 2025
eb226c5
more passing (and failing tests)
swannodette Sep 12, 2025
d5cca13
IAssociative for simple-map-entry, more tests
swannodette Sep 12, 2025
f6f9a60
bring over the other tests, even if commented, reader test, parse test
swannodette Sep 12, 2025
7593b11
Fix cljs.seq-test for :lite-mode
swannodette Sep 12, 2025
db2d623
remove RSeq comment
swannodette Sep 12, 2025
591b5a8
missing declare Vector
swannodette Sep 13, 2025
5845b89
don't cross wires, only use Vector in simple-map-entry when LITE_MODE…
swannodette Sep 13, 2025
37255cd
remove typos
swannodette Sep 13, 2025
b549ba5
es6 interop tests passing
swannodette Sep 13, 2025
c103b37
fix cljs.reducers-test
swannodette Sep 13, 2025
a529a38
remove duped IIterable for ObjMap
swannodette Sep 13, 2025
474bfec
fix ObjMap/EMPTY hash
swannodette Sep 13, 2025
681a507
less opaque reporting from walk test, rename test
swannodette Sep 13, 2025
1452729
missing collection protocol method for simple-map-entry
swannodette Sep 13, 2025
d97804e
test cljs.walk-test now that simple-map-entry is fixed
swannodette Sep 13, 2025
48d6340
remove stray comment about cljs.walk-test
swannodette Sep 13, 2025
429d7ca
Vector ILookup and IFn issues
swannodette Sep 21, 2025
5ad974d
Vector IIterable impl
swannodette Sep 22, 2025
75c82ed
Set IIterable impl, cljs.iterator-test now passing
swannodette Sep 22, 2025
366110d
generate more detailed error in the metadata tests
swannodette Sep 22, 2025
9434c0a
make lite_test.edn easier to compare with test.edn, npm-deps-tests pa…
swannodette Sep 22, 2025
9549fff
remove stale comment
swannodette Sep 23, 2025
13d7f8c
cljs.metadata-test passing
swannodette Sep 23, 2025
bf26779
cljs.tagged-literals-test passing
swannodette Sep 27, 2025
1306709
cljs.extend-to-native-test passing
swannodette Sep 27, 2025
75afb2f
IFn impl for simple-map-entry
swannodette Sep 29, 2025
fcfe7f9
cljs.spec-test passing
swannodette Sep 29, 2025
e6a6073
Vector IDrop impl, elide another chunked-seq test in LITE_MODE
swannodette Sep 30, 2025
e3cd744
Vector, Set -with-meta should return coll if meta identical
swannodette Sep 30, 2025
fbd8bce
0.1 -> 0 etc. when calling -nth on vector
swannodette Sep 30, 2025
f122ee6
fix broken ObjMap -find
swannodette Sep 30, 2025
d1212bd
cljs.collection-test passing
swannodette Sep 30, 2025
7d8ee19
remove :nodejs target, add code size tests for lite mode
swannodette Sep 30, 2025
f0e76c3
cleanup
swannodette Oct 4, 2025
66276a4
remove typo
swannodette Oct 4, 2025
cc88daa
note quite 32K
swannodette Oct 4, 2025
01c65d1
fix trivial output size for vector not in :lite-mode/:elide-to-string
swannodette Oct 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,63 @@ jobs:
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc builds/out-adv/core-advanced-test.js | tee test-out.txt
grep -qxF '0 failures, 0 errors.' test-out.txt

# Lite Tests
lite-test:
name: Lite Tests
runs-on: macos-14
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- uses: DeLaGuardo/[email protected]
with:
tools-deps: '1.10.1.763'

- name: Cache maven
uses: actions/cache@v4
env:
cache-name: cache-maven
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-

- name: Cache gitlibs
uses: actions/cache@v4
env:
cache-name: cache-gitlibs
with:
path: ~/.gitlibs
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-

# - name: Cache JSC
# uses: actions/cache@v4
# env:
# cache-name: cache-jsc
# with:
# path: WebKit
# key: ${{ runner.os }}-jsc
# restore-keys: |
# ${{ runner.os }}-jsc

- name: Build tests
run: clojure -M:lite.test.build

# - name: Install JSC
# run: ./ci/install_jsc.sh

- name: Run tests
run: |
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc builds/out-lite/lite-test.js | tee test-out.txt
grep -qxF '0 failures, 0 errors.' test-out.txt

# Runtime Tests
runtime-windows-test:
name: Runtime Windows Tests
Expand Down
2 changes: 2 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"-e" "(cljs.test-runner/-main)"]}
:runtime.test.build {:extra-paths ["src/test/cljs"]
:main-opts ["-m" "cljs.main" "-co" "resources/test.edn" "-c"]}
:lite.test.build {:extra-paths ["src/test/cljs"]
:main-opts ["-m" "cljs.main" "-co" "resources/lite_test.edn" "-c"]}
:selfhost.test.build {:extra-paths ["src/test/self"]
:main-opts ["-m" "cljs.main" "-co" "resources/self_host_test.edn" "-c"]}
:selfparity.test.build {:extra-paths ["src/test/self"]
Expand Down
28 changes: 28 additions & 0 deletions resources/lite_test.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{:optimizations :advanced
:main lite-test-runner
:output-to "builds/out-lite/lite-test.js"
:output-dir "builds/out-lite"
:output-wrapper true
:verbose true
:compiler-stats true
:parallel-build true
:npm-deps {:lodash "4.17.4"}
:closure-warnings {:non-standard-jsdoc :off :global-this :off}
:install-deps true
:language-out :es5
:foreign-libs
[{:file "src/test/cljs/calculator_global.js"
:provides ["calculator"]
:global-exports {calculator Calculator}}
{:file "src/test/cljs/es6_dep.js"
:module-type :es6
:provides ["es6_calc"]}
{:file "src/test/cljs/calculator.js"
:module-type :commonjs
:provides ["calculator"]}
{:file "src/test/cljs/es6_default_hello.js"
:provides ["es6_default_hello"]
:module-type :es6}]
:pseudo-names true
:pretty-print true
:lite-mode true}
32 changes: 32 additions & 0 deletions src/main/cljs/cljs/analyzer/passes/lite.cljc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
;; Copyright (c) Rich Hickey. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.

(ns cljs.analyzer.passes.lite
(:refer-clojure :exclude [var?]))

(defn var? [ast]
(= :var (:op ast)))

(def ctor->simple-ctor
'{cljs.core/vector cljs.core/simple-vector
cljs.core/vec cljs.core/simple-vec})

(defn update-var [{:keys [name] :as ast}]
(let [replacement (get ctor->simple-ctor name)]
(-> ast
(assoc :name replacement)
(assoc-in [:info :name] replacement))))

(defn replace-var? [ast]
(and (var? ast)
(contains? ctor->simple-ctor (:name ast))))

(defn use-lite-types
[env ast _]
(cond-> ast
(replace-var? ast) update-var))
Loading