diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-10 03:59:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-10 03:59:20 +0000 |
commit | 0c22e4415fe9e88acaa99e72d33f4500d557ce68 (patch) | |
tree | ab834b9b0b4730baa18d49e3c47ae5033b722809 /libgo/runtime/go-unsafe-pointer.c | |
parent | 8462d909a7439fb0bf7095144dbf36524c7e61ea (diff) | |
download | gcc-0c22e4415fe9e88acaa99e72d33f4500d557ce68.zip gcc-0c22e4415fe9e88acaa99e72d33f4500d557ce68.tar.gz gcc-0c22e4415fe9e88acaa99e72d33f4500d557ce68.tar.bz2 |
compiler, runtime: drop size arguments to hash/equal functions
Drop the size arguments for the hash/equal functions stored in type
descriptors. Types know what size they are. To make this work,
generate hash/equal functions for types that can use an identity
comparison but are not a standard size and alignment.
Drop the multiplications by 33 in the generated hash code and the
reflect package hash code. They are not necessary since we started
passing a seed value around, as the seed includes the hash of the
earlier values.
Copy the algorithms for standard types from the Go 1.7 runtime,
replacing the C functions.
Reviewed-on: https://go-review.googlesource.com/34983
From-SVN: r244256
Diffstat (limited to 'libgo/runtime/go-unsafe-pointer.c')
-rw-r--r-- | libgo/runtime/go-unsafe-pointer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c index ce82fcd..b980683 100644 --- a/libgo/runtime/go-unsafe-pointer.c +++ b/libgo/runtime/go-unsafe-pointer.c @@ -38,6 +38,11 @@ static const String reflection_string = const uintptr unsafe_Pointer_gc[] = {sizeof(void*), GC_APTR, 0, GC_END}; +extern const FuncVal runtime_pointerhash_descriptor + __asm__ (GOSYM_PREFIX "runtime.pointerhash$descriptor"); +extern const FuncVal runtime_pointerequal_descriptor + __asm__ (GOSYM_PREFIX "runtime.pointerequal$descriptor"); + const struct __go_type_descriptor unsafe_Pointer = { /* __code */ @@ -51,9 +56,9 @@ const struct __go_type_descriptor unsafe_Pointer = /* __hash */ 78501163U, /* __hashfn */ - &__go_type_hash_identity_descriptor, + &runtime_pointerhash_descriptor, /* __equalfn */ - &__go_type_equal_identity_descriptor, + &runtime_pointerequal_descriptor, /* __gc */ unsafe_Pointer_gc, /* __reflection */ @@ -94,9 +99,9 @@ const struct __go_ptr_type pointer_unsafe_Pointer = /* __hash */ 1256018616U, /* __hashfn */ - &__go_type_hash_identity_descriptor, + &runtime_pointerhash_descriptor, /* __equalfn */ - &__go_type_equal_identity_descriptor, + &runtime_pointerequal_descriptor, /* __gc */ unsafe_Pointer_gc, /* __reflection */ |