The Go library reflect package used to have a notion of reflectFlags
that were used to indicate an invalid interface value.  That has not
been used for a while.  This patch drops testing for it from the libgo
runtime.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r fa6e0c716dba libgo/runtime/go-eface-compare.c
--- a/libgo/runtime/go-eface-compare.c	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/go-eface-compare.c	Thu Jul 10 17:23:00 2014 -0700
@@ -19,10 +19,6 @@
 
   left_descriptor = left.__type_descriptor;
 
-  if (((uintptr_t) left_descriptor & reflectFlags) != 0
-      || ((uintptr_t) right.__type_descriptor & reflectFlags) != 0)
-    runtime_panicstring ("invalid interface value");
-
   if (left_descriptor == NULL && right.__type_descriptor == NULL)
     return 0;
   if (left_descriptor == NULL || right.__type_descriptor == NULL)
diff -r fa6e0c716dba libgo/runtime/go-eface-val-compare.c
--- a/libgo/runtime/go-eface-val-compare.c	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/go-eface-val-compare.c	Thu Jul 10 17:23:00 2014 -0700
@@ -20,8 +20,6 @@
   const struct __go_type_descriptor *left_descriptor;
 
   left_descriptor = left.__type_descriptor;
-  if (((uintptr_t) left_descriptor & reflectFlags) != 0)
-    runtime_panicstring ("invalid interface value");
   if (left_descriptor == NULL)
     return 1;
   if (!__go_type_descriptors_equal (left_descriptor, right_descriptor))
diff -r fa6e0c716dba libgo/runtime/go-interface-eface-compare.c
--- a/libgo/runtime/go-interface-eface-compare.c	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/go-interface-eface-compare.c	Thu Jul 10 17:23:00 2014 -0700
@@ -18,8 +18,6 @@
 {
   const struct __go_type_descriptor *left_descriptor;
 
-  if (((uintptr_t) right.__type_descriptor & reflectFlags) != 0)
-    runtime_panicstring ("invalid interface value");
   if (left.__methods == NULL && right.__type_descriptor == NULL)
     return 0;
   if (left.__methods == NULL || right.__type_descriptor == NULL)
diff -r fa6e0c716dba libgo/runtime/go-type-eface.c
--- a/libgo/runtime/go-type-eface.c	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/go-type-eface.c	Thu Jul 10 17:23:00 2014 -0700
@@ -44,9 +44,6 @@
   v2 = (const struct __go_empty_interface *) vv2;
   v1_descriptor = v1->__type_descriptor;
   v2_descriptor = v2->__type_descriptor;
-  if (((uintptr_t) v1_descriptor & reflectFlags) != 0
-      || ((uintptr_t) v2_descriptor & reflectFlags) != 0)
-    runtime_panicstring ("invalid interface value");
   if (v1_descriptor == NULL || v2_descriptor == NULL)
     return v1_descriptor == v2_descriptor;
   if (!__go_type_descriptors_equal (v1_descriptor, v2_descriptor))
diff -r fa6e0c716dba libgo/runtime/go-type.h
--- a/libgo/runtime/go-type.h	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/go-type.h	Thu Jul 10 17:23:00 2014 -0700
@@ -302,15 +302,6 @@
   struct __go_open_array __fields;
 };
 
-/* If an empty interface has these bits set in its type pointer, it
-   was copied from a reflect.Value and is not a valid empty
-   interface.  */
-
-enum 
-{
-  reflectFlags = 3,
-};
-
 /* Whether a type descriptor is a pointer.  */
 
 static inline _Bool
diff -r fa6e0c716dba libgo/runtime/iface.goc
--- a/libgo/runtime/iface.goc	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/iface.goc	Thu Jul 10 17:23:00 2014 -0700
@@ -32,8 +32,6 @@
 
 // Convert an empty interface to an empty interface.
 func ifaceE2E2(e empty_interface) (ret empty_interface, ok bool) {
-	if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
-		runtime_panicstring("invalid interface value");
 	ret = e;
 	ok = ret.__type_descriptor != nil;
 }
@@ -53,8 +51,6 @@
 
 // Convert an empty interface to a non-empty interface.
 func ifaceE2I2(inter *descriptor, e empty_interface) (ret interface, ok bool) {
-	if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
-		runtime_panicstring("invalid interface value");
 	if (e.__type_descriptor == nil) {
 		ret.__methods = nil;
 		ret.__object = nil;
@@ -84,8 +80,6 @@
 
 // Convert an empty interface to a pointer type.
 func ifaceE2T2P(inter *descriptor, e empty_interface) (ret *void, ok bool) {
-	if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
-		runtime_panicstring("invalid interface value");
 	if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) {
 		ret = nil;
 		ok = 0;
@@ -109,8 +103,6 @@
 
 // Convert an empty interface to a non-pointer type.
 func ifaceE2T2(inter *descriptor, e empty_interface, ret *void) (ok bool) {
-	if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
-		runtime_panicstring("invalid interface value");
 	if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) {
 		__builtin_memset(ret, 0, inter->__size);
 		ok = 0;
diff -r fa6e0c716dba libgo/runtime/reflect.goc
--- a/libgo/runtime/reflect.goc	Tue Jul 08 14:27:21 2014 -0700
+++ b/libgo/runtime/reflect.goc	Thu Jul 10 17:23:00 2014 -0700
@@ -12,8 +12,6 @@
 	const Type *t;
 	Eface err;
 
-	if(((uintptr)e.__type_descriptor&reflectFlags) != 0)
-		runtime_throw("invalid interface value");
 	t = e.__type_descriptor;
 	if(t == nil) {
 		// explicit conversions require non-nil interface value.

Reply via email to