@salang/sa 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/sa.js +19 -1
- package/package.json +8 -7
- package/sa_std/alloc/layout.sal +12 -0
- package/sa_std/alloc/prelude.sa +1 -0
- package/sa_std/alloc/prelude.sal +1 -0
- package/sa_std/alloc/string.sa +3 -0
- package/sa_std/alloc/vec.sa +684 -0
- package/sa_std/alloc/vec.sal +4 -0
- package/sa_std/any.sa +130 -0
- package/sa_std/any.sal +23 -0
- package/sa_std/array.sa +1876 -0
- package/sa_std/ascii.sa +2 -0
- package/sa_std/ascii.sal +1 -0
- package/sa_std/async.sla +116 -0
- package/sa_std/binary_heap.sa +3003 -0
- package/sa_std/binary_heap.sal +7 -0
- package/sa_std/borrow.sa +171 -0
- package/sa_std/borrow.sal +13 -0
- package/sa_std/btree_map.sa +2210 -0
- package/sa_std/btree_map.sal +11 -0
- package/sa_std/btree_set.sa +1072 -0
- package/sa_std/btree_set.sal +6 -0
- package/sa_std/char.sa +1309 -0
- package/sa_std/char.sal +50 -0
- package/sa_std/cmp.sa +554 -0
- package/sa_std/cmp.sal +14 -0
- package/sa_std/collections/binary_heap.sa +1 -0
- package/sa_std/collections/btree_map.sa +1 -0
- package/sa_std/collections/btree_set.sa +1 -0
- package/sa_std/collections/hashmap.sa +1 -0
- package/sa_std/collections/hashset.sa +1 -0
- package/sa_std/collections/linked_list.sa +1120 -0
- package/sa_std/collections/linked_list.sal +10 -0
- package/sa_std/collections/prelude.sa +7 -0
- package/sa_std/collections/prelude.sal +1 -0
- package/sa_std/collections/vec_deque.sa +1 -0
- package/sa_std/collections.sal +13 -0
- package/sa_std/convert.sa +1115 -0
- package/sa_std/convert.sal +24 -0
- package/sa_std/core/arc.sa +233 -0
- package/sa_std/core/arc.sal +4 -0
- package/sa_std/core/ascii.sa +784 -0
- package/sa_std/core/ascii.sal +34 -0
- package/sa_std/core/bit.sa +41 -0
- package/sa_std/core/box.sa +1 -0
- package/sa_std/core/box.sal +2 -0
- package/sa_std/core/cell.sa +108 -0
- package/sa_std/core/cell.sal +5 -0
- package/sa_std/core/cleanup.sa +26 -0
- package/sa_std/core/control.sa +20 -0
- package/sa_std/core/derive.sa +60 -0
- package/sa_std/core/derive.sal +1 -0
- package/sa_std/core/dispatch.sa +7 -0
- package/sa_std/core/dispatch.sal +5 -0
- package/sa_std/core/future.sa +777 -0
- package/sa_std/core/future.sal +73 -0
- package/sa_std/core/hash.sa +48 -0
- package/sa_std/core/iter.sa +2805 -0
- package/sa_std/core/iter.sal +4 -0
- package/sa_std/core/loop.sa +60 -0
- package/sa_std/core/mem.sa +220 -0
- package/sa_std/core/option.sa +825 -0
- package/sa_std/core/option.sal +11 -0
- package/sa_std/core/panic.sa +23 -0
- package/sa_std/core/panic.sal +12 -0
- package/sa_std/core/prelude.sa +18 -0
- package/sa_std/core/prelude.sal +18 -0
- package/sa_std/core/rc.sa +225 -0
- package/sa_std/core/rc.sal +4 -0
- package/sa_std/core/refcell.sa +283 -0
- package/sa_std/core/refcell.sal +13 -0
- package/sa_std/core/result.sa +708 -0
- package/sa_std/core/result.sal +6 -0
- package/sa_std/core/rust_patterns.sal +295 -0
- package/sa_std/core/sa_core.sa +84 -0
- package/sa_std/core/slice.sa +4021 -0
- package/sa_std/core/slice.sal +7 -0
- package/sa_std/core/task.sa +112 -0
- package/sa_std/core/task.sal +15 -0
- package/sa_std/core/trait_object.sa +26 -0
- package/sa_std/core/trait_object.sal +4 -0
- package/sa_std/core/waker.sa +289 -0
- package/sa_std/core/waker.sal +31 -0
- package/sa_std/core/weak.sa +2 -0
- package/sa_std/core/weak.sal +4 -0
- package/sa_std/cow.sa +3 -0
- package/sa_std/cow.sal +2 -0
- package/sa_std/cstring.sa +3 -0
- package/sa_std/cstring.sal +2 -0
- package/sa_std/default.sa +99 -0
- package/sa_std/duration.sa +3 -0
- package/sa_std/duration.sal +2 -0
- package/sa_std/encoding/json.sa +259 -0
- package/sa_std/encoding/json.sai +54 -0
- package/sa_std/encoding/json.sal +35 -0
- package/sa_std/encoding/prelude.sa +1 -0
- package/sa_std/encoding/prelude.sal +0 -0
- package/sa_std/env.sa +390 -0
- package/sa_std/env.sai +25 -0
- package/sa_std/error.sa +253 -0
- package/sa_std/error.sal +44 -0
- package/sa_std/ffi/cstring.sa +3 -0
- package/sa_std/ffi/cstring.sal +1 -0
- package/sa_std/ffi/prelude.sa +2 -0
- package/sa_std/ffi/prelude.sal +2 -0
- package/sa_std/ffi.sa +635 -0
- package/sa_std/ffi.sal +51 -0
- package/sa_std/fmt.sa +2 -0
- package/sa_std/fmt.sai +18 -0
- package/sa_std/fmt.sal +35 -0
- package/sa_std/fs.sa +1023 -0
- package/sa_std/fs.sai +127 -0
- package/sa_std/fs.sal +51 -0
- package/sa_std/future.sa +2 -0
- package/sa_std/future.sal +1 -0
- package/sa_std/hash.sa +1486 -0
- package/sa_std/hash.sal +13 -0
- package/sa_std/hashmap.sa +1962 -0
- package/sa_std/hashmap.sal +20 -0
- package/sa_std/hashset.sa +1004 -0
- package/sa_std/hashset.sal +18 -0
- package/sa_std/http2.sa +78 -0
- package/sa_std/http2.sai +26 -0
- package/sa_std/http2.sal +36 -0
- package/sa_std/instant.sa +3 -0
- package/sa_std/instant.sal +2 -0
- package/sa_std/io/buf_reader.sa +43 -0
- package/sa_std/io/buf_writer.sa +35 -0
- package/sa_std/io/bufio.sa +4 -0
- package/sa_std/io/bufio.sal +4 -0
- package/sa_std/io/prelude.sa +1 -0
- package/sa_std/io/prelude.sal +1 -0
- package/sa_std/io/print.sa +2 -0
- package/sa_std/io/print.sai +3 -0
- package/sa_std/io.sa +925 -0
- package/sa_std/io.sai +25 -0
- package/sa_std/io.sal +84 -0
- package/sa_std/iter.sa +2 -0
- package/sa_std/iter.sal +1 -0
- package/sa_std/join_handle.sa +3 -0
- package/sa_std/join_handle.sal +2 -0
- package/sa_std/libsa_async.sa +80 -0
- package/sa_std/m_async.sa +137 -0
- package/sa_std/m_async.sal +30 -0
- package/sa_std/m_async.sla +2 -0
- package/sa_std/manually_drop.sa +3 -0
- package/sa_std/manually_drop.sal +2 -0
- package/sa_std/marker/phantom_data.sa +3 -0
- package/sa_std/marker/phantom_data.sal +1 -0
- package/sa_std/marker/prelude.sa +4 -0
- package/sa_std/marker/prelude.sal +4 -0
- package/sa_std/marker.sa +220 -0
- package/sa_std/marker.sal +15 -0
- package/sa_std/math.sa +84 -0
- package/sa_std/math.sai +10 -0
- package/sa_std/mem/manually_drop.sa +3 -0
- package/sa_std/mem/manually_drop.sal +1 -0
- package/sa_std/mem/prelude.sa +2 -0
- package/sa_std/mem/prelude.sal +2 -0
- package/sa_std/mem.sa +564 -0
- package/sa_std/mem.sal +40 -0
- package/sa_std/modstate.sai +19 -0
- package/sa_std/net.sa +4227 -0
- package/sa_std/net.sai +239 -0
- package/sa_std/net.sal +159 -0
- package/sa_std/netx.sa +85 -0
- package/sa_std/netx.sai +11 -0
- package/sa_std/netx.sal +39 -0
- package/sa_std/nonzero.sa +3 -0
- package/sa_std/nonzero.sal +2 -0
- package/sa_std/num/nonzero.sa +3 -0
- package/sa_std/num/nonzero.sal +1 -0
- package/sa_std/num/prelude.sa +3 -0
- package/sa_std/num/prelude.sal +3 -0
- package/sa_std/num.sa +17302 -0
- package/sa_std/num.sai +11 -0
- package/sa_std/num.sal +341 -0
- package/sa_std/ops.sa +1884 -0
- package/sa_std/ops.sal +68 -0
- package/sa_std/option.sa +2 -0
- package/sa_std/option.sal +1 -0
- package/sa_std/os/fd.sa +96 -0
- package/sa_std/os/fd.sai +7 -0
- package/sa_std/os/fd.sal +11 -0
- package/sa_std/os/prelude.sa +2 -0
- package/sa_std/os/prelude.sal +1 -0
- package/sa_std/os/unix_ffi.sa +271 -0
- package/sa_std/panic.sa +1 -0
- package/sa_std/panic.sal +1 -0
- package/sa_std/path.sa +3170 -0
- package/sa_std/path.sal +12 -0
- package/sa_std/phantom_data.sa +3 -0
- package/sa_std/phantom_data.sal +2 -0
- package/sa_std/pin.sa +79 -0
- package/sa_std/pin.sal +5 -0
- package/sa_std/plugin_async.sa +90 -0
- package/sa_std/plugin_async.sal +29 -0
- package/sa_std/plugin_async.sla +4 -0
- package/sa_std/plugin_http_async.sa +46 -0
- package/sa_std/plugin_http_server.sa +61 -0
- package/sa_std/plugin_http_server.sla +2 -0
- package/sa_std/plugin_sqlite.sa +106 -0
- package/sa_std/plugin_sqlite.sla +2 -0
- package/sa_std/prelude.sa +60 -0
- package/sa_std/prelude.sal +55 -0
- package/sa_std/process.sa +916 -0
- package/sa_std/process.sai +57 -0
- package/sa_std/process.sal +27 -0
- package/sa_std/ptr.sa +503 -0
- package/sa_std/ptr.sal +2 -0
- package/sa_std/result.sa +2 -0
- package/sa_std/result.sal +1 -0
- package/sa_std/rust_core.sa +51 -0
- package/sa_std/rust_core.sal +26 -0
- package/sa_std/sa.mod +7 -0
- package/sa_std/sort.sa +156 -0
- package/sa_std/str.sla +13 -0
- package/sa_std/string.sa +12240 -0
- package/sa_std/string.sai +25 -0
- package/sa_std/string.sal +17 -0
- package/sa_std/string_format.sa +269 -0
- package/sa_std/sync/atomic.sa +1500 -0
- package/sa_std/sync/atomic.sal +45 -0
- package/sa_std/sync/barrier.sa +105 -0
- package/sa_std/sync/barrier.sal +7 -0
- package/sa_std/sync/condvar.sa +240 -0
- package/sa_std/sync/condvar.sal +4 -0
- package/sa_std/sync/mpsc.sa +758 -0
- package/sa_std/sync/mpsc.sal +42 -0
- package/sa_std/sync/mpsc_list.sa +255 -0
- package/sa_std/sync/mpsc_list.sal +3 -0
- package/sa_std/sync/mutex.sa +182 -0
- package/sa_std/sync/mutex.sal +7 -0
- package/sa_std/sync/once.sa +371 -0
- package/sa_std/sync/once.sal +31 -0
- package/sa_std/sync/poison.sa +36 -0
- package/sa_std/sync/poison.sal +11 -0
- package/sa_std/sync/prelude.sa +8 -0
- package/sa_std/sync/prelude.sal +7 -0
- package/sa_std/sync/rwlock.sa +369 -0
- package/sa_std/sync/rwlock.sal +13 -0
- package/sa_std/task.sa +2 -0
- package/sa_std/task.sal +1 -0
- package/sa_std/term.sa +2 -0
- package/sa_std/term.sai +10 -0
- package/sa_std/term.sal +33 -0
- package/sa_std/testing/assert.sai +4 -0
- package/sa_std/testing/mock_io.sa +174 -0
- package/sa_std/testing/mock_io.sal +5 -0
- package/sa_std/testing/prelude.sa +2 -0
- package/sa_std/testing/prelude.sal +1 -0
- package/sa_std/text/prelude.sa +1 -0
- package/sa_std/text/prelude.sal +1 -0
- package/sa_std/text/regex.sa +2 -0
- package/sa_std/text/regex.sai +9 -0
- package/sa_std/text/regex.sal +33 -0
- package/sa_std/thread/join_handle.sa +3 -0
- package/sa_std/thread/join_handle.sal +1 -0
- package/sa_std/thread/prelude.sa +4 -0
- package/sa_std/thread/prelude.sal +3 -0
- package/sa_std/thread.sa +160 -0
- package/sa_std/thread.sai +11 -0
- package/sa_std/thread.sal +4 -0
- package/sa_std/thread_local.sa +45 -0
- package/sa_std/thread_local.sai +9 -0
- package/sa_std/time/duration.sa +3 -0
- package/sa_std/time/duration.sal +1 -0
- package/sa_std/time/instant.sa +3 -0
- package/sa_std/time/instant.sal +1 -0
- package/sa_std/time/prelude.sa +4 -0
- package/sa_std/time/prelude.sal +4 -0
- package/sa_std/time.sa +850 -0
- package/sa_std/time.sai +37 -0
- package/sa_std/time.sal +35 -0
- package/sa_std/time.sla +67 -0
- package/sa_std/tls_client.sai +39 -0
- package/sa_std/vec.sa +5754 -0
- package/sa_std/vec.sal +1 -0
- package/sa_std/vec_deque.sa +4925 -0
- package/sa_std/vec_deque.sal +8 -0
- package/sa_std/vec_runtime_macros.sa +11 -0
- package/sa_std/ws_client.sai +57 -0
package/sa_std/io.sai
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SA-facing contracts for the Zig-backed sa_std.io module.
|
|
2
|
+
// Handles returned by stdio accessors are borrowed process handles; do not close them.
|
|
3
|
+
@extern sa_io_stdin() -> u64
|
|
4
|
+
@extern sa_io_stdout() -> u64
|
|
5
|
+
@extern sa_io_stderr() -> u64
|
|
6
|
+
|
|
7
|
+
// Convenience printing uses the same Zig-backed stdout writer as the runtime facade.
|
|
8
|
+
@extern sa_std_println(&msg: ptr, len: u64) -> i32!
|
|
9
|
+
|
|
10
|
+
// Owned handles returned by Zig-backed modules are closed explicitly.
|
|
11
|
+
@extern sa_io_read_line(handle: ptr, max_bytes: u64) -> ^ptr!
|
|
12
|
+
@extern sa_io_read(handle: u64, &buf: ptr, cap: u64, &out_read: ptr) -> i32
|
|
13
|
+
@extern sa_io_read_exact(handle: u64, &buf: ptr, len: u64) -> i32
|
|
14
|
+
@extern sa_io_write(handle: u64, &buf: ptr, len: u64, &out_written: ptr) -> i32
|
|
15
|
+
@extern sa_io_write_all(handle: u64, &buf: ptr, len: u64) -> i32
|
|
16
|
+
@extern sa_io_flush(handle: u64) -> i32
|
|
17
|
+
@extern sa_io_close(handle: u64) -> i32
|
|
18
|
+
|
|
19
|
+
// Owned byte buffers use SaIoBuffer layout and must be freed explicitly.
|
|
20
|
+
@extern sa_io_buffer_data(&buffer: ptr) -> &ptr
|
|
21
|
+
@extern sa_io_buffer_len(&buffer: ptr) -> u64
|
|
22
|
+
@extern sa_io_buffer_free(^buffer: ptr) -> i32!
|
|
23
|
+
|
|
24
|
+
// Legacy demo compatibility: equivalent to stdout().write_all(bytes).
|
|
25
|
+
@extern sa_print_bytes(&msg: ptr, len: u64) -> void
|
package/sa_std/io.sal
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#def SA_IO_OK = 0
|
|
2
|
+
#def SA_IO_ERR_UNKNOWN = 1
|
|
3
|
+
#def SA_IO_ERR_EOF = 2
|
|
4
|
+
#def SA_IO_ERR_WOULD_BLOCK = 3
|
|
5
|
+
#def SA_IO_ERR_INTERRUPTED = 4
|
|
6
|
+
#def SA_IO_ERR_INVALID_HANDLE = 5
|
|
7
|
+
#def SA_IO_ERR_INVALID_DATA = 6
|
|
8
|
+
|
|
9
|
+
#def SA_IO_STDIN = 0
|
|
10
|
+
#def SA_IO_STDOUT = 1
|
|
11
|
+
#def SA_IO_STDERR = 2
|
|
12
|
+
|
|
13
|
+
#def SA_IO_SEEK_START = 0
|
|
14
|
+
#def SA_IO_SEEK_CURRENT = 1
|
|
15
|
+
#def SA_IO_SEEK_END = 2
|
|
16
|
+
|
|
17
|
+
#def IO_ERROR_KIND_OTHER = 0
|
|
18
|
+
#def IO_ERROR_KIND_UNEXPECTED_EOF = 1
|
|
19
|
+
#def IO_ERROR_KIND_WOULD_BLOCK = 2
|
|
20
|
+
#def IO_ERROR_KIND_INTERRUPTED = 3
|
|
21
|
+
#def IO_ERROR_KIND_INVALID_INPUT = 4
|
|
22
|
+
#def IO_ERROR_KIND_WRITE_ZERO = 5
|
|
23
|
+
#def IO_ERROR_KIND_INVALID_DATA = 6
|
|
24
|
+
#def IO_ERROR_KIND_NOT_FOUND = 7
|
|
25
|
+
#def IO_ERROR_KIND_PERMISSION_DENIED = 8
|
|
26
|
+
#def IO_ERROR_KIND_CONNECTION_REFUSED = 9
|
|
27
|
+
#def IO_ERROR_KIND_CONNECTION_RESET = 10
|
|
28
|
+
#def IO_ERROR_KIND_CONNECTION_ABORTED = 11
|
|
29
|
+
#def IO_ERROR_KIND_NOT_CONNECTED = 12
|
|
30
|
+
#def IO_ERROR_KIND_ADDR_IN_USE = 13
|
|
31
|
+
#def IO_ERROR_KIND_ADDR_NOT_AVAILABLE = 14
|
|
32
|
+
#def IO_ERROR_KIND_BROKEN_PIPE = 15
|
|
33
|
+
#def IO_ERROR_KIND_ALREADY_EXISTS = 16
|
|
34
|
+
#def IO_ERROR_KIND_TIMED_OUT = 17
|
|
35
|
+
#def IO_ERROR_KIND_UNSUPPORTED = 18
|
|
36
|
+
#def IO_ERROR_KIND_OUT_OF_MEMORY = 19
|
|
37
|
+
#def IO_ERROR_KIND_IS_A_DIRECTORY = 20
|
|
38
|
+
#def IO_ERROR_KIND_DIRECTORY_NOT_EMPTY = 21
|
|
39
|
+
#def IO_ERROR_KIND_RECURSIVE_ENTRY = 22
|
|
40
|
+
#def IO_ERROR_KIND_QUOTA_EXCEEDED = 23
|
|
41
|
+
#def IO_ERROR_KIND_FILE_TOO_LARGE = 24
|
|
42
|
+
#def IO_ERROR_KIND_FILESYSTEM_LOOP = 25
|
|
43
|
+
#def IO_ERROR_KIND_EXECUTABLE_FILE_BUSY = 26
|
|
44
|
+
#def IO_ERROR_KIND_CROSSED_DEVICES = 27
|
|
45
|
+
#def IO_ERROR_KIND_NOT_SEEKABLE = 28
|
|
46
|
+
#def IO_ERROR_KIND_READ_ONLY_FILESYSTEM = 29
|
|
47
|
+
#def IO_ERROR_KIND_ARGUMENT_LIST_TOO_LONG = 30
|
|
48
|
+
#def IO_ERROR_KIND_RESOURCE_BUSY = 31
|
|
49
|
+
#def IO_ERROR_KIND_NAME_TOO_LONG = 32
|
|
50
|
+
#def IO_ERROR_KIND_TOO_MANY_LINKS = 33
|
|
51
|
+
#def IO_ERROR_KIND_HOST_UNREACHABLE = 34
|
|
52
|
+
#def IO_ERROR_KIND_NETWORK_UNREACHABLE = 35
|
|
53
|
+
#def IO_ERROR_KIND_NETWORK_DOWN = 36
|
|
54
|
+
#def IO_ERROR_KIND_STALE_NETWORK_FILE_HANDLE = 37
|
|
55
|
+
#def IO_ERROR_KIND_FILESYSTEM_QUOTA = 38
|
|
56
|
+
#def IO_ERROR_KIND_STORAGE_FULL = 39
|
|
57
|
+
|
|
58
|
+
#def SaIoBuffer_SIZE = 24
|
|
59
|
+
#def SaIoBuffer_ptr = +0
|
|
60
|
+
#def SaIoBuffer_len = +8
|
|
61
|
+
#def SaIoBuffer_cap = +16
|
|
62
|
+
|
|
63
|
+
#def IoSlice_SIZE = 16
|
|
64
|
+
#def IoSlice_ptr = +0
|
|
65
|
+
#def IoSlice_len = +8
|
|
66
|
+
|
|
67
|
+
#def IoSliceMut_SIZE = 16
|
|
68
|
+
#def IoSliceMut_ptr = +0
|
|
69
|
+
#def IoSliceMut_len = +8
|
|
70
|
+
|
|
71
|
+
#def IoCursor_SIZE = 24
|
|
72
|
+
#def IoCursor_ptr = +0
|
|
73
|
+
#def IoCursor_len = +8
|
|
74
|
+
#def IoCursor_pos = +16
|
|
75
|
+
|
|
76
|
+
#def IoEmpty_SIZE = 0
|
|
77
|
+
#def IoSink_SIZE = 0
|
|
78
|
+
|
|
79
|
+
#def IoRepeat_SIZE = 8
|
|
80
|
+
#def IoRepeat_byte = +0
|
|
81
|
+
|
|
82
|
+
#def IoTake_SIZE = 16
|
|
83
|
+
#def IoTake_cursor = +0
|
|
84
|
+
#def IoTake_limit = +8
|
package/sa_std/iter.sa
ADDED
package/sa_std/iter.sal
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "core/iter.sal"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Standard async state machine helper macros.
|
|
2
|
+
// These are pure text templates: the frontend still owns the actual
|
|
3
|
+
// coroutine/state-machine shape, but the repetitive poll/pending/ready
|
|
4
|
+
// bookkeeping is standardized here.
|
|
5
|
+
// The poll context is expected to remain owned by the caller; these macros
|
|
6
|
+
// only manage the state-machine bookkeeping and never release the context.
|
|
7
|
+
|
|
8
|
+
[MACRO] ASYNC_CTX_DEF %name
|
|
9
|
+
#def %name_SIZE = 32
|
|
10
|
+
#def %name_state = +0
|
|
11
|
+
#def %name_stage = +4
|
|
12
|
+
#def %name_status = +8
|
|
13
|
+
#def %name_value = +16
|
|
14
|
+
#def %name_resume = +24
|
|
15
|
+
#def %name_PENDING = 0
|
|
16
|
+
#def %name_READY = 1
|
|
17
|
+
#def %name_INVALID = 102
|
|
18
|
+
[END_MACRO]
|
|
19
|
+
|
|
20
|
+
[MACRO] ASYNC_STATE_BEGIN %state_id
|
|
21
|
+
L_ASYNC_STATE_%state_id:
|
|
22
|
+
[END_MACRO]
|
|
23
|
+
|
|
24
|
+
[MACRO] ASYNC_STATE_END %ctx, %state_field, %next_state
|
|
25
|
+
store %ctx+%state_field, %next_state as u32
|
|
26
|
+
[END_MACRO]
|
|
27
|
+
|
|
28
|
+
[MACRO] ASYNC_POLL_PROLOGUE %ctx, %state_field
|
|
29
|
+
async_state_%state_field = load %ctx+%state_field as u32
|
|
30
|
+
[END_MACRO]
|
|
31
|
+
|
|
32
|
+
[MACRO] ASYNC_AWAIT_POINT %ctx, %state_field, %state_id, %poll_fn, %take_fn, %result_field
|
|
33
|
+
async_poll_status_%state_id_%state_field = call %poll_fn(%ctx)
|
|
34
|
+
async_is_ready_%state_id_%state_field = eq async_poll_status_%state_id_%state_field, 1
|
|
35
|
+
br async_is_ready_%state_id_%state_field -> L_ASYNC_AWAIT_READY_%state_id_%state_field, L_ASYNC_AWAIT_PENDING_%state_id_%state_field
|
|
36
|
+
L_ASYNC_AWAIT_PENDING_%state_id_%state_field:
|
|
37
|
+
store %ctx+%state_field, %state_id as u32
|
|
38
|
+
!async_poll_status_%state_id_%state_field
|
|
39
|
+
!async_is_ready_%state_id_%state_field
|
|
40
|
+
return 0
|
|
41
|
+
L_ASYNC_AWAIT_READY_%state_id_%state_field:
|
|
42
|
+
call %take_fn(%ctx)
|
|
43
|
+
async_result_%state_id_%state_field = load %ctx+%result_field as i32
|
|
44
|
+
async_next_state_%state_id_%state_field = add %state_id, 1
|
|
45
|
+
store %ctx+%state_field, async_next_state_%state_id_%state_field as u32
|
|
46
|
+
!async_poll_status_%state_id_%state_field
|
|
47
|
+
!async_is_ready_%state_id_%state_field
|
|
48
|
+
!async_next_state_%state_id_%state_field
|
|
49
|
+
[END_MACRO]
|
|
50
|
+
|
|
51
|
+
[MACRO] ASYNC_AWAIT_POINT_FINAL %ctx, %state_field, %state_id, %poll_fn, %take_fn
|
|
52
|
+
async_poll_status_%state_id_%state_field = call %poll_fn(%ctx)
|
|
53
|
+
async_is_ready_%state_id_%state_field = eq async_poll_status_%state_id_%state_field, 1
|
|
54
|
+
br async_is_ready_%state_id_%state_field -> L_ASYNC_AWAIT_FINAL_READY_%state_id_%state_field, L_ASYNC_AWAIT_FINAL_PENDING_%state_id_%state_field
|
|
55
|
+
L_ASYNC_AWAIT_FINAL_PENDING_%state_id_%state_field:
|
|
56
|
+
store %ctx+%state_field, %state_id as u32
|
|
57
|
+
!async_poll_status_%state_id_%state_field
|
|
58
|
+
!async_is_ready_%state_id_%state_field
|
|
59
|
+
return 0
|
|
60
|
+
L_ASYNC_AWAIT_FINAL_READY_%state_id_%state_field:
|
|
61
|
+
call %take_fn(%ctx)
|
|
62
|
+
async_next_state_%state_id_%state_field = add %state_id, 1
|
|
63
|
+
store %ctx+%state_field, async_next_state_%state_id_%state_field as u32
|
|
64
|
+
!async_poll_status_%state_id_%state_field
|
|
65
|
+
!async_is_ready_%state_id_%state_field
|
|
66
|
+
!async_next_state_%state_id_%state_field
|
|
67
|
+
return 1
|
|
68
|
+
[END_MACRO]
|
|
69
|
+
|
|
70
|
+
[MACRO] ASYNC_RETURN_PENDING
|
|
71
|
+
return 0
|
|
72
|
+
[END_MACRO]
|
|
73
|
+
|
|
74
|
+
[MACRO] ASYNC_READY
|
|
75
|
+
return 1
|
|
76
|
+
[END_MACRO]
|
|
77
|
+
|
|
78
|
+
[MACRO] ASYNC_INVALID_STATE
|
|
79
|
+
panic(102)
|
|
80
|
+
[END_MACRO]
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// m-async compatibility facade for SA.
|
|
2
|
+
// Structured cancellation/task-group lifecycle over the existing Future/Task
|
|
3
|
+
// layouts. Scheduling remains cooperative and explicit.
|
|
4
|
+
@import "m_async.sal"
|
|
5
|
+
|
|
6
|
+
[MACRO] M_ASYNC_CANCEL_TOKEN_NEW %out_token
|
|
7
|
+
%out_token = alloc MAsyncCancelToken_SIZE
|
|
8
|
+
store %out_token+MAsyncCancelToken_cancelled, MAsyncCancelToken_ACTIVE as u64
|
|
9
|
+
[END_MACRO]
|
|
10
|
+
|
|
11
|
+
[MACRO] M_ASYNC_CANCEL_TOKEN_CANCEL %token
|
|
12
|
+
store %token+MAsyncCancelToken_cancelled, MAsyncCancelToken_CANCELLED as u64
|
|
13
|
+
[END_MACRO]
|
|
14
|
+
|
|
15
|
+
[MACRO] M_ASYNC_CANCEL_TOKEN_RESET %token
|
|
16
|
+
store %token+MAsyncCancelToken_cancelled, MAsyncCancelToken_ACTIVE as u64
|
|
17
|
+
[END_MACRO]
|
|
18
|
+
|
|
19
|
+
[MACRO] M_ASYNC_CANCEL_TOKEN_IS_CANCELLED %out_bool, %token
|
|
20
|
+
__m_async_cancel_state_%out_bool = load %token+MAsyncCancelToken_cancelled as u64
|
|
21
|
+
%out_bool = eq __m_async_cancel_state_%out_bool, MAsyncCancelToken_CANCELLED
|
|
22
|
+
!__m_async_cancel_state_%out_bool
|
|
23
|
+
[END_MACRO]
|
|
24
|
+
|
|
25
|
+
[MACRO] M_ASYNC_TASK_NEW %out_task, %future_ptr, %context_ptr, %cancel_ptr
|
|
26
|
+
%out_task = alloc MAsyncTask_SIZE
|
|
27
|
+
store %out_task+MAsyncTask_future, %future_ptr as ptr
|
|
28
|
+
store %out_task+MAsyncTask_context, %context_ptr as ptr
|
|
29
|
+
store %out_task+MAsyncTask_cancel, %cancel_ptr as ptr
|
|
30
|
+
store %out_task+MAsyncTask_state, MAsyncTask_PENDING as u64
|
|
31
|
+
store %out_task+MAsyncTask_result, 0 as u64
|
|
32
|
+
store %out_task+MAsyncTask_error, 0 as u64
|
|
33
|
+
[END_MACRO]
|
|
34
|
+
|
|
35
|
+
[MACRO] M_ASYNC_TASK_STATE %out_state, %task
|
|
36
|
+
%out_state = load %task+MAsyncTask_state as u64
|
|
37
|
+
[END_MACRO]
|
|
38
|
+
|
|
39
|
+
[MACRO] M_ASYNC_TASK_RESULT %out_value, %task
|
|
40
|
+
%out_value = load %task+MAsyncTask_result as u64
|
|
41
|
+
[END_MACRO]
|
|
42
|
+
|
|
43
|
+
[MACRO] M_ASYNC_TASK_ERROR %out_error, %task
|
|
44
|
+
%out_error = load %task+MAsyncTask_error as u64
|
|
45
|
+
[END_MACRO]
|
|
46
|
+
|
|
47
|
+
[MACRO] M_ASYNC_TASK_IS_DONE %out_bool, %task
|
|
48
|
+
__m_async_task_done_state_%out_bool = load %task+MAsyncTask_state as u64
|
|
49
|
+
__m_async_task_done_ready_%out_bool = eq __m_async_task_done_state_%out_bool, MAsyncTask_READY
|
|
50
|
+
__m_async_task_done_failed_%out_bool = eq __m_async_task_done_state_%out_bool, MAsyncTask_FAILED
|
|
51
|
+
__m_async_task_done_cancelled_%out_bool = eq __m_async_task_done_state_%out_bool, MAsyncTask_CANCELLED
|
|
52
|
+
__m_async_task_done_terminal_%out_bool = or __m_async_task_done_ready_%out_bool, __m_async_task_done_failed_%out_bool
|
|
53
|
+
%out_bool = or __m_async_task_done_terminal_%out_bool, __m_async_task_done_cancelled_%out_bool
|
|
54
|
+
!__m_async_task_done_cancelled_%out_bool
|
|
55
|
+
!__m_async_task_done_terminal_%out_bool
|
|
56
|
+
!__m_async_task_done_failed_%out_bool
|
|
57
|
+
!__m_async_task_done_ready_%out_bool
|
|
58
|
+
!__m_async_task_done_state_%out_bool
|
|
59
|
+
[END_MACRO]
|
|
60
|
+
|
|
61
|
+
[MACRO] M_ASYNC_TASK_CANCEL %task
|
|
62
|
+
store %task+MAsyncTask_state, MAsyncTask_CANCELLED as u64
|
|
63
|
+
store %task+MAsyncTask_error, 97 as u64
|
|
64
|
+
__m_async_task_cancel_token_%task = load %task+MAsyncTask_cancel as ptr
|
|
65
|
+
__m_async_task_has_cancel_token_%task = ne __m_async_task_cancel_token_%task, 0
|
|
66
|
+
br __m_async_task_has_cancel_token_%task -> L_M_ASYNC_TASK_CANCEL_TOKEN_%task, L_M_ASYNC_TASK_CANCEL_DONE_%task
|
|
67
|
+
L_M_ASYNC_TASK_CANCEL_TOKEN_%task:
|
|
68
|
+
EXPAND M_ASYNC_CANCEL_TOKEN_CANCEL __m_async_task_cancel_token_%task
|
|
69
|
+
!__m_async_task_has_cancel_token_%task
|
|
70
|
+
!__m_async_task_cancel_token_%task
|
|
71
|
+
jmp L_M_ASYNC_TASK_CANCEL_DONE_%task
|
|
72
|
+
L_M_ASYNC_TASK_CANCEL_DONE_%task:
|
|
73
|
+
[END_MACRO]
|
|
74
|
+
|
|
75
|
+
[MACRO] M_ASYNC_GROUP_NEW %out_group, %cancel
|
|
76
|
+
%out_group = alloc MAsyncGroup_SIZE
|
|
77
|
+
store %out_group+MAsyncGroup_cancel, %cancel as ptr
|
|
78
|
+
store %out_group+MAsyncGroup_children, 0 as u64
|
|
79
|
+
store %out_group+MAsyncGroup_completed, 0 as u64
|
|
80
|
+
store %out_group+MAsyncGroup_failed, 0 as u64
|
|
81
|
+
store %out_group+MAsyncGroup_error, 0 as u64
|
|
82
|
+
store %out_group+MAsyncGroup_state, MAsyncGroup_ACTIVE as u64
|
|
83
|
+
[END_MACRO]
|
|
84
|
+
|
|
85
|
+
[MACRO] M_ASYNC_GROUP_TOKEN %out_token, %group
|
|
86
|
+
%out_token = load %group+MAsyncGroup_cancel as ptr
|
|
87
|
+
[END_MACRO]
|
|
88
|
+
|
|
89
|
+
[MACRO] M_ASYNC_GROUP_ADD %group
|
|
90
|
+
__m_async_group_children_%group = load %group+MAsyncGroup_children as u64
|
|
91
|
+
__m_async_group_children_next_%group = add __m_async_group_children_%group, 1
|
|
92
|
+
store %group+MAsyncGroup_children, __m_async_group_children_next_%group as u64
|
|
93
|
+
!__m_async_group_children_next_%group
|
|
94
|
+
!__m_async_group_children_%group
|
|
95
|
+
[END_MACRO]
|
|
96
|
+
|
|
97
|
+
[MACRO] M_ASYNC_GROUP_COMPLETE %group
|
|
98
|
+
__m_async_group_completed_%group = load %group+MAsyncGroup_completed as u64
|
|
99
|
+
__m_async_group_completed_next_%group = add __m_async_group_completed_%group, 1
|
|
100
|
+
store %group+MAsyncGroup_completed, __m_async_group_completed_next_%group as u64
|
|
101
|
+
!__m_async_group_completed_next_%group
|
|
102
|
+
!__m_async_group_completed_%group
|
|
103
|
+
[END_MACRO]
|
|
104
|
+
|
|
105
|
+
[MACRO] M_ASYNC_GROUP_FAIL %group, %error
|
|
106
|
+
store %group+MAsyncGroup_failed, 1 as u64
|
|
107
|
+
store %group+MAsyncGroup_error, %error as u64
|
|
108
|
+
store %group+MAsyncGroup_state, MAsyncGroup_FAILED as u64
|
|
109
|
+
__m_async_group_fail_token_%group = load %group+MAsyncGroup_cancel as ptr
|
|
110
|
+
EXPAND M_ASYNC_CANCEL_TOKEN_CANCEL __m_async_group_fail_token_%group
|
|
111
|
+
!__m_async_group_fail_token_%group
|
|
112
|
+
[END_MACRO]
|
|
113
|
+
|
|
114
|
+
[MACRO] M_ASYNC_GROUP_CANCEL %group
|
|
115
|
+
store %group+MAsyncGroup_state, MAsyncGroup_CANCELLED as u64
|
|
116
|
+
__m_async_group_cancel_token_%group = load %group+MAsyncGroup_cancel as ptr
|
|
117
|
+
EXPAND M_ASYNC_CANCEL_TOKEN_CANCEL __m_async_group_cancel_token_%group
|
|
118
|
+
!__m_async_group_cancel_token_%group
|
|
119
|
+
[END_MACRO]
|
|
120
|
+
|
|
121
|
+
[MACRO] M_ASYNC_GROUP_IS_COMPLETE %out_bool, %group
|
|
122
|
+
__m_async_group_children_%out_bool = load %group+MAsyncGroup_children as u64
|
|
123
|
+
__m_async_group_completed_%out_bool = load %group+MAsyncGroup_completed as u64
|
|
124
|
+
%out_bool = eq __m_async_group_children_%out_bool, __m_async_group_completed_%out_bool
|
|
125
|
+
!__m_async_group_completed_%out_bool
|
|
126
|
+
!__m_async_group_children_%out_bool
|
|
127
|
+
[END_MACRO]
|
|
128
|
+
|
|
129
|
+
[MACRO] M_ASYNC_GROUP_IS_FAILED %out_bool, %group
|
|
130
|
+
__m_async_group_failed_%out_bool = load %group+MAsyncGroup_failed as u64
|
|
131
|
+
%out_bool = ne __m_async_group_failed_%out_bool, 0
|
|
132
|
+
!__m_async_group_failed_%out_bool
|
|
133
|
+
[END_MACRO]
|
|
134
|
+
|
|
135
|
+
[MACRO] M_ASYNC_GROUP_ERROR %out_error, %group
|
|
136
|
+
%out_error = load %group+MAsyncGroup_error as u64
|
|
137
|
+
[END_MACRO]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// m-async compatibility layouts.
|
|
2
|
+
// Fixed-width slots shared by SA and SLA lowering.
|
|
3
|
+
|
|
4
|
+
#def MAsyncCancelToken_SIZE = 8
|
|
5
|
+
#def MAsyncCancelToken_cancelled = +0
|
|
6
|
+
#def MAsyncCancelToken_ACTIVE = 0
|
|
7
|
+
#def MAsyncCancelToken_CANCELLED = 1
|
|
8
|
+
|
|
9
|
+
#def MAsyncTask_SIZE = 48
|
|
10
|
+
#def MAsyncTask_future = +0
|
|
11
|
+
#def MAsyncTask_context = +8
|
|
12
|
+
#def MAsyncTask_cancel = +16
|
|
13
|
+
#def MAsyncTask_state = +24
|
|
14
|
+
#def MAsyncTask_result = +32
|
|
15
|
+
#def MAsyncTask_error = +40
|
|
16
|
+
#def MAsyncTask_PENDING = 0
|
|
17
|
+
#def MAsyncTask_READY = 1
|
|
18
|
+
#def MAsyncTask_FAILED = 2
|
|
19
|
+
#def MAsyncTask_CANCELLED = 3
|
|
20
|
+
|
|
21
|
+
#def MAsyncGroup_SIZE = 48
|
|
22
|
+
#def MAsyncGroup_cancel = +0
|
|
23
|
+
#def MAsyncGroup_children = +8
|
|
24
|
+
#def MAsyncGroup_completed = +16
|
|
25
|
+
#def MAsyncGroup_failed = +24
|
|
26
|
+
#def MAsyncGroup_error = +32
|
|
27
|
+
#def MAsyncGroup_state = +40
|
|
28
|
+
#def MAsyncGroup_ACTIVE = 0
|
|
29
|
+
#def MAsyncGroup_CANCELLED = 1
|
|
30
|
+
#def MAsyncGroup_FAILED = 2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../marker.sal"
|
package/sa_std/marker.sa
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
@import "marker.sal"
|
|
2
|
+
@import "hash.sa"
|
|
3
|
+
|
|
4
|
+
[MACRO] MARKER_ZST_SIZE %out_size
|
|
5
|
+
%out_size = add 0, 0
|
|
6
|
+
[END_MACRO]
|
|
7
|
+
|
|
8
|
+
[MACRO] MARKER_ZST_ALIGN %out_align
|
|
9
|
+
%out_align = add 0, 1
|
|
10
|
+
[END_MACRO]
|
|
11
|
+
|
|
12
|
+
[MACRO] MARKER_IS_ZST %out_bool, %size
|
|
13
|
+
%out_bool = eq %size, 0
|
|
14
|
+
[END_MACRO]
|
|
15
|
+
|
|
16
|
+
[MACRO] PHANTOM_DATA_DEFAULT %out_token
|
|
17
|
+
%out_token = add 0, 0
|
|
18
|
+
[END_MACRO]
|
|
19
|
+
|
|
20
|
+
[MACRO] PHANTOM_DATA_COPY %out_token, %phantom_token
|
|
21
|
+
%out_token = add 0, 0
|
|
22
|
+
[END_MACRO]
|
|
23
|
+
|
|
24
|
+
[MACRO] PHANTOM_DATA_CLONE %out_token, %phantom_token
|
|
25
|
+
%out_token = add 0, 0
|
|
26
|
+
[END_MACRO]
|
|
27
|
+
|
|
28
|
+
[MACRO] PHANTOM_DATA_CLONE_FROM %out_token, %phantom_token
|
|
29
|
+
%out_token = add 0, 0
|
|
30
|
+
[END_MACRO]
|
|
31
|
+
|
|
32
|
+
[MACRO] PHANTOM_DATA_EQ %out_bool, %left_token, %right_token
|
|
33
|
+
%out_bool = add 0, 1
|
|
34
|
+
[END_MACRO]
|
|
35
|
+
|
|
36
|
+
[MACRO] PHANTOM_DATA_NE %out_bool, %left_token, %right_token
|
|
37
|
+
%out_bool = add 0, 0
|
|
38
|
+
[END_MACRO]
|
|
39
|
+
|
|
40
|
+
[MACRO] PHANTOM_DATA_CMP %out_ordering, %left_token, %right_token
|
|
41
|
+
%out_ordering = add 0, 0
|
|
42
|
+
[END_MACRO]
|
|
43
|
+
|
|
44
|
+
[MACRO] PHANTOM_DATA_PARTIAL_CMP %out_ordering, %left_token, %right_token
|
|
45
|
+
%out_ordering = add 0, 0
|
|
46
|
+
[END_MACRO]
|
|
47
|
+
|
|
48
|
+
[MACRO] PHANTOM_DATA_LT %out_bool, %left_token, %right_token
|
|
49
|
+
%out_bool = add 0, 0
|
|
50
|
+
[END_MACRO]
|
|
51
|
+
|
|
52
|
+
[MACRO] PHANTOM_DATA_LE %out_bool, %left_token, %right_token
|
|
53
|
+
%out_bool = add 0, 1
|
|
54
|
+
[END_MACRO]
|
|
55
|
+
|
|
56
|
+
[MACRO] PHANTOM_DATA_GT %out_bool, %left_token, %right_token
|
|
57
|
+
%out_bool = add 0, 0
|
|
58
|
+
[END_MACRO]
|
|
59
|
+
|
|
60
|
+
[MACRO] PHANTOM_DATA_GE %out_bool, %left_token, %right_token
|
|
61
|
+
%out_bool = add 0, 1
|
|
62
|
+
[END_MACRO]
|
|
63
|
+
|
|
64
|
+
[MACRO] DEFAULT_HASHER_WRITE_PHANTOM_DATA %hasher, %phantom_token
|
|
65
|
+
EXPAND DEFAULT_HASHER_WRITE_UNIT %hasher, %phantom_token
|
|
66
|
+
[END_MACRO]
|
|
67
|
+
|
|
68
|
+
[MACRO] PHANTOM_DATA_HASH %out_hash, %phantom_token
|
|
69
|
+
__phantom_data_hash_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
70
|
+
EXPAND DEFAULT_HASHER_NEW __phantom_data_hash_hasher_%out_hash
|
|
71
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_DATA __phantom_data_hash_hasher_%out_hash, %phantom_token
|
|
72
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __phantom_data_hash_hasher_%out_hash
|
|
73
|
+
[END_MACRO]
|
|
74
|
+
|
|
75
|
+
[MACRO] BUILD_HASHER_DEFAULT_HASH_ONE_PHANTOM_DATA %out_hash, %builder, %phantom_token
|
|
76
|
+
__build_hash_one_phantom_data_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
77
|
+
EXPAND BUILD_HASHER_DEFAULT_BUILD __build_hash_one_phantom_data_hasher_%out_hash, %builder
|
|
78
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_DATA __build_hash_one_phantom_data_hasher_%out_hash, %phantom_token
|
|
79
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __build_hash_one_phantom_data_hasher_%out_hash
|
|
80
|
+
[END_MACRO]
|
|
81
|
+
|
|
82
|
+
[MACRO] RANDOM_STATE_HASH_ONE_PHANTOM_DATA %out_hash, %state, %phantom_token
|
|
83
|
+
__random_state_hash_one_phantom_data_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
84
|
+
EXPAND RANDOM_STATE_BUILD __random_state_hash_one_phantom_data_hasher_%out_hash, %state
|
|
85
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_DATA __random_state_hash_one_phantom_data_hasher_%out_hash, %phantom_token
|
|
86
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __random_state_hash_one_phantom_data_hasher_%out_hash
|
|
87
|
+
[END_MACRO]
|
|
88
|
+
|
|
89
|
+
[MACRO] PHANTOM_DATA_IS_COPY %out_bool
|
|
90
|
+
%out_bool = add 0, 1
|
|
91
|
+
[END_MACRO]
|
|
92
|
+
|
|
93
|
+
[MACRO] PHANTOM_DATA_IS_SEND %out_bool
|
|
94
|
+
%out_bool = add 0, 1
|
|
95
|
+
[END_MACRO]
|
|
96
|
+
|
|
97
|
+
[MACRO] PHANTOM_DATA_IS_SYNC %out_bool
|
|
98
|
+
%out_bool = add 0, 1
|
|
99
|
+
[END_MACRO]
|
|
100
|
+
|
|
101
|
+
[MACRO] PHANTOM_DATA_IS_UNPIN %out_bool
|
|
102
|
+
%out_bool = add 0, 1
|
|
103
|
+
[END_MACRO]
|
|
104
|
+
|
|
105
|
+
[MACRO] PHANTOM_PINNED_DEFAULT %out_token
|
|
106
|
+
%out_token = add 0, 0
|
|
107
|
+
[END_MACRO]
|
|
108
|
+
|
|
109
|
+
[MACRO] PHANTOM_PINNED_COPY %out_token, %pinned_token
|
|
110
|
+
%out_token = add 0, 0
|
|
111
|
+
[END_MACRO]
|
|
112
|
+
|
|
113
|
+
[MACRO] PHANTOM_PINNED_CLONE %out_token, %pinned_token
|
|
114
|
+
%out_token = add 0, 0
|
|
115
|
+
[END_MACRO]
|
|
116
|
+
|
|
117
|
+
[MACRO] PHANTOM_PINNED_CLONE_FROM %out_token, %pinned_token
|
|
118
|
+
%out_token = add 0, 0
|
|
119
|
+
[END_MACRO]
|
|
120
|
+
|
|
121
|
+
[MACRO] PHANTOM_PINNED_EQ %out_bool, %left_token, %right_token
|
|
122
|
+
%out_bool = add 0, 1
|
|
123
|
+
[END_MACRO]
|
|
124
|
+
|
|
125
|
+
[MACRO] PHANTOM_PINNED_NE %out_bool, %left_token, %right_token
|
|
126
|
+
%out_bool = add 0, 0
|
|
127
|
+
[END_MACRO]
|
|
128
|
+
|
|
129
|
+
[MACRO] PHANTOM_PINNED_CMP %out_ordering, %left_token, %right_token
|
|
130
|
+
%out_ordering = add 0, 0
|
|
131
|
+
[END_MACRO]
|
|
132
|
+
|
|
133
|
+
[MACRO] PHANTOM_PINNED_PARTIAL_CMP %out_ordering, %left_token, %right_token
|
|
134
|
+
%out_ordering = add 0, 0
|
|
135
|
+
[END_MACRO]
|
|
136
|
+
|
|
137
|
+
[MACRO] PHANTOM_PINNED_LT %out_bool, %left_token, %right_token
|
|
138
|
+
%out_bool = add 0, 0
|
|
139
|
+
[END_MACRO]
|
|
140
|
+
|
|
141
|
+
[MACRO] PHANTOM_PINNED_LE %out_bool, %left_token, %right_token
|
|
142
|
+
%out_bool = add 0, 1
|
|
143
|
+
[END_MACRO]
|
|
144
|
+
|
|
145
|
+
[MACRO] PHANTOM_PINNED_GT %out_bool, %left_token, %right_token
|
|
146
|
+
%out_bool = add 0, 0
|
|
147
|
+
[END_MACRO]
|
|
148
|
+
|
|
149
|
+
[MACRO] PHANTOM_PINNED_GE %out_bool, %left_token, %right_token
|
|
150
|
+
%out_bool = add 0, 1
|
|
151
|
+
[END_MACRO]
|
|
152
|
+
|
|
153
|
+
[MACRO] DEFAULT_HASHER_WRITE_PHANTOM_PINNED %hasher, %pinned_token
|
|
154
|
+
EXPAND DEFAULT_HASHER_WRITE_UNIT %hasher, %pinned_token
|
|
155
|
+
[END_MACRO]
|
|
156
|
+
|
|
157
|
+
[MACRO] PHANTOM_PINNED_HASH %out_hash, %pinned_token
|
|
158
|
+
__phantom_pinned_hash_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
159
|
+
EXPAND DEFAULT_HASHER_NEW __phantom_pinned_hash_hasher_%out_hash
|
|
160
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_PINNED __phantom_pinned_hash_hasher_%out_hash, %pinned_token
|
|
161
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __phantom_pinned_hash_hasher_%out_hash
|
|
162
|
+
[END_MACRO]
|
|
163
|
+
|
|
164
|
+
[MACRO] BUILD_HASHER_DEFAULT_HASH_ONE_PHANTOM_PINNED %out_hash, %builder, %pinned_token
|
|
165
|
+
__build_hash_one_phantom_pinned_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
166
|
+
EXPAND BUILD_HASHER_DEFAULT_BUILD __build_hash_one_phantom_pinned_hasher_%out_hash, %builder
|
|
167
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_PINNED __build_hash_one_phantom_pinned_hasher_%out_hash, %pinned_token
|
|
168
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __build_hash_one_phantom_pinned_hasher_%out_hash
|
|
169
|
+
[END_MACRO]
|
|
170
|
+
|
|
171
|
+
[MACRO] RANDOM_STATE_HASH_ONE_PHANTOM_PINNED %out_hash, %state, %pinned_token
|
|
172
|
+
__random_state_hash_one_phantom_pinned_hasher_%out_hash = stack_alloc DefaultHasher_SIZE
|
|
173
|
+
EXPAND RANDOM_STATE_BUILD __random_state_hash_one_phantom_pinned_hasher_%out_hash, %state
|
|
174
|
+
EXPAND DEFAULT_HASHER_WRITE_PHANTOM_PINNED __random_state_hash_one_phantom_pinned_hasher_%out_hash, %pinned_token
|
|
175
|
+
EXPAND DEFAULT_HASHER_FINISH %out_hash, __random_state_hash_one_phantom_pinned_hasher_%out_hash
|
|
176
|
+
[END_MACRO]
|
|
177
|
+
|
|
178
|
+
[MACRO] PHANTOM_PINNED_IS_COPY %out_bool
|
|
179
|
+
%out_bool = add 0, 1
|
|
180
|
+
[END_MACRO]
|
|
181
|
+
|
|
182
|
+
[MACRO] PHANTOM_PINNED_IS_SEND %out_bool
|
|
183
|
+
%out_bool = add 0, 1
|
|
184
|
+
[END_MACRO]
|
|
185
|
+
|
|
186
|
+
[MACRO] PHANTOM_PINNED_IS_SYNC %out_bool
|
|
187
|
+
%out_bool = add 0, 1
|
|
188
|
+
[END_MACRO]
|
|
189
|
+
|
|
190
|
+
[MACRO] PHANTOM_PINNED_IS_UNPIN %out_bool
|
|
191
|
+
%out_bool = add 0, 0
|
|
192
|
+
[END_MACRO]
|
|
193
|
+
|
|
194
|
+
[MACRO] MARKER_PRIMITIVE_IS_SIZED %out_bool
|
|
195
|
+
%out_bool = add 0, 1
|
|
196
|
+
[END_MACRO]
|
|
197
|
+
|
|
198
|
+
[MACRO] MARKER_PRIMITIVE_IS_COPY %out_bool
|
|
199
|
+
%out_bool = add 0, 1
|
|
200
|
+
[END_MACRO]
|
|
201
|
+
|
|
202
|
+
[MACRO] MARKER_PRIMITIVE_IS_SEND %out_bool
|
|
203
|
+
%out_bool = add 0, 1
|
|
204
|
+
[END_MACRO]
|
|
205
|
+
|
|
206
|
+
[MACRO] MARKER_PRIMITIVE_IS_SYNC %out_bool
|
|
207
|
+
%out_bool = add 0, 1
|
|
208
|
+
[END_MACRO]
|
|
209
|
+
|
|
210
|
+
[MACRO] MARKER_PRIMITIVE_IS_UNPIN %out_bool
|
|
211
|
+
%out_bool = add 0, 1
|
|
212
|
+
[END_MACRO]
|
|
213
|
+
|
|
214
|
+
[MACRO] MARKER_PRIMITIVE_IS_FREEZE %out_bool
|
|
215
|
+
%out_bool = add 0, 1
|
|
216
|
+
[END_MACRO]
|
|
217
|
+
|
|
218
|
+
[MACRO] MARKER_CAPABILITY %out_bool, %enabled
|
|
219
|
+
%out_bool = ne %enabled, 0
|
|
220
|
+
[END_MACRO]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#def PhantomData_SIZE = 0
|
|
2
|
+
#def PhantomData_ALIGN = 1
|
|
3
|
+
|
|
4
|
+
#def PhantomPinned_SIZE = 0
|
|
5
|
+
#def PhantomPinned_ALIGN = 1
|
|
6
|
+
|
|
7
|
+
#def MARKER_TRAIT_SIZED = 1
|
|
8
|
+
#def MARKER_TRAIT_COPY = 2
|
|
9
|
+
#def MARKER_TRAIT_SEND = 3
|
|
10
|
+
#def MARKER_TRAIT_SYNC = 4
|
|
11
|
+
#def MARKER_TRAIT_UNPIN = 5
|
|
12
|
+
#def MARKER_TRAIT_FREEZE = 6
|
|
13
|
+
|
|
14
|
+
#def MARKER_CAP_FALSE = 0
|
|
15
|
+
#def MARKER_CAP_TRUE = 1
|