-
-
Notifications
You must be signed in to change notification settings - Fork 95
Add intial jtl and rework runtime objects #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Not all are passing yet.
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.
Part 1
We're introducing jtl, which is the start of a replacement for the C++ stdlib. This will grow to contain functionality as we remove more and more stdlib headers. The purpose of this is to optimize both our compile times and our run times. The jtl will aim to be closer to Rust than the C++ stdlib, but it's a replacement nonetheless.
jtl::ptr
jtl::ref
jtl::storage
jank_assert
andjank_debug_assert
jtl::panic
option
intojtl
result
intojtl
native_persistent_string
intojtl::immutable_string
type_name
intojtl
native_box
usage for errors and analysisPart 2
With the start of the jtl in place, we also took some steps to improve how we represent objects. Previously, we have a
native_box<T>
type which was a GC'd smart pointer with assertions againstnullptr
derefs. Now, we havejtl::ptr
which does the same, but acceptsnullptr
as a valid state. We also havejtl::ref
, which can never holdnullptr
. We also haveoref<T>
, which is only for jank runtime objects.oref<T>
cannot holdnullptr
, but it can holdnil
. This is analogous to the JVM'snull
, since derefing it can now throw an exception, rather than be UB. Juggling bothnil
andT
in one box requires some type erasure dancing.We also introduce
sequence_range
as a bridge from the Clojure sequence world into the C++ iterator world. Another benefit it adds is that we don't need to worry aboutnext
vsnext_in_place
anymore. We delegate all of that tosequence_range
, which allows us to makenext_in_place
optional for some types. This solves some long-standing issues with sequence-related crashes.Finally, the entire compiler/runtime has been updated to use jtl's fixed-width primitive types. This also follows Rust's design.
oref
to deal with runtime objectsnative_box
usages withoref
for runtimesequence_range
and makenext_in_place
optional forconj
andlazy_sequence
-- this fixes Segmentation fault onfor
list comprehension at certain size #87jank_nil
,jank_true
, andjank_false
constants for easy use -- the C API fns have been renamednative_bool
,native_integer
,native_real
, andnative_hash
with jtl primitives