tree-sitter/lib/src
Ryan Patterson b5e4ef6d9a
clone wasm store engine (#3542)
This resolves https://github.com/tree-sitter/tree-sitter/issues/3454.

This brings the usage of wasmtime::Engine in line with how wasmtime
intends it to be used. All wasmtime functions that receive an Engine
always receive an `&Engine`, never an owned `Engine`.  They are always
responsible for cloning the reference if they need it.

This brings the usage of wasmtime::Engine in line with how TSParser
treats TSLanguages: when setting a language to the parser, the parser is
responsible for cloning the reference to the TSLanguage. It is
counterintuitive for TSParser to have different behavior when receiving
wasmtime_engine_t.

C API users also expect this behavior, see "Memory Management"
[here](https://docs.wasmtime.dev/c-api/wasm_8h.html). Talking about the
C API: without this change, failing to clone the `wasmtime_engine_t`
(which, again, is never something API users need to do in wasmtime) and
then reusing the engine in multiple TSLanguages results in a use after
free. With this change, failing to call `wasm_engine_delete` on your
owned Engine results in a memory leak. Memory leaks are safer than
use-after-free.
2024-08-22 08:01:37 -07:00
..
unicode Expand on query docs 2019-10-30 10:26:10 -07:00
wasm Add strncat to wasm stdlib 2024-03-25 09:51:54 -07:00
alloc.c fix(lib): include api.h so ts_set_allocator is visible 2024-02-27 09:21:17 -05:00
alloc.h fix(lib): allow hiding symbols 2024-03-17 07:21:06 -04:00
array.h fix(lib): avoid possible UB of calling memset on a null ptr when 0 is passed into array_grow_by 2024-03-13 00:02:53 -04:00
atomic.h Merge branch 'master' into wasm-language 2023-10-27 12:11:43 +01:00
clock.h fix(lib): a null clock must have tv_nsec be 0 as well 2024-05-19 02:19:37 -04:00
error_costs.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
get_changed_ranges.c fix: rename shadowed variables from -Wshadow warnings and apply some useful clang-tidy warnings 2023-07-19 18:12:26 -04:00
get_changed_ranges.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
host.h Make SubtreeInlineData work on Big-Endian 2021-12-24 16:47:10 +01:00
language.c Rename wasm C sources to avoid conflicts with standard wasm headers 2024-02-26 13:08:30 -08:00
language.h Fix crash when attempting to load ancient languages via wasm 2024-02-23 11:48:14 -08:00
length.h Tolerate tree edits whose old range extends beyond the end of the tree 2022-08-25 10:20:40 -07:00
lexer.c feat: allow external scanners to use the logger 2024-08-17 14:46:28 -04:00
lexer.h fix: do not install parser.h 2024-02-02 11:30:24 -05:00
lib.c Rename wasm C sources to avoid conflicts with standard wasm headers 2024-02-26 13:08:30 -08:00
node.c fix(lib): do not return field names for extras 2024-04-30 19:23:11 -04:00
parser.c Reset language when resetting wasm store (#3495) 2024-07-31 10:30:58 -07:00
parser.h feat: allow external scanners to use the logger 2024-08-17 14:46:28 -04:00
point.h Change goto_first_child_for_{byte,point} to compare nodes' ranges inclusively 2022-02-04 12:38:33 -08:00
query.c fix(lib): an empty root node should not precede an empty range 2024-08-17 17:05:26 -04:00
reduce_action.h Generate node-fields.json file 2019-02-12 11:06:18 -08:00
reusable_node.h Allocate parent nodes together with their child array 2020-10-23 12:15:44 -07:00
stack.c Fix invalid parse stack recursive merging with mismatched error cost 2024-02-26 20:16:21 -05:00
stack.h Store the lookahead subtree of paused stack versions, not just the lookahead symbol 2022-02-22 09:45:26 -08:00
subtree.c fix(lib): properly account for aliased root nodes and root nodes with 2024-03-20 19:23:08 -04:00
subtree.h fix(lib): properly account for aliased root nodes and root nodes with 2024-03-20 19:23:08 -04:00
tree.c fix(lib): account for the root node of a tree cursor being an alias 2024-03-20 19:23:08 -04:00
tree.h Add --dot flag to parse subcommand, for printing tree as DOT graph 2023-02-13 12:33:34 -08:00
tree_cursor.c fix(lib): account for the root node of a tree cursor being an alias 2024-03-20 19:23:08 -04:00
tree_cursor.h fix(lib): account for the root node of a tree cursor being an alias 2024-03-20 19:23:08 -04:00
unicode.h lib: remove utf8proc dependency (#436) 2019-10-14 11:18:39 -07:00
wasm_store.c clone wasm store engine (#3542) 2024-08-22 08:01:37 -07:00
wasm_store.h Handle memory errors occurring in wasm scanners 2024-03-17 10:19:42 -07:00