Skip to content
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

Add SIGINT handling to Ares #105

Merged
merged 15 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion hoon/scaffolding/playpen.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
::
+$ cord @t
+$ knot @ta
+$ term @tas
+$ char @t
+$ ship @p
+$ life @ud
Expand Down Expand Up @@ -54,9 +55,10 @@
[%palm p=(qual tape tape tape tape) q=(list tank)]
[%rose p=(trel tape tape tape) q=(list tank)]
==
+$ tang (list tank)
+$ toon $% [%0 p=*]
[%1 p=*]
[%2 p=(list tank)]
[%2 p=tang]
==
++ tree |$ [node] $@(~ [n=node l=(tree node) r=(tree node)])
++ gate $-(* *)
Expand Down
67 changes: 46 additions & 21 deletions hoon/scaffolding/toddler.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,46 @@
!=
=>
|%
+$ card (cask)
++ cask |$ [a] (pair mark a)
+$ goof [mote=term =tang]
+$ mark @tas
+$ card (cask)
+$ ovum [=wire =card]
+$ vere [[non=@ta rev=path] kel=wynn]
+$ wire path
+$ wasp
:: %crud: reroute $ovum with $goof
:: %wack: iterate entropy
:: %wyrd: check/record runtime kelvin stack
::
$% [%crud =goof =ovum]
[%wack p=@uvJ]
[%wyrd p=vere]
==
+$ weft [lal=@tas num=@ud]
+$ wynn (list weft)
:: mutually recursive Ackermann functions
:: test turning %spot hints on/off
++ wack
++ ack
:: re-enable %spot hints
!:
|= [m=@ud n=@ud]
:: %mean hint
~_ [%leaf "I am a %mean hint via ~_ from +wack"]
:: %hela hint
~> %hela
:: %memo hint
~+
?~ m +(n)
?~ n
(tack (dec m) 1)
(tack (dec m) $(n (dec n)))
++ tack
:: disable %spot hints
(ack (dec m) 1)
(ack (dec m) $(n (dec n)))
++ slow
|= x=@ud
!:
(slow-help x 0)
++ slow-help
|= [x=@ud y=@ud]
!.
|= [m=@ud n=@ud]
:: %hela hint
~> %hela
:: %memo hint
~+
?~ m +(n)
?~ n
(wack (dec m) 1)
(wack (dec m) $(n (dec n)))
?: .= x y
x
$(y .+(y))
-- =>
::
|%
Expand All @@ -50,8 +57,26 @@
++ poke
|= [now=@da ovo=ovum]
^- ^
~> %slog.[0 leaf+(scow %ud (wack 2 1))]
[~ ..poke]
::
?. ?=(?(%crud %wack %wyrd) p.card.ovo)
~> %slog.[0 leaf+(scow %ud (slow (bex 23)))]
[~ ..poke]
::
=/ buz
~> %mean.'pith: bad wasp'
;;(wasp card.ovo)
?+ -.buz
~> %slog.[0 leaf+(scow %ud (ack 2 1))]
[~ ..poke]
::
%crud
=/ tang tang.goof.buz
|-
?~ tang
[~ ..poke]
~> %slog.[0 -.tang]
$(tang +.tang)
==
--
::
|= [now=@da ovo=ovum]
Expand Down
21 changes: 21 additions & 0 deletions rust/ares/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions rust/ares/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@ edition = "2018"
# [patch.crates-io]
# ibig = { path = "../ibig-rs" }

# Please keep these alphabetized
[dependencies]
ares_macros = { path = "../ares_macros" }
assert_no_alloc = "1.1.2"
# use this when debugging requires allocation (e.g. eprintln)
# assert_no_alloc = {version="1.1.2", features=["warn_debug"]}
bitvec = "1.0.0"
criterion = "0.4"
either = "1.9.0"
ibig = { path = "../ibig-rs" }
intmap = "1.1.0"
lazy_static = "1.4.0"
libc = "0.2.126"
murmur3 = { git = "https://github.com/tloncorp/murmur3", rev = "7878a0f" }
memmap = "0.7.0"
intmap = "1.1.0"
num-traits = "0.2"
murmur3 = { git = "https://github.com/tloncorp/murmur3", rev = "7878a0f" }
num-derive = "0.3"
criterion = "0.4"
num-traits = "0.2"
signal-hook = "0.3"
Comment on lines +15 to +29
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this reordering done by some automated tool? Or just manually alphabetized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was manual (because of the 'tism).

static_assertions = "1.1.0"
ibig = { path = "../ibig-rs" }
assert_no_alloc = "1.1.2"
# use this when debugging requires allocation (e.g. eprintln)
# assert_no_alloc = {version="1.1.2", features=["warn_debug"]}

[build-dependencies]
cc = "1.0.79"
Expand All @@ -40,4 +43,3 @@ opt-level = 3
opt-level = 3

[features]
check_acyclic=[]
4 changes: 2 additions & 2 deletions rust/ares/src/hamt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<T: Copy> MutHamt<T> {
mug >>= 5;
match (*stem).entry(chunk) {
None => {
let new_leaf_buffer = stack.struct_alloc(1);
let new_leaf_buffer = stack.struct_alloc::<(Noun, T)>(1);
*new_leaf_buffer = (*n, t);
(*stem).bitmap |= chunk_to_bit(chunk);
(*stem).typemap &= !chunk_to_bit(chunk);
Expand Down Expand Up @@ -480,7 +480,7 @@ impl<T: Copy + Preserve> Preserve for Hamt<T> {
};
*(stem.buffer.add(idx) as *mut Entry<T>) = Entry { stem: new_stem };
assert!(traversal_depth <= 5); // will increment
traversal_stack[traversal_depth - 1].unwrap().1 = position + 1;
traversal_stack[traversal_depth - 1] = Some((stem, position + 1));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marker for synchronous review: question about this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixing a logical error that was not causing a bug due to safety logic up above (we discovered it together during the very first pairing session for the memory seniority bug):

The lvalue here is incorrect and not actually resulting in the Stem in the path at depth traversal_depth - 1 to be updated. The compiler is moving the value and inferring mutability to the moved value, which is then updated, leaving the original untouched. However, when we come back around with the same position value as before, the buffer of the Stem has already been copied into the parent frame, resulting in the is_in_frame() check to return false, and therefore immediately incrementing the position value and continuing the loop.

traversal_stack[traversal_depth] = Some((new_stem, 0));
traversal_depth += 1;
continue 'preserve;
Expand Down
Loading