Bug 210639

Summary: offlineasm is generating the wrong load/store for the "orh" instruction.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: angelos, fpizlo, guijemont, keith_miller, msaboff, pmatos, rmorisset, saam, ticaiolima, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 210665    
Bug Blocks: 207330    
Attachments:
Description Flags
proposed patch. rmorisset: review+

Description Mark Lam 2020-04-16 23:40:27 PDT
For example, on ARM64E, it was generating the following:

    "\tldr w17, [x1, #0]\n"                                  // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
    "\torr w17, w17, #64\n"                                  // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
    "\tstr w17, [x1, #0]\n"                                  // JavaScriptCore/llint/LowLevelInterpreter64.asm:919

i.e. a 32-bit load, followed by a 32-bit OR, followed by a 32-bit store.

Instead, it should be generating the following:

    "\tldrh w17, [x1, #0]\n"                                 // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
    "\torr w17, w17, #64\n"                                  // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
    "\tstrh w17, [x1, #0]\n"                                 // JavaScriptCore/llint/LowLevelInterpreter64.asm:919

i.e. a 16-bit load, followed by a 32-bit OR, followed by a 16-bit store.

This bug also affects ARM64, ARMv7, and MIPS (basically any backend that uses riscLowerMisplacedAddresses() from rise.rb).
It does not affect x86, x86_64, and C_LOOP (which was written based on x86).

<rdar://problem/21501876>
Comment 1 Mark Lam 2020-04-16 23:49:48 PDT
Created attachment 396743 [details]
proposed patch.
Comment 2 Robin Morisset 2020-04-17 01:25:36 PDT
Comment on attachment 396743 [details]
proposed patch.

r=me
Comment 3 Mark Lam 2020-04-17 07:39:50 PDT
Thanks for the review.  Landed in r260246: <http://trac.webkit.org/r260246>.