Bug 204126 - Support or16(TrustedImm32, AbsoluteAddress) in the MIPS MacroAssembler
Summary: Support or16(TrustedImm32, AbsoluteAddress) in the MIPS MacroAssembler
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Caio Lima
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-11-12 13:33 PST by Robin Morisset
Modified: 2019-11-14 12:52 PST (History)
13 users (show)

See Also:


Attachments
WIP - Patch (2.15 KB, patch)
2019-11-12 18:23 PST, Caio Lima
no flags Details | Formatted Diff | Diff
WIP - Patch (2.32 KB, patch)
2019-11-13 11:33 PST, Caio Lima
no flags Details | Formatted Diff | Diff
Patch (5.98 KB, patch)
2019-11-13 18:31 PST, Caio Lima
no flags Details | Formatted Diff | Diff
Patch (5.91 KB, patch)
2019-11-14 03:16 PST, Caio Lima
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2019-11-12 13:33:48 PST
My patch at https://bugs.webkit.org/show_bug.cgi?id=202832 was rolled out, because it was using or32 on a now-16bits field.
I am currently fixing it, which includes implementing or16 in the 32 and 64-bits x86 and ARM MacroAssembler backends.
I cannot fix the MIPS backend as I have no way to test it and don't even know which processors it is supposed to work on; so once I am done and lands the patch again it will probably break the MIPS port.
The solution is simply to implement or16(TrustedImm32, AbsoluteAddress) in MacroAssemblerMIPS.h. There is already a 32-bit version, so it should not be too difficult.
Comment 1 Caio Lima 2019-11-12 18:23:54 PST
Created attachment 383417 [details]
WIP - Patch

This seems to be the proper implementation. I'm running tests to validate it.
Comment 2 Caio Lima 2019-11-13 11:33:04 PST
Created attachment 383476 [details]
WIP - Patch

Diff from current https://bugs.webkit.org/show_bug.cgi?id=202832
Comment 3 Robin Morisset 2019-11-13 12:43:15 PST
Comment on attachment 383476 [details]
WIP - Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=383476&action=review

> Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:-491
> -            m_assembler.lw(immTempRegister, addrTempRegister, adr & 0xffff);

This patch appears to be altering the implementation of or32, instead of adding or16?
Comment 4 Caio Lima 2019-11-13 18:25:39 PST
Comment on attachment 383476 [details]
WIP - Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=383476&action=review

>> Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:-491
>> -            m_assembler.lw(immTempRegister, addrTempRegister, adr & 0xffff);
> 
> This patch appears to be altering the implementation of or32, instead of adding or16?

Actually, this is a diff from your current patch that already landed. I'm uploading a Patch to this soon.
Comment 5 Caio Lima 2019-11-13 18:31:34 PST
Created attachment 383533 [details]
Patch
Comment 6 Mark Lam 2019-11-13 21:04:58 PST
Comment on attachment 383533 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=383533&action=review

> JSTests/stress/regress-57020338.js:6
> +  for (let j = 0; j < 10000; j++) {

I’m not sure this is a valid is an appropriate change to make.  Robin, is 10000 sufficient to repro the problem in x86_64?  If not,, then the timeout issue on slow ports should be handled in a different way.
Comment 7 Caio Lima 2019-11-14 03:16:03 PST
Created attachment 383552 [details]
Patch
Comment 8 Caio Lima 2019-11-14 03:31:58 PST
(In reply to Mark Lam from comment #6)
> Comment on attachment 383533 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=383533&action=review
> 
> > JSTests/stress/regress-57020338.js:6
> > +  for (let j = 0; j < 10000; j++) {
> 
> I’m not sure this is a valid is an appropriate change to make.  Robin, is
> 10000 sufficient to repro the problem in x86_64?  If not,, then the timeout
> issue on slow ports should be handled in a different way.

To reproduce the issue, I changed `ArithProfile<BitfieldType>::emitUnconditionalSet` to use `or32` instead of `or16`.

I was able to see crashes in x86_64, but not every time. Now, I changed another place and I was able to reproduce segfault 100/100 tries in my x86_64 macOS build. I also tested this on jsc-only and reproduced the crash.
Comment 9 Caio Lima 2019-11-14 11:42:24 PST
ping
Comment 10 Mark Lam 2019-11-14 11:45:03 PST
Comment on attachment 383552 [details]
Patch

rs=me
Comment 11 Caio Lima 2019-11-14 11:46:55 PST
For the record, both issues of stress/ensure-code-block-is-not-precise-allocation.js.dfg-eager (MIPS) and stress/toctou-having-a-bad-time-new-array.js (ARMv7) are not related with this Patch. The former is due the broken OSR to LLInt into MIPS and later is a OOM on ToT (see one report here https://build.webkit.org/builders/JSCOnly%20Linux%20ARMv7%20Thumb2%20Release/builds/9979/steps/jscore-test/logs/stdio)
Comment 12 Caio Lima 2019-11-14 12:08:03 PST
Comment on attachment 383552 [details]
Patch

Thank you very much for the review!
Comment 13 WebKit Commit Bot 2019-11-14 12:51:10 PST
Comment on attachment 383552 [details]
Patch

Clearing flags on attachment: 383552

Committed r252463: <https://trac.webkit.org/changeset/252463>
Comment 14 WebKit Commit Bot 2019-11-14 12:51:12 PST
All reviewed patches have been landed.  Closing bug.
Comment 15 Radar WebKit Bug Importer 2019-11-14 12:52:20 PST
<rdar://problem/57200550>