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.
- package/LICENSE +2 -1
- package/README.md +2 -0
- package/dist/cli.js +397 -80
- package/dist/crypto.js +38 -11
- package/dist/engine/engine.c +6 -3
- package/kernel/Sources/CQuickJS/include/kernel_qjs.h +8 -1
- package/kernel/Sources/CQuickJS/kernel_internal.h +54 -0
- package/kernel/Sources/CQuickJS/kernel_qjs.c +17 -29
- package/kernel/Sources/CQuickJS/kernel_wasm.c +1155 -0
- package/kernel/Sources/CWAMR/include/kernel_wamr.h +151 -0
- package/kernel/Sources/CWAMR/include/kernel_wamr_config.h +66 -0
- package/kernel/Sources/CWAMR/vendor/LICENSE +219 -0
- package/kernel/Sources/CWAMR/vendor/core/config.h +727 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/aot/aot_runtime.h +899 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/arch/invokeNative_general.c +123 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_application.c +933 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_blocking_op.c +92 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api.c +5391 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api_internal.h +246 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.c +336 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.h +328 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.c +242 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.h +62 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.c +1999 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.h +154 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.c +1532 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.h +117 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.c +8070 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.h +1396 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.c +477 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.h +63 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_suspend_flags.h +52 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/compilation/aot.h +366 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/include/lib_export.h +60 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_c_api.h +910 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_export.h +2440 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm.h +1492 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp.h +122 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp_fast.c +7998 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.c +16909 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.h +80 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_opcode.h +1043 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.c +5174 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.h +912 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.c +1569 -0
- package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.h +256 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_alloc.c +1169 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.c +497 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.h +350 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc_internal.h +384 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_hmu.c +95 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_kfc.c +547 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.c +252 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.h +96 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/memory/mremap.c +12 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_blocking_op.c +70 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_malloc.c +72 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_memmap.c +302 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_sleep.c +20 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_thread.c +784 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_time.c +28 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_init.c +43 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_internal.h +126 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_extension.h +1676 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_vmcore.h +192 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_common.h +204 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_wasi_types.h +610 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_init.c +43 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_internal.h +139 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.c +25 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.h +42 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_atomic.h +300 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.c +27 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.h +114 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.c +217 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.h +83 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.c +339 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.h +168 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.c +77 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.h +30 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.c +111 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.h +109 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.c +111 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.h +94 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_platform.h +38 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.c +256 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.h +80 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.c +279 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.h +126 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/gnuc.h +14 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.c +469 -0
- package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.h +51 -0
- package/kernel/Sources/CWAMR/vendor/core/version.h +24 -0
- package/kernel/Sources/CWAMR/wamr_bh_assert.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_bitmap.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_common.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_hashmap.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_leb128.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_list.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_log.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_queue.c +98 -0
- package/kernel/Sources/CWAMR/wamr_bh_vector.c +98 -0
- package/kernel/Sources/CWAMR/wamr_ems_alloc.c +98 -0
- package/kernel/Sources/CWAMR/wamr_ems_gc.c +98 -0
- package/kernel/Sources/CWAMR/wamr_ems_hmu.c +98 -0
- package/kernel/Sources/CWAMR/wamr_ems_kfc.c +98 -0
- package/kernel/Sources/CWAMR/wamr_invokeNative_general.c +98 -0
- package/kernel/Sources/CWAMR/wamr_mem_alloc.c +98 -0
- package/kernel/Sources/CWAMR/wamr_mremap.c +98 -0
- package/kernel/Sources/CWAMR/wamr_platform_init_darwin.c +100 -0
- package/kernel/Sources/CWAMR/wamr_platform_init_linux.c +100 -0
- package/kernel/Sources/CWAMR/wamr_posix_blocking_op.c +98 -0
- package/kernel/Sources/CWAMR/wamr_posix_malloc.c +98 -0
- package/kernel/Sources/CWAMR/wamr_posix_memmap.c +98 -0
- package/kernel/Sources/CWAMR/wamr_posix_sleep.c +98 -0
- package/kernel/Sources/CWAMR/wamr_posix_thread.c +98 -0
- package/kernel/Sources/CWAMR/wamr_posix_time.c +98 -0
- package/kernel/Sources/CWAMR/wamr_runtime_timer.c +98 -0
- package/kernel/Sources/CWAMR/wamr_thread_manager.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_application.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_blocking_op.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_c_api.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_exec_env.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_interp_fast.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_loader.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_loader_common.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_memory.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_native.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_runtime.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_runtime_common.c +98 -0
- package/kernel/Sources/CWAMR/wamr_wasm_shared_memory.c +98 -0
- package/kernel/Sources/Kernel/PluginPrelude.js +5 -2
- package/kernel/Tests/KernelTests/CasePins.js +50 -0
- package/package.json +2 -2
- package/skill/krillplayer-plugin/SKILL.md +2 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-content-rejected.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-login-expired.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-muted.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-other.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-rate-limited.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-sent.json +8 -4
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-logged-in.json +39 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-backup-line.json +46 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-line-gone.json +46 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live.json +21 -1
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/plugin.ts +39 -4
- package/skill/krillplayer-plugin/references/cases.md +20 -2
- package/skill/krillplayer-plugin/references/contract.d.ts +114 -12
- package/skill/krillplayer-plugin/references/crypto-tools.md +104 -0
- package/skill/krillplayer-plugin/references/errors-and-fixes.md +5 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#ifndef _WASM_MEMORY_H
|
|
7
|
+
#define _WASM_MEMORY_H
|
|
8
|
+
|
|
9
|
+
#include "bh_common.h"
|
|
10
|
+
#include "../include/wasm_export.h"
|
|
11
|
+
#include "../interpreter/wasm_runtime.h"
|
|
12
|
+
#include "../common/wasm_shared_memory.h"
|
|
13
|
+
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
extern "C" {
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if WASM_ENABLE_SHARED_MEMORY != 0 && BH_ATOMIC_64_IS_ATOMIC != 0
|
|
19
|
+
#define GET_LINEAR_MEMORY_SIZE(memory) \
|
|
20
|
+
BH_ATOMIC_64_LOAD(memory->memory_data_size)
|
|
21
|
+
#define SET_LINEAR_MEMORY_SIZE(memory, size) \
|
|
22
|
+
BH_ATOMIC_64_STORE(memory->memory_data_size, size)
|
|
23
|
+
#elif WASM_ENABLE_SHARED_MEMORY != 0
|
|
24
|
+
static inline uint64
|
|
25
|
+
GET_LINEAR_MEMORY_SIZE(const WASMMemoryInstance *memory)
|
|
26
|
+
{
|
|
27
|
+
SHARED_MEMORY_LOCK(memory);
|
|
28
|
+
uint64 memory_data_size = BH_ATOMIC_64_LOAD(memory->memory_data_size);
|
|
29
|
+
SHARED_MEMORY_UNLOCK(memory);
|
|
30
|
+
return memory_data_size;
|
|
31
|
+
}
|
|
32
|
+
static inline void
|
|
33
|
+
SET_LINEAR_MEMORY_SIZE(WASMMemoryInstance *memory, uint64 size)
|
|
34
|
+
{
|
|
35
|
+
SHARED_MEMORY_LOCK(memory);
|
|
36
|
+
BH_ATOMIC_64_STORE(memory->memory_data_size, size);
|
|
37
|
+
SHARED_MEMORY_UNLOCK(memory);
|
|
38
|
+
}
|
|
39
|
+
#else
|
|
40
|
+
#define GET_LINEAR_MEMORY_SIZE(memory) memory->memory_data_size
|
|
41
|
+
#define SET_LINEAR_MEMORY_SIZE(memory, size) memory->memory_data_size = size
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#if WASM_ENABLE_INTERP != 0
|
|
45
|
+
#if WASM_ENABLE_SHARED_HEAP != 0
|
|
46
|
+
|
|
47
|
+
#if WASM_ENABLE_MULTI_MEMORY != 0
|
|
48
|
+
/* Only enable shared heap for the default memory */
|
|
49
|
+
#define is_default_memory (memidx == 0)
|
|
50
|
+
#else
|
|
51
|
+
#define is_default_memory true
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
#if UINTPTR_MAX == UINT64_MAX
|
|
55
|
+
#define get_shared_heap_end_off() module->e->shared_heap_end_off.u64
|
|
56
|
+
#else
|
|
57
|
+
#define get_shared_heap_end_off() \
|
|
58
|
+
(uint64)(module->e->shared_heap_end_off.u32[0])
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
#if WASM_ENABLE_MEMORY64 != 0
|
|
62
|
+
#define shared_heap_is_memory64 is_memory64
|
|
63
|
+
#else
|
|
64
|
+
#define shared_heap_is_memory64 false
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#define app_addr_in_shared_heap(app_addr, bytes) \
|
|
68
|
+
(is_default_memory \
|
|
69
|
+
&& is_app_addr_in_shared_heap((WASMModuleInstanceCommon *)module, \
|
|
70
|
+
shared_heap_is_memory64, (uint64)app_addr, \
|
|
71
|
+
bytes))
|
|
72
|
+
#define shared_heap_addr_app_to_native(app_addr, native_addr) \
|
|
73
|
+
native_addr = module->e->shared_heap_base_addr_adj + app_addr
|
|
74
|
+
#define CHECK_SHARED_HEAP_OVERFLOW(app_addr, bytes, native_addr) \
|
|
75
|
+
if (app_addr_in_shared_heap(app_addr, bytes)) \
|
|
76
|
+
shared_heap_addr_app_to_native(app_addr, native_addr); \
|
|
77
|
+
else
|
|
78
|
+
|
|
79
|
+
#else /* else of WASM_ENABLE_SHARED_HEAP != 0 */
|
|
80
|
+
#define CHECK_SHARED_HEAP_OVERFLOW(app_addr, bytes, native_addr)
|
|
81
|
+
#endif /* end of WASM_ENABLE_SHARED_HEAP != 0 */
|
|
82
|
+
#endif /* end of WASM_ENABLE_INTERP != 0 */
|
|
83
|
+
|
|
84
|
+
#if WASM_ENABLE_SHARED_HEAP != 0
|
|
85
|
+
bool
|
|
86
|
+
is_app_addr_in_shared_heap(WASMModuleInstanceCommon *module_inst,
|
|
87
|
+
bool is_memory64, uint64 app_offset, uint32 bytes);
|
|
88
|
+
|
|
89
|
+
WASMSharedHeap *
|
|
90
|
+
wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args);
|
|
91
|
+
|
|
92
|
+
WASMSharedHeap *
|
|
93
|
+
wasm_runtime_chain_shared_heaps(WASMSharedHeap *head, WASMSharedHeap *body);
|
|
94
|
+
|
|
95
|
+
WASMSharedHeap *
|
|
96
|
+
wasm_runtime_unchain_shared_heaps(WASMSharedHeap *head, bool entire_chain);
|
|
97
|
+
|
|
98
|
+
bool
|
|
99
|
+
wasm_runtime_attach_shared_heap(WASMModuleInstanceCommon *module_inst,
|
|
100
|
+
WASMSharedHeap *shared_heap);
|
|
101
|
+
bool
|
|
102
|
+
wasm_runtime_attach_shared_heap_internal(WASMModuleInstanceCommon *module_inst,
|
|
103
|
+
WASMSharedHeap *shared_heap);
|
|
104
|
+
|
|
105
|
+
void
|
|
106
|
+
wasm_runtime_detach_shared_heap(WASMModuleInstanceCommon *module_inst);
|
|
107
|
+
|
|
108
|
+
void
|
|
109
|
+
wasm_runtime_detach_shared_heap_internal(WASMModuleInstanceCommon *module_inst);
|
|
110
|
+
|
|
111
|
+
WASMSharedHeap *
|
|
112
|
+
wasm_runtime_get_shared_heap(WASMModuleInstanceCommon *module_inst_comm);
|
|
113
|
+
|
|
114
|
+
uint64
|
|
115
|
+
wasm_runtime_shared_heap_malloc(WASMModuleInstanceCommon *module_inst,
|
|
116
|
+
uint64 size, void **p_native_addr);
|
|
117
|
+
|
|
118
|
+
void
|
|
119
|
+
wasm_runtime_shared_heap_free(WASMModuleInstanceCommon *module_inst,
|
|
120
|
+
uint64 ptr);
|
|
121
|
+
#endif /* end of WASM_ENABLE_SHARED_HEAP != 0 */
|
|
122
|
+
|
|
123
|
+
bool
|
|
124
|
+
wasm_runtime_memory_init(mem_alloc_type_t mem_alloc_type,
|
|
125
|
+
const MemAllocOption *alloc_option);
|
|
126
|
+
|
|
127
|
+
void
|
|
128
|
+
wasm_runtime_memory_destroy(void);
|
|
129
|
+
|
|
130
|
+
unsigned
|
|
131
|
+
wasm_runtime_memory_pool_size(void);
|
|
132
|
+
|
|
133
|
+
void
|
|
134
|
+
wasm_runtime_set_mem_bound_check_bytes(WASMMemoryInstance *memory,
|
|
135
|
+
uint64 memory_data_size);
|
|
136
|
+
|
|
137
|
+
void
|
|
138
|
+
wasm_runtime_set_enlarge_mem_error_callback(
|
|
139
|
+
const enlarge_memory_error_callback_t callback, void *user_data);
|
|
140
|
+
|
|
141
|
+
void
|
|
142
|
+
wasm_deallocate_linear_memory(WASMMemoryInstance *memory_inst);
|
|
143
|
+
|
|
144
|
+
int
|
|
145
|
+
wasm_allocate_linear_memory(uint8 **data, bool is_shared_memory,
|
|
146
|
+
bool is_memory64, uint64 num_bytes_per_page,
|
|
147
|
+
uint64 init_page_count, uint64 max_page_count,
|
|
148
|
+
uint64 *memory_data_size);
|
|
149
|
+
|
|
150
|
+
#ifdef __cplusplus
|
|
151
|
+
}
|
|
152
|
+
#endif
|
|
153
|
+
|
|
154
|
+
#endif /* end of _WASM_MEMORY_H */
|