diff options
Diffstat (limited to 'libgo/runtime/go-reflect-chan.c')
-rw-r--r-- | libgo/runtime/go-reflect-chan.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libgo/runtime/go-reflect-chan.c b/libgo/runtime/go-reflect-chan.c index 61e3602..e8b4366 100644 --- a/libgo/runtime/go-reflect-chan.c +++ b/libgo/runtime/go-reflect-chan.c @@ -33,16 +33,21 @@ makechan (const struct __go_type_descriptor *typ, uint32_t size) return (uintptr_t) ret; } -extern _Bool chansend (uintptr_t, uintptr_t, _Bool) +extern _Bool chansend (struct __go_channel_type *, uintptr_t, uintptr_t, _Bool) asm ("libgo_reflect.reflect.chansend"); _Bool -chansend (uintptr_t ch, uintptr_t val_i, _Bool nb) +chansend (struct __go_channel_type *ct, uintptr_t ch, uintptr_t val_i, + _Bool nb) { struct __go_channel *channel = (struct __go_channel *) ch; uintptr_t element_size; void *pv; + __go_assert (ct->__common.__code == GO_CHAN); + __go_assert (__go_type_descriptors_equal (ct->__element_type, + channel->element_type)); + if (channel == NULL) __go_panic_msg ("send to nil channel"); @@ -94,17 +99,22 @@ struct chanrecv_ret _Bool received; }; -extern struct chanrecv_ret chanrecv (uintptr_t, _Bool) +extern struct chanrecv_ret chanrecv (struct __go_channel_type *, uintptr_t, + _Bool) asm ("libgo_reflect.reflect.chanrecv"); struct chanrecv_ret -chanrecv (uintptr_t ch, _Bool nb) +chanrecv (struct __go_channel_type *ct, uintptr_t ch, _Bool nb) { struct __go_channel *channel = (struct __go_channel *) ch; void *pv; uintptr_t element_size; struct chanrecv_ret ret; + __go_assert (ct->__common.__code == GO_CHAN); + __go_assert (__go_type_descriptors_equal (ct->__element_type, + channel->element_type)); + element_size = channel->element_type->__size; if (__go_is_pointer_type (channel->element_type)) |