⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267535 in webkit


Ignore:
Timestamp:
Sep 24, 2020, 9:16:59 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[MIPS] Broken build after r267371
https://bugs.webkit.org/show_bug.cgi?id=216893

Patch by Angelos Oikonomopoulos <Angelos Oikonomopoulos> on 2020-09-24
Reviewed by Adrian Perez de Castro.

This addresses two issues.

First, the fix in https://bugs.webkit.org/show_bug.cgi?id=216772 was not
getting exercised, because the LabelReference offset was always zero.

The reason the offset was zero is that LabelReference.mapChildren would discard
the offset when generating a new LabelReference to wrap the Label returned by
the code block it yielded to.

The reason this was only an issue on MIPS is because only MIPS was using the
result of calls to LabelReference.mapChildren (in its lowering phase,
assignRegistersToTemporaries -> replaceTemporariesWithRegisters ->
mapChildren). Other archs, e.g. X86_64 only call mapChildren in earlier phases
(specifically, subsequent to a call to isASTErroneous), in which the new
LabelReferences returned by mapChildren are later discarded. Even though ARM
32/64 contains indirect calls to mapChildren, those are made after the
arm{,64}LowerLabelReferences transformation which doesn't leave any
LabelReference nodes around for .mapChildren to be called on.

So this is not an issue for architectures other than MIPS because
(a) AddImmediates.fold correctly constructs a LabelReference with an offset by
calling LabelReference.plusOffset and
(b) they don't call (and therefore don't use the result of)
LabelReference.mapChildren in their lowering code.

Second, the code we generate needs to look up the /label/ in the GOT, not the
computed address. After the lookup, we simply need to add the offset.

  • offlineasm/ast.rb:
  • offlineasm/mips.rb:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r267522 r267535  
     12020-09-24  Angelos Oikonomopoulos  <angelos@igalia.com>
     2
     3        [MIPS] Broken build after r267371
     4        https://bugs.webkit.org/show_bug.cgi?id=216893
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        This addresses two issues.
     9
     10        First, the fix in https://bugs.webkit.org/show_bug.cgi?id=216772 was not
     11        getting exercised, because the LabelReference offset was always zero.
     12
     13        The reason the offset was zero is that LabelReference.mapChildren would discard
     14        the offset when generating a new LabelReference to wrap the Label returned by
     15        the code block it yielded to.
     16
     17        The reason this was only an issue on MIPS is because only MIPS was using the
     18        result of calls to LabelReference.mapChildren (in its lowering phase,
     19        assignRegistersToTemporaries -> replaceTemporariesWithRegisters ->
     20        mapChildren). Other archs, e.g. X86_64 only call mapChildren in earlier phases
     21        (specifically, subsequent to a call to isASTErroneous), in which the new
     22        LabelReferences returned by mapChildren are later discarded. Even though ARM
     23        32/64 contains indirect calls to mapChildren, those are made after the
     24        arm{,64}LowerLabelReferences transformation which doesn't leave any
     25        LabelReference nodes around for .mapChildren to be called on.
     26
     27        So this is not an issue for architectures other than MIPS because
     28        (a) AddImmediates.fold correctly constructs a LabelReference with an offset by
     29        calling LabelReference.plusOffset and
     30        (b) they don't call (and therefore don't use the result of)
     31        LabelReference.mapChildren in their lowering code.
     32
     33        Second, the code we generate needs to look up the /label/ in the GOT, not the
     34        computed address. After the lookup, we simply need to add the offset.
     35
     36        * offlineasm/ast.rb:
     37        * offlineasm/mips.rb:
     38
    1392020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
    240
  • trunk/Source/JavaScriptCore/offlineasm/ast.rb

    r260310 r267535  
    11641164   
    11651165    def mapChildren
    1166         LabelReference.new(codeOrigin, (yield @label))
     1166        result = LabelReference.new(codeOrigin, (yield @label))
     1167        result.offset = @offset
     1168        result
    11671169    end
    11681170   
  • trunk/Source/JavaScriptCore/offlineasm/mips.rb

    r267395 r267535  
    10511051            if operands[0].is_a? LabelReference
    10521052                labelRef = operands[0]
     1053                $asm.puts "lw #{operands[1].mipsOperand}, %got(#{labelRef.asmLabel})($gp)"
    10531054                if labelRef.offset > 0
    1054                     $asm.puts "li #{operands[1].mipsOperand}, #{labelRef.asmLabel}"
    10551055                    $asm.puts "addu #{operands[1].mipsOperand}, #{operands[1].mipsOperand}, #{labelRef.offset}"
    1056                     $asm.puts "lw #{operands[1].mipsOperand}, %got(#{operands[1].mipsOperand})($gp)"
    1057                 else
    1058                     $asm.puts "lw #{operands[1].mipsOperand}, %got(#{labelRef.asmLabel})($gp)"
    10591056                end
    10601057            else
Note: See TracChangeset for help on using the changeset viewer.