Skip to content

Commit

Permalink
Continue cleaning up compiler configurations
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274438
rdar://128441724

Reviewed by Ross Kirsling.

This patch further simplifies compiler configurations.

1. Drop MINGW, nobody is supporting it.
2. Remove MSVC hacks further.
3. Remove most of COMPILER(GCC_COMPATIBLE) in JavaScriptCore.
4. Fix CodeBlock's static_assert, which was not effective before.

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/assembler/ARM64Assembler.h:
* Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp:
* Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp:
* Source/JavaScriptCore/bytecode/CodeBlock.h:
* Source/JavaScriptCore/heap/GCMemoryOperations.h:
(JSC::gcSafeMemcpy):
(JSC::gcSafeMemmove):
(JSC::gcSafeZeroMemory):
* Source/JavaScriptCore/jit/CCallHelpers.h:
(JSC::CCallHelpers::marshallArgumentRegister):
* Source/JavaScriptCore/jit/JITOperations.cpp:
(JSC::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
* Source/JavaScriptCore/runtime/ArrayConventions.cpp:
(JSC::clearArrayMemset):
* Source/JavaScriptCore/runtime/EnsureStillAliveHere.cpp: Removed.
* Source/JavaScriptCore/runtime/EnsureStillAliveHere.h:
* Source/JavaScriptCore/runtime/ExceptionScope.h:
* Source/JavaScriptCore/runtime/ISO8601.h:
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::JSBigInt::digitDiv):
* Source/WTF/wtf/Assertions.h:
* Source/WTF/wtf/Compiler.h:
* Source/WTF/wtf/CurrentTime.cpp:
(WTF::highResUpTime):
* Source/WTF/wtf/InlineASM.h:
* Source/WTF/wtf/win/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadInternal):
* Source/WebCore/platform/graphics/FormatConverter.cpp:
(WebCore::FormatConverter::convert):

Canonical link: https://commits.webkit.org/279051@main
  • Loading branch information
