US 12,436,868 B2
Code inspection method under weak memory ordering architecture and corresponding device
Yuzhong Wen, Hangzhou (CN); Jonas Oberhauser, Dresden (DE); Diogo Behrens, Dresden (DE); and Ming Fu, Shanghai (CN)
Assigned to HUAWEI TECHNOLOGIES CO., LTD., Shenzhen (CN)
Filed by HUAWEI TECHNOLOGIES CO., LTD., Guangdong (CN)
Filed on Oct. 11, 2023, as Appl. No. 18/484,641.
Application 18/484,641 is a continuation of application No. PCT/CN2022/086590, filed on Apr. 13, 2022.
Claims priority of application No. 202110401685.0 (CN), filed on Apr. 14, 2021.
Prior Publication US 2024/0045787 A1, Feb. 8, 2024
Int. Cl. G06F 11/3604 (2025.01)
CPC G06F 11/3612 (2013.01) 16 Claims
OG exemplary drawing
 
1. A code inspection method under a weak memory ordering architecture, comprising:
obtaining a first source code and a test code, wherein the first source code comprises a blocking mark, the test code indicates a condition that needs to be met for correct running of the first source code, the first source code corresponds to a plurality of threads, the plurality of threads have at least one shared memory, and the blocking mark indicates a location of a busy-wait loop in the first source code;
generating, based on the first source code and the condition indicated by the test code, a plurality of execution flows under the weak memory ordering architecture for the plurality of threads that operate a same shared memory, wherein each execution flow is a code execution process in which a processor runs the plurality of threads to perform a read operation and/or write operation on the same shared memory, and a busy-wait loop exists in a target execution flow that comprises the blocking mark and that is in the plurality of execution flows; and
determining the busy-wait loop in the target execution flow as an infinite loop if a read operation executed by a target thread in one iteration of the busy-wait loop cannot reference an unreferenced write operation when the plurality of threads are invoked to execute the busy-wait loop in the target execution flow, wherein the infinite loop indicates that an error exists in the first source code, and the target thread is any one of the plurality of threads.