krillplayer-plugin 0.5.0 → 0.7.0

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.
Files changed (150) hide show
  1. package/LICENSE +2 -1
  2. package/README.md +2 -0
  3. package/dist/cli.js +397 -80
  4. package/dist/crypto.js +38 -11
  5. package/dist/engine/engine.c +6 -3
  6. package/kernel/Sources/CQuickJS/include/kernel_qjs.h +8 -1
  7. package/kernel/Sources/CQuickJS/kernel_internal.h +54 -0
  8. package/kernel/Sources/CQuickJS/kernel_qjs.c +17 -29
  9. package/kernel/Sources/CQuickJS/kernel_wasm.c +1155 -0
  10. package/kernel/Sources/CWAMR/include/kernel_wamr.h +151 -0
  11. package/kernel/Sources/CWAMR/include/kernel_wamr_config.h +66 -0
  12. package/kernel/Sources/CWAMR/vendor/LICENSE +219 -0
  13. package/kernel/Sources/CWAMR/vendor/core/config.h +727 -0
  14. package/kernel/Sources/CWAMR/vendor/core/iwasm/aot/aot_runtime.h +899 -0
  15. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/arch/invokeNative_general.c +123 -0
  16. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_application.c +933 -0
  17. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_blocking_op.c +92 -0
  18. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api.c +5391 -0
  19. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api_internal.h +246 -0
  20. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.c +336 -0
  21. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.h +328 -0
  22. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.c +242 -0
  23. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.h +62 -0
  24. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.c +1999 -0
  25. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.h +154 -0
  26. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.c +1532 -0
  27. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.h +117 -0
  28. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.c +8070 -0
  29. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.h +1396 -0
  30. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.c +477 -0
  31. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.h +63 -0
  32. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_suspend_flags.h +52 -0
  33. package/kernel/Sources/CWAMR/vendor/core/iwasm/compilation/aot.h +366 -0
  34. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/lib_export.h +60 -0
  35. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_c_api.h +910 -0
  36. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_export.h +2440 -0
  37. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm.h +1492 -0
  38. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp.h +122 -0
  39. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp_fast.c +7998 -0
  40. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.c +16909 -0
  41. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.h +80 -0
  42. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_opcode.h +1043 -0
  43. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.c +5174 -0
  44. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.h +912 -0
  45. package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.c +1569 -0
  46. package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.h +256 -0
  47. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_alloc.c +1169 -0
  48. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.c +497 -0
  49. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.h +350 -0
  50. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc_internal.h +384 -0
  51. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_hmu.c +95 -0
  52. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_kfc.c +547 -0
  53. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.c +252 -0
  54. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.h +96 -0
  55. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/memory/mremap.c +12 -0
  56. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_blocking_op.c +70 -0
  57. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_malloc.c +72 -0
  58. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_memmap.c +302 -0
  59. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_sleep.c +20 -0
  60. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_thread.c +784 -0
  61. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_time.c +28 -0
  62. package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_init.c +43 -0
  63. package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_internal.h +126 -0
  64. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_extension.h +1676 -0
  65. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_vmcore.h +192 -0
  66. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_common.h +204 -0
  67. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_wasi_types.h +610 -0
  68. package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_init.c +43 -0
  69. package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_internal.h +139 -0
  70. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.c +25 -0
  71. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.h +42 -0
  72. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_atomic.h +300 -0
  73. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.c +27 -0
  74. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.h +114 -0
  75. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.c +217 -0
  76. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.h +83 -0
  77. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.c +339 -0
  78. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.h +168 -0
  79. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.c +77 -0
  80. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.h +30 -0
  81. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.c +111 -0
  82. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.h +109 -0
  83. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.c +111 -0
  84. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.h +94 -0
  85. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_platform.h +38 -0
  86. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.c +256 -0
  87. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.h +80 -0
  88. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.c +279 -0
  89. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.h +126 -0
  90. package/kernel/Sources/CWAMR/vendor/core/shared/utils/gnuc.h +14 -0
  91. package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.c +469 -0
  92. package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.h +51 -0
  93. package/kernel/Sources/CWAMR/vendor/core/version.h +24 -0
  94. package/kernel/Sources/CWAMR/wamr_bh_assert.c +98 -0
  95. package/kernel/Sources/CWAMR/wamr_bh_bitmap.c +98 -0
  96. package/kernel/Sources/CWAMR/wamr_bh_common.c +98 -0
  97. package/kernel/Sources/CWAMR/wamr_bh_hashmap.c +98 -0
  98. package/kernel/Sources/CWAMR/wamr_bh_leb128.c +98 -0
  99. package/kernel/Sources/CWAMR/wamr_bh_list.c +98 -0
  100. package/kernel/Sources/CWAMR/wamr_bh_log.c +98 -0
  101. package/kernel/Sources/CWAMR/wamr_bh_queue.c +98 -0
  102. package/kernel/Sources/CWAMR/wamr_bh_vector.c +98 -0
  103. package/kernel/Sources/CWAMR/wamr_ems_alloc.c +98 -0
  104. package/kernel/Sources/CWAMR/wamr_ems_gc.c +98 -0
  105. package/kernel/Sources/CWAMR/wamr_ems_hmu.c +98 -0
  106. package/kernel/Sources/CWAMR/wamr_ems_kfc.c +98 -0
  107. package/kernel/Sources/CWAMR/wamr_invokeNative_general.c +98 -0
  108. package/kernel/Sources/CWAMR/wamr_mem_alloc.c +98 -0
  109. package/kernel/Sources/CWAMR/wamr_mremap.c +98 -0
  110. package/kernel/Sources/CWAMR/wamr_platform_init_darwin.c +100 -0
  111. package/kernel/Sources/CWAMR/wamr_platform_init_linux.c +100 -0
  112. package/kernel/Sources/CWAMR/wamr_posix_blocking_op.c +98 -0
  113. package/kernel/Sources/CWAMR/wamr_posix_malloc.c +98 -0
  114. package/kernel/Sources/CWAMR/wamr_posix_memmap.c +98 -0
  115. package/kernel/Sources/CWAMR/wamr_posix_sleep.c +98 -0
  116. package/kernel/Sources/CWAMR/wamr_posix_thread.c +98 -0
  117. package/kernel/Sources/CWAMR/wamr_posix_time.c +98 -0
  118. package/kernel/Sources/CWAMR/wamr_runtime_timer.c +98 -0
  119. package/kernel/Sources/CWAMR/wamr_thread_manager.c +98 -0
  120. package/kernel/Sources/CWAMR/wamr_wasm_application.c +98 -0
  121. package/kernel/Sources/CWAMR/wamr_wasm_blocking_op.c +98 -0
  122. package/kernel/Sources/CWAMR/wamr_wasm_c_api.c +98 -0
  123. package/kernel/Sources/CWAMR/wamr_wasm_exec_env.c +98 -0
  124. package/kernel/Sources/CWAMR/wamr_wasm_interp_fast.c +98 -0
  125. package/kernel/Sources/CWAMR/wamr_wasm_loader.c +98 -0
  126. package/kernel/Sources/CWAMR/wamr_wasm_loader_common.c +98 -0
  127. package/kernel/Sources/CWAMR/wamr_wasm_memory.c +98 -0
  128. package/kernel/Sources/CWAMR/wamr_wasm_native.c +98 -0
  129. package/kernel/Sources/CWAMR/wamr_wasm_runtime.c +98 -0
  130. package/kernel/Sources/CWAMR/wamr_wasm_runtime_common.c +98 -0
  131. package/kernel/Sources/CWAMR/wamr_wasm_shared_memory.c +98 -0
  132. package/kernel/Sources/Kernel/PluginPrelude.js +5 -2
  133. package/kernel/Tests/KernelTests/CasePins.js +50 -0
  134. package/package.json +2 -2
  135. package/skill/krillplayer-plugin/SKILL.md +2 -0
  136. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-content-rejected.json +8 -4
  137. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-login-expired.json +8 -4
  138. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-muted.json +8 -4
  139. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-other.json +8 -4
  140. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-rate-limited.json +8 -4
  141. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-sent.json +8 -4
  142. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-logged-in.json +39 -0
  143. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-backup-line.json +46 -0
  144. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-line-gone.json +46 -0
  145. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live.json +21 -1
  146. package/skill/krillplayer-plugin/assets/samples/live-video-platform/plugin.ts +39 -4
  147. package/skill/krillplayer-plugin/references/cases.md +20 -2
  148. package/skill/krillplayer-plugin/references/contract.d.ts +114 -12
  149. package/skill/krillplayer-plugin/references/crypto-tools.md +104 -0
  150. package/skill/krillplayer-plugin/references/errors-and-fixes.md +5 -1
