@@ -497,6 +497,27 @@ void _emplaceTupleHashableDescriptor() {
497
497
*tupleHashableConf = intptr_t (hashable) - intptr_t (tupleHashableConf);
498
498
}
499
499
500
+ using RawHashValueFn = SWIFT_CC(swift) intptr_t (intptr_t seed,
501
+ const Metadata *Self,
502
+ const WitnessTable *witnessTable,
503
+ SWIFT_CONTEXT OpaqueValue *value);
504
+
505
+ static RawHashValueFn *get_rawHashValueDefaultImplFunc () {
506
+ auto func = SWIFT_LAZY_CONSTANT (
507
+ reinterpret_cast <RawHashValueFn *>(
508
+ dlsym (RTLD_DEFAULT, " $sSHsE13_rawHashValue4seedS2i_tF" )));
509
+ return func;
510
+ }
511
+
512
+ SWIFT_RUNTIME_EXPORT SWIFT_CC (swift)
513
+ intptr_t _swift_tupleHashable_rawHashValue(intptr_t seed,
514
+ SWIFT_CONTEXT OpaqueValue *tuple,
515
+ const Metadata *Self,
516
+ const WitnessTable *witnessTable) {
517
+ auto _rawHashValue = get_rawHashValueDefaultImplFunc ();
518
+ return _rawHashValue (seed, Self, witnessTable, tuple);
519
+ }
520
+
500
521
// The base Equatable protocol is itself a requirement, thus the requirement
501
522
// count is 4 (Equatable + hashValue + hash(into:) + _rawHashValue) and the
502
523
// witness is the tuple Equatable table.
@@ -507,24 +528,10 @@ _WitnessTable<4> _swift_tupleHashable_wt = {
507
528
reinterpret_cast <const void *>(&_swift_tupleEquatable_wt),
508
529
reinterpret_cast <void *>(_swift_tupleHashable_hashValue),
509
530
reinterpret_cast <void *>(_swift_tupleHashable_hash),
510
- nullptr
531
+ reinterpret_cast < void *>(_swift_tupleHashable_rawHashValue)
511
532
}
512
533
};
513
534
514
- static void *get_rawHashValueDefaultImplFunc () {
515
- auto impl = SWIFT_LAZY_CONSTANT (
516
- dlsym (RTLD_DEFAULT, " $sSHsE13_rawHashValue4seedS2i_tF" ));
517
- return impl;
518
- }
519
-
520
- // Due to the fact that the compatibility libraries can't have a hard
521
- // dependency to libswiftCore (which is where the _rawHashValue default impl
522
- // lives), we have to manually implant this before calling any user code.
523
- __attribute__ ((constructor))
524
- void _emplaceTupleHashable_rawHashValueDefaultImpl() {
525
- _swift_tupleHashable_wt.Witnesses [3 ] = get_rawHashValueDefaultImplFunc ();
526
- }
527
-
528
535
using HashValueFn = SWIFT_CC(swift) intptr_t (OpaqueValue *value, Metadata *Self,
529
536
void *witnessTable);
530
537
using HasherCombineFn = SWIFT_CC(swift) void (OpaqueValue *value,
@@ -533,17 +540,17 @@ using HasherCombineFn = SWIFT_CC(swift) void(OpaqueValue *value,
533
540
SWIFT_CONTEXT OpaqueValue *hasher);
534
541
535
542
static HashValueFn *get_hashValueFunc () {
536
- auto descriptor = SWIFT_LAZY_CONSTANT (
543
+ auto func = SWIFT_LAZY_CONSTANT (
537
544
reinterpret_cast <HashValueFn *>(
538
545
dlsym (RTLD_DEFAULT, XSTR (SWIFT_HASHVALUE_FUNC))));
539
- return descriptor ;
546
+ return func ;
540
547
}
541
548
542
549
static HasherCombineFn *getHashCombineFunc () {
543
- auto descriptor = SWIFT_LAZY_CONSTANT (
550
+ auto func = SWIFT_LAZY_CONSTANT (
544
551
reinterpret_cast <HasherCombineFn *>(
545
552
dlsym (RTLD_DEFAULT, XSTR (SWIFT_HASHER_COMBINE_FUNC))));
546
- return descriptor ;
553
+ return func ;
547
554
}
548
555
549
556
SWIFT_RUNTIME_EXPORT SWIFT_CC (swift)
0 commit comments