dispatch_arm64.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright 2021 ByteDance Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package native
  17. import (
  18. `unsafe`
  19. neon `github.com/bytedance/sonic/internal/native/neon`
  20. `github.com/bytedance/sonic/internal/native/types`
  21. )
  22. const (
  23. MaxFrameSize uintptr = 200
  24. BufPaddingSize int = 64
  25. )
  26. var (
  27. S_f64toa uintptr
  28. S_f32toa uintptr
  29. S_i64toa uintptr
  30. S_u64toa uintptr
  31. S_lspace uintptr
  32. )
  33. var (
  34. S_quote uintptr
  35. S_unquote uintptr
  36. )
  37. var (
  38. S_value uintptr
  39. S_vstring uintptr
  40. S_vnumber uintptr
  41. S_vsigned uintptr
  42. S_vunsigned uintptr
  43. )
  44. var (
  45. S_skip_one uintptr
  46. S_skip_one_fast uintptr
  47. S_get_by_path uintptr
  48. S_skip_array uintptr
  49. S_skip_object uintptr
  50. S_skip_number uintptr
  51. )
  52. //go:nosplit
  53. //go:noescape
  54. //go:linkname Quote github.com/bytedance/sonic/internal/native/neon.__quote
  55. func Quote(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) int
  56. //go:nosplit
  57. //go:noescape
  58. //go:linkname Unquote github.com/bytedance/sonic/internal/native/neon.__unquote
  59. func Unquote(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) int
  60. //go:nosplit
  61. //go:noescape
  62. //go:linkname HTMLEscape github.com/bytedance/sonic/internal/native/neon.__html_escape
  63. func HTMLEscape(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) int
  64. //go:nosplit
  65. //go:noescape
  66. //go:linkname Value github.com/bytedance/sonic/internal/native/neon.__value
  67. func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) int
  68. //go:nosplit
  69. //go:noescape
  70. //go:linkname SkipOne github.com/bytedance/sonic/internal/native/neon.__skip_one
  71. func SkipOne(s *string, p *int, m *types.StateMachine, flags uint64) int
  72. //go:nosplit
  73. //go:noescape
  74. //go:linkname SkipOneFast github.com/bytedance/sonic/internal/native/neon.__skip_one_fast
  75. func SkipOneFast(s *string, p *int) int
  76. //go:nosplit
  77. //go:noescape
  78. //go:linkname GetByPath github.com/bytedance/sonic/internal/native/neon.__get_by_path
  79. func GetByPath(s *string, p *int, path *[]interface{}, m *types.StateMachine) int
  80. //go:nosplit
  81. //go:noescape
  82. //go:linkname ValidateOne github.com/bytedance/sonic/internal/native/neon.__validate_one
  83. func ValidateOne(s *string, p *int, m *types.StateMachine, flags uint64) int
  84. //go:nosplit
  85. //go:noescape
  86. //go:linkname I64toa github.com/bytedance/sonic/internal/native/neon.__i64toa
  87. func I64toa(out *byte, val int64) (ret int)
  88. //go:nosplit
  89. //go:noescape
  90. //go:linkname U64toa github.com/bytedance/sonic/internal/native/neon.__u64toa
  91. func U64toa(out *byte, val uint64) (ret int)
  92. //go:nosplit
  93. //go:noescape
  94. //go:linkname F64toa github.com/bytedance/sonic/internal/native/neon.__f64toa
  95. func F64toa(out *byte, val float64) (ret int)
  96. //go:nosplit
  97. //go:noescape
  98. //go:linkname F32toa github.com/bytedance/sonic/internal/native/neon.__f32toa
  99. func F32toa(out *byte, val float32) (ret int)
  100. //go:nosplit
  101. //go:noescape
  102. //go:linkname ValidateUTF8 github.com/bytedance/sonic/internal/native/neon.__validate_utf8
  103. func ValidateUTF8(s *string, p *int, m *types.StateMachine) (ret int)
  104. //go:nosplit
  105. //go:noescape
  106. //go:linkname ValidateUTF8Fast github.com/bytedance/sonic/internal/native/neon.__validate_utf8_fast
  107. func ValidateUTF8Fast(s *string) (ret int)
  108. func useNeon() {
  109. S_f64toa = neon.S_f64toa
  110. S_f32toa = neon.S_f32toa
  111. S_i64toa = neon.S_i64toa
  112. S_u64toa = neon.S_u64toa
  113. S_lspace = neon.S_lspace
  114. S_quote = neon.S_quote
  115. S_unquote = neon.S_unquote
  116. S_value = neon.S_value
  117. S_vstring = neon.S_vstring
  118. S_vnumber = neon.S_vnumber
  119. S_vsigned = neon.S_vsigned
  120. S_vunsigned = neon.S_vunsigned
  121. S_skip_one = neon.S_skip_one
  122. S_skip_one_fast = neon.S_skip_one_fast
  123. S_skip_array = neon.S_skip_array
  124. S_skip_object = neon.S_skip_object
  125. S_skip_number = neon.S_skip_number
  126. S_get_by_path = neon.S_get_by_path
  127. }
  128. func init() {
  129. useNeon()
  130. }