diff --git a/src/cmd/5a/a.y b/src/cmd/5a/a.y index 6395359949..56d0c563db 100644 --- a/src/cmd/5a/a.y +++ b/src/cmd/5a/a.y @@ -336,7 +336,7 @@ inst: { if($2.type != D_CONST) 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"); outcode($1, Always, &$2, NREG, &$4); } diff --git a/src/cmd/5a/y.tab.c b/src/cmd/5a/y.tab.c index 67712d2c8f..0bc8c34e10 100644 --- a/src/cmd/5a/y.tab.c +++ b/src/cmd/5a/y.tab.c @@ -2120,7 +2120,7 @@ yyreduce: { if((yyvsp[(2) - (4)].addr).type != D_CONST) 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"); outcode((yyvsp[(1) - (4)].lval), Always, &(yyvsp[(2) - (4)].addr), NREG, &(yyvsp[(4) - (4)].addr)); } diff --git a/src/pkg/runtime/asm_386.s b/src/pkg/runtime/asm_386.s index dae241a15b..95312089d9 100644 --- a/src/pkg/runtime/asm_386.s +++ b/src/pkg/runtime/asm_386.s @@ -343,8 +343,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-16 MOVL $runtime·badreflectcall(SB), 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) \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ + FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \ + FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\ /* copy arguments to stack */ \ MOVL argptr+4(FP), SI; \ MOVL argsize+8(FP), CX; \ @@ -353,6 +367,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ /* call function */ \ MOVL f+0(FP), DX; \ MOVL (DX), AX; \ + PCDATA $PCDATA_StackMapIndex, $0; \ CALL AX; \ /* copy return values back */ \ MOVL argptr+4(FP), DI; \ diff --git a/src/pkg/runtime/asm_amd64.s b/src/pkg/runtime/asm_amd64.s index 27abb37cdb..3c7eaf3433 100644 --- a/src/pkg/runtime/asm_amd64.s +++ b/src/pkg/runtime/asm_amd64.s @@ -321,8 +321,22 @@ TEXT reflect·call(SB), NOSPLIT, $0-24 MOVQ $runtime·badreflectcall(SB), 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) \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \ + FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \ + FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\ /* copy arguments to stack */ \ MOVQ argptr+8(FP), SI; \ MOVLQZX argsize+16(FP), CX; \ @@ -330,6 +344,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-24; \ REP;MOVSB; \ /* call function */ \ MOVQ f+0(FP), DX; \ + PCDATA $PCDATA_StackMapIndex, $0; \ CALL (DX); \ /* copy return values back */ \ MOVQ argptr+8(FP), DI; \ diff --git a/src/pkg/runtime/asm_arm.s b/src/pkg/runtime/asm_arm.s index 3ce3deb2e2..024649be07 100644 --- a/src/pkg/runtime/asm_arm.s +++ b/src/pkg/runtime/asm_arm.s @@ -301,8 +301,22 @@ TEXT reflect·call(SB), NOSPLIT, $-4-16 MOVW $runtime·badreflectcall(SB), 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) \ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ + FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \ + FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\ /* copy arguments to stack */ \ MOVW argptr+4(FP), R0; \ MOVW argsize+8(FP), R2; \ @@ -316,6 +330,7 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ /* call function */ \ MOVW f+0(FP), R7; \ MOVW (R7), R0; \ + PCDATA $PCDATA_StackMapIndex, $0; \ BL (R0); \ /* copy return values back */ \ MOVW argptr+4(FP), R0; \