Changeset 260246 in webkit


Ignore:
Timestamp:
Apr 17, 2020 7:38:43 AM (4 years ago)
Author:
mark.lam@apple.com
Message:

offlineasm is generating the wrong load/store for the "orh" instruction.
https://bugs.webkit.org/show_bug.cgi?id=210639
<rdar://problem/21501876>

Reviewed by Robin Morisset.

For example, on ARM64E, the "orh" instruction 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).

  • offlineasm/risc.rb:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r260237 r260246  
     12020-04-17  Mark Lam  <mark.lam@apple.com>
     2
     3        offlineasm is generating the wrong load/store for the "orh" instruction.
     4        https://bugs.webkit.org/show_bug.cgi?id=210639
     5        <rdar://problem/21501876>
     6
     7        Reviewed by Robin Morisset.
     8
     9        For example, on ARM64E, the "orh" instruction was generating the following:
     10
     11            "\tldr w17, [x1, #0]\n"     // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     12            "\torr w17, w17, #64\n"     // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     13            "\tstr w17, [x1, #0]\n"     // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     14
     15        i.e. a 32-bit load, followed by a 32-bit OR, followed by a 32-bit store.
     16
     17        Instead, it should be generating the following:
     18
     19            "\tldrh w17, [x1, #0]\n"    // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     20            "\torr w17, w17, #64\n"     // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     21            "\tstrh w17, [x1, #0]\n"    // JavaScriptCore/llint/LowLevelInterpreter64.asm:919
     22
     23        i.e. a 16-bit load, followed by a 32-bit OR, followed by a 16-bit store.
     24
     25        This bug also affects ARM64, ARMv7, and MIPS (basically any backend that uses
     26        riscLowerMisplacedAddresses() from rise.rb).  It does not affect x86, x86_64, and
     27        C_LOOP (which was written based on x86).
     28
     29        * offlineasm/risc.rb:
     30
    1312020-04-16  Ross Kirsling  <ross.kirsling@sony.com>
    232
  • trunk/Source/JavaScriptCore/offlineasm/risc.rb

    r252422 r260246  
    1 # Copyright (C) 2011-2018 Apple Inc. All rights reserved.
     1# Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    463463            annotation = node.annotation
    464464            case node.opcode
    465             when "addi", "addis", "andi", "lshifti", "muli", "negi", "noti", "ori", "orh", "oris",
     465            when "addi", "addis", "andi", "lshifti", "muli", "negi", "noti", "ori", "oris",
    466466                "rshifti", "urshifti", "subi", "subis", "xori", /^bi/, /^bti/, /^ci/, /^ti/
    467467                newList << Instruction.new(node.codeOrigin,
    468468                                           node.opcode,
    469469                                           riscAsRegisters(newList, postInstructions, node.operands, "i"),
     470                                           annotation)
     471            when "orh"
     472                newList << Instruction.new(node.codeOrigin,
     473                                           node.opcode,
     474                                           riscAsRegisters(newList, postInstructions, node.operands, "h"),
    470475                                           annotation)
    471476            when "addp", "andp", "lshiftp", "mulp", "negp", "orp", "rshiftp", "urshiftp",
Note: See TracChangeset for help on using the changeset viewer.