Code Relatives Detection via Instruction Dependency Graphs
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods fail to efficiently detect code relatives and clones across software libraries and APIs, especially in identifying processes with similar behavior despite differing code structures, which hinders code maintenance and plagiarism detection.
Innovation Solution
A method and system that generate instruction dependency graphs for code segments, using link analysis and subgraph isomorphism to determine similarity between processes, identifying code relatives by exceeding a pre-determined threshold, and employing a dynamic vector representation to compute similarity distances.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional code similarity detection methods are used, then syntactically similar code can be identified, but processes with similar behavior but different code structures cannot be detected
Solution Approach 1:
The patent transforms code from static syntactic representation to dynamic behavioral representation by changing the analysis parameter from source code text to instruction dependency graphs generated during runtime execution. This allows detection of behaviorally similar code regardless of syntactic differences.
Solution Approach 2:
The patent replaces traditional text-based code comparison mechanisms with a graph-based dependency analysis system. Instead of mechanically comparing source code strings, the system constructs instruction dependency graphs that capture behavioral semantics, enabling detection of functionally equivalent code with different syntax.
2Measurement precision
If comprehensive code analysis is performed to improve detection accuracy, then more code relatives can be identified, but time complexity increases significantly
Solution Approach 1:
The patent performs preliminary code instrumentation and static analysis before runtime execution to pre-compute and store instruction dependency information. This preliminary action reduces the computational burden during actual similarity detection, as the graph structures are already constructed and can be directly compared without re-analysis.
Solution Approach 2:
The patent segments the code analysis process into distinct phases: static instrumentation, runtime graph generation, and similarity comparison. By dividing the comprehensive analysis into manageable segments, the system can optimize each phase independently and avoid the need to perform all analyses simultaneously, reducing overall time complexity.
3Loss of information
If code representation is tied to specific code expression, then detailed code structure information is preserved, but program representations become expression-dependent and less generalizable
Solution Approach 1:
The patent extracts the essential behavioral semantics from the code by generating instruction dependency graphs that separate functional behavior from syntactic expression. By taking out only the relevant dependency relationships and execution flow information, the system creates representations that are independent of the original code expression while preserving behavioral meaning.
Data Source
AI summary
Disclosed are devices, systems, apparatus, methods, products, media, and other implementations, including a method that includes generating for a code segment of a first process an instruction dependency graph representative of behavior of the first process, obtaining respective one or more instruction dependency graphs representative of behaviors of code segments for one or more other processes, and determining, based on the first instruction dependency graph for the first process and the respective one or more instruction dependency graphs for the one or more other processes, a level of similarity between the first process and at least one of the one or more other processes.


