github.com/dgraph-io/simdjson-go@v0.3.0/find_subroutines_amd64.go (about) 1 //+build !noasm 2 //+build !appengine 3 //+build gc 4 5 /* 6 * MinIO Cloud Storage, (C) 2020 MinIO, Inc. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 package simdjson 22 23 import ( 24 "unsafe" 25 ) 26 27 //go:noescape 28 func __finalize_structurals() 29 30 //go:noescape 31 func __finalize_structurals_avx512() 32 33 //go:noescape 34 func _finalize_structurals(structurals_in, whitespace, quote_mask, quote_bits uint64, prev_iter_ends_pseudo_pred unsafe.Pointer) (structurals uint64) 35 36 func finalize_structurals(structurals, whitespace, quote_mask, quote_bits uint64, prev_iter_ends_pseudo_pred *uint64) uint64 { 37 return _finalize_structurals(structurals, whitespace, quote_mask, quote_bits, unsafe.Pointer(prev_iter_ends_pseudo_pred)) 38 } 39 40 //go:noescape 41 func _find_newline_delimiters(raw []byte, quoteMask uint64) (mask uint64) 42 43 //go:noescape 44 func __find_newline_delimiters() 45 46 //go:noescape 47 func _find_newline_delimiters_avx512(raw []byte, quoteMask uint64) (mask uint64) 48 49 //go:noescape 50 func __init_newline_delimiters_avx512() 51 52 //go:noescape 53 func __find_newline_delimiters_avx512() 54 55 //go:noescape 56 func __find_quote_mask_and_bits() 57 58 //go:noescape 59 func _find_quote_mask_and_bits(input unsafe.Pointer, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer) (quote_mask uint64) 60 61 func find_quote_mask_and_bits(buf []byte, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask *uint64) (quote_mask uint64) { 62 63 return _find_quote_mask_and_bits(unsafe.Pointer(&buf[0]), odd_ends, unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(quote_bits), unsafe.Pointer(error_mask)) 64 } 65 66 //go:noescape 67 func __init_quote_mask_and_bits_avx512() 68 69 //go:noescape 70 func __find_quote_mask_and_bits_avx512() 71 72 //go:noescape 73 func _find_quote_mask_and_bits_avx512(input unsafe.Pointer, odd_ends uint64, prev_iter_inside_quote unsafe.Pointer) (error_mask, quote_bits, quote_mask uint64) 74 75 func find_quote_mask_and_bits_avx512(buf []byte, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask *uint64) (quote_mask uint64) { 76 77 *error_mask, *quote_bits, quote_mask = _find_quote_mask_and_bits_avx512(unsafe.Pointer(&buf[0]), odd_ends, unsafe.Pointer(prev_iter_inside_quote)) 78 return 79 } 80 81 //go:noescape 82 func __find_odd_backslash_sequences() 83 84 //go:noescape 85 func _find_odd_backslash_sequences(p1, p3 unsafe.Pointer) (result uint64) 86 87 func find_odd_backslash_sequences(buf []byte, prev_iter_ends_odd_backslash *uint64) uint64 { 88 return _find_odd_backslash_sequences(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash)) 89 } 90 91 //go:noescape 92 func __init_odd_backslash_sequences_avx512() 93 94 //go:noescape 95 func __find_odd_backslash_sequences_avx512() 96 97 //go:noescape 98 func _find_odd_backslash_sequences_avx512(p1, p3 unsafe.Pointer) (result uint64) 99 100 func find_odd_backslash_sequences_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64) uint64 { 101 return _find_odd_backslash_sequences_avx512(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash)) 102 } 103 104 //go:noescape 105 func _find_structural_bits(p1, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 106 prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 107 whitespace, structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 108 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 109 ) (structurals uint64) 110 111 func find_structural_bits(buf []byte, prev_iter_ends_odd_backslash *uint64, 112 prev_iter_inside_quote, error_mask *uint64, 113 structurals uint64, 114 prev_iter_ends_pseudo_pred *uint64) uint64 { 115 116 quote_bits := uint64(0) 117 whitespace := uint64(0) 118 119 return _find_structural_bits(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash), 120 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer("e_bits), unsafe.Pointer(error_mask), 121 unsafe.Pointer(&whitespace), unsafe.Pointer(&structurals), 122 unsafe.Pointer(prev_iter_ends_pseudo_pred)) 123 } 124 125 //go:noescape 126 func _find_structural_bits_avx512(p1, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 127 prev_iter_inside_quote, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 128 structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 129 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 130 ) (structurals uint64) 131 132 func find_structural_bits_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64, 133 prev_iter_inside_quote, error_mask *uint64, 134 structurals uint64, 135 prev_iter_ends_pseudo_pred *uint64) uint64 { 136 137 return _find_structural_bits_avx512(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash), 138 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(error_mask), 139 unsafe.Pointer(&structurals), 140 unsafe.Pointer(prev_iter_ends_pseudo_pred)) 141 } 142 143 //go:noescape 144 func _find_structural_bits_in_slice(buf unsafe.Pointer, len uint64, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 145 prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 146 whitespace, structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 147 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 148 indexes, index unsafe.Pointer, indexes_len uint64, 149 carried unsafe.Pointer, position unsafe.Pointer, 150 ndjson uint64) (processed uint64) 151 152 func find_structural_bits_in_slice(buf []byte, prev_iter_ends_odd_backslash *uint64, 153 prev_iter_inside_quote, error_mask *uint64, 154 prev_iter_ends_pseudo_pred *uint64, 155 indexes *[indexSize]uint32, index *int, carried *uint64, position *uint64, 156 ndjson uint64) (processed uint64) { 157 158 if len(buf) == 0 { 159 return 0 160 } 161 162 structurals := uint64(0) 163 quote_bits := uint64(0) 164 whitespace := uint64(0) 165 166 return _find_structural_bits_in_slice(unsafe.Pointer(&buf[0]), uint64(len(buf)), unsafe.Pointer(prev_iter_ends_odd_backslash), 167 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer("e_bits), unsafe.Pointer(error_mask), 168 unsafe.Pointer(&whitespace), unsafe.Pointer(&structurals), 169 unsafe.Pointer(prev_iter_ends_pseudo_pred), 170 unsafe.Pointer(&(*indexes)[0]), unsafe.Pointer(index), indexSizeWithSafetyBuffer, 171 unsafe.Pointer(carried), unsafe.Pointer(position), 172 ndjson) 173 } 174 175 //go:noescape 176 func _find_structural_bits_in_slice_avx512(buf unsafe.Pointer, len uint64, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 177 prev_iter_inside_quote, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 178 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 179 indexes, index unsafe.Pointer, indexes_len uint64, 180 carried unsafe.Pointer, position unsafe.Pointer, 181 ndjson uint64) (processed uint64) 182 183 func find_structural_bits_in_slice_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64, 184 prev_iter_inside_quote, error_mask *uint64, 185 prev_iter_ends_pseudo_pred *uint64, 186 indexes *[indexSize]uint32, index *int, carried *uint64, position *uint64, 187 ndjson uint64) (processed uint64) { 188 189 if len(buf) == 0 { 190 return 0 191 } 192 193 return _find_structural_bits_in_slice_avx512(unsafe.Pointer(&buf[0]), uint64(len(buf)), unsafe.Pointer(prev_iter_ends_odd_backslash), 194 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(error_mask), 195 unsafe.Pointer(prev_iter_ends_pseudo_pred), 196 unsafe.Pointer(&(*indexes)[0]), unsafe.Pointer(index), indexSizeWithSafetyBuffer, 197 unsafe.Pointer(carried), unsafe.Pointer(position), 198 ndjson) 199 } 200 201 //go:noescape 202 func __find_whitespace_and_structurals() 203 204 //go:noescape 205 func _find_whitespace_and_structurals(input, whitespace, structurals unsafe.Pointer) 206 207 func find_whitespace_and_structurals(buf []byte, whitespace, structurals *uint64) { 208 _find_whitespace_and_structurals(unsafe.Pointer(&buf[0]), unsafe.Pointer(whitespace), unsafe.Pointer(structurals)) 209 } 210 211 //go:noescape 212 func __init_whitespace_and_structurals_avx512() 213 214 //go:noescape 215 func __find_whitespace_and_structurals_avx512() 216 217 //go:noescape 218 func _find_whitespace_and_structurals_avx512(input unsafe.Pointer) (whitespace, structurals uint64) 219 220 func find_whitespace_and_structurals_avx512(buf []byte, whitespace, structurals *uint64) { 221 *whitespace, *structurals = _find_whitespace_and_structurals_avx512(unsafe.Pointer(&buf[0])) 222 } 223 224 //go:noescape 225 func __flatten_bits_incremental() 226 227 //go:noescape 228 func _flatten_bits_incremental(base_ptr, pbase unsafe.Pointer, mask uint64, carried unsafe.Pointer, position unsafe.Pointer) 229 230 func flatten_bits_incremental(base *[indexSize]uint32, base_index *int, mask uint64, carried *int, position *uint64) { 231 _flatten_bits_incremental(unsafe.Pointer(&(*base)[0]), unsafe.Pointer(base_index), mask, unsafe.Pointer(carried), unsafe.Pointer(position)) 232 }