-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat: don't manage blittable types #1407
Merged
Merged
Commits on Nov 29, 2021
-
feat: add box templates and box type
This commit adds an implementation of Boxes, memory manged heap allocated values. Boxes are implemented as C pointers, with no additional structure but are treated as structs in Carp. To facilitate this, we need to add them as a clause to our special type emissions (TypesToC) as they'd otherwise be emitted like other struct types. Co-authored-by: Veit Heller <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d23977b - Browse repository at this point
Copy the full SHA d23977bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c6839d - Browse repository at this point
Copy the full SHA 5c6839dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 33c99e0 - Browse repository at this point
Copy the full SHA 33c99e0View commit details -
Revert "fix: Ignore clang nitpick"
This reverts commit 70ec6d4.
Configuration menu - View commit details
-
Copy full SHA for 7149afd - Browse repository at this point
Copy the full SHA 7149afdView commit details -
fix: update example/functor.carp
Now that a builtin type named Box exists, the definitions in this file cause a conflict. I've renamed the "Box" type in the functor example to remove the conflict.
Configuration menu - View commit details
-
Copy full SHA for 082cfab - Browse repository at this point
Copy the full SHA 082cfabView commit details -
Box.peek allows users to transform a reference to a box into a a reference to the box's contained value. The returned reference will have the same lifetime as the box. This function allows callers to manipulate the value in a box without re-allocation, for example: ```clojure (deftype Num [val Int]) (let-do [box (Box.init (Num.init 0))] (Num.set-val! (Box.peek &box) 1) @(Num.val (Box.peek &box))) ``` This commit also includes tests for Box.peek. Co-authored-by: TimDeve <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7e95f58 - Browse repository at this point
Copy the full SHA 7e95f58View commit details
Commits on Dec 8, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 50ab32e - Browse repository at this point
Copy the full SHA 50ab32eView commit details
Commits on Dec 28, 2021
-
Configuration menu - View commit details
-
Copy full SHA for d52f7a3 - Browse repository at this point
Copy the full SHA d52f7a3View commit details
Commits on Mar 7, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 215b4fd - Browse repository at this point
Copy the full SHA 215b4fdView commit details
Commits on Mar 22, 2022
-
Configuration menu - View commit details
-
Copy full SHA for ee33762 - Browse repository at this point
Copy the full SHA ee33762View commit details
Commits on Mar 23, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 503ead4 - Browse repository at this point
Copy the full SHA 503ead4View commit details
Commits on Mar 28, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 5dc22ec - Browse repository at this point
Copy the full SHA 5dc22ecView commit details
Commits on Apr 1, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 44dca8e - Browse repository at this point
Copy the full SHA 44dca8eView commit details -
feat: don't manage blittable types
The `blit` interface, when implemented, indicates that a type is freely copyable and does not require deletion. It is similar to Rust's Copy trait and indicates that a type should have copy instead of "move" semantics. This commit updates the memory management system to ignore such types, since we do not need to worry about deleting them. Thus, when using a blittable type, users can freely use a variable of the type in more than one place. This commit also fixes a small typo and adds a TODO to warn users when delete and blit are both implemented (as typically one shouldn't need delete if a type is truly blittable).
Configuration menu - View commit details
-
Copy full SHA for 0a34084 - Browse repository at this point
Copy the full SHA 0a34084View commit details -
test: check blittable memory behavior in memory.carp
This commit updates memory.carp to test that types that implement blit are freely copyable (have copy instead of move semantics, are not borrow checked) and do not cause leaks. Of course, users can still cause leaks if they define blit on a type that isn't actually freely copyable (e.g. it owns some data that is heap allocated), but this test checks the basic behavior.
Configuration menu - View commit details
-
Copy full SHA for aa93614 - Browse repository at this point
Copy the full SHA aa93614View commit details
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.