forked from mmcloughlin/avo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add attributes argument to TEXT
Brings the TEXT() function signature closer to how the directive works in assembly. Also update almost all examples to use NOSPLIT. Closes mmcloughlin#11
- Loading branch information
1 parent
76db5bb
commit 304c742
Showing
25 changed files
with
105 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package build | ||
|
||
import "github.com/mmcloughlin/avo/attr" | ||
|
||
// TEXT and DATA attribute values included for convenience. | ||
var ( | ||
NOPROF = attr.NOPROF | ||
DUPOK = attr.DUPOK | ||
NOSPLIT = attr.NOSPLIT | ||
RODATA = attr.RODATA | ||
NOPTR = attr.NOPTR | ||
WRAPPER = attr.WRAPPER | ||
NEEDCTXT = attr.NEEDCTXT | ||
TLSBSS = attr.TLSBSS | ||
NOFRAME = attr.NOFRAME | ||
REFLECTMETHOD = attr.REFLECTMETHOD | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,111 @@ | ||
// Code generated by command: go run asm.go -out args.s -stubs stub.go. DO NOT EDIT. | ||
|
||
#include "textflag.h" | ||
|
||
// func Second(x int32, y int32) int32 | ||
TEXT ·Second(SB), $0-12 | ||
TEXT ·Second(SB), NOSPLIT, $0-12 | ||
MOVL y+4(FP), AX | ||
MOVL AX, ret+8(FP) | ||
RET | ||
|
||
// func StringLen(s string) int | ||
TEXT ·StringLen(SB), $0-24 | ||
TEXT ·StringLen(SB), NOSPLIT, $0-24 | ||
MOVQ s_len+8(FP), AX | ||
MOVQ AX, ret+16(FP) | ||
RET | ||
|
||
// func SliceLen(s []int) int | ||
TEXT ·SliceLen(SB), $0-32 | ||
TEXT ·SliceLen(SB), NOSPLIT, $0-32 | ||
MOVQ s_len+8(FP), AX | ||
MOVQ AX, ret+24(FP) | ||
RET | ||
|
||
// func SliceCap(s []int) int | ||
TEXT ·SliceCap(SB), $0-32 | ||
TEXT ·SliceCap(SB), NOSPLIT, $0-32 | ||
MOVQ s_cap+16(FP), AX | ||
MOVQ AX, ret+24(FP) | ||
RET | ||
|
||
// func ArrayThree(a [7]uint64) uint64 | ||
TEXT ·ArrayThree(SB), $0-64 | ||
TEXT ·ArrayThree(SB), NOSPLIT, $0-64 | ||
MOVQ a_3+24(FP), AX | ||
MOVQ AX, ret+56(FP) | ||
RET | ||
|
||
// func FieldByte(s Struct) byte | ||
TEXT ·FieldByte(SB), $0-177 | ||
TEXT ·FieldByte(SB), NOSPLIT, $0-177 | ||
MOVB s_Byte(FP), AL | ||
MOVB AL, ret+176(FP) | ||
RET | ||
|
||
// func FieldInt8(s Struct) int8 | ||
TEXT ·FieldInt8(SB), $0-177 | ||
TEXT ·FieldInt8(SB), NOSPLIT, $0-177 | ||
MOVB s_Int8+1(FP), AL | ||
MOVB AL, ret+176(FP) | ||
RET | ||
|
||
// func FieldUint16(s Struct) uint16 | ||
TEXT ·FieldUint16(SB), $0-178 | ||
TEXT ·FieldUint16(SB), NOSPLIT, $0-178 | ||
MOVW s_Uint16+2(FP), AX | ||
MOVW AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldInt32(s Struct) int32 | ||
TEXT ·FieldInt32(SB), $0-180 | ||
TEXT ·FieldInt32(SB), NOSPLIT, $0-180 | ||
MOVL s_Int32+4(FP), AX | ||
MOVL AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldUint64(s Struct) uint64 | ||
TEXT ·FieldUint64(SB), $0-184 | ||
TEXT ·FieldUint64(SB), NOSPLIT, $0-184 | ||
MOVQ s_Uint64+8(FP), AX | ||
MOVQ AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldFloat32(s Struct) float32 | ||
TEXT ·FieldFloat32(SB), $0-180 | ||
TEXT ·FieldFloat32(SB), NOSPLIT, $0-180 | ||
MOVSS s_Float32+16(FP), X0 | ||
MOVSS X0, ret+176(FP) | ||
RET | ||
|
||
// func FieldFloat64(s Struct) float64 | ||
TEXT ·FieldFloat64(SB), $0-184 | ||
TEXT ·FieldFloat64(SB), NOSPLIT, $0-184 | ||
MOVSD s_Float64+24(FP), X0 | ||
MOVSD X0, ret+176(FP) | ||
RET | ||
|
||
// func FieldStringLen(s Struct) int | ||
TEXT ·FieldStringLen(SB), $0-184 | ||
TEXT ·FieldStringLen(SB), NOSPLIT, $0-184 | ||
MOVQ s_String_len+40(FP), AX | ||
MOVQ AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldSliceCap(s Struct) int | ||
TEXT ·FieldSliceCap(SB), $0-184 | ||
TEXT ·FieldSliceCap(SB), NOSPLIT, $0-184 | ||
MOVQ s_Slice_cap+64(FP), AX | ||
MOVQ AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldArrayTwoBTwo(s Struct) byte | ||
TEXT ·FieldArrayTwoBTwo(SB), $0-177 | ||
TEXT ·FieldArrayTwoBTwo(SB), NOSPLIT, $0-177 | ||
MOVB s_Array_2_B_2+114(FP), AL | ||
MOVB AL, ret+176(FP) | ||
RET | ||
|
||
// func FieldArrayOneC(s Struct) uint16 | ||
TEXT ·FieldArrayOneC(SB), $0-178 | ||
TEXT ·FieldArrayOneC(SB), NOSPLIT, $0-178 | ||
MOVW s_Array_1_C+100(FP), AX | ||
MOVW AX, ret+176(FP) | ||
RET | ||
|
||
// func FieldComplex64Imag(s Struct) float32 | ||
TEXT ·FieldComplex64Imag(SB), $0-180 | ||
TEXT ·FieldComplex64Imag(SB), NOSPLIT, $0-180 | ||
MOVSS s_Complex64_imag+156(FP), X0 | ||
MOVSS X0, ret+176(FP) | ||
RET | ||
|
||
// func FieldComplex128Real(s Struct) float64 | ||
TEXT ·FieldComplex128Real(SB), $0-184 | ||
TEXT ·FieldComplex128Real(SB), NOSPLIT, $0-184 | ||
MOVSD s_Complex128_real+160(FP), X0 | ||
MOVSD X0, ret+176(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.