mirror of
https://github.com/golang/go
synced 2024-11-26 09:28:07 -07:00
add sys.BUG_intereq to compare interfaces for equality
R=r OCL=16929 CL=16929
This commit is contained in:
parent
e7c8e78879
commit
827dcb86b7
@ -80,3 +80,4 @@ export func stringtorune(string, int32) (int32, int32); // convert bytes to rune
|
||||
|
||||
export func exit(int32);
|
||||
|
||||
export func BUG_intereq(a, b interface{}) bool; // should not be necessary
|
||||
|
@ -68,5 +68,6 @@ char *sysimport =
|
||||
"export func sys.bytestorune (? *sys.uint8, ? sys.int32, ? sys.int32) (? sys.int32, ? sys.int32)\n"
|
||||
"export func sys.stringtorune (? sys.string, ? sys.int32) (? sys.int32, ? sys.int32)\n"
|
||||
"export func sys.exit (? sys.int32)\n"
|
||||
"export func sys.BUG_intereq (a interface { }, b interface { }) (? sys.bool)\n"
|
||||
"\n"
|
||||
"$$\n";
|
||||
|
@ -133,3 +133,21 @@ TEXT cas(SB), 7, $0
|
||||
MOVL $1, AX
|
||||
RET
|
||||
|
||||
// func BUG_intereq(a, b interface{}) bool {
|
||||
// return a == b
|
||||
// }
|
||||
// TODO: delete once 6g can compile a == b on interfaces.
|
||||
TEXT sys·BUG_intereq(SB),7,$0
|
||||
// First interface at 8(SP) and 16(SP)
|
||||
// Second interface at 24(SP) and 32(SP)
|
||||
// Answer at 40(SP)
|
||||
MOVQ 8(SP), AX
|
||||
CMPQ AX, 24(SP)
|
||||
JNE 6(PC)
|
||||
MOVQ 16(SP), AX
|
||||
CMPQ AX, 32(SP)
|
||||
JNE 3(PC)
|
||||
MOVQ $1, 40(SP)
|
||||
RET
|
||||
MOVQ $0, 40(SP)
|
||||
RET
|
||||
|
Loading…
Reference in New Issue
Block a user