Show assembler offsets in IONFLAGS=codegen output for x86/x64
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox151 | --- | fixed |
People
(Reporter: jseward, Assigned: jseward)
References
Details
Attachments
(2 files)
Debugging wasm::TrapSiteDesc and wasm::StackMap bugs is difficult on x86/x64
because these depend critically on which code addresses (assembler offsets) the
trapsites/stackmaps are associated with. Unfortunately that info is not shown
in the IONFLAGS=codegen output on such targets, even though it is on others (eg
arm64). We should fix this.
| Assignee | ||
Comment 1•5 months ago
|
||
This patch makes changes in the x86-shared implementation of class GenericAssembler.
-
GenericAssembler::spewVA, which prints to the required logging channels:
accept a new parametercurrentOffset, to be the assembler offset to
display at the start of the line. -
GenericAssembler::spew: temporarily (for this patch only), pass zero to
::spewVA. -
Merge an
ifdef JS_JITSPEWinto its predecessor.
Doing it like this means we can split off the core part of the patch from the
"big mechanical" changes that involve all (hundreds) of call sites for ::spew.
With this patch in place, an offset is now printed as required, but it is
always zero.
The intended effect (once the part 2 patch lands) is that all calls to
GenericAssembler::spew now must pass the current assembler offset. That is
unfortunately necessary because (1) class GenericAssembler doesn't carry the
current offset, and (2) even if it did, it would not always show the offset for
the first byte of the instruction, since in some places, calls to ::spew happen
after part of the instruction has already been emitted.
| Assignee | ||
Comment 2•5 months ago
|
||
This is a "big mechanical" patch. It builds on the part 1 patch, by changing
all x86/x64 uses of spew(whatever) to spew(currentOffset(), whatever).
There are several hundred such calls and the patch is commensurately huge.
Some caveats:
-
In a few places, the
spew(..)call is not at the start of the routine, but
happens afterm_formatter..(..)has been called. Hence using
spew(currentOffset(), ..)is incorrect. I think I found all such places,
and changed them to begin withauto offset = currentOffset() ; ... ; spew(offset, ..). -
In AssemblerBuffer::spew, the dummy value of zero passed to ::spewVA is now
the real offset. -
In order that release-build performance is not impacted, it is important that
a callspew(currentOffset(), format-string, args)is inlined away
completely. In support of this:-
BaseAssembler::currentOffset (BaseAssembler-x86-sharted.h:4605) has been
markedinline. -
I verified that the
spewcall in the fragment below gets inlined away in
a release build with clang -O2. Themovabsqinstructions serve as
markers around thespewcall. Disassembly of the shell executable shows
them back-to-back, with nothing in between.
-
void adcq_rr(RegisterID src, RegisterID dst) {
__asm__ __volatile__("movabsq $0x3333444455556666, %%rdi" ::: "rdi");
spew(currentOffset(), "adcq %s, %s", GPReg64Name(src),
GPReg64Name(dst));
__asm__ __volatile__("movabsq $0xaaaabbbbccccdddd, %%rdi" ::: "rdi");
m_formatter.oneByteOp64(OP_ADC_GvEv, src, dst);
}
Comment 4•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0eb6946ee9e4
https://hg.mozilla.org/mozilla-central/rev/26282a37754e
Updated•4 months ago
|
Description
•