aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-28 14:53:50 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-28 14:57:38 -0700
commitdf24ce52b1059232db66e9af425a02df558aa1ca (patch)
treebf314eace4c7acd533c5c9532b330ecd8ae65686 /lib/std/debug.zig
parenteb9c29eb817a24e5326b9a63ebf7265d3b2bad2c (diff)
parent55c58f226d06d3708a82878a67f3800e0ce5810b (diff)
downloadzig-df24ce52b1059232db66e9af425a02df558aa1ca.tar.gz
zig-df24ce52b1059232db66e9af425a02df558aa1ca.zip
Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
In particular I wanted to take advantage of the new hex float parsing code.
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 89c5119156..68828ad24c 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -339,6 +339,13 @@ pub const StackIterator = struct {
fp: usize,
pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
+ if (native_arch == .sparcv9) {
+ // Flush all the register windows on stack.
+ asm volatile (
+ \\ flushw
+ ::: "memory");
+ }
+
return StackIterator{
.first_address = first_address,
.fp = fp orelse @frameAddress(),
@@ -346,18 +353,18 @@ pub const StackIterator = struct {
}
// Offset of the saved BP wrt the frame pointer.
- const fp_offset = if (native_arch.isRISCV())
+ const fp_offset = if (comptime native_arch.isRISCV())
// On RISC-V the frame pointer points to the top of the saved register
// area, on pretty much every other architecture it points to the stack
// slot where the previous frame pointer is saved.
2 * @sizeOf(usize)
- else if (native_arch.isSPARC())
+ else if (comptime native_arch.isSPARC())
// On SPARC the previous frame pointer is stored at 14 slots past %fp+BIAS.
14 * @sizeOf(usize)
else
0;
- const fp_bias = if (native_arch.isSPARC())
+ const fp_bias = if (comptime native_arch.isSPARC())
// On SPARC frame pointers are biased by a constant.
2047
else
@@ -383,7 +390,7 @@ pub const StackIterator = struct {
}
fn next_internal(self: *StackIterator) ?usize {
- const fp = if (native_arch.isSPARC())
+ const fp = if (comptime native_arch.isSPARC())
// On SPARC the offset is positive. (!)
math.add(usize, self.fp, fp_offset) catch return null
else