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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llint/LLIntData.cpp

    r262054 r267371  
    11/*
    2  * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "ArithProfile.h"
    3030#include "CodeBlock.h"
     31#include "JSCConfig.h"
    3132#include "LLIntCLoop.h"
    3233#include "Opcode.h"
     
    3940
    4041namespace LLInt {
    41 
    42 
    43 uint8_t Data::s_exceptionInstructions[maxOpcodeLength + 1] = { };
    44 uint8_t Data::s_wasmExceptionInstructions[maxOpcodeLength + 1] = { };
    45 Opcode g_opcodeMap[numOpcodeIDs + numWasmOpcodeIDs] = { };
    46 Opcode g_opcodeMapWide16[numOpcodeIDs + numWasmOpcodeIDs] = { };
    47 Opcode g_opcodeMapWide32[numOpcodeIDs + numWasmOpcodeIDs] = { };
    4842
    4943#if !ENABLE(C_LOOP)
     
    6256
    6357#else // !ENABLE(C_LOOP)
    64     llint_entry(&g_opcodeMap, &g_opcodeMapWide16, &g_opcodeMapWide32);
     58    llint_entry(&g_jscConfig.llint.opcodeMap, &g_jscConfig.llint.opcodeMapWide16, &g_jscConfig.llint.opcodeMapWide32);
    6559
    6660#if ENABLE(WEBASSEMBLY)
    67     wasm_entry(&g_opcodeMap[numOpcodeIDs], &g_opcodeMapWide16[numOpcodeIDs], &g_opcodeMapWide32[numOpcodeIDs]);
     61    wasm_entry(&g_jscConfig.llint.opcodeMap[numOpcodeIDs], &g_jscConfig.llint.opcodeMapWide16[numOpcodeIDs], &g_jscConfig.llint.opcodeMapWide32[numOpcodeIDs]);
    6862#endif // ENABLE(WEBASSEMBLY)
    6963
    7064    for (int i = 0; i < numOpcodeIDs + numWasmOpcodeIDs; ++i) {
    71         g_opcodeMap[i] = tagCodePtr(g_opcodeMap[i], BytecodePtrTag);
    72         g_opcodeMapWide16[i] = tagCodePtr(g_opcodeMapWide16[i], BytecodePtrTag);
    73         g_opcodeMapWide32[i] = tagCodePtr(g_opcodeMapWide32[i], BytecodePtrTag);
     65        g_jscConfig.llint.opcodeMap[i] = tagCodePtr(g_jscConfig.llint.opcodeMap[i], BytecodePtrTag);
     66        g_jscConfig.llint.opcodeMapWide16[i] = tagCodePtr(g_jscConfig.llint.opcodeMapWide16[i], BytecodePtrTag);
     67        g_jscConfig.llint.opcodeMapWide32[i] = tagCodePtr(g_jscConfig.llint.opcodeMapWide32[i], BytecodePtrTag);
    7468    }
    7569
    7670    ASSERT(llint_throw_from_slow_path_trampoline < UINT8_MAX);
    7771    for (unsigned i = 0; i < maxOpcodeLength + 1; ++i) {
    78         Data::s_exceptionInstructions[i] = llint_throw_from_slow_path_trampoline;
    79         Data::s_wasmExceptionInstructions[i] = wasm_throw_from_slow_path_trampoline;
     72        g_jscConfig.llint.exceptionInstructions[i] = llint_throw_from_slow_path_trampoline;
     73        g_jscConfig.llint.wasmExceptionInstructions[i] = wasm_throw_from_slow_path_trampoline;
    8074    }
    8175#endif // ENABLE(C_LOOP)
Note: See TracChangeset for help on using the changeset viewer.