From c14e64d4cac8f0b384e55aeff5e7074ce1bcc76d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Jul 2014 00:39:03 +0000 Subject: runtime: Rename iface.goc to go-iface.goc. Rename in order to avoid confusion with the new runtime/iface.goc file in the Go library master sources. From-SVN: r212447 --- libgo/Makefile.am | 2 +- libgo/Makefile.in | 6 +-- libgo/runtime/go-iface.goc | 130 +++++++++++++++++++++++++++++++++++++++++++++ libgo/runtime/iface.goc | 130 --------------------------------------------- 4 files changed, 134 insertions(+), 134 deletions(-) create mode 100644 libgo/runtime/go-iface.goc delete mode 100644 libgo/runtime/iface.goc (limited to 'libgo') diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 7466a17..ad457a4 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -515,7 +515,7 @@ runtime_files = \ runtime/thread.c \ runtime/yield.c \ $(rtems_task_variable_add_file) \ - iface.c \ + go-iface.c \ malloc.c \ map.c \ mprof.c \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index dd94285..0bff21f 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -216,7 +216,7 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ $(am__objects_2) mfixalloc.lo mgc0.lo mheap.lo msize.lo \ $(am__objects_3) panic.lo parfor.lo print.lo proc.lo \ runtime.lo signal_unix.lo thread.lo yield.lo $(am__objects_4) \ - iface.lo malloc.lo map.lo mprof.lo netpoll.lo reflect.lo \ + go-iface.lo malloc.lo map.lo mprof.lo netpoll.lo reflect.lo \ runtime1.lo sema.lo sigqueue.lo string.lo time.lo \ $(am__objects_5) am_libgo_la_OBJECTS = $(am__objects_6) @@ -844,7 +844,7 @@ runtime_files = \ runtime/thread.c \ runtime/yield.c \ $(rtems_task_variable_add_file) \ - iface.c \ + go-iface.c \ malloc.c \ map.c \ mprof.c \ @@ -2429,6 +2429,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-val-compare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-fieldtrack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-getgoroot.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-iface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-array-to-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-to-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-interface-compare.Plo@am__quote@ @@ -2476,7 +2477,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unwind.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-varargs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lfstack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_futex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_sema.Plo@am__quote@ diff --git a/libgo/runtime/go-iface.goc b/libgo/runtime/go-iface.goc new file mode 100644 index 0000000..0d5cb5e --- /dev/null +++ b/libgo/runtime/go-iface.goc @@ -0,0 +1,130 @@ +// Copyright 2010 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. + +package runtime +#include "runtime.h" +#include "go-type.h" +#include "interface.h" + +typedef struct __go_type_descriptor descriptor; +typedef const struct __go_type_descriptor const_descriptor; +typedef struct __go_interface interface; +typedef struct __go_empty_interface empty_interface; + +// Compare two type descriptors. +func ifacetypeeq(a *descriptor, b *descriptor) (eq bool) { + eq = __go_type_descriptors_equal(a, b); +} + +// Return the descriptor for an empty interface type.n +func efacetype(e empty_interface) (d *const_descriptor) { + return e.__type_descriptor; +} + +// Return the descriptor for a non-empty interface type. +func ifacetype(i interface) (d *const_descriptor) { + if (i.__methods == nil) { + return nil; + } + d = i.__methods[0]; +} + +// Convert an empty interface to an empty interface. +func ifaceE2E2(e empty_interface) (ret empty_interface, ok bool) { + ret = e; + ok = ret.__type_descriptor != nil; +} + +// Convert a non-empty interface to an empty interface. +func ifaceI2E2(i interface) (ret empty_interface, ok bool) { + if (i.__methods == nil) { + ret.__type_descriptor = nil; + ret.__object = nil; + ok = 0; + } else { + ret.__type_descriptor = i.__methods[0]; + ret.__object = i.__object; + ok = 1; + } +} + +// Convert an empty interface to a non-empty interface. +func ifaceE2I2(inter *descriptor, e empty_interface) (ret interface, ok bool) { + if (e.__type_descriptor == nil) { + ret.__methods = nil; + ret.__object = nil; + ok = 0; + } else { + ret.__methods = __go_convert_interface_2(inter, + e.__type_descriptor, + 1); + ret.__object = e.__object; + ok = ret.__methods != nil; + } +} + +// Convert a non-empty interface to a non-empty interface. +func ifaceI2I2(inter *descriptor, i interface) (ret interface, ok bool) { + if (i.__methods == nil) { + ret.__methods = nil; + ret.__object = nil; + ok = 0; + } else { + ret.__methods = __go_convert_interface_2(inter, + i.__methods[0], 1); + ret.__object = i.__object; + ok = ret.__methods != nil; + } +} + +// Convert an empty interface to a pointer type. +func ifaceE2T2P(inter *descriptor, e empty_interface) (ret *void, ok bool) { + if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) { + ret = nil; + ok = 0; + } else { + ret = e.__object; + ok = 1; + } +} + +// Convert a non-empty interface to a pointer type. +func ifaceI2T2P(inter *descriptor, i interface) (ret *void, ok bool) { + if (i.__methods == nil + || !__go_type_descriptors_equal(inter, i.__methods[0])) { + ret = nil; + ok = 0; + } else { + ret = i.__object; + ok = 1; + } +} + +// Convert an empty interface to a non-pointer type. +func ifaceE2T2(inter *descriptor, e empty_interface, ret *void) (ok bool) { + if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) { + __builtin_memset(ret, 0, inter->__size); + ok = 0; + } else { + __builtin_memcpy(ret, e.__object, inter->__size); + ok = 1; + } +} + +// Convert a non-empty interface to a non-pointer type. +func ifaceI2T2(inter *descriptor, i interface, ret *void) (ok bool) { + if (i.__methods == nil + || !__go_type_descriptors_equal(inter, i.__methods[0])) { + __builtin_memset(ret, 0, inter->__size); + ok = 0; + } else { + __builtin_memcpy(ret, i.__object, inter->__size); + ok = 1; + } +} + +// Return whether we can convert an interface to a type. +func ifaceI2Tp(to *descriptor, from *descriptor) (ok bool) { + ok = __go_can_convert_to_interface(to, from); +} diff --git a/libgo/runtime/iface.goc b/libgo/runtime/iface.goc deleted file mode 100644 index 0d5cb5e..0000000 --- a/libgo/runtime/iface.goc +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2010 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. - -package runtime -#include "runtime.h" -#include "go-type.h" -#include "interface.h" - -typedef struct __go_type_descriptor descriptor; -typedef const struct __go_type_descriptor const_descriptor; -typedef struct __go_interface interface; -typedef struct __go_empty_interface empty_interface; - -// Compare two type descriptors. -func ifacetypeeq(a *descriptor, b *descriptor) (eq bool) { - eq = __go_type_descriptors_equal(a, b); -} - -// Return the descriptor for an empty interface type.n -func efacetype(e empty_interface) (d *const_descriptor) { - return e.__type_descriptor; -} - -// Return the descriptor for a non-empty interface type. -func ifacetype(i interface) (d *const_descriptor) { - if (i.__methods == nil) { - return nil; - } - d = i.__methods[0]; -} - -// Convert an empty interface to an empty interface. -func ifaceE2E2(e empty_interface) (ret empty_interface, ok bool) { - ret = e; - ok = ret.__type_descriptor != nil; -} - -// Convert a non-empty interface to an empty interface. -func ifaceI2E2(i interface) (ret empty_interface, ok bool) { - if (i.__methods == nil) { - ret.__type_descriptor = nil; - ret.__object = nil; - ok = 0; - } else { - ret.__type_descriptor = i.__methods[0]; - ret.__object = i.__object; - ok = 1; - } -} - -// Convert an empty interface to a non-empty interface. -func ifaceE2I2(inter *descriptor, e empty_interface) (ret interface, ok bool) { - if (e.__type_descriptor == nil) { - ret.__methods = nil; - ret.__object = nil; - ok = 0; - } else { - ret.__methods = __go_convert_interface_2(inter, - e.__type_descriptor, - 1); - ret.__object = e.__object; - ok = ret.__methods != nil; - } -} - -// Convert a non-empty interface to a non-empty interface. -func ifaceI2I2(inter *descriptor, i interface) (ret interface, ok bool) { - if (i.__methods == nil) { - ret.__methods = nil; - ret.__object = nil; - ok = 0; - } else { - ret.__methods = __go_convert_interface_2(inter, - i.__methods[0], 1); - ret.__object = i.__object; - ok = ret.__methods != nil; - } -} - -// Convert an empty interface to a pointer type. -func ifaceE2T2P(inter *descriptor, e empty_interface) (ret *void, ok bool) { - if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) { - ret = nil; - ok = 0; - } else { - ret = e.__object; - ok = 1; - } -} - -// Convert a non-empty interface to a pointer type. -func ifaceI2T2P(inter *descriptor, i interface) (ret *void, ok bool) { - if (i.__methods == nil - || !__go_type_descriptors_equal(inter, i.__methods[0])) { - ret = nil; - ok = 0; - } else { - ret = i.__object; - ok = 1; - } -} - -// Convert an empty interface to a non-pointer type. -func ifaceE2T2(inter *descriptor, e empty_interface, ret *void) (ok bool) { - if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) { - __builtin_memset(ret, 0, inter->__size); - ok = 0; - } else { - __builtin_memcpy(ret, e.__object, inter->__size); - ok = 1; - } -} - -// Convert a non-empty interface to a non-pointer type. -func ifaceI2T2(inter *descriptor, i interface, ret *void) (ok bool) { - if (i.__methods == nil - || !__go_type_descriptors_equal(inter, i.__methods[0])) { - __builtin_memset(ret, 0, inter->__size); - ok = 0; - } else { - __builtin_memcpy(ret, i.__object, inter->__size); - ok = 1; - } -} - -// Return whether we can convert an interface to a type. -func ifaceI2Tp(to *descriptor, from *descriptor) (ok bool) { - ok = __go_can_convert_to_interface(to, from); -} -- cgit v1.1