From 4e7e7a49b760bc46bf0ade36c25a7d8e088b6dea Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 May 2011 20:06:29 +0000 Subject: More uses of backend interface for types. From-SVN: r173507 --- libgo/runtime/channel.h | 3 +++ libgo/runtime/go-map-index.c | 6 +++--- libgo/runtime/go-map-len.c | 2 +- libgo/runtime/go-map-range.c | 2 +- libgo/runtime/go-new-map.c | 4 ++-- libgo/runtime/map.h | 11 ++++++----- 6 files changed, 16 insertions(+), 12 deletions(-) (limited to 'libgo/runtime') diff --git a/libgo/runtime/channel.h b/libgo/runtime/channel.h index ac79174..9dcaf7f 100644 --- a/libgo/runtime/channel.h +++ b/libgo/runtime/channel.h @@ -74,6 +74,9 @@ struct __go_channel uint64_t data[]; }; +/* Try to link up with the structure generated by the frontend. */ +typedef struct __go_channel __go_channel; + /* The mutex used to control access to the value pointed to by the __go_channel_select selected field. No additional mutexes may be acquired while this mutex is held. */ diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c index 1561c97..02a0f73 100644 --- a/libgo/runtime/go-map-index.c +++ b/libgo/runtime/go-map-index.c @@ -21,11 +21,11 @@ __go_map_rehash (struct __go_map *map) size_t key_offset; size_t key_size; size_t (*hashfn) (const void *, size_t); - size_t old_bucket_count; + uintptr_t old_bucket_count; void **old_buckets; - size_t new_bucket_count; + uintptr_t new_bucket_count; void **new_buckets; - size_t i; + uintptr_t i; descriptor = map->__descriptor; diff --git a/libgo/runtime/go-map-len.c b/libgo/runtime/go-map-len.c index 01df5b4..a8922b9 100644 --- a/libgo/runtime/go-map-len.c +++ b/libgo/runtime/go-map-len.c @@ -18,6 +18,6 @@ __go_map_len (struct __go_map *map) { if (map == NULL) return 0; - __go_assert (map->__element_count == (size_t) (int) map->__element_count); + __go_assert (map->__element_count == (uintptr_t) (int) map->__element_count); return map->__element_count; } diff --git a/libgo/runtime/go-map-range.c b/libgo/runtime/go-map-range.c index 364cda9..54444bc 100644 --- a/libgo/runtime/go-map-range.c +++ b/libgo/runtime/go-map-range.c @@ -34,7 +34,7 @@ __go_mapiternext (struct __go_hash_iter *it) if (entry == NULL) { const struct __go_map *map; - size_t bucket; + uintptr_t bucket; map = it->map; bucket = it->bucket; diff --git a/libgo/runtime/go-new-map.c b/libgo/runtime/go-new-map.c index 73e8d7d..3a47129 100644 --- a/libgo/runtime/go-new-map.c +++ b/libgo/runtime/go-new-map.c @@ -73,8 +73,8 @@ static const unsigned long prime_list[] = /* 256 + 1 or 256 + 48 + 1 */ /* Return the next number from PRIME_LIST >= N. */ -unsigned long -__go_map_next_prime (unsigned long n) +uintptr_t +__go_map_next_prime (uintptr_t n) { size_t low; size_t high; diff --git a/libgo/runtime/map.h b/libgo/runtime/map.h index 9c3fda2..40c31f8 100644 --- a/libgo/runtime/map.h +++ b/libgo/runtime/map.h @@ -1,10 +1,11 @@ /* map.h -- the map type for Go. - Copyright 2009, 2010 The Go Authors. All rights reserved. + Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include +#include #include "go-type.h" @@ -38,10 +39,10 @@ struct __go_map const struct __go_map_descriptor *__descriptor; /* The number of elements in the hash table. */ - size_t __element_count; + uintptr_t __element_count; /* The number of entries in the __buckets array. */ - size_t __bucket_count; + uintptr_t __bucket_count; /* Each bucket is a pointer to a linked list of map entries. */ void **__buckets; @@ -64,13 +65,13 @@ struct __go_hash_iter all the entries in the current bucket. */ const void *next_entry; /* The bucket index of the current and next entry. */ - size_t bucket; + uintptr_t bucket; }; extern struct __go_map *__go_new_map (const struct __go_map_descriptor *, uintptr_t); -extern unsigned long __go_map_next_prime (unsigned long); +extern uintptr_t __go_map_next_prime (uintptr_t); extern void *__go_map_index (struct __go_map *, const void *, _Bool); -- cgit v1.1