Constellation committed May 21, 2024
1 parent f856b06 commit 9245865
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5901,7 +5901,6 @@
FE336B5225DB497D0098F034 /* MarkingConstraintExecutorPair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkingConstraintExecutorPair.h; sourceTree = "<group>"; };
FE3422111D6B818C0032BE88 /* ThrowScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThrowScope.h; sourceTree = "<group>"; };
FE34EE2024398A9A00AA2E7C /* EnsureStillAliveHere.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnsureStillAliveHere.h; sourceTree = "<group>"; };
FE34EE2224398B8500AA2E7C /* EnsureStillAliveHere.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EnsureStillAliveHere.cpp; sourceTree = "<group>"; };
FE35C2F021B1E6C5000F4CA8 /* Template.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = Template.rb; sourceTree = "<group>"; };
FE35C2F121B1E6C6000F4CA8 /* Fits.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = Fits.rb; sourceTree = "<group>"; };
FE35C2F221B1E6C6000F4CA8 /* GeneratedFile.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = GeneratedFile.rb; sourceTree = "<group>"; };
Expand Down Expand Up @@ -8054,7 +8053,6 @@
A70447EC17A0BD7000F5898E /* DumpContext.h */,
145FF2C6243BB99A00569E71 /* ECMAMode.cpp */,
145FF2C7243BB99A00569E71 /* ECMAMode.h */,
FE34EE2224398B8500AA2E7C /* EnsureStillAliveHere.cpp */,
FE34EE2024398A9A00AA2E7C /* EnsureStillAliveHere.h */,
2AD2EDFA19799E38004D6478 /* EnumerationMode.h */,
BC337BEA0E1B00CB0076918A /* Error.cpp */,
Expand Down
1 change: 0 additions & 1 deletion Source/JavaScriptCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,6 @@ runtime/DirectEvalExecutable.cpp
runtime/DoublePredictionFuzzerAgent.cpp
runtime/DumpContext.cpp
runtime/ECMAMode.cpp
runtime/EnsureStillAliveHere.cpp
runtime/Error.cpp
runtime/ErrorConstructor.cpp
runtime/ErrorHandlingScope.cpp
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/assembler/ARM64Assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3656,7 +3656,7 @@ class ARM64Assembler {

unsigned debugOffset() { return m_buffer.debugOffset(); }

#if OS(LINUX) && COMPILER(GCC_COMPATIBLE)
#if OS(LINUX)
static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
{
__builtin___clear_cache(reinterpret_cast<char*>(begin), reinterpret_cast<char*>(end));
Expand Down
3 changes: 0 additions & 3 deletions Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ JSC_ANNOTATE_JIT_OPERATION_PROBE(ctiMasmProbeTrampolineSIMD);

using namespace ARM64Registers;

#if COMPILER(GCC_COMPATIBLE)

// The following are offsets for Probe::State fields accessed
// by the ctiMasmProbeTrampoline stub.
#if CPU(ADDRESS64)
Expand Down Expand Up @@ -835,7 +833,6 @@ asm (
#endif
".previous" "\n"
);
#endif // COMPILER(GCC_COMPATIBLE)
void MacroAssembler::probe(Probe::Function function, void* arg, SavedFPWidth savedFPWidth)
{
Expand Down
3 changes: 0 additions & 3 deletions Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ JSC_ANNOTATE_JIT_OPERATION_PROBE(ctiMasmProbeTrampoline);

using namespace ARMRegisters;

#if COMPILER(GCC_COMPATIBLE)

// The following are offsets for Probe::State fields accessed
// by the ctiMasmProbeTrampoline stub.

Expand Down Expand Up @@ -364,7 +362,6 @@ asm (
"pop { pc }" "\n"
".previous" "\n"
);
#endif // COMPILER(GCC_COMPATIBLE)

void MacroAssembler::probe(Probe::Function function, void* arg, SavedFPWidth)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/bytecode/CodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@ class CodeBlock : public JSCell {
#endif
};
/* This check is for normal Release builds; ASSERT_ENABLED changes the size. */
#if defined(NDEBUG) && !defined(ASSERT_ENABLED) && COMPILER(GCC_COMPATIBLE)
static_assert(sizeof(CodeBlock) <= 224, "Keep it small for memory saving");
#if !ASSERT_ENABLED
static_assert(sizeof(CodeBlock) <= 232, "Keep it small for memory saving");
#endif

template <typename ExecutableType>
Expand Down
12 changes: 5 additions & 7 deletions Source/JavaScriptCore/heap/GCMemoryOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ALWAYS_INLINE void gcSafeMemcpy(T* dst, const T* src, size_t bytes)
bitwise_cast<volatile uint64_t*>(dst)[i] = bitwise_cast<volatile uint64_t*>(src)[i];
};

#if COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#if CPU(X86_64) || CPU(ARM64)
if (bytes <= smallCutoff)
slowPathForwardMemcpy();
else if (isARM64() || bytes <= mediumCutoff) {
Expand Down Expand Up @@ -136,7 +136,7 @@ ALWAYS_INLINE void gcSafeMemcpy(T* dst, const T* src, size_t bytes)
}
#else
slowPathForwardMemcpy();
#endif // COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#endif // CPU(X86_64) || CPU(ARM64)
#else
memcpy(dst, src, bytes);
#endif // USE(JSVALUE64)
Expand Down Expand Up @@ -165,7 +165,7 @@ ALWAYS_INLINE void gcSafeMemmove(T* dst, const T* src, size_t bytes)
bitwise_cast<volatile uint64_t*>(dst)[i] = bitwise_cast<volatile uint64_t*>(src)[i];
};

#if COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#if CPU(X86_64) || CPU(ARM64)
if (bytes <= smallCutoff)
slowPathBackwardsMemmove();
else {
Expand Down Expand Up @@ -239,7 +239,7 @@ ALWAYS_INLINE void gcSafeMemmove(T* dst, const T* src, size_t bytes)
}
#else
slowPathBackwardsMemmove();
#endif // COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#endif // CPU(X86_64) || CPU(ARM64)
#else
memmove(dst, src, bytes);
#endif // USE(JSVALUE64)
Expand All @@ -251,7 +251,6 @@ ALWAYS_INLINE void gcSafeZeroMemory(T* dst, size_t bytes)
static_assert(sizeof(T) == sizeof(JSValue));
RELEASE_ASSERT(bytes % 8 == 0);
#if USE(JSVALUE64)
#if COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#if CPU(X86_64)
uint64_t zero = 0;
size_t count = bytes / 8;
Expand Down Expand Up @@ -291,12 +290,11 @@ ALWAYS_INLINE void gcSafeZeroMemory(T* dst, size_t bytes)
:
: "d0", "d1", "memory", "cc"
);
#endif // CPU(X86_64)
#else
size_t count = bytes / 8;
for (size_t i = 0; i < count; ++i)
bitwise_cast<volatile uint64_t*>(dst)[i] = 0;
#endif // COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#endif
#else
memset(reinterpret_cast<char*>(dst), 0, bytes);
#endif // USE(JSVALUE64)
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/jit/CCallHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ class CCallHelpers : public AssemblyHelpers {

// Avoid MSVC optimization time explosion associated with __forceinline in recursive templates.
template<typename OperationType, unsigned numGPRArgs, unsigned numGPRSources, unsigned numFPRArgs, unsigned numFPRSources, unsigned numCrossSources, unsigned extraGPRArgs, unsigned nonArgGPRs, unsigned extraPoke, typename RegType, typename... Args>
ALWAYS_INLINE_EXCEPT_MSVC void marshallArgumentRegister(ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, nonArgGPRs, extraPoke> argSourceRegs, RegType arg, Args... args)
ALWAYS_INLINE void marshallArgumentRegister(ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, nonArgGPRs, extraPoke> argSourceRegs, RegType arg, Args... args)
{
using InfoType = InfoTypeForReg<RegType>;
unsigned numArgRegisters = InfoType::numberOfArgumentRegisters;
Expand Down
4 changes: 0 additions & 4 deletions Source/JavaScriptCore/jit/JITOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4446,13 +4446,11 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(operationExceptionFuzz, void, (JSGlobalObject*
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
auto scope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(scope);
#if COMPILER(GCC_COMPATIBLE)
void* returnPC = __builtin_return_address(0);
// FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address()
// sometimes gives us a signed pointer, and sometimes does not.
returnPC = removeCodePtrTag(returnPC);
doExceptionFuzzing(globalObject, scope, "JITOperations", returnPC);
#endif // COMPILER(GCC_COMPATIBLE)
}

JSC_DEFINE_NOEXCEPT_JIT_OPERATION(operationExceptionFuzzWithCallFrame, void, (VM* vmPointer))
Expand All @@ -4462,13 +4460,11 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(operationExceptionFuzzWithCallFrame, void, (VM
JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
auto scope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(scope);
#if COMPILER(GCC_COMPATIBLE)
void* returnPC = __builtin_return_address(0);
// FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address()
// sometimes gives us a signed pointer, and sometimes does not.
returnPC = removeCodePtrTag(returnPC);
doExceptionFuzzing(callFrame->lexicalGlobalObject(vm), scope, "JITOperations", returnPC);
#endif // COMPILER(GCC_COMPATIBLE)
}

JSC_DEFINE_JIT_OPERATION(operationValueAdd, EncodedJSValue, (JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2))
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/runtime/ArrayConventions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void clearArrayMemset(WriteBarrier<Unknown>* base, unsigned count)

void clearArrayMemset(double* base, unsigned count)
{
#if CPU(X86_64) && COMPILER(GCC_COMPATIBLE)
#if CPU(X86_64)
uint64_t pnan = bitwise_cast<uint64_t>(PNaN);
asm volatile (
"rep stosq\n\t"
Expand Down
45 changes: 0 additions & 45 deletions Source/JavaScriptCore/runtime/EnsureStillAliveHere.cpp

This file was deleted.

9 changes: 0 additions & 9 deletions Source/JavaScriptCore/runtime/EnsureStillAliveHere.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

namespace JSC {

#if COMPILER(GCC_COMPATIBLE)

ALWAYS_INLINE void ensureStillAliveHere(uint64_t value)
{
asm volatile ("" : : "g"(value) : "memory");
Expand All @@ -39,11 +37,4 @@ ALWAYS_INLINE void ensureStillAliveHere(const void* pointer)
asm volatile ("" : : "g"(pointer) : "memory");
}

#else

JS_EXPORT_PRIVATE void ensureStillAliveHere(uint64_t value);
JS_EXPORT_PRIVATE void ensureStillAliveHere(const void*);

#endif

} // namespace JSC
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/runtime/ExceptionScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Exception;

#if ENABLE(C_LOOP)
#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) (vm__).currentCLoopStackPointer()
#elif ASAN_ENABLED && COMPILER(GCC_COMPATIBLE)
#elif ASAN_ENABLED
#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) currentStackPointer()
#else
#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) nullptr
Expand Down
2 changes: 0 additions & 2 deletions Source/JavaScriptCore/runtime/ISO8601.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ class PlainDate {
int32_t m_month : 5; // Starts with 1.
int32_t m_day : 6; // Starts with 1.
};
#if COMPILER(GCC_COMPATIBLE)
static_assert(sizeof(PlainDate) == sizeof(int32_t));
#endif

using TimeZone = std::variant<TimeZoneID, int64_t>;

Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/runtime/JSBigInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ inline JSBigInt::Digit JSBigInt::digitPow(Digit base, Digit exponent)
inline JSBigInt::Digit JSBigInt::digitDiv(Digit high, Digit low, Digit divisor, Digit& remainder)
{
ASSERT(high < divisor);
#if CPU(X86_64) && COMPILER(GCC_COMPATIBLE)
#if CPU(X86_64)
Digit quotient;
Digit rem;
__asm__("divq %[divisor]"
Expand All @@ -1275,7 +1275,7 @@ inline JSBigInt::Digit JSBigInt::digitDiv(Digit high, Digit low, Digit divisor,
: "d"(high), "a"(low), [divisor] "rm"(divisor));
remainder = rem;
return quotient;
#elif CPU(X86) && COMPILER(GCC_COMPATIBLE)
#elif CPU(X86)
Digit quotient;
Digit rem;
__asm__("divl %[divisor]"
Expand Down
2 changes: 0 additions & 2 deletions Source/JavaScriptCore/runtime/TZoneInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include <wtf/TZoneMalloc.h>
#include <wtf/TZoneMallocInitialization.h>

using namespace JSC;

void TZoneInit([[maybe_unused]] const char** darwinEnvp)
{
#if USE(TZONE_MALLOC)
Expand Down
5 changes: 1 addition & 4 deletions Source/WTF/wtf/Assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@

#define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__

#if COMPILER(MINGW)
/* By default MinGW emits warnings when C99 format attributes are used, even if __USE_MINGW_ANSI_STDIO is defined */
#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__((__format__(gnu_printf, formatStringArgument, extraArguments)))
#elif COMPILER(GCC_COMPATIBLE) && !defined(__OBJC__)
#if COMPILER(GCC_COMPATIBLE) && !defined(__OBJC__)
/* WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute
emits a warning when %@ is used in the format string. Until <rdar://problem/5195437> is resolved we can't include
the attribute when being used from Objective-C code in case it decides to use %@. */
Expand Down
Loading

0 comments on commit 9245865

Please sign in to comment.