@@ -497,6 +497,27 @@ void _emplaceTupleHashableDescriptor() {
497497 *tupleHashableConf = intptr_t (hashable) - intptr_t (tupleHashableConf);
498498}
499499
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+
500521// The base Equatable protocol is itself a requirement, thus the requirement
501522// count is 4 (Equatable + hashValue + hash(into:) + _rawHashValue) and the
502523// witness is the tuple Equatable table.
@@ -507,24 +528,10 @@ _WitnessTable<4> _swift_tupleHashable_wt = {
507528 reinterpret_cast <const void *>(&_swift_tupleEquatable_wt),
508529 reinterpret_cast <void *>(_swift_tupleHashable_hashValue),
509530 reinterpret_cast <void *>(_swift_tupleHashable_hash),
510- nullptr
531+ reinterpret_cast < void *>(_swift_tupleHashable_rawHashValue)
511532 }
512533};
513534
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-
528535using HashValueFn = SWIFT_CC(swift) intptr_t (OpaqueValue *value, Metadata *Self,
529536 void *witnessTable);
530537using HasherCombineFn = SWIFT_CC(swift) void (OpaqueValue *value,
@@ -533,17 +540,17 @@ using HasherCombineFn = SWIFT_CC(swift) void(OpaqueValue *value,
533540 SWIFT_CONTEXT OpaqueValue *hasher);
534541
535542static HashValueFn *get_hashValueFunc () {
536- auto descriptor = SWIFT_LAZY_CONSTANT (
543+ auto func = SWIFT_LAZY_CONSTANT (
537544 reinterpret_cast <HashValueFn *>(
538545 dlsym (RTLD_DEFAULT, XSTR (SWIFT_HASHVALUE_FUNC))));
539- return descriptor ;
546+ return func ;
540547}
541548
542549static HasherCombineFn *getHashCombineFunc () {
543- auto descriptor = SWIFT_LAZY_CONSTANT (
550+ auto func = SWIFT_LAZY_CONSTANT (
544551 reinterpret_cast <HasherCombineFn *>(
545552 dlsym (RTLD_DEFAULT, XSTR (SWIFT_HASHER_COMBINE_FUNC))));
546- return descriptor ;
553+ return func ;
547554}
548555
549556SWIFT_RUNTIME_EXPORT SWIFT_CC (swift)
0 commit comments