Ignore:
Timestamp:
Sep 21, 2020, 3:01:12 PM (5 years ago)
Author:
[email protected]
Message:

Move some LLInt globals into JSC::Config.
https://bugs.webkit.org/show_bug.cgi?id=216685
rdar://68964544

Reviewed by Keith Miller.

Source/bmalloc:

Introduce ConfigAlignment to match WTFConfig.h.
Added BENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) support to match WTF.

  • bmalloc/BPlatform.h:
  • bmalloc/Gigacage.cpp:

(Gigacage::ensureGigacage):

  • bmalloc/GigacageConfig.h:
  • bmalloc/mbmalloc.cpp:

Source/JavaScriptCore:

  1. Moved the following into g_jscConfig:

Data::s_exceptionInstructions ==> g_jscConfig.llint.exceptionInstructions
Data::s_wasmExceptionInstructions ==> g_jscConfig.llint.wasmExceptionInstructions
g_opcodeMap ==> g_jscConfig.llint.opcodeMap
g_opcodeMapWide16 ==> g_jscConfig.llint.opcodeMapWide16
g_opcodeMapWide32 ==> g_jscConfig.llint.opcodeMapWide32

  1. Fixed cloop.rb so that it can take an offset for the leap offlineasm instruction.
  2. Fixed x86.rb so that it can take an offset for the leap offlineasm instruction.
  3. Fixed arm.rb so that it can take an offset for the leap offlineasm instruction.

Note: arm64.rb already does this right.

  1. Added JSC::Config::singleton() to return a reference to g_jscConfig. This is useful when debugging with lldb since g_jscConfig is not an actual label, but is a macro that computes the address of the Config record.

This patch has been smoke tested on arm64e, x86_64, and cloop (on x86_64 and armv7k).

  • llint/LLIntData.cpp:

(JSC::LLInt::LLIntInitializeAssertScope::LLIntInitializeAssertScope):
(JSC::LLInt::LLIntInitializeAssertScope::~LLIntInitializeAssertScope):
(JSC::LLInt::LLIntInitializeAssertScope::assertInitializationIsAllowed):
(JSC::LLInt::initialize):

  • llint/LLIntData.h:

(JSC::LLInt::exceptionInstructions):
(JSC::LLInt::wasmExceptionInstructions):
(JSC::LLInt::opcodeMap):
(JSC::LLInt::opcodeMapWide16):
(JSC::LLInt::opcodeMapWide32):
(JSC::LLInt::getOpcode):
(JSC::LLInt::getOpcodeWide16):
(JSC::LLInt::getOpcodeWide32):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:
  • llint/LowLevelInterpreter64.asm:
  • llint/WebAssembly.asm:
  • offlineasm/arm.rb:
  • offlineasm/cloop.rb:
  • offlineasm/x86.rb:
  • runtime/JSCConfig.cpp:

(JSC::Config::singleton):

  • runtime/JSCConfig.h:

Source/WTF:

  1. Introduce ConfigAlignment as a distinct value from ConfigSizeToProtect. This is because ConfigSizeToProtect is now larger than 1 CeilingOnPageSize on some platforms, but ConfigAlignment only needs to match CeilingOnPageSize.
  1. Introduced ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD) to disable using the unified g_config record for Windows ports.

This is needed because WTF is built as a DLL on Windows. offlineasm does not
know how to resolve a DLL exported variable. Additionally, the Windows ports
have never supported freezing of the Config record to begin with. So, we're
working around this by disabling ENABLE(UNIFIED_AND_FREEZABLE_CONFIG_RECORD)
for Windows. This allows JSC to have its own g_jscConfig record, which solves
this issue for now.

  • wtf/PlatformEnable.h:
  • wtf/WTFConfig.cpp:

(WTF::Config::permanentlyFreeze):

  • wtf/WTFConfig.h:
Location:
trunk/Source/JavaScriptCore/offlineasm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/arm.rb

    r259996 r267371  
    263263                labelRef = node.operands[0]
    264264                if labelRef.is_a? LabelReference
    265                     raise unless labelRef.offset == 0
    266265                    tmp = Tmp.new(node.codeOrigin, :gpr)
    267266                    newList << Instruction.new(codeOrigin, "globaladdr", [LabelReference.new(node.codeOrigin, labelRef.label), node.operands[1], tmp])
     267                    # FIXME: This check against 255 is just the simplest check we can do. ARM is capable of encoding some larger constants using
     268                    # rotation (subject to some special rules). Perhaps we can add the more comprehensive encoding check here.
     269                    if labelRef.offset > 255
     270                        newList << Instruction.new(codeOrigin, "move", [Immediate.new(node.codeOrigin, labelRef.offset), tmp])
     271                        newList << Instruction.new(codeOrigin, "addp", [tmp, node.operands[1]])
     272                    elsif labelRef.offset > 0
     273                        newList << Instruction.new(codeOrigin, "addp", [Immediate.new(node.codeOrigin, labelRef.offset), node.operands[1]])
     274                    end
    268275                else
    269276                    newList << node
  • trunk/Source/JavaScriptCore/offlineasm/cloop.rb

    r252422 r267371  
    1 # Copyright (C) 2012-2019 Apple Inc. All rights reserved.
     1# Copyright (C) 2012-2020 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    334334    def cloopEmitLea(destination, type)
    335335        $asm.putc "#{destination.clLValue(:voidPtr)} = CAST<void*>(&#{cLabel});"
     336        if offset != 0
     337            $asm.putc "#{destination.clLValue(:int8Ptr)} = #{destination.clValue(:int8Ptr)} + #{offset};"
     338        end
    336339    end
    337340end
     
    345348    def cloopEmitLea(destination, type)
    346349        if destination == base
    347             $asm.putc "#{destination.clLValue(:int8Ptr)} += #{offset.clValue(type)};"
     350            $asm.putc "#{destination.clLValue(:int8Ptr)} = #{destination.clValue(:int8Ptr)} + #{offset.clValue(type)};"
    348351        else
    349352            $asm.putc "#{destination.clLValue(:int8Ptr)} = #{base.clValue(:int8Ptr)} + #{offset.clValue(type)};"
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r262389 r267371  
    575575            else
    576576                $asm.puts "lea #{dst.x86Operand(:ptr)}, #{src.asmLabel}"
     577            end
     578            if src.offset != 0
     579                $asm.puts "add#{x86Suffix(kind)} #{orderOperands(const(src.offset), dst.x86Operand(kind))}"
    577580            end
    578581        else
Note: See TracChangeset for help on using the changeset viewer.