Skip to content

Commit

Permalink
Revert std::bit_cast changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Dec 1, 2024
1 parent bcfcd06 commit a20741f
Show file tree
Hide file tree
Showing 383 changed files with 3,695 additions and 3,760 deletions.
10 changes: 5 additions & 5 deletions Source/JavaScriptCore/API/APICast.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ inline JSC::JSValue toJS(JSC::JSGlobalObject* globalObject, JSValueRef v)
else
result = jsCell;
#else
JSC::JSValue result = __bit_cast<JSC::JSValue>(v);
JSC::JSValue result = std::bit_cast<JSC::JSValue>(v);
#endif
if (!result)
return JSC::jsNull();
Expand All @@ -98,7 +98,7 @@ inline JSC::JSValue toJS(JSC::JSGlobalObject* globalObject, JSValueRef v)
#if CPU(ADDRESS64)
inline JSC::JSValue toJS(JSValueRef value)
{
return JSC::Integrity::audit(__bit_cast<JSC::JSValue>(value));
return JSC::Integrity::audit(std::bit_cast<JSC::JSValue>(value));
}
#endif

Expand All @@ -111,7 +111,7 @@ inline JSC::JSValue toJSForGC(JSC::JSGlobalObject* globalObject, JSValueRef v)
return JSC::JSValue();
JSC::JSValue result = jsCell;
#else
JSC::JSValue result = __bit_cast<JSC::JSValue>(v);
JSC::JSValue result = std::bit_cast<JSC::JSValue>(v);
#endif
if (result && result.isCell()) {
JSC::Integrity::audit(result.asCell());
Expand Down Expand Up @@ -155,7 +155,7 @@ inline JSValueRef toRef(JSC::VM& vm, JSC::JSValue v)
return reinterpret_cast<JSValueRef>(v.asCell());
#else
UNUSED_PARAM(vm);
return __bit_cast<JSValueRef>(JSC::Integrity::audit(v));
return std::bit_cast<JSValueRef>(JSC::Integrity::audit(v));
#endif
}

Expand All @@ -167,7 +167,7 @@ inline JSValueRef toRef(JSC::JSGlobalObject* globalObject, JSC::JSValue v)
#if CPU(ADDRESS64)
inline JSValueRef toRef(JSC::JSValue v)
{
return __bit_cast<JSValueRef>(JSC::Integrity::audit(v));
return std::bit_cast<JSValueRef>(JSC::Integrity::audit(v));
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/MarkedJSValueRefArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void MarkedJSValueRefArray::visitAggregate(Visitor& visitor)
continue;
visitor.appendUnbarriered(jsCell); // We should mark the wrapper itself to keep JSValueRef live.
#else
visitor.appendUnbarriered(__bit_cast<JSValue>(value));
visitor.appendUnbarriered(std::bit_cast<JSValue>(value));
#endif
}
}
Expand Down
38 changes: 19 additions & 19 deletions Source/JavaScriptCore/assembler/ARM64Assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class ARM64Assembler {
{
data.realTypes.m_from = from;
#if CPU(ARM64E)
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ __bit_cast<intptr_t>(assembler)));
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
data.realTypes.m_to = to;
Expand All @@ -368,7 +368,7 @@ class ARM64Assembler {
{
data.realTypes.m_from = from;
#if CPU(ARM64E)
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ __bit_cast<intptr_t>(assembler)));
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
data.realTypes.m_to = to;
Expand All @@ -381,7 +381,7 @@ class ARM64Assembler {
{
data.realTypes.m_from = from;
#if CPU(ARM64E)
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ __bit_cast<intptr_t>(assembler)));
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
data.realTypes.m_to = to;
Expand All @@ -396,7 +396,7 @@ class ARM64Assembler {
{
data.realTypes.m_from = from;
#if CPU(ARM64E)
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ __bit_cast<intptr_t>(assembler)));
data.realTypes.m_to = tagInt(to, static_cast<PtrTag>(from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
data.realTypes.m_to = to;
Expand All @@ -423,7 +423,7 @@ class ARM64Assembler {
void setFrom(const ARM64Assembler* assembler, intptr_t from)
{
#if CPU(ARM64E)
data.realTypes.m_to = tagInt(to(assembler), static_cast<PtrTag>(from ^ __bit_cast<intptr_t>(assembler)));
data.realTypes.m_to = tagInt(to(assembler), static_cast<PtrTag>(from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
#endif
Expand All @@ -432,7 +432,7 @@ class ARM64Assembler {
intptr_t to(const ARM64Assembler* assembler) const
{
#if CPU(ARM64E)
return untagInt(data.realTypes.m_to, static_cast<PtrTag>(data.realTypes.m_from ^ __bit_cast<intptr_t>(assembler)));
return untagInt(data.realTypes.m_to, static_cast<PtrTag>(data.realTypes.m_from ^ std::bit_cast<intptr_t>(assembler)));
#else
UNUSED_PARAM(assembler);
return data.realTypes.m_to;
Expand Down Expand Up @@ -2347,7 +2347,7 @@ class ARM64Assembler {
ALWAYS_INLINE static void fillNearTailCall(void* from, void* to)
{
RELEASE_ASSERT(roundUpToMultipleOf<instructionSize>(from) == from);
intptr_t offset = (__bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(from)) >> 2;
intptr_t offset = (std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(from)) >> 2;
ASSERT(static_cast<int>(offset) == offset);
ASSERT(isInt<26>(offset));
constexpr bool isCall = false;
Expand Down Expand Up @@ -3545,28 +3545,28 @@ class ARM64Assembler {
{
ASSERT(to);
ASSERT(from.isSet());
m_jumpsToLink.append(LinkRecord(this, from.offset(), __bit_cast<intptr_t>(to), type, condition, ThunkOrNot::Thunk));
m_jumpsToLink.append(LinkRecord(this, from.offset(), std::bit_cast<intptr_t>(to), type, condition, ThunkOrNot::Thunk));
}

void linkJumpThunk(AssemblerLabel from, void* to, JumpType type, Condition condition, bool is64Bit, RegisterID compareRegister)
{
ASSERT(to);
ASSERT(from.isSet());
m_jumpsToLink.append(LinkRecord(this, from.offset(), __bit_cast<intptr_t>(to), type, condition, is64Bit, compareRegister, ThunkOrNot::Thunk));
m_jumpsToLink.append(LinkRecord(this, from.offset(), std::bit_cast<intptr_t>(to), type, condition, is64Bit, compareRegister, ThunkOrNot::Thunk));
}

void linkJumpThunk(AssemblerLabel from, void* to, JumpType type, Condition condition, unsigned bitNumber, RegisterID compareRegister)
{
ASSERT(to);
ASSERT(from.isSet());
m_jumpsToLink.append(LinkRecord(this, from.offset(), __bit_cast<intptr_t>(to), type, condition, bitNumber, compareRegister, ThunkOrNot::Thunk));
m_jumpsToLink.append(LinkRecord(this, from.offset(), std::bit_cast<intptr_t>(to), type, condition, bitNumber, compareRegister, ThunkOrNot::Thunk));
}

void linkNearCallThunk(AssemblerLabel from, void* to)
{
ASSERT(to);
ASSERT(from.isSet());
m_jumpsToLink.append(LinkRecord(this, from.offset() - sizeof(int), __bit_cast<intptr_t>(to), ThunkOrNot::Thunk));
m_jumpsToLink.append(LinkRecord(this, from.offset() - sizeof(int), std::bit_cast<intptr_t>(to), ThunkOrNot::Thunk));
}

static void linkJump(void* code, AssemblerLabel from, void* to)
Expand Down Expand Up @@ -3603,7 +3603,7 @@ class ARM64Assembler {
#if ENABLE(JUMP_ISLANDS)
if (!isInt<26>(offset)) {
to = ExecutableAllocator::singleton().getJumpIslandToUsingJITMemcpy(where, to);
offset = (__bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(where)) >> 2;
offset = (std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(where)) >> 2;
RELEASE_ASSERT(isInt<26>(offset));
}
#endif
Expand Down Expand Up @@ -3716,7 +3716,7 @@ class ARM64Assembler {
#if ENABLE(JUMP_ISLANDS)
static void* prepareForAtomicRelinkJumpConcurrently(void* from, void* to)
{
intptr_t offset = (__bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(from)) >> 2;
intptr_t offset = (std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(from)) >> 2;
ASSERT(static_cast<int>(offset) == offset);

if (isInt<26>(offset))
Expand All @@ -3727,7 +3727,7 @@ class ARM64Assembler {

static void* prepareForAtomicRelinkCallConcurrently(void* from, void* to)
{
from = static_cast<void*>(__bit_cast<int*>(from) - 1);
from = static_cast<void*>(std::bit_cast<int*>(from) - 1);
return prepareForAtomicRelinkJumpConcurrently(from, to);
}
#endif
Expand Down Expand Up @@ -3904,7 +3904,7 @@ class ARM64Assembler {

static ALWAYS_INLINE bool canEmitJump(void* from, void* to)
{
intptr_t diff = (__bit_cast<intptr_t>(from) - __bit_cast<intptr_t>(to)) >> 2;
intptr_t diff = (std::bit_cast<intptr_t>(from) - std::bit_cast<intptr_t>(to)) >> 2;
return isInt<26>(diff);
}

Expand Down Expand Up @@ -3960,16 +3960,16 @@ class ARM64Assembler {
ASSERT(!(reinterpret_cast<intptr_t>(to) & 3));
assertIsNotTagged(to);
assertIsNotTagged(fromInstruction);
intptr_t offset = (__bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(fromInstruction)) >> 2;
intptr_t offset = (std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(fromInstruction)) >> 2;
ASSERT(static_cast<int>(offset) == offset);

#if ENABLE(JUMP_ISLANDS)
if (!isInt<26>(offset)) {
if constexpr (copy == MachineCodeCopyMode::JITMemcpy)
to = ExecutableAllocator::singleton().getJumpIslandToUsingJITMemcpy(__bit_cast<void*>(fromInstruction), to);
to = ExecutableAllocator::singleton().getJumpIslandToUsingJITMemcpy(std::bit_cast<void*>(fromInstruction), to);
else
to = ExecutableAllocator::singleton().getJumpIslandToUsingMemcpy(__bit_cast<void*>(fromInstruction), to);
offset = (__bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(fromInstruction)) >> 2;
to = ExecutableAllocator::singleton().getJumpIslandToUsingMemcpy(std::bit_cast<void*>(fromInstruction), to);
offset = (std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(fromInstruction)) >> 2;
RELEASE_ASSERT(isInt<26>(offset));
}
#endif
Expand Down
14 changes: 7 additions & 7 deletions Source/JavaScriptCore/assembler/ARMv7Assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ class ARMv7Assembler {
ASSERT(isEven(from));
ASSERT(isEven(to));

intptr_t offset = __bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(from);
intptr_t offset = std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(from);
ASSERT(static_cast<int>(offset) == offset);

if (isInt<25>(offset))
Expand Down Expand Up @@ -2759,8 +2759,8 @@ class ARMv7Assembler {

static void replaceWithJump(void* instructionStart, void* to)
{
ASSERT(!(__bit_cast<uintptr_t>(instructionStart) & 1));
ASSERT(!(__bit_cast<uintptr_t>(to) & 1));
ASSERT(!(std::bit_cast<uintptr_t>(instructionStart) & 1));
ASSERT(!(std::bit_cast<uintptr_t>(to) & 1));

#if OS(LINUX)
if (canBeJumpT4(reinterpret_cast<uint16_t*>(instructionStart), to)) {
Expand Down Expand Up @@ -2849,7 +2849,7 @@ class ARMv7Assembler {
{
// 'from' holds the address of the branch instruction. The branch range however is relative
// to the architectural value of the PC which is 4 larger than the address of the branch.
intptr_t offset = __bit_cast<intptr_t>(to) - (__bit_cast<intptr_t>(from) + 4);
intptr_t offset = std::bit_cast<intptr_t>(to) - (std::bit_cast<intptr_t>(from) + 4);
return isInt<25>(offset);
}

Expand Down Expand Up @@ -3226,11 +3226,11 @@ class ARMv7Assembler {
ASSERT(isEven(to));
ASSERT(link == BranchWithLink::Yes ? isBL(from - 2) : isB(from - 2));

intptr_t offset = __bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(fromInstruction);
intptr_t offset = std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(fromInstruction);
#if ENABLE(JUMP_ISLANDS)
if (!isInt<25>(offset)) {
to = ExecutableAllocator::singleton().getJumpIslandToUsingJITMemcpy(__bit_cast<void*>(fromInstruction), to);
offset = __bit_cast<intptr_t>(to) - __bit_cast<intptr_t>(fromInstruction);
to = ExecutableAllocator::singleton().getJumpIslandToUsingJITMemcpy(std::bit_cast<void*>(fromInstruction), to);
offset = std::bit_cast<intptr_t>(to) - std::bit_cast<intptr_t>(fromInstruction);
}
#endif
RELEASE_ASSERT(isInt<25>(offset));
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/assembler/AssemblerBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace JSC {
inline uint32_t offset() const
{
#if ENABLE(JIT_SIGN_ASSEMBLER_BUFFER)
return static_cast<uint32_t>(untagInt(m_offset, __bit_cast<PtrTag>(this)));
return static_cast<uint32_t>(untagInt(m_offset, std::bit_cast<PtrTag>(this)));
#else
return m_offset;
#endif
Expand All @@ -91,7 +91,7 @@ namespace JSC {
inline void setOffset(uint32_t offset)
{
#if ENABLE(JIT_SIGN_ASSEMBLER_BUFFER)
m_offset = tagInt(static_cast<uint64_t>(offset), __bit_cast<PtrTag>(this));
m_offset = tagInt(static_cast<uint64_t>(offset), std::bit_cast<PtrTag>(this));
#else
m_offset = offset;
#endif
Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/assembler/AssemblerCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,16 @@ static ALWAYS_INLINE void* memcpyAtomicIfPossible(void* dst, const void* src, si
// We would like to do atomic write here.
switch (n) {
case 1:
WTF::atomicStore(__bit_cast<uint8_t*>(dst), *__bit_cast<const uint8_t*>(src), std::memory_order_relaxed);
WTF::atomicStore(std::bit_cast<uint8_t*>(dst), *std::bit_cast<const uint8_t*>(src), std::memory_order_relaxed);
return dst;
case 2:
WTF::atomicStore(__bit_cast<uint16_t*>(dst), *__bit_cast<const uint16_t*>(src), std::memory_order_relaxed);
WTF::atomicStore(std::bit_cast<uint16_t*>(dst), *std::bit_cast<const uint16_t*>(src), std::memory_order_relaxed);
return dst;
case 4:
WTF::atomicStore(__bit_cast<uint32_t*>(dst), *__bit_cast<const uint32_t*>(src), std::memory_order_relaxed);
WTF::atomicStore(std::bit_cast<uint32_t*>(dst), *std::bit_cast<const uint32_t*>(src), std::memory_order_relaxed);
return dst;
case 8:
WTF::atomicStore(__bit_cast<uint64_t*>(dst), *__bit_cast<const uint64_t*>(src), std::memory_order_relaxed);
WTF::atomicStore(std::bit_cast<uint64_t*>(dst), *std::bit_cast<const uint64_t*>(src), std::memory_order_relaxed);
return dst;
default:
break;
Expand Down
12 changes: 6 additions & 6 deletions Source/JavaScriptCore/assembler/AssemblyComments.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class AssemblyCommentRegistry {
return;
Locker locker { m_lock };

auto newStart = __bit_cast<uintptr_t>(start);
auto newEnd = __bit_cast<uintptr_t>(end);
auto newStart = std::bit_cast<uintptr_t>(start);
auto newEnd = std::bit_cast<uintptr_t>(end);
RELEASE_ASSERT(newStart < newEnd);

#if ASSERT_ENABLED
Expand Down Expand Up @@ -83,7 +83,7 @@ class AssemblyCommentRegistry {
return;

auto& [foundEnd, _] = it->second;
RELEASE_ASSERT(foundEnd == __bit_cast<uintptr_t>(end));
RELEASE_ASSERT(foundEnd == std::bit_cast<uintptr_t>(end));
m_comments.erase(it);
}

Expand All @@ -98,10 +98,10 @@ class AssemblyCommentRegistry {
return { };

auto& [end, map] = it->second;
if (__bit_cast<uintptr_t>(in) > __bit_cast<uintptr_t>(end))
if (std::bit_cast<uintptr_t>(in) > std::bit_cast<uintptr_t>(end))
return { };

auto it2 = map.find(__bit_cast<uintptr_t>(in));
auto it2 = map.find(std::bit_cast<uintptr_t>(in));

if (it2 == map.end())
return { };
Expand All @@ -114,7 +114,7 @@ class AssemblyCommentRegistry {
private:

// Flip ordering for lower_bound comparator to work.
inline uintptr_t orderedKey(void* in) { return std::numeric_limits<uintptr_t>::max() - __bit_cast<uintptr_t>(in); }
inline uintptr_t orderedKey(void* in) { return std::numeric_limits<uintptr_t>::max() - std::bit_cast<uintptr_t>(in); }
inline uintptr_t orderedKeyInverse(uintptr_t in) { return std::numeric_limits<uintptr_t>::max() - in; }

Lock m_lock;
Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/assembler/JITOperationList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ LLINT_DECLARE_ROUTINE_VALIDATE(ipint_entry);
#endif

#define LLINT_ROUTINE(functionName) { \
__bit_cast<void*>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(functionName)), \
std::bit_cast<void*>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(functionName)), \
LLINT_OP_EXTRAS(LLINT_ROUTINE_VALIDATE(functionName)) \
},

#define LLINT_OP(name) { \
__bit_cast<void*>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name)), \
std::bit_cast<void*>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name)), \
LLINT_OP_EXTRAS(LLINT_RETURN_VALIDATE(name)) \
}, { \
__bit_cast<void*>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name)), \
std::bit_cast<void*>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name)), \
LLINT_OP_EXTRAS(LLINT_RETURN_WIDE16_VALIDATE(name)) \
}, { \
__bit_cast<void*>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name)), \
std::bit_cast<void*>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name)), \
LLINT_OP_EXTRAS(LLINT_RETURN_WIDE32_VALIDATE(name)) \
},

Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/assembler/JITOperationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class JITOperationList {
template<typename PtrType>
void* map(PtrType pointer) const
{
return m_validatedOperations.get(removeCodePtrTag(__bit_cast<void*>(pointer)));
return m_validatedOperations.get(removeCodePtrTag(std::bit_cast<void*>(pointer)));
}

#if ENABLE(JIT_OPERATION_VALIDATION_ASSERT)
template<typename PtrType>
void* inverseMap(PtrType pointer) const
{
return m_validatedOperationsInverseMap.get(__bit_cast<void*>(pointer));
return m_validatedOperationsInverseMap.get(std::bit_cast<void*>(pointer));
}
#endif

Expand Down
Loading

0 comments on commit a20741f

Please sign in to comment.