Open zesterer opened 2 months ago
Do you have an example to reproduce the problem?
Not that I can easily extract. Something like this should work on your end though:
fn square(x: usize) -> usize {
let lut = const {
let mut lut = [0; 4096];
let mut i = 0;
while i < 4096 {
lut[i] = i * i;
}
lut
};
lut[x]
}
It might be worth noting that I'm compiling for an ARM-based platform so perhaps the way the compiler treats static data might be a little different given the differences in addressing mode (ARM only really supports near addresses without building up a pointer manually in a register).
On x86 this generates a huge table but it goes into a separate section so output is still perfectly readable. Can you post some sample output of how it looks on arm? Preferably something not too huge?
Here's an example. Note the extremely long lines which, when displayed in a terminal, wrap.
Is that the output from cargo-show-asm
? Those tables go into separate sections and I expect them not to be displayed by default.
If it dumps in a single line I'd use something like cargo asm ... --color | less -SR
Anyway, I don't mind adding something to deal with this issue, but only if it can't be solved with less
as I shown above.
In theory I can process the output in any number of ways, but I think an option like --code-only
would be fairly consistent with the existing features of the crate (such as --simplify
).
I'm writing code that's making considerable use of LUTs generated inline via const code. As a result, I end up with the LUT data being displayed inline with the code, which is often many thousands of times larger than the code itself. It would be useful to have the option to strip data or - even better - data over a specific length from the output.
EDIT:
For anybody with a similar problem, my solution for now is:
which strips all lines containing
asciz
from the output (if your assembly language uses another keyword to denote data, use that instead). You will also want to add--color
to the cargo command to retain colour output.