|
| 1 | + |
| 2 | +#ifndef WASMER_H_MACROS |
| 3 | +#define WASMER_H_MACROS |
| 4 | +#if MSVC |
| 5 | +#ifdef _M_AMD64 |
| 6 | +#define ARCH_X86_64 |
| 7 | +#endif |
| 8 | +#endif |
| 9 | + |
| 10 | +#if GCC |
| 11 | +#ifdef __x86_64__ |
| 12 | +#define ARCH_X86_64 |
| 13 | +#endif |
| 14 | +#endif |
| 15 | +#endif // WASMER_H_MACROS |
| 16 | + |
| 17 | + |
1 | 18 | #ifndef WASMER_H
|
2 | 19 | #define WASMER_H
|
3 | 20 |
|
@@ -146,17 +163,23 @@ struct wasmer_serialized_module_t {
|
146 | 163 |
|
147 | 164 | };
|
148 | 165 |
|
| 166 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
149 | 167 | struct wasmer_trampoline_buffer_builder_t {
|
150 | 168 |
|
151 | 169 | };
|
| 170 | +#endif |
152 | 171 |
|
| 172 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
153 | 173 | struct wasmer_trampoline_callable_t {
|
154 | 174 |
|
155 | 175 | };
|
| 176 | +#endif |
156 | 177 |
|
| 178 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
157 | 179 | struct wasmer_trampoline_buffer_t {
|
158 | 180 |
|
159 | 181 | };
|
| 182 | +#endif |
160 | 183 |
|
161 | 184 | /// Opens a directory that's visible to the WASI module as `alias` but
|
162 | 185 | /// is backed by the host file at `host_file_path`
|
@@ -612,32 +635,46 @@ uint32_t wasmer_table_length(wasmer_table_t *table);
|
612 | 635 | /// and `wasmer_last_error_message` to get an error message.
|
613 | 636 | wasmer_result_t wasmer_table_new(wasmer_table_t **table, wasmer_limits_t limits);
|
614 | 637 |
|
| 638 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
615 | 639 | /// Adds a callinfo trampoline to the builder.
|
616 | 640 | uintptr_t wasmer_trampoline_buffer_builder_add_callinfo_trampoline(wasmer_trampoline_buffer_builder_t *builder,
|
617 | 641 | const wasmer_trampoline_callable_t *func,
|
618 | 642 | const void *ctx,
|
619 | 643 | uint32_t num_params);
|
| 644 | +#endif |
620 | 645 |
|
| 646 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
621 | 647 | /// Adds a context trampoline to the builder.
|
622 | 648 | uintptr_t wasmer_trampoline_buffer_builder_add_context_trampoline(wasmer_trampoline_buffer_builder_t *builder,
|
623 | 649 | const wasmer_trampoline_callable_t *func,
|
624 | 650 | const void *ctx);
|
| 651 | +#endif |
625 | 652 |
|
| 653 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
626 | 654 | /// Finalizes the trampoline builder into an executable buffer.
|
627 | 655 | wasmer_trampoline_buffer_t *wasmer_trampoline_buffer_builder_build(wasmer_trampoline_buffer_builder_t *builder);
|
| 656 | +#endif |
628 | 657 |
|
| 658 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
629 | 659 | /// Creates a new trampoline builder.
|
630 | 660 | wasmer_trampoline_buffer_builder_t *wasmer_trampoline_buffer_builder_new();
|
| 661 | +#endif |
631 | 662 |
|
| 663 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
632 | 664 | /// Destroys the trampoline buffer if not null.
|
633 | 665 | void wasmer_trampoline_buffer_destroy(wasmer_trampoline_buffer_t *buffer);
|
| 666 | +#endif |
634 | 667 |
|
| 668 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
635 | 669 | /// Returns the callable pointer for the trampoline with index `idx`.
|
636 | 670 | const wasmer_trampoline_callable_t *wasmer_trampoline_buffer_get_trampoline(const wasmer_trampoline_buffer_t *buffer,
|
637 | 671 | uintptr_t idx);
|
| 672 | +#endif |
638 | 673 |
|
| 674 | +#if (!defined(_WIN32) && defined(ARCH_X86_64)) |
639 | 675 | /// Returns the context added by `add_context_trampoline`, from within the callee function.
|
640 | 676 | void *wasmer_trampoline_get_context();
|
| 677 | +#endif |
641 | 678 |
|
642 | 679 | /// Returns true for valid wasm bytes and false for invalid bytes
|
643 | 680 | bool wasmer_validate(const uint8_t *wasm_bytes, uint32_t wasm_bytes_len);
|
|
0 commit comments