Skip to content

Commit

Permalink
Merge pull request #105 from urbit/as/ctrlc
Browse files Browse the repository at this point in the history
Add SIGINT handling to Ares
  • Loading branch information
eamsden authored Oct 5, 2023
2 parents 57452b2 + 6bbd114 commit bb059a5
Show file tree
Hide file tree
Showing 11 changed files with 531 additions and 240 deletions.
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"
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));
traversal_stack[traversal_depth] = Some((new_stem, 0));
traversal_depth += 1;
continue 'preserve;
Expand Down
Loading

0 comments on commit bb059a5

Please sign in to comment.