@@ -0,0 +1,151 @@
1
+ #ifndef KERNEL_WAMR_H
2
+ #define KERNEL_WAMR_H
3
+
4
+ /* 由 Scripts/check-wamr.py 写出(--write),不手改。内核用的 WAMR 接口:先带上钉住的编译选项并就地核对,
5
+ * 再是上游的公开头文件(wasm_export.h 里分配器的形状随选项变)。 */
6
+ #include "kernel_wamr_config.h"
7
+ #if !defined(WASM_ENABLE_INTERP) || WASM_ENABLE_INTERP != 1
8
+ #error "WASM_ENABLE_INTERP is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
9
+ #endif
10
+ #if !defined(WASM_ENABLE_FAST_INTERP) || WASM_ENABLE_FAST_INTERP != 1
11
+ #error "WASM_ENABLE_FAST_INTERP is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
12
+ #endif
13
+ #if !defined(WASM_ENABLE_AOT) || WASM_ENABLE_AOT != 0
14
+ #error "WASM_ENABLE_AOT is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
15
+ #endif
16
+ #if !defined(WASM_ENABLE_JIT) || WASM_ENABLE_JIT != 0
17
+ #error "WASM_ENABLE_JIT is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
18
+ #endif
19
+ #if !defined(WASM_ENABLE_FAST_JIT) || WASM_ENABLE_FAST_JIT != 0
20
+ #error "WASM_ENABLE_FAST_JIT is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
21
+ #endif
22
+ #if !defined(WASM_ENABLE_LAZY_JIT) || WASM_ENABLE_LAZY_JIT != 0
23
+ #error "WASM_ENABLE_LAZY_JIT is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
24
+ #endif
25
+ #if !defined(WASM_ENABLE_LIBC_BUILTIN) || WASM_ENABLE_LIBC_BUILTIN != 0
26
+ #error "WASM_ENABLE_LIBC_BUILTIN is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
27
+ #endif
28
+ #if !defined(WASM_ENABLE_LIBC_WASI) || WASM_ENABLE_LIBC_WASI != 0
29
+ #error "WASM_ENABLE_LIBC_WASI is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
30
+ #endif
31
+ #if !defined(WASM_ENABLE_LIB_PTHREAD) || WASM_ENABLE_LIB_PTHREAD != 0
32
+ #error "WASM_ENABLE_LIB_PTHREAD is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
33
+ #endif
34
+ #if !defined(WASM_ENABLE_LIB_WASI_THREADS) || WASM_ENABLE_LIB_WASI_THREADS != 0
35
+ #error "WASM_ENABLE_LIB_WASI_THREADS is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
36
+ #endif
37
+ #if !defined(WASM_ENABLE_MULTI_MODULE) || WASM_ENABLE_MULTI_MODULE != 0
38
+ #error "WASM_ENABLE_MULTI_MODULE is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
39
+ #endif
40
+ #if !defined(WASM_ENABLE_THREAD_MGR) || WASM_ENABLE_THREAD_MGR != 1
41
+ #error "WASM_ENABLE_THREAD_MGR is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
42
+ #endif
43
+ #if !defined(WASM_ENABLE_SHARED_MEMORY) || WASM_ENABLE_SHARED_MEMORY != 0
44
+ #error "WASM_ENABLE_SHARED_MEMORY is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
45
+ #endif
46
+ #if !defined(WASM_ENABLE_SIMD) || WASM_ENABLE_SIMD != 0
47
+ #error "WASM_ENABLE_SIMD is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
48
+ #endif
49
+ #if !defined(WASM_ENABLE_GC) || WASM_ENABLE_GC != 0
50
+ #error "WASM_ENABLE_GC is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
51
+ #endif
52
+ #if !defined(WASM_ENABLE_EXCE_HANDLING) || WASM_ENABLE_EXCE_HANDLING != 0
53
+ #error "WASM_ENABLE_EXCE_HANDLING is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
54
+ #endif
55
+ #if !defined(WASM_ENABLE_MEMORY64) || WASM_ENABLE_MEMORY64 != 0
56
+ #error "WASM_ENABLE_MEMORY64 is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
57
+ #endif
58
+ #if !defined(WASM_ENABLE_TAIL_CALL) || WASM_ENABLE_TAIL_CALL != 0
59
+ #error "WASM_ENABLE_TAIL_CALL is pinned to 0 in kernel_wamr_config.h (ADR 0042)"
60
+ #endif
61
+ #if !defined(WASM_MEM_ALLOC_WITH_USAGE) || WASM_MEM_ALLOC_WITH_USAGE != 1
62
+ #error "WASM_MEM_ALLOC_WITH_USAGE is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
63
+ #endif
64
+ #if !defined(WASM_DISABLE_HW_BOUND_CHECK) || WASM_DISABLE_HW_BOUND_CHECK != 1
65
+ #error "WASM_DISABLE_HW_BOUND_CHECK is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
66
+ #endif
67
+ #if !defined(WASM_DISABLE_STACK_HW_BOUND_CHECK) || WASM_DISABLE_STACK_HW_BOUND_CHECK != 1
68
+ #error "WASM_DISABLE_STACK_HW_BOUND_CHECK is pinned to 1 in kernel_wamr_config.h (ADR 0042)"
69
+ #endif
70
+ #include "../vendor/core/iwasm/include/wasm_export.h"
71
+
72
+ /* 每个包装文件编出来的钉住选项的取值(kq_wamr_options_<包装名>),测试逐个核对。 */
73
+ const char *kq_wamr_options_invokeNative_general(void);
74
+ const char *kq_wamr_options_wasm_application(void);
75
+ const char *kq_wamr_options_wasm_blocking_op(void);
76
+ const char *kq_wamr_options_wasm_c_api(void);
77
+ const char *kq_wamr_options_wasm_exec_env(void);
78
+ const char *kq_wamr_options_wasm_loader_common(void);
79
+ const char *kq_wamr_options_wasm_memory(void);
80
+ const char *kq_wamr_options_wasm_native(void);
81
+ const char *kq_wamr_options_wasm_runtime_common(void);
82
+ const char *kq_wamr_options_wasm_shared_memory(void);
83
+ const char *kq_wamr_options_wasm_interp_fast(void);
84
+ const char *kq_wamr_options_wasm_loader(void);
85
+ const char *kq_wamr_options_wasm_runtime(void);
86
+ const char *kq_wamr_options_thread_manager(void);
87
+ const char *kq_wamr_options_ems_alloc(void);
88
+ const char *kq_wamr_options_ems_gc(void);
89
+ const char *kq_wamr_options_ems_hmu(void);
90
+ const char *kq_wamr_options_ems_kfc(void);
91
+ const char *kq_wamr_options_mem_alloc(void);
92
+ const char *kq_wamr_options_mremap(void);
93
+ const char *kq_wamr_options_posix_blocking_op(void);
94
+ const char *kq_wamr_options_posix_malloc(void);
95
+ const char *kq_wamr_options_posix_memmap(void);
96
+ const char *kq_wamr_options_posix_sleep(void);
97
+ const char *kq_wamr_options_posix_thread(void);
98
+ const char *kq_wamr_options_posix_time(void);
99
+ const char *kq_wamr_options_platform_init_darwin(void);
100
+ const char *kq_wamr_options_platform_init_linux(void);
101
+ const char *kq_wamr_options_bh_assert(void);
102
+ const char *kq_wamr_options_bh_bitmap(void);
103
+ const char *kq_wamr_options_bh_common(void);
104
+ const char *kq_wamr_options_bh_hashmap(void);
105
+ const char *kq_wamr_options_bh_leb128(void);
106
+ const char *kq_wamr_options_bh_list(void);
107
+ const char *kq_wamr_options_bh_log(void);
108
+ const char *kq_wamr_options_bh_queue(void);
109
+ const char *kq_wamr_options_bh_vector(void);
110
+ const char *kq_wamr_options_runtime_timer(void);
111
+ #define KQ_WAMR_WRAPPERS(X) \
112
+ X(invokeNative_general) \
113
+ X(wasm_application) \
114
+ X(wasm_blocking_op) \
115
+ X(wasm_c_api) \
116
+ X(wasm_exec_env) \
117
+ X(wasm_loader_common) \
118
+ X(wasm_memory) \
119
+ X(wasm_native) \
120
+ X(wasm_runtime_common) \
121
+ X(wasm_shared_memory) \
122
+ X(wasm_interp_fast) \
123
+ X(wasm_loader) \
124
+ X(wasm_runtime) \
125
+ X(thread_manager) \
126
+ X(ems_alloc) \
127
+ X(ems_gc) \
128
+ X(ems_hmu) \
129
+ X(ems_kfc) \
130
+ X(mem_alloc) \
131
+ X(mremap) \
132
+ X(posix_blocking_op) \
133
+ X(posix_malloc) \
134
+ X(posix_memmap) \
135
+ X(posix_sleep) \
136
+ X(posix_thread) \
137
+ X(posix_time) \
138
+ X(platform_init_darwin) \
139
+ X(platform_init_linux) \
140
+ X(bh_assert) \
141
+ X(bh_bitmap) \
142
+ X(bh_common) \
143
+ X(bh_hashmap) \
144
+ X(bh_leb128) \
145
+ X(bh_list) \
146
+ X(bh_log) \
147
+ X(bh_queue) \
148
+ X(bh_vector) \
149
+ X(runtime_timer) \
150
+
151
+ #endif
@@ -0,0 +1,66 @@
1
+ #ifndef KERNEL_WAMR_CONFIG_H
2
+ #define KERNEL_WAMR_CONFIG_H
3
+
4
+ /* WAMR 的编译选项,只在这里定(ADR 0042「运行时:WAMR」)。每个 WAMR 源文件的包装(wamr_*.c)与内核的封装
5
+ * (CQuickJS/kernel_wasm.c)都先 include 它,wasm_export.h 里分配器的形状随这些选项变,两边必须同一份。
6
+ * 钉住的几项由包装文件与 kernel_wamr.h 在 include 它之后就地核对(Scripts/check-wamr.py 写出);每个包装编完时的取值与
7
+ * 关掉的语言特性被拒收由两宿主的测试核对(PluginWasmTests 的 testPinned…、plugins/wasm-fixtures)。这些防无意的漂移,
8
+ * 不防有意绕过(Scripts/check-wamr.py 开头)。 */
9
+
10
+ /* 只有快速解释器:不生成可执行内存,三端与试跑器同一份。 */
11
+ #define WASM_ENABLE_INTERP 1
12
+ #define WASM_ENABLE_FAST_INTERP 1
13
+ #define WASM_ENABLE_AOT 0
14
+ #define WASM_ENABLE_JIT 0
15
+ #define WASM_ENABLE_FAST_JIT 0
16
+ #define WASM_ENABLE_LAZY_JIT 0
17
+ #define WASM_ENABLE_MINI_LOADER 0
18
+
19
+ /* 没有 WASI、内建 libc 与 pthread:模块拿到的宿主函数只有插件传进去的 JS 函数。 */
20
+ #define WASM_ENABLE_LIBC_BUILTIN 0
21
+ #define WASM_ENABLE_LIBC_WASI 0
22
+ #define WASM_ENABLE_LIB_PTHREAD 0
23
+ #define WASM_ENABLE_LIB_WASI_THREADS 0
24
+ #define WASM_ENABLE_MULTI_MODULE 0
25
+
26
+ /* 线程管理只为一件事开:wasm_runtime_terminate 设的终止标志,快速解释器只在开了它时在每个跳转上查,
27
+ * 不开的话死循环打断不了。线程本身(共享内存、原子操作)不开。 */
28
+ #define WASM_ENABLE_THREAD_MGR 1
29
+ #define WASM_ENABLE_SHARED_MEMORY 0
30
+
31
+ /* 语言特性:工具链默认产出的开(批量内存、引用类型;多值、符号扩展、饱和转换上游一直开着),
32
+ * SIMD、GC、异常、内存 64 位、尾调用不开,用到的模块实例化失败。 */
33
+ #define WASM_ENABLE_BULK_MEMORY 1
34
+ #define WASM_ENABLE_REF_TYPES 1
35
+ #define WASM_ENABLE_SIMD 0
36
+ #define WASM_ENABLE_GC 0
37
+ #define WASM_ENABLE_EXCE_HANDLING 0
38
+ #define WASM_ENABLE_MEMORY64 0
39
+ #define WASM_ENABLE_TAIL_CALL 0
40
+ #define WASM_ENABLE_EXTENDED_CONST_EXPR 0
41
+
42
+ /* 分配全部交给内核的计数分配器:线性内存也按用途向它要(不开的话苹果的 arm64 上每个实例另映射 8 GiB 的保留地址,
43
+ * 绕过分配器),越界由软件检查,不靠保留地址与信号。 */
44
+ #define WASM_MEM_ALLOC_WITH_USAGE 1
45
+ #define WASM_DISABLE_HW_BOUND_CHECK 1
46
+ #define WASM_DISABLE_STACK_HW_BOUND_CHECK 1
47
+ #define WASM_ENABLE_SHRUNK_MEMORY 1
48
+ #define WASM_HAVE_MREMAP 0
49
+
50
+ /* 调宿主函数只走原始形状(wasm_runtime_register_natives_raw),用 C 写的通用调用,不用各架构的汇编。 */
51
+ #define WASM_ENABLE_QUICK_AOT_ENTRY 0
52
+ #define WASM_ENABLE_AOT_INTRINSICS 0
53
+ #define WASM_DISABLE_WAKEUP_BLOCKING_OP 0
54
+ #define WASM_GLOBAL_HEAP_SIZE 0
55
+ #define BH_MALLOC wasm_runtime_malloc
56
+ #define BH_FREE wasm_runtime_free
57
+
58
+ #if defined(__APPLE__)
59
+ #define BH_PLATFORM_DARWIN
60
+ #elif defined(__linux__)
61
+ #define BH_PLATFORM_LINUX
62
+ #else
63
+ #error "WAMR is built for Apple platforms and, for the plugin toolkit, Linux"
64
+ #endif
65
+
66
+ #endif
@@ -0,0 +1,219 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+
204
+ --- LLVM Exceptions to the Apache 2.0 License ----
205
+
206
+ As an exception, if, as a result of your compiling your source code, portions
207
+ of this Software are embedded into an Object form of such source code, you
208
+ may redistribute such embedded portions in such Object form without complying
209
+ with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
210
+
211
+ In addition, if you combine or link compiled forms of this Software with
212
+ software that is licensed under the GPLv2 ("Combined Software") and if a
213
+ court of competent jurisdiction determines that the patent provision (Section
214
+ 3), the indemnity provision (Section 9) or other Section of the License
215
+ conflicts with the conditions of the GPLv2, you may retroactively and
216
+ prospectively choose to deem waived or otherwise exclude such Section(s) of
217
+ the License, but only in their entirety and only with respect to the Combined
218
+ Software.
219
+