mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 05:11:19 +00:00 
			
		
		
		
	Fix several coding style and return value unchecked issues (#722)
And enable building Windows CI with multi cores
This commit is contained in:
		
							parent
							
								
									3953f819bc
								
							
						
					
					
						commit
						4e4d48e72b
					
				
							
								
								
									
										16
									
								
								.github/workflows/windows.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/windows.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -30,55 +30,55 @@ jobs: | |||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [aot only] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [interp only] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_AOT=0 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [tail call] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_TAIL_CALL=1 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [custom name section] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [disable hardware boundary check] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [reference types] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_REF_TYPES=1 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
|     - name: Build iwasm [128-bit SIMD] | ||||
|       run: | | ||||
|         cd product-mini/platforms/windows | ||||
|         mkdir build && cd build | ||||
|         cmake .. -DWAMR_BUILD_SIMD=1 | ||||
|         cmake --build . --config Release | ||||
|         cmake --build . --config Release --parallel 4 | ||||
|         cd .. && rm -force -r build | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include "aot_emit_compare.h" | ||||
| #include "aot_intrinsic.h" | ||||
| #include "../aot/aot_intrinsic.h" | ||||
| 
 | ||||
| static bool | ||||
| int_cond_to_llvm_op(IntCond cond, LLVMIntPredicate *op) | ||||
|  | @ -158,23 +158,25 @@ aot_compile_op_f32_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
|     POP_F32(rhs); | ||||
|     POP_F32(lhs); | ||||
| 
 | ||||
|     if (comp_ctx->disable_llvm_intrinsics && aot_intrinsic_check_capability(comp_ctx, "f32_cmp")) | ||||
|     { | ||||
|     if (comp_ctx->disable_llvm_intrinsics | ||||
|         && aot_intrinsic_check_capability(comp_ctx, "f32_cmp")) { | ||||
|         LLVMTypeRef param_types[3]; | ||||
|         LLVMValueRef opcond = LLVMConstInt(I32_TYPE, cond, true); | ||||
|         param_types[0] = I32_TYPE; | ||||
|         param_types[1] = F32_TYPE; | ||||
|         param_types[2] = F32_TYPE; | ||||
|         res = aot_call_llvm_intrinsic(comp_ctx, func_ctx, "f32_cmp", I32_TYPE, param_types, 3, opcond, lhs, rhs); | ||||
|         res = aot_call_llvm_intrinsic(comp_ctx, func_ctx, "f32_cmp", I32_TYPE, | ||||
|                                       param_types, 3, opcond, lhs, rhs); | ||||
|         if (!res) { | ||||
|             goto fail; | ||||
|         } | ||||
|         res = LLVMBuildIntCast(comp_ctx->builder, res, INT1_TYPE, "bit_cast"); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|     else { | ||||
|         res = LLVMBuildFCmp(comp_ctx->builder, op, lhs, rhs, "f32_cmp"); | ||||
|     } | ||||
| 
 | ||||
|     if (!res) | ||||
|     { | ||||
|     if (!res) { | ||||
|         aot_set_last_error("llvm build compare failed."); | ||||
|         return false; | ||||
|     } | ||||
|  | @ -200,23 +202,25 @@ aot_compile_op_f64_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
|     POP_F64(rhs); | ||||
|     POP_F64(lhs); | ||||
| 
 | ||||
|     if (comp_ctx->disable_llvm_intrinsics && aot_intrinsic_check_capability(comp_ctx, "f64_cmp")) | ||||
|     { | ||||
|     if (comp_ctx->disable_llvm_intrinsics | ||||
|         && aot_intrinsic_check_capability(comp_ctx, "f64_cmp")) { | ||||
|         LLVMTypeRef param_types[3]; | ||||
|         LLVMValueRef opcond = LLVMConstInt(I32_TYPE, cond, true); | ||||
|         param_types[0] = I32_TYPE; | ||||
|         param_types[1] = F64_TYPE; | ||||
|         param_types[2] = F64_TYPE; | ||||
|         res = aot_call_llvm_intrinsic(comp_ctx, func_ctx, "f64_cmp", I32_TYPE, param_types, 3, opcond, lhs, rhs); | ||||
|         res = aot_call_llvm_intrinsic(comp_ctx, func_ctx, "f64_cmp", I32_TYPE, | ||||
|                                       param_types, 3, opcond, lhs, rhs); | ||||
|         if (!res) { | ||||
|             goto fail; | ||||
|         } | ||||
|         res = LLVMBuildIntCast(comp_ctx->builder, res, INT1_TYPE, "bit_cast"); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|     else { | ||||
|         res = LLVMBuildFCmp(comp_ctx->builder, op, lhs, rhs, "f64_cmp"); | ||||
|     } | ||||
| 
 | ||||
|     if (!res) | ||||
|     { | ||||
|     if (!res) { | ||||
|         aot_set_last_error("llvm build compare failed."); | ||||
|         return false; | ||||
|     } | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| #include "aot_emit_conversion.h" | ||||
| #include "aot_emit_exception.h" | ||||
| #include "aot_emit_numberic.h" | ||||
| #include "aot_intrinsic.h" | ||||
| #include "aot_runtime.h" | ||||
| #include "../aot/aot_intrinsic.h" | ||||
| #include "../aot/aot_runtime.h" | ||||
| 
 | ||||
| static bool | ||||
| trunc_float_to_int(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | ||||
|  | @ -29,6 +29,9 @@ trunc_float_to_int(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
|         res = aot_call_llvm_intrinsic( | ||||
|           comp_ctx, func_ctx, src_type == F32_TYPE ? "f32_cmp" : "f64_cmp", | ||||
|           I32_TYPE, param_types, 3, opcond, operand, operand); | ||||
|         if (!res) { | ||||
|             goto fail; | ||||
|         } | ||||
|         res = LLVMBuildIntCast(comp_ctx->builder, res, INT1_TYPE, "bit_cast"); | ||||
|     } | ||||
|     else { | ||||
|  | @ -67,6 +70,9 @@ trunc_float_to_int(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
|         is_less = aot_call_llvm_intrinsic( | ||||
|           comp_ctx, func_ctx, src_type == F32_TYPE ? "f32_cmp" : "f64_cmp", | ||||
|           I32_TYPE, param_types, 3, opcond, operand, min_value); | ||||
|         if (!is_less) { | ||||
|             goto fail; | ||||
|         } | ||||
|         is_less = | ||||
|           LLVMBuildIntCast(comp_ctx->builder, is_less, INT1_TYPE, "bit_cast"); | ||||
|     } | ||||
|  | @ -91,6 +97,9 @@ trunc_float_to_int(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
|         is_greater = aot_call_llvm_intrinsic( | ||||
|           comp_ctx, func_ctx, src_type == F32_TYPE ? "f32_cmp" : "f64_cmp", | ||||
|           I32_TYPE, param_types, 3, opcond, operand, max_value); | ||||
|         if (!is_greater) { | ||||
|             goto fail; | ||||
|         } | ||||
|         is_greater = LLVMBuildIntCast(comp_ctx->builder, is_greater, INT1_TYPE, | ||||
|                                       "bit_cast"); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang