mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
[ares] fix a couple bugs in unifying equality
East/West typo, also we were setting the frame pointer to the stack pointer while chasing up the stack. This also refactors the conditionals in a way that I think is easier to read. We always have to do both calculations anyway.
This commit is contained in:
parent
5edfc1a801
commit
43f3622f63
@ -777,21 +777,14 @@ unsafe fn senior_pointer_first<T>(
|
||||
),
|
||||
};
|
||||
loop {
|
||||
if a < high_pointer && a >= low_pointer {
|
||||
// a is in the current frame
|
||||
if b < high_pointer && b >= low_pointer {
|
||||
// so is b, pick arbitrarily
|
||||
break (a, b);
|
||||
} else {
|
||||
// b is not, so b must be further up, b is senior
|
||||
break (b, a);
|
||||
}
|
||||
} else {
|
||||
// a is not in the current frame
|
||||
if b < high_pointer && b >= low_pointer {
|
||||
// b is, a is senior
|
||||
break (a, b);
|
||||
} else {
|
||||
match (
|
||||
a < high_pointer && a >= low_pointer,
|
||||
b < high_pointer && b >= low_pointer,
|
||||
) {
|
||||
(true, true) => break (a, b), // both pointers are in the same frame, pick arbitrarily
|
||||
(true, false) => break (b, a), // a is in the frame, b is not, so b is senior
|
||||
(false, true) => break (a, b), // b is in the frame, a is not, so a is senior
|
||||
(false, false) => {
|
||||
// chase up the stack
|
||||
if (frame_pointer as *const u64) == stack.start {
|
||||
// we found the top of the stack!
|
||||
@ -801,15 +794,15 @@ unsafe fn senior_pointer_first<T>(
|
||||
Polarity::East => {
|
||||
high_pointer = *(frame_pointer.sub(2)) as *const T;
|
||||
low_pointer = *(frame_pointer.sub(1)) as *const T;
|
||||
frame_pointer = *(frame_pointer.sub(1)) as *const u64;
|
||||
frame_pointer = *(frame_pointer.sub(2)) as *const u64;
|
||||
polarity = Polarity::West;
|
||||
continue;
|
||||
}
|
||||
Polarity::West => {
|
||||
high_pointer = *frame_pointer as *const T;
|
||||
low_pointer = *(frame_pointer.add(1)) as *const T;
|
||||
frame_pointer = *frame_pointer as *const u64;
|
||||
polarity = Polarity::West;
|
||||
frame_pointer = *(frame_pointer.add(1)) as *const u64;
|
||||
polarity = Polarity::East;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user