Tags: glojurelang/glojure
Tags
Fix regex literal AOT compilation (#132) (#133) Add support for *regexp.Regexp values in code generator by serializing them as regexp.MustCompile() calls. The regex pattern string is preserved using the Regexp.String() method. This fixes the "unsupported value type *regexp.Regexp" error when using regex literals (#"...") in AOT-compiled code. The re-pattern function already worked because it returns the compiled regexp at runtime rather than embedding it as a constant. Added comprehensive test cases covering various regex patterns including special characters, escapes, quotes, and newlines.
Several more clojure-test-suite fixes (#116) * symbol implements ifn, regen code after set fix Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fix ratio -> int Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Read zero ratios as 0 ints Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Support intern Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fix for keys/vals and keyword namespace Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fixes for mod Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Add sym method to keyword Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fixes for nth Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fix for long range count Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Implement rationalize Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fix prefixed map regression Signed-off-by: James Hamlin <jfhamlin@gmail.com> --------- Signed-off-by: James Hamlin <jfhamlin@gmail.com>
Read version from go build info (#113) * Read version from go build info Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Don't assert specific help contents in cli test Signed-off-by: James Hamlin <jfhamlin@gmail.com> --------- Signed-off-by: James Hamlin <jfhamlin@gmail.com>
Fix compatibility issues for clojure-test-suite (#110) - Add missing iterate function implementation for lazy sequence generation - Export AllNamespaces, VarLoadFile, and GetUseAOT functions for test suite compatibility - Add NewSet2 constructor for creating sets with initial elements - Fix namespace iteration to use AllNamespaces() instead of direct Namespaces access - Update stdlib core files to support test suite requirements - Regenerate platform-specific import registrations for all architectures
Retain clojure.* name for standard namespaces (#107) * Split go generate and aot into separate make commands Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Retain clojure.* name for standard namespaces Completes #52 and #53 Signed-off-by: James Hamlin <jfhamlin@gmail.com> * AOT compile clojure.core.protocols to go Signed-off-by: James Hamlin <jfhamlin@gmail.com> --------- Signed-off-by: James Hamlin <jfhamlin@gmail.com>
Add AOT compilation support for Glojure standard library (#99) This commit introduces Ahead-Of-Time (AOT) compilation specifically for the Glojure standard library, significantly improving startup performance by pre-compiling core modules to Go code. Key Features: - Code generation infrastructure in pkg/runtime/codegen.go - Pre-compiled standard library modules (core, core_print, protocols, etc.) - Automatic AOT compilation during build via 'make generate' - Runtime registration and loading of pre-compiled namespaces - Comprehensive test suite with golden file testing Implementation Scope (Standard Library Only): - This initial implementation focuses exclusively on pre-compiling the Glojure standard library for faster startup - User code AOT compilation will be added in future updates - Pre-compiled modules are embedded in the binary at build time Technical Implementation: - AST-to-Go code transformation with proper scoping - Support for all core language constructs used in stdlib - Special forms: def, set!, case, letfn, try/catch/finally, etc. - Metadata preservation and symbol/keyword pre-allocation - Topological sorting for dependency resolution Performance Benefits: - Eliminates parse and eval overhead for standard library at runtime - REPL startup time significantly reduced - Default enabled with GLOJURE_USE_AOT=true environment variable Testing: - Comprehensive test coverage for code generation paths - Golden file testing for reproducible output verification - Behavioral testing ensures correctness vs interpreted code This foundation will enable AOT compilation of user code in future releases, further improving performance for production Glojure applications.
Implement `sort` and `sort-by` functions (#78) * Implement sort function for Glojure - Add SortSlice function in pkg/lang/sort.go that performs stable in-place sorting - Add Compare function to support Clojure's compare semantics (nil handling, cross-type numeric comparison) - Update ToSlice to handle all required types: nil→empty, IPersistentVector, IPersistentMap, string→char array - Add transformation in rewrite.clj to replace java.util.Arrays.sort with SortSlice - Add transformation for clojure.lang.Util.compare to use Compare function The implementation matches Clojure JVM semantics: - Stable sort (equal elements maintain order) - Comparator contract (-1/0/1 return values) - Proper nil handling (nil sorts before non-nil) - Support for custom comparators * Add sort tests Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Update number compare Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Use Comparer interface a la Java Comparable Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Sort test files for consistent run order Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Fix sort-by Signed-off-by: James Hamlin <jfhamlin@gmail.com> * Add more sort-by tests Signed-off-by: James Hamlin <jfhamlin@gmail.com> --------- Signed-off-by: James Hamlin <jfhamlin@gmail.com>
PreviousNext