LibGC+LibWeb+LibJS: Remove workaround for Swift boolean bitfield issue

We're using a main snapshot everywhere, so we can yeet the workaround.
This commit is contained in:
Andrew Kaster 2025-04-04 07:04:10 -06:00
parent 83e46b3728
commit d454108fcd
9 changed files with 39 additions and 51 deletions

View file

@ -20,9 +20,5 @@ if (ENABLE_SWIFT)
Heap+Swift.swift
)
target_link_libraries(LibGC PRIVATE AK)
# FIXME: https://github.com/swiftlang/swift/issues/80182
target_compile_options(LibGC PUBLIC $<$<COMPILE_LANGUAGE:C,CXX>:-DLIBGC_WORKAROUND_BOOL_BITFIELD>
SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xcc -DLIBGC_WORKAROUND_BOOL_BITFIELD>)
add_swift_target_properties(LibGC LAGOM_LIBRARIES AK COMPILE_DEFINITIONS LIBGC_WORKAROUND_BOOL_BITFIELD)
add_swift_target_properties(LibGC LAGOM_LIBRARIES AK)
endif()

View file

@ -28,13 +28,6 @@ namespace GC {
# define IGNORE_GC
#endif
// https://github.com/swiftlang/swift/issues/80182
#if defined(LIBGC_WORKAROUND_BOOL_BITFIELD)
# define BOOL_BITFIELD
#else
# define BOOL_BITFIELD : 1
#endif
#define GC_CELL(class_, base_class) \
public: \
using Base = base_class; \
@ -195,9 +188,9 @@ protected:
void set_overrides_must_survive_garbage_collection(bool b) { m_overrides_must_survive_garbage_collection = b; }
private:
bool m_mark BOOL_BITFIELD { false };
bool m_overrides_must_survive_garbage_collection BOOL_BITFIELD { false };
State m_state BOOL_BITFIELD { State::Live };
bool m_mark : 1 { false };
bool m_overrides_must_survive_garbage_collection : 1 { false };
State m_state : 1 { State::Live };
} SWIFT_UNSAFE_REFERENCE;
}

View file

@ -142,9 +142,9 @@ private:
PropertyAttributes m_attributes { 0 };
TransitionType m_transition_type { TransitionType::Invalid };
bool m_dictionary BOOL_BITFIELD { false };
bool m_cacheable BOOL_BITFIELD { true };
bool m_is_prototype_shape BOOL_BITFIELD { false };
bool m_dictionary : 1 { false };
bool m_cacheable : 1 { true };
bool m_is_prototype_shape : 1 { false };
};
}

View file

@ -49,17 +49,17 @@ protected:
explicit PlatformObject(JS::Object& prototype, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No);
struct LegacyPlatformObjectFlags {
u16 supports_indexed_properties BOOL_BITFIELD = false;
u16 supports_named_properties BOOL_BITFIELD = false;
u16 has_indexed_property_setter BOOL_BITFIELD = false;
u16 has_named_property_setter BOOL_BITFIELD = false;
u16 has_named_property_deleter BOOL_BITFIELD = false;
u16 has_legacy_unenumerable_named_properties_interface_extended_attribute BOOL_BITFIELD = false;
u16 has_legacy_override_built_ins_interface_extended_attribute BOOL_BITFIELD = false;
u16 has_global_interface_extended_attribute BOOL_BITFIELD = false;
u16 indexed_property_setter_has_identifier BOOL_BITFIELD = false;
u16 named_property_setter_has_identifier BOOL_BITFIELD = false;
u16 named_property_deleter_has_identifier BOOL_BITFIELD = false;
u16 supports_indexed_properties : 1 = false;
u16 supports_named_properties : 1 = false;
u16 has_indexed_property_setter : 1 = false;
u16 has_named_property_setter : 1 = false;
u16 has_named_property_deleter : 1 = false;
u16 has_legacy_unenumerable_named_properties_interface_extended_attribute : 1 = false;
u16 has_legacy_override_built_ins_interface_extended_attribute : 1 = false;
u16 has_global_interface_extended_attribute : 1 = false;
u16 indexed_property_setter_has_identifier : 1 = false;
u16 named_property_setter_has_identifier : 1 = false;
u16 named_property_deleter_has_identifier : 1 = false;
};
Optional<LegacyPlatformObjectFlags> m_legacy_platform_object_flags = {};

