Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
dfca529
Explicitly set bdwgc debug flags
jeaye Oct 16, 2025
bf31860
Move reusable_context to jtl::ref
jeaye Oct 16, 2025
b8f24b5
Use gc allocator and remove thread_local usage
jeaye Oct 16, 2025
c538cd5
Upgrade bdwgc and use malloc redirection
jeaye Oct 16, 2025
238cfdb
Fix clang-tidy issues
jeaye Oct 17, 2025
ee7b68b
Merge branch 'main' of github.com:jank-lang/jank into gc
jeaye Nov 4, 2025
0c6bfe1
Remove BppTree
jeaye Nov 5, 2025
c561a85
Remove direct std::set usages
jeaye Nov 5, 2025
c7e6d39
Hack in some cpp gen fixes
jeaye Nov 6, 2025
cf1375f
Merge branch 'gc' into cppgen
jeaye Nov 6, 2025
5679cf8
Just adding everything so I can have it on my mac
jeaye Nov 11, 2025
278f7cb
Address some tidy issues
jeaye Nov 18, 2025
69418a2
Generate stack save/restore during loop IR gen
jeaye Nov 18, 2025
746e756
Fix more cppgen issues
jeaye Nov 20, 2025
5025847
Fix some more cppgen tests
jeaye Nov 20, 2025
88623e5
More cppgen fixes
jeaye Nov 20, 2025
05dda52
More cppgen fixes
jeaye Nov 20, 2025
a807c3d
More cppgen fixes
jeaye Nov 21, 2025
39ed6d1
More cppgen fixes
jeaye Nov 21, 2025
c571a77
More cppgen fixes
jeaye Nov 21, 2025
d4cc3aa
Don't wrap cpp_raw during eval
jeaye Nov 21, 2025
02032b9
More cppgen fixes
jeaye Nov 21, 2025
03ab344
Implement cppgen for letfn
jeaye Nov 21, 2025
c5bc9ef
Optimize core libs during phase 1
jeaye Nov 22, 2025
e026ce9
Add cppgen for case
jeaye Nov 22, 2025
8796a4e
Skip static member test for now
jeaye Nov 22, 2025
9c3de6c
Detect unsupported static member access
jeaye Nov 22, 2025
f97dc5a
Add another static test
jeaye Nov 22, 2025
bd95aab
Fix tidy issues
jeaye Nov 22, 2025
d4153d2
Fix some string gc bits
jeaye Nov 23, 2025
381a8bb
Bypass one layer of typedefs manually
jeaye Nov 24, 2025
7f5eb1c
Ensure no implicit conversion for instantiation
jeaye Nov 24, 2025
a5fb045
Fix tidy issues
jeaye Nov 24, 2025
e32634c
Remove remaining bpptree references
jeaye Nov 24, 2025
d8cfc8d
Add some missing meta cppgen
jeaye Nov 25, 2025
1d72ec3
Intern ns in jank_load fn for cppgen
jeaye Nov 25, 2025
1789ee1
Merge branch 'cppgen' of github.com:jank-lang/jank into cppgen
jeaye Nov 25, 2025
892800a
Remove bpptree entirely
jeaye Nov 25, 2025
a64bc41
Fix aot cppgen for vars
jeaye Nov 25, 2025
90d5c0f
Fix var_ref cppgen
jeaye Nov 26, 2025
d233b77
Clear up static const issue
jeaye Nov 26, 2025
7c7ae86
Fix cppgen for throw
jeaye Nov 26, 2025
87aaa10
Fix inf/nan cppgen
jeaye Nov 26, 2025
5bb7306
Lift macro derefs too
jeaye Nov 26, 2025
d416973
Test string_builder inf/nan
jeaye Nov 26, 2025
3e0ef7a
Improve profile output
jeaye Nov 26, 2025
5b47b3c
Start optimizing cppgen for size
jeaye Nov 27, 2025
ac27ef9
Move lifted constants and vars to codegen
jeaye Nov 27, 2025
65d38b6
Use explicit empty containers in cppgen
jeaye Nov 27, 2025
636a38a
Add empty string cppgen
jeaye Nov 27, 2025
b28b6c2
More cppgen fixes
jeaye Nov 29, 2025
5a162b2
Fix var interning order for cppgen
jeaye Nov 29, 2025
34f5c16
Implement support for typed catch clauses
jianlingzhong Oct 28, 2025
3b5f662
ignore false positive clang-tidy warnings
jianlingzhong Nov 28, 2025
2b18b30
rename duplicated testing functions
jianlingzhong Nov 28, 2025
6892c5a
update catch syntax in test.jank; remove option in catch bodies
jianlingzhong Nov 28, 2025
a1854d2
update catch syntax in test.jank
jianlingzhong Nov 28, 2025
a760a6b
Port `biginteger` (#581)
shantanu-sardesai Nov 6, 2025
aeb6e77
fix: odd? on negative numbers works properly (#587)
stmonty Nov 17, 2025
6a83037
Update depth in submodule update in build.md (#586)
pfeodrippe Nov 18, 2025
3cae34f
Port `double` (#583)
shantanu-sardesai Nov 18, 2025
c43416e
Fix integer equal with big_integer (#596)
djblue Nov 19, 2025
a0bf7e1
Fix `even?` and `odd?` for `big_integer` (#597)
djblue Nov 20, 2025
f9b58c3
Fix ODR violation for cpp/raw functions during AOT compilation (#591)
pfeodrippe Nov 21, 2025
edcd9a7
Improve `keyword` parsing (#577)
shantanu-sardesai Nov 24, 2025
4e07130
Make jank build portable on macOS in nix-darwin environments (#585)
oscarvarto Nov 24, 2025
2d10bf8
Add clang args that fix the potential for OS and local Clang build st…
cjbarre Nov 25, 2025
a794c1f
Clean up and document macOS stdinc fix (#603)
jeaye Nov 25, 2025
010a34e
Link to LLVM's custom libundwind (#607)
shantanu-sardesai Nov 26, 2025
ea68e87
Add contributing guidelines
jeaye Nov 27, 2025
ca61caa
Shuffle around guideline sections
jeaye Nov 27, 2025
12ca6b5
Implement support for typed catch clauses
jianlingzhong Oct 28, 2025
016e7ca
ignore false positive clang-tidy warnings
jianlingzhong Nov 28, 2025
1167014
rename duplicated testing functions
jianlingzhong Nov 28, 2025
fc402b3
update catch syntax in test.jank; remove option in catch bodies
jianlingzhong Nov 28, 2025
db229d0
update catch syntax in test.jank
jianlingzhong Nov 28, 2025
3d53c4e
Consolidate and enhance try/catch test suite
jianlingzhong Nov 30, 2025
2ad1e08
Fix clang-tidy issue and 'Jank'
jianlingzhong Nov 30, 2025
b447f43
Add TODO full error handling for duplicated catch types
jianlingzhong Nov 30, 2025
89c4a32
typed catch (cppgen) almost work
jianlingzhong Dec 2, 2025
5b5740a
cppgen typed catch passes
jianlingzhong Dec 2, 2025
e94e596
Merge remote-tracking branch 'upstream/main' into catch_type
jianlingzhong Dec 2, 2025
d1b9460
cppgen & llvm ir gen wip
jianlingzhong Dec 4, 2025
d2c3234
cppgen & llvm ir gen wip (2 llvm ir failures remaining)
jianlingzhong Dec 4, 2025
15393ab
Merge remote-tracking branch 'upstream/main' into working_llvm_ir_test
jianlingzhong Dec 5, 2025
98bcf69
Merge branch 'working_llvm_ir_test' into catch_type_merge_test
jianlingzhong Dec 5, 2025
c024e3a
cppgen fully works; llvm ir gen 1 failure remains
jianlingzhong Dec 5, 2025
342cb3b
cppgen fully works; llvm ir gen fully works
jianlingzhong Dec 5, 2025
0d3187e
remove duplicated test and add new tests
jianlingzhong Dec 5, 2025
d35f205
move throw definition to separate block
jianlingzhong Dec 5, 2025
3bba08a
fixed all test failures
jianlingzhong Dec 5, 2025
2bd5a44
fix format
jianlingzhong Dec 5, 2025
73a76d6
fix clang-tidy
jianlingzhong Dec 6, 2025
17cb450
fix symbol not found in release
jianlingzhong Dec 6, 2025
5d3955e
update error message for "recur in try"
jianlingzhong Dec 6, 2025
05c8d08
fix output.txt
jianlingzhong Dec 6, 2025
d704634
fix output.txt
jianlingzhong Dec 6, 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
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ jobs:
analyze: on

## Debug + sanitization
- name: Ubuntu - address sanitizer
os: ubuntu-24.04
build_type: Debug
sanitize: address
# TODO: Fix this. GC issue: https://github.com/bdwgc/bdwgc/issues/772
#- name: Ubuntu - address sanitizer
# os: ubuntu-24.04
# build_type: Debug
# sanitize: address

- name: Ubuntu - undefined behavior sanitizer
os: ubuntu-24.04
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ a.out
.jank-repl-history
.envrc
.direnv
/notes

# Vim files
/.ycm_extra_conf.py*
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "compiler+runtime/third-party/folly"]
path = compiler+runtime/third-party/folly
url = https://github.com/jank-lang/folly.git
[submodule "compiler+runtime/third-party/bpptree"]
path = compiler+runtime/third-party/bpptree
url = https://github.com/jank-lang/BppTree.git
[submodule "compiler+runtime/third-party/immer"]
path = compiler+runtime/third-party/immer
url = https://github.com/jank-lang/immer.git
Expand Down
4 changes: 2 additions & 2 deletions compiler+runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ option(jank_coverage "Enable code coverage measurement" OFF)
option(jank_analyze "Enable static analysis" OFF)
option(jank_test "Enable jank's test suite" OFF)
option(jank_unity_build "Optimize translation unit compilation for the number of cores" OFF)
option(jank_debug_gc "Enable GC debug assertions" OFF)
set(jank_sanitize "none" CACHE STRING "The type of Clang sanitization to use (or none)")
set(jank_resource_dir
"../lib/jank/${CMAKE_PROJECT_VERSION}"
Expand Down Expand Up @@ -569,7 +570,6 @@ target_include_directories(
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/nanobench/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/folly>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/bpptree/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/bdwgc/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/immer>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/cli11/include>"
Expand Down Expand Up @@ -905,7 +905,7 @@ add_custom_command(
DEPENDS ${CMAKE_BINARY_DIR}/jank-phase-1 ${CMAKE_SOURCE_DIR}/src/jank/clojure/core.jank ${jank_incremental_pch_flag}
OUTPUT ${jank_core_libraries_flag}
BYPRODUCTS ${jank_clojure_core_o}
COMMAND ${CMAKE_BINARY_DIR}/jank-phase-1 compile-module -o ${jank_clojure_core_o} clojure.core
COMMAND ${CMAKE_BINARY_DIR}/jank-phase-1 compile-module -O3 -o ${jank_clojure_core_o} clojure.core
COMMAND touch ${jank_core_libraries_flag}
)
add_custom_target(
Expand Down
19 changes: 19 additions & 0 deletions compiler+runtime/cmake/dependency/bdwgc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,37 @@ set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
set(CMAKE_CXX_CLANG_TIDY_OLD ${CMAKE_CXX_CLANG_TIDY})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")

if(NOT APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DREDIRECT_MALLOC=GC_malloc_uncollectable -DREDIR_MALLOC_AND_LINUX_THREADS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREDIRECT_MALLOC=GC_malloc_uncollectable -DREDIR_MALLOC_AND_LINUX_THREADS")
endif()

set(BUILD_SHARED_LIBS OFF)
set(CMAKE_CXX_CLANG_TIDY "")
set(enable_cplusplus ON CACHE BOOL "Enable C++")
set(build_cord OFF CACHE BOOL "Build cord")
set(enable_docs OFF CACHE BOOL "Enable docs")
set(enable_threads ON CACHE BOOL "Enable multi-threading support")
set(enable_large_config ON CACHE BOOL "Optimize for large heap or root set")
set(enable_throw_bad_alloc_library ON CACHE BOOL "Enable C++ gctba library build")
set(enable_gc_debug OFF CACHE BOOL "Support for pointer back-tracing")

if(jank_debug_gc)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGC_ASSERTIONS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGC_ASSERTIONS")
set(enable_gc_debug ON CACHE BOOL "Support for pointer back-tracing")
endif()

add_subdirectory(third-party/bdwgc EXCLUDE_FROM_ALL)

unset(enable_cplusplus)
unset(build_cord)
unset(enable_docs)
unset(enable_threads)
unset(enable_large_config)
unset(enable_throw_bad_alloc_library)
unset(enable_gc_debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_OLD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_OLD}")
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD})
Expand Down
11 changes: 0 additions & 11 deletions compiler+runtime/cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ jank_glob_install_without_prefix(
PATTERN "${CMAKE_SOURCE_DIR}/third-party/folly/folly/*.h"
)

jank_glob_install_without_prefix(
INPUT_PREFIX "${CMAKE_SOURCE_DIR}/third-party/bpptree/"
PATTERN "${CMAKE_SOURCE_DIR}/third-party/bpptree/include/*"
)

jank_glob_install_without_prefix(
INPUT_PREFIX "${CMAKE_SOURCE_DIR}/third-party/immer/"
OUTPUT_PREFIX "include/"
Expand All @@ -82,12 +77,6 @@ jank_glob_install_without_prefix(
PATTERN "${CMAKE_SOURCE_DIR}/third-party/ftxui/include/*"
)

jank_glob_install_without_prefix(
INPUT_PREFIX "${CMAKE_SOURCE_DIR}/third-party/libzippp/src/"
OUTPUT_PREFIX "include/"
PATTERN "${CMAKE_SOURCE_DIR}/third-party/libzippp/src/*"
)

jank_glob_install_without_prefix(
INPUT_PREFIX "${CMAKE_SOURCE_DIR}/third-party/cpptrace/"
PATTERN "${CMAKE_SOURCE_DIR}/third-party/cpptrace/include/*"
Expand Down
1 change: 1 addition & 0 deletions compiler+runtime/cmake/summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jank_message("│ jank analyze : ${jank_analyze}")
jank_message("│ jank sanitize : ${jank_sanitize}")
jank_message("│ jank unity build : ${jank_unity_build}")
jank_message("│ jank resource dir : ${jank_resource_dir}")
jank_message("│ jank debug gc : ${jank_debug_gc}")
jank_message("│ clang version : ${LLVM_PACKAGE_VERSION}")
jank_message("│ clang prefix : ${CLANG_INSTALL_PREFIX}")
jank_message("│ clang resource dir : ${clang_resource_dir}")
Expand Down
1 change: 1 addition & 0 deletions compiler+runtime/include/cpp/jank/analyze/cpp_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace jank::analyze::cpp_util
native_vector<jtl::ptr<void>> find_adl_scopes(native_vector<jtl::ptr<void>> const &starters);

jtl::immutable_string get_qualified_name(jtl::ptr<void> scope);
jtl::immutable_string get_qualified_type_name(jtl::ptr<void> type);
void register_rtti(jtl::ptr<void> type);

jtl::ptr<void> expression_type(expression_ref expr);
Expand Down
1 change: 1 addition & 0 deletions compiler+runtime/include/cpp/jank/analyze/expr/if.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace jank::analyze::expr

/* TODO: Rename to have _expr suffixes. */
expression_ref condition;
/* The then/else exprs are expected to have the same type. We handle this during analysis. */
expression_ref then;
jtl::option<expression_ref> else_;
};
Expand Down
4 changes: 3 additions & 1 deletion compiler+runtime/include/cpp/jank/analyze/expr/try.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once


#include <jtl/option.hpp>

#include <jank/analyze/expr/cpp_type.hpp>
#include <jank/analyze/expression.hpp>

namespace jank::runtime::obj
Expand Down Expand Up @@ -36,7 +38,7 @@ namespace jank::analyze::expr
void walk(std::function<void(jtl::ref<expression>)> const &f) override;

do_ref body;
jtl::option<catch_> catch_body{};
native_vector<catch_> catch_bodies{};
jtl::option<do_ref> finally_body{};
};
}
6 changes: 6 additions & 0 deletions compiler+runtime/include/cpp/jank/analyze/expr/var_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ namespace jank::analyze::expr

runtime::object_ref to_runtime_data() const override;

/* Holds the fully qualified name for the originally resolved var.
* It will be useful to know that the var ref happened through a
* referred var, for static analysis and error reporting.
*
* For all the other purposes, `var` member should be used that points
* to the actual value of the var.. */
runtime::obj::symbol_ref qualified_name{};
runtime::var_ref var{};
};
Expand Down
34 changes: 1 addition & 33 deletions compiler+runtime/include/cpp/jank/analyze/local_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace jank::runtime
{
struct context;
using var_ref = oref<struct var>;

namespace obj
{
Expand All @@ -29,25 +30,6 @@ namespace jank::analyze
using function_context_ref = jtl::ref<struct function_context>;
}

struct lifted_var
{
jtl::immutable_string native_name{};
runtime::obj::symbol_ref var_name{};

runtime::object_ref to_runtime_data() const;
};

/* TODO: Track constant usages to figure out if boxing is needed at all,
* rather than just doing both. */
struct lifted_constant
{
jtl::immutable_string native_name{};
jtl::option<jtl::immutable_string> unboxed_native_name{};
runtime::object_ref data{};

runtime::object_ref to_runtime_data() const;
};

struct local_binding
{
runtime::obj::symbol_ref name{};
Expand Down Expand Up @@ -135,14 +117,6 @@ namespace jank::analyze

static bool within_same_fn(jtl::ptr<local_frame>, jtl::ptr<local_frame>);

runtime::obj::symbol_ref lift_var(runtime::obj::symbol_ref const &);
jtl::option<std::reference_wrapper<lifted_var const>>
find_lifted_var(runtime::obj::symbol_ref const &) const;

void lift_constant(runtime::object_ref);
jtl::option<std::reference_wrapper<lifted_constant const>>
find_lifted_constant(runtime::object_ref) const;

static local_frame const &find_closest_fn_frame(local_frame const &frame);
static local_frame &find_closest_fn_frame(local_frame &frame);

Expand All @@ -152,12 +126,6 @@ namespace jank::analyze
jtl::option<jtl::ptr<local_frame>> parent;
native_unordered_map<runtime::obj::symbol_ref, local_binding> locals;
native_unordered_map<runtime::obj::symbol_ref, local_binding> captures;
native_unordered_map<runtime::obj::symbol_ref, lifted_var> lifted_vars;
native_unordered_map<runtime::object_ref,
lifted_constant,
std::hash<runtime::object_ref>,
runtime::very_equal_to>
lifted_constants;
/* This is only set if the frame type is fn. */
jtl::ptr<expr::function_context> fn_ctx;
};
Expand Down
2 changes: 2 additions & 0 deletions compiler+runtime/include/cpp/jank/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ extern "C"
jank_object_ref jank_read_string(jank_object_ref s);
jank_object_ref jank_read_string_c(char const * const s);

jank_object_ref jank_ns_intern(jank_object_ref sym);
jank_object_ref jank_ns_intern_c(char const * const sym);
void jank_ns_set_symbol_counter(char const * const ns, jank_u64 const count);

jank_object_ref jank_var_intern(jank_object_ref ns, jank_object_ref name);
Expand Down
3 changes: 2 additions & 1 deletion compiler+runtime/include/cpp/jank/codegen/llvm_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ namespace jank::codegen
llvm_processor(analyze::expr::function_ref const expr,
jtl::immutable_string const &module,
compilation_target target);
llvm_processor(analyze::expr::function_ref expr, std::unique_ptr<reusable_context> ctx);
/* For this ctor, we're inheriting the context from another function, which means
* we're building a nested function. */
llvm_processor(analyze::expr::function_ref expr, std::unique_ptr<reusable_context> ctx);
llvm_processor(analyze::expr::function_ref expr, jtl::ref<reusable_context> ctx);
llvm_processor(llvm_processor const &) = delete;
llvm_processor(llvm_processor &&) noexcept = default;

Expand Down
Loading
Loading