|
|
@@ -2311,77 +2311,3 @@ jit_frontend_get_jitted_return_addr_offset()
|
|
|
{
|
|
|
return (uint32)offsetof(WASMInterpFrame, jitted_return_addr);
|
|
|
}
|
|
|
-
|
|
|
-#if 0
|
|
|
-#if WASM_ENABLE_THREAD_MGR != 0
|
|
|
-bool
|
|
|
-check_suspend_flags(JitCompContext *cc, JITFuncContext *func_ctx)
|
|
|
-{
|
|
|
- LLVMValueRef terminate_addr, terminate_flags, flag, offset, res;
|
|
|
- JitBasicBlock *terminate_check_block, non_terminate_block;
|
|
|
- JITFuncType *jit_func_type = func_ctx->jit_func->func_type;
|
|
|
- JitBasicBlock *terminate_block;
|
|
|
-
|
|
|
- /* Offset of suspend_flags */
|
|
|
- offset = I32_FIVE;
|
|
|
-
|
|
|
- if (!(terminate_addr = LLVMBuildInBoundsGEP(
|
|
|
- cc->builder, func_ctx->exec_env, &offset, 1, "terminate_addr"))) {
|
|
|
- jit_set_last_error("llvm build in bounds gep failed");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!(terminate_addr =
|
|
|
- LLVMBuildBitCast(cc->builder, terminate_addr, INT32_PTR_TYPE,
|
|
|
- "terminate_addr_ptr"))) {
|
|
|
- jit_set_last_error("llvm build bit cast failed");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if (!(terminate_flags =
|
|
|
- LLVMBuildLoad(cc->builder, terminate_addr, "terminate_flags"))) {
|
|
|
- jit_set_last_error("llvm build bit cast failed");
|
|
|
- return false;
|
|
|
- }
|
|
|
- /* Set terminate_flags memory accecc to volatile, so that the value
|
|
|
- will always be loaded from memory rather than register */
|
|
|
- LLVMSetVolatile(terminate_flags, true);
|
|
|
-
|
|
|
- CREATE_BASIC_BLOCK(terminate_check_block, "terminate_check");
|
|
|
- MOVE_BASIC_BLOCK_AFTER_CURR(terminate_check_block);
|
|
|
-
|
|
|
- CREATE_BASIC_BLOCK(non_terminate_block, "non_terminate");
|
|
|
- MOVE_BASIC_BLOCK_AFTER_CURR(non_terminate_block);
|
|
|
-
|
|
|
- BUILD_ICMP(LLVMIntSGT, terminate_flags, I32_ZERO, res, "need_terminate");
|
|
|
- BUILD_COND_BR(res, terminate_check_block, non_terminate_block);
|
|
|
-
|
|
|
- /* Move builder to terminate check block */
|
|
|
- SET_BUILDER_POS(terminate_check_block);
|
|
|
-
|
|
|
- CREATE_BASIC_BLOCK(terminate_block, "terminate");
|
|
|
- MOVE_BASIC_BLOCK_AFTER_CURR(terminate_block);
|
|
|
-
|
|
|
- if (!(flag = LLVMBuildAnd(cc->builder, terminate_flags, I32_ONE,
|
|
|
- "termination_flag"))) {
|
|
|
- jit_set_last_error("llvm build AND failed");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- BUILD_ICMP(LLVMIntSGT, flag, I32_ZERO, res, "need_terminate");
|
|
|
- BUILD_COND_BR(res, terminate_block, non_terminate_block);
|
|
|
-
|
|
|
- /* Move builder to terminate block */
|
|
|
- SET_BUILDER_POS(terminate_block);
|
|
|
- if (!jit_build_zero_function_ret(cc, func_ctx, jit_func_type)) {
|
|
|
- goto fail;
|
|
|
- }
|
|
|
-
|
|
|
- /* Move builder to terminate block */
|
|
|
- SET_BUILDER_POS(non_terminate_block);
|
|
|
- return true;
|
|
|
-
|
|
|
-fail:
|
|
|
- return false;
|
|
|
-}
|
|
|
-#endif /* End of WASM_ENABLE_THREAD_MGR */
|
|
|
-#endif
|