Skip to content
Permalink
Browse files
Use jsc_llint as a LLInt local label prefix instead of _offlineasm.
https://bugs.webkit.org/show_bug.cgi?id=240885

Reviewed by Geoffrey Garen.

Code generated by the offlineasm is tightly coupled with JSC anyway.  Might as well
make the local labels more informative about where the code came from in crash traces.

So, instead of this:

    JavaScriptCore`vmEntryToJavaScript:
        0x1028b5d90 <+0 >:   pacibsp
        0x1028b5d94 <+4 >:   stp    x29, x30, [sp, #-0x10]!
        0x1028b5d98 <+8 >:   mov    x29, sp
        0x1028b5d9c <+12 >:  sub    sp, x29, #0xb0
        0x1028b5da0 <+16 >:  mov    x13, #0xc800
        0x1028b5da4 <+20 >:  add    x17, x1, x13
        0x1028b5da8 <+24 >:  ldr    w4, [x17]
        0x1028b5dac <+28 >:  cbnz   w4, 0x1028b5f34           ; _offlineasm_doVMEntry__checkVMEntryPermission
        0x1028b5db0 <+32 >:  str    x1, [sp]
        0x1028b5db4 <+36 >:  mov    x17, #0x9e78
        ...
        0x1028b5de8 <+88 >:  sub    x3, sp, x4
        0x1028b5dec <+92 >:  cmp    sp, x3
        0x1028b5df0 <+96 >:  b.ls   0x1028b5ef4               ; _offlineasm_doVMEntry__throwStackOverflow
        0x1028b5df4 <+100 >: mov    x17, #0xca00
        0x1028b5df8 <+104 >: add    x13, x1, x17
        0x1028b5dfc <+108 >: ldr    x17, [x13]
        0x1028b5e00 <+112 >: cmp    x3, x17
        0x1028b5e04 <+116 >: b.lo   0x1028b5ef4               ; _offlineasm_doVMEntry__throwStackOverflow

    JavaScriptCore`_offlineasm_doVMEntry__stackHeightOK:
        0x1028b5e08 <+0 >:   mov    sp, x3
        0x1028b5e0c <+4 >:   mov    x3, #0x4

    JavaScriptCore`_offlineasm_doVMEntry__copyHeaderLoop:
        0x1028b5e10 <+0 >:   sub    w3, w3, #0x1
        0x1028b5e14 <+4 >:   add    x17, x2, x3, lsl #3
        0x1028b5e18 <+8 >:   ldr    x5, [x17]

We now get this:

    JavaScriptCore`vmEntryToJavaScript:
        0x1028cdd90 <+0>:   pacibsp
        0x1028cdd94 <+4>:   stp    x29, x30, [sp, #-0x10]!
        0x1028cdd98 <+8>:   mov    x29, sp
        0x1028cdd9c <+12>:  sub    sp, x29, #0xb0
        0x1028cdda0 <+16>:  mov    x13, #0xc800
        0x1028cdda4 <+20>:  add    x17, x1, x13
        0x1028cdda8 <+24>:  ldr    w4, [x17]
        0x1028cddac <+28>:  cbnz   w4, 0x1028cdf34           ; jsc_llint_doVMEntry__checkVMEntryPermission
        0x1028cddb0 <+32>:  str    x1, [sp]
        0x1028cddb4 <+36>:  mov    x17, #0x9e78
        ...
        0x1028cdde8 <+88>:  sub    x3, sp, x4
        0x1028cddec <+92>:  cmp    sp, x3
        0x1028cddf0 <+96>:  b.ls   0x1028cdef4               ; jsc_llint_doVMEntry__throwStackOverflow
        0x1028cddf4 <+100>: mov    x17, #0xca00
        0x1028cddf8 <+104>: add    x13, x1, x17
        0x1028cddfc <+108>: ldr    x17, [x13]
        0x1028cde00 <+112>: cmp    x3, x17
        0x1028cde04 <+116>: b.lo   0x1028cdef4               ; jsc_llint_doVMEntry__throwStackOverflow

    JavaScriptCore`jsc_llint_doVMEntry__stackHeightOK:
        0x1028cde08 <+0>:   mov    sp, x3
        0x1028cde0c <+4>:   mov    x3, #0x4

    JavaScriptCore`jsc_llint_doVMEntry__copyHeaderLoop:
        0x1028cde10 <+0>:   sub    w3, w3, #0x1
        0x1028cde14 <+4>:   add    x17, x2, x3, lsl #3
        0x1028cde18 <+8>:   ldr    x5, [x17]

* Source/JavaScriptCore/offlineasm/arm.rb:
* Source/JavaScriptCore/offlineasm/arm64.rb:
* Source/JavaScriptCore/offlineasm/backends.rb:
* Source/JavaScriptCore/offlineasm/config.rb:

Canonical link: https://commits.webkit.org/250946@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Mark Lam committed May 25, 2022
1 parent 4d3155f commit cd44c39f8b49a3c96684540ce1ee41d7ce58e5da
Showing 4 changed files with 16 additions and 16 deletions.
@@ -1,4 +1,4 @@
# Copyright (C) 2011-2020 Apple Inc. All rights reserved.
# Copyright (C) 2011-2022 Apple Inc. All rights reserved.
# Copyright (C) 2013 University of Szeged. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -703,16 +703,16 @@ def lowerARMCommon
uid = $asm.newUID

$asm.putStr("#if OS(DARWIN)")
$asm.puts "movw #{operands[1].armOperand}, :lower16:(L#{operands[0].asmLabel}_#{uid}$non_lazy_ptr-(L_offlineasm_#{uid}+4))"
$asm.puts "movt #{operands[1].armOperand}, :upper16:(L#{operands[0].asmLabel}_#{uid}$non_lazy_ptr-(L_offlineasm_#{uid}+4))"
$asm.puts "L_offlineasm_#{uid}:"
$asm.puts "movw #{operands[1].armOperand}, :lower16:(L#{operands[0].asmLabel}_#{uid}$non_lazy_ptr-(Ljsc_llint_#{uid}+4))"
$asm.puts "movt #{operands[1].armOperand}, :upper16:(L#{operands[0].asmLabel}_#{uid}$non_lazy_ptr-(Ljsc_llint_#{uid}+4))"
$asm.puts "Ljsc_llint_#{uid}:"
$asm.puts "add #{operands[1].armOperand}, pc"
$asm.puts "ldr #{operands[1].armOperand}, [#{operands[1].armOperand}]"

# On Linux, use ELF GOT relocation specifiers.
$asm.putStr("#elif OS(LINUX)")
gotLabel = Assembler.localLabelReference("offlineasm_arm_got_#{uid}")
offsetLabel = Assembler.localLabelReference("offlineasm_arm_got_offset_#{uid}")
gotLabel = Assembler.localLabelReference("jsc_llint_arm_got_#{uid}")
offsetLabel = Assembler.localLabelReference("jsc_llint_arm_got_offset_#{uid}")

$asm.puts "ldr #{dest.armOperand}, #{gotLabel}"
$asm.puts "ldr #{temp.armOperand}, #{gotLabel}+4"
@@ -1,4 +1,4 @@
# Copyright (C) 2011-2020 Apple Inc. All rights reserved.
# Copyright (C) 2011-2022 Apple Inc. All rights reserved.
# Copyright (C) 2014 University of Szeged. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -1121,9 +1121,9 @@ def lowerARM64
# On Darwin, use Macho-O GOT relocation specifiers, along with
# the labels required for the .loh directive.
$asm.putStr("#if OS(DARWIN)")
$asm.puts "L_offlineasm_loh_adrp_#{uid}:"
$asm.puts "Ljsc_llint_loh_adrp_#{uid}:"
$asm.puts "adrp #{operands[1].arm64Operand(:quad)}, #{operands[0].asmLabel}@GOTPAGE"
$asm.puts "L_offlineasm_loh_ldr_#{uid}:"
$asm.puts "Ljsc_llint_loh_ldr_#{uid}:"
$asm.puts "ldr #{operands[1].arm64Operand(:quad)}, [#{operands[1].arm64Operand(:quad)}, #{operands[0].asmLabel}@GOTPAGEOFF]"

# On Linux, use ELF GOT relocation specifiers.
@@ -1139,7 +1139,7 @@ def lowerARM64
$asm.deferAction {
# On Darwin, also include the .loh directive using the generated labels.
$asm.putStr("#if OS(DARWIN)")
$asm.puts ".loh AdrpLdrGot L_offlineasm_loh_adrp_#{uid}, L_offlineasm_loh_ldr_#{uid}"
$asm.puts ".loh AdrpLdrGot Ljsc_llint_loh_adrp_#{uid}, Ljsc_llint_loh_ldr_#{uid}"
$asm.putStr("#endif")
}

@@ -1,4 +1,4 @@
# Copyright (C) 2011-2020 Apple Inc. All rights reserved.
# Copyright (C) 2011-2022 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -152,7 +152,7 @@ def lower(name)

class LocalLabel
def lower(name)
$asm.putsLocalLabel "_offlineasm_#{self.name[1..-1]}"
$asm.putsLocalLabel "jsc_llint_#{self.name[1..-1]}"
end
end

@@ -172,11 +172,11 @@ def cLabel

class LocalLabelReference
def asmLabel
Assembler.localLabelReference("_offlineasm_"+name[1..-1])
Assembler.localLabelReference("jsc_llint_"+name[1..-1])
end

def cLabel
Assembler.cLocalLabelReference("_offlineasm_"+name[1..-1])
Assembler.cLocalLabelReference("jsc_llint_"+name[1..-1])
end
end

@@ -1,4 +1,4 @@
# Copyright (C) 2012-2021 Apple Inc. All rights reserved.
# Copyright (C) 2012-2022 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -39,7 +39,7 @@
# For example, the output will look like this:
#
# ...
# OFFLINE_ASM_LOCAL_LABEL(_offlineasm_4_functionArityCheck__continue) // Local Label 24 .
# OFFLINE_ASM_LOCAL_LABEL(jsc_llint_4_functionArityCheck__continue) // Local Label 24 .
# ...
# OFFLINE_ASM_GLOBAL_LABEL(llint_op_enter) // Global Label 8 .
# ...

0 comments on commit cd44c39

Please sign in to comment.