View file

@ -1007,5 +1007,5 @@ if (ENABLE_SWIFT)
HTML/Parser/SpeculativeHTMLParser.swift
)
target_link_libraries(LibWeb PRIVATE AK Collections)
add_swift_target_properties(LibWeb LAGOM_LIBRARIES AK LibGfx LibGC COMPILE_DEFINITIONS LIBGC_WORKAROUND_BOOL_BITFIELD)
add_swift_target_properties(LibWeb LAGOM_LIBRARIES AK LibGfx LibGC)
endif()

View file

@ -11,10 +11,10 @@
namespace Web::CSS {
struct RequiredInvalidationAfterStyleChange {
bool repaint BOOL_BITFIELD { false };
bool rebuild_stacking_context_tree BOOL_BITFIELD { false };
bool relayout BOOL_BITFIELD { false };
bool rebuild_layout_tree BOOL_BITFIELD { false };
bool repaint : 1 { false };
bool rebuild_stacking_context_tree : 1 { false };
bool relayout : 1 { false };
bool rebuild_layout_tree : 1 { false };
void operator|=(RequiredInvalidationAfterStyleChange const& other)
{

View file

@ -553,16 +553,16 @@ private:
Array<CSSPixelPoint, 3> m_scroll_offset;
bool m_in_top_layer BOOL_BITFIELD { false };
bool m_rendered_in_top_layer BOOL_BITFIELD { false };
bool m_style_uses_css_custom_properties BOOL_BITFIELD { false };
bool m_affected_by_has_pseudo_class_in_subject_position BOOL_BITFIELD { false };
bool m_affected_by_has_pseudo_class_in_non_subject_position BOOL_BITFIELD { false };
bool m_affected_by_direct_sibling_combinator BOOL_BITFIELD { false };
bool m_affected_by_indirect_sibling_combinator BOOL_BITFIELD { false };
bool m_affected_by_first_or_last_child_pseudo_class BOOL_BITFIELD { false };
bool m_affected_by_nth_child_pseudo_class BOOL_BITFIELD { false };
bool m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator BOOL_BITFIELD { false };
bool m_in_top_layer : 1 { false };
bool m_rendered_in_top_layer : 1 { false };
bool m_style_uses_css_custom_properties : 1 { false };
bool m_affected_by_has_pseudo_class_in_subject_position : 1 { false };
bool m_affected_by_has_pseudo_class_in_non_subject_position : 1 { false };
bool m_affected_by_direct_sibling_combinator : 1 { false };
bool m_affected_by_indirect_sibling_combinator : 1 { false };
bool m_affected_by_first_or_last_child_pseudo_class : 1 { false };
bool m_affected_by_nth_child_pseudo_class : 1 { false };
bool m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator : 1 { false };
size_t m_sibling_invalidation_distance { 0 };

View file

@ -168,12 +168,12 @@ private:
SelectionState m_selection_state { SelectionState::None };
bool m_positioned BOOL_BITFIELD { false };
bool m_fixed_position BOOL_BITFIELD { false };
bool m_sticky_position BOOL_BITFIELD { false };
bool m_absolutely_positioned BOOL_BITFIELD { false };
bool m_floating BOOL_BITFIELD { false };
bool m_inline BOOL_BITFIELD { false };
bool m_positioned : 1 { false };
bool m_fixed_position : 1 { false };
bool m_sticky_position : 1 { false };
bool m_absolutely_positioned : 1 { false };
bool m_floating : 1 { false };
bool m_inline : 1 { false };
};
inline DOM::Node* HitTestResult::dom_node()

View file

@ -19,7 +19,6 @@ if (ENABLE_SWIFT)
add_swift_target_properties(TestGCSwift
LAGOM_LIBRARIES AK LibGC
COMPILE_DEFINITIONS LIBGC_WORKAROUND_BOOL_BITFIELD
COMPILE_OPTIONS ${testing_compile_options} -enable-experimental-feature Extern
)
add_test(NAME TestGCSwift COMMAND TestGCSwift)