Commit cee8bcab authored by Keith Randall's avatar Keith Randall

runtime: provide gc maps for the reflect.callXX frames.

Update #8030

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/100620045
parent eb34288a
...@@ -336,7 +336,7 @@ inst: ...@@ -336,7 +336,7 @@ inst:
{ {
if($2.type != D_CONST) if($2.type != D_CONST)
yyerror("index for FUNCDATA must be integer constant"); yyerror("index for FUNCDATA must be integer constant");
if($4.type != D_EXTERN && $4.type != D_STATIC) if($4.type != D_EXTERN && $4.type != D_STATIC && $4.type != D_OREG)
yyerror("value for FUNCDATA must be symbol reference"); yyerror("value for FUNCDATA must be symbol reference");
outcode($1, Always, &$2, NREG, &$4); outcode($1, Always, &$2, NREG, &$4);
} }
......
...@@ -2120,7 +2120,7 @@ yyreduce: ...@@ -2120,7 +2120,7 @@ yyreduce:
{ {
if((yyvsp[(2) - (4)].addr).type != D_CONST) if((yyvsp[(2) - (4)].addr).type != D_CONST)
yyerror("index for FUNCDATA must be integer constant"); yyerror("index for FUNCDATA must be integer constant");
if((yyvsp[(4) - (4)].addr).type != D_EXTERN && (yyvsp[(4) - (4)].addr).type != D_STATIC) if((yyvsp[(4) - (4)].addr).type != D_EXTERN && (yyvsp[(4) - (4)].addr).type != D_STATIC && (yyvsp[(4) - (4)].addr).type != D_OREG)
yyerror("value for FUNCDATA must be symbol reference"); yyerror("value for FUNCDATA must be symbol reference");
outcode((yyvsp[(1) - (4)].lval), Always, &(yyvsp[(2) - (4)].addr), NREG, &(yyvsp[(4) - (4)].addr)); outcode((yyvsp[(1) - (4)].lval), Always, &(yyvsp[(2) - (4)].addr), NREG, &(yyvsp[(4) - (4)].addr));
} }
......
...@@ -343,8 +343,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-16 ...@@ -343,8 +343,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-16
MOVL $runtime·badreflectcall(SB), AX MOVL $runtime·badreflectcall(SB), AX
JMP AX JMP AX
// Argument map for the callXX frames. Each has one
// stack map (for the single call) with 3 arguments.
DATA gcargs_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gcargs_reflectcall<>+0x04(SB)/4, $6 // 3 args
DATA gcargs_reflectcall<>+0x08(SB)/4, $(const_BitsPointer+(const_BitsPointer<<2)+(const_BitsScalar<<4))
GLOBL gcargs_reflectcall<>(SB),RODATA,$12
// callXX frames have no locals
DATA gclocals_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gclocals_reflectcall<>+0x04(SB)/4, $0 // 0 locals
GLOBL gclocals_reflectcall<>(SB),RODATA,$8
#define CALLFN(NAME,MAXSIZE) \ #define CALLFN(NAME,MAXSIZE) \
TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \
FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \
FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\
/* copy arguments to stack */ \ /* copy arguments to stack */ \
MOVL argptr+4(FP), SI; \ MOVL argptr+4(FP), SI; \
MOVL argsize+8(FP), CX; \ MOVL argsize+8(FP), CX; \
...@@ -353,6 +367,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ ...@@ -353,6 +367,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \
/* call function */ \ /* call function */ \
MOVL f+0(FP), DX; \ MOVL f+0(FP), DX; \
MOVL (DX), AX; \ MOVL (DX), AX; \
PCDATA $PCDATA_StackMapIndex, $0; \
CALL AX; \ CALL AX; \
/* copy return values back */ \ /* copy return values back */ \
MOVL argptr+4(FP), DI; \ MOVL argptr+4(FP), DI; \
......
...@@ -321,8 +321,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-24 ...@@ -321,8 +321,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-24
MOVQ $runtime·badreflectcall(SB), AX MOVQ $runtime·badreflectcall(SB), AX
JMP AX JMP AX
// Argument map for the callXX frames. Each has one
// stack map (for the single call) with 3 arguments.
DATA gcargs_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gcargs_reflectcall<>+0x04(SB)/4, $6 // 3 args
DATA gcargs_reflectcall<>+0x08(SB)/4, $(const_BitsPointer+(const_BitsPointer<<2)+(const_BitsScalar<<4))
GLOBL gcargs_reflectcall<>(SB),RODATA,$12
// callXX frames have no locals
DATA gclocals_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gclocals_reflectcall<>+0x04(SB)/4, $0 // 0 locals
GLOBL gclocals_reflectcall<>(SB),RODATA,$8
#define CALLFN(NAME,MAXSIZE) \ #define CALLFN(NAME,MAXSIZE) \
TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \
FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \
FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\
/* copy arguments to stack */ \ /* copy arguments to stack */ \
MOVQ argptr+8(FP), SI; \ MOVQ argptr+8(FP), SI; \
MOVLQZX argsize+16(FP), CX; \ MOVLQZX argsize+16(FP), CX; \
...@@ -330,6 +344,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \ ...@@ -330,6 +344,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \
REP;MOVSB; \ REP;MOVSB; \
/* call function */ \ /* call function */ \
MOVQ f+0(FP), DX; \ MOVQ f+0(FP), DX; \
PCDATA $PCDATA_StackMapIndex, $0; \
CALL (DX); \ CALL (DX); \
/* copy return values back */ \ /* copy return values back */ \
MOVQ argptr+8(FP), DI; \ MOVQ argptr+8(FP), DI; \
......
...@@ -301,8 +301,22 @@ TEXT reflect·call(SB), NOSPLIT, $-4-16 ...@@ -301,8 +301,22 @@ TEXT reflect·call(SB), NOSPLIT, $-4-16
MOVW $runtime·badreflectcall(SB), R1 MOVW $runtime·badreflectcall(SB), R1
B (R1) B (R1)
// Argument map for the callXX frames. Each has one
// stack map (for the single call) with 3 arguments.
DATA gcargs_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gcargs_reflectcall<>+0x04(SB)/4, $6 // 3 args
DATA gcargs_reflectcall<>+0x08(SB)/4, $(const_BitsPointer+(const_BitsPointer<<2)+(const_BitsScalar<<4))
GLOBL gcargs_reflectcall<>(SB),RODATA,$12
// callXX frames have no locals
DATA gclocals_reflectcall<>+0x00(SB)/4, $1 // 1 stackmap
DATA gclocals_reflectcall<>+0x04(SB)/4, $0 // 0 locals
GLOBL gclocals_reflectcall<>(SB),RODATA,$8
#define CALLFN(NAME,MAXSIZE) \ #define CALLFN(NAME,MAXSIZE) \
TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \
FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \
FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\
/* copy arguments to stack */ \ /* copy arguments to stack */ \
MOVW argptr+4(FP), R0; \ MOVW argptr+4(FP), R0; \
MOVW argsize+8(FP), R2; \ MOVW argsize+8(FP), R2; \
...@@ -316,6 +330,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ ...@@ -316,6 +330,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \
/* call function */ \ /* call function */ \
MOVW f+0(FP), R7; \ MOVW f+0(FP), R7; \
MOVW (R7), R0; \ MOVW (R7), R0; \
PCDATA $PCDATA_StackMapIndex, $0; \
BL (R0); \ BL (R0); \
/* copy return values back */ \ /* copy return values back */ \
MOVW argptr+4(FP), R0; \ MOVW argptr+4(FP), R0; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment