Implement wasm_runtime_init_thread_env for Windows platform (#683)

Implement wasm_runtime_init_thread_env() for Windows platform by calling os_thread_env_init(): if current thread is created by developer himself but not runtime, developer should call wasm_runtime_init_thread_env() to init the thread environment before calling wasm function, and call wasm_runtime_destroy_thread_env() before thread exits.
And clear compile warnings for Windows platform, fix compile error for AliOS-Things platform

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-08-03 10:49:50 +08:00
committed by GitHub
parent 445722cac3
commit 541f577164
9 changed files with 115 additions and 28 deletions

View File

@ -50,7 +50,7 @@ rotl32(uint32 n, uint32 c)
const uint32 mask = (31);
c = c % 32;
c &= mask;
return (n<<c) | (n>>( (-c)&mask ));
return (n << c) | (n >> ((0 - c) & mask));
}
static inline uint32
@ -59,7 +59,7 @@ rotr32(uint32 n, uint32 c)
const uint32 mask = (31);
c = c % 32;
c &= mask;
return (n>>c) | (n<<( (-c)&mask ));
return (n >> c) | (n << ((0 - c) & mask));
}
static inline uint64
@ -68,7 +68,7 @@ rotl64(uint64 n, uint64 c)
const uint64 mask = (63);
c = c % 64;
c &= mask;
return (n<<c) | (n>>( (-c)&mask ));
return (n << c) | (n >> ((0 - c) & mask));
}
static inline uint64
@ -77,7 +77,7 @@ rotr64(uint64 n, uint64 c)
const uint64 mask = (63);
c = c % 64;
c &= mask;
return (n>>c) | (n<<( (-c)&mask ));
return (n >> c) | (n << ((0 - c) & mask));
}
static inline double
@ -2623,7 +2623,7 @@ label_pop_csp_n:
goto out_of_bounds;
bh_memcpy_s(maddr, linear_mem_size - addr,
data + offset, bytes);
data + offset, (uint32)bytes);
break;
}
case WASM_OP_DATA_DROP:
@ -2717,9 +2717,9 @@ label_pop_csp_n:
bh_memcpy_s(
(uint8 *)(tbl_inst)
+ offsetof(WASMTableInstance, base_addr) + d * sizeof(uint32),
(tbl_inst->cur_size - d) * sizeof(uint32),
(uint32)((tbl_inst->cur_size - d) * sizeof(uint32)),
module->module->table_segments[elem_idx].func_indexes + s,
n * sizeof(uint32));
(uint32)(n * sizeof(uint32)));
break;
}
@ -2764,10 +2764,10 @@ label_pop_csp_n:
bh_memmove_s(
(uint8 *)(dst_tbl_inst) + offsetof(WASMTableInstance, base_addr)
+ d * sizeof(uint32),
(dst_tbl_inst->cur_size - d) * sizeof(uint32),
(uint32)((dst_tbl_inst->cur_size - d) * sizeof(uint32)),
(uint8 *)(src_tbl_inst) + offsetof(WASMTableInstance, base_addr)
+ s * sizeof(uint32),
n * sizeof(uint32));
(uint32)(n * sizeof(uint32)));
break;
}
case WASM_OP_TABLE_GROW: