# US 2024/0176600 A1 · Intelligent Adaptation of Source Code for Multi-Purpose Compilation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0176600 A1
- Document ID: US20240176600A1
- Status: Published application
- Kind: A1
- Application number: 18/060,364
- Filed: 2022-11-30
- Published: 2024-05-30
- Earliest claimed: 2022-11-30
- Assignees: Tencent America LLC
- Applicants: Tencent America LLC
- Inventors: Xuelei FAN
- Web page: https://patentgrep.com/patent/US20240176600A1

## CPC

- G06F 8/41: Compilation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure generally relates to computer source code architecture for adaptive compilation, and is particularly directed to methods and systems for intelligently and automatically preprocessing source code for compilation in an adaptive manner for various purposes. The various implementations described in the disclosure below provide examples for such adaptive programing architecture for automatically pre-processing the source code depending on the purpose of a compilation. In particular, one or more of a plurality of types of servicing/supporting modules, functions, or methods in the source code may be adaptively and automatically removed during compilation depending on a type of compilation among a plurality of different types of compilations. In addition, a mechanism is further provided for facilitating intelligent and automatic generation or expansion of servicing or supporting function components in a source code before compilation.

## Claims

### Claim 1

A method for processing computer source code, the method comprising:
receiving a compilation request associated with a set of source code, the set of sourced code comprising a definition of a class, the class comprising a utility function;
retrieving the set of source code;
automatically identifying a first servicing function demarcated by a first predetermined servicing keyword within the class; the first servicing function being configured to evaluate the utility function;
determining a compilation type from the compilation request;
automatically altering the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate modified set of source code; and
compiling the modified set of source code to generate a set of objective code.

### Claim 2 (depends on 1)

The method of claim 1, wherein automatically altering the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate the modified set of source code comprises:
when the compilation type does not match the first predetermined servicing keyword, automatically removing the first servicing function from the set of source code to generate the modified set of source code.

### Claim 3 (depends on 2)

The method of claim 2, wherein the compilation type comprises a production release type and the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation or a testing of the utility function, and the method comprises removing the first servicing function from the set of source code to generate the modified set of source code.

### Claim 4 (depends on 2)

The method of claim 2, wherein automatically altering the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate the modified set of source code further comprises:
when the compilation type matches the first predetermined servicing keyword, automatically expanding the first servicing function to generate an expanded first servicing function and including the expanded first servicing function in the modified set of source code.

### Claim 5 (depends on 4)

The method of claim 4, wherein the compilation type comprises a benchmarking release type and the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation of the utility function, and wherein expanding the first servicing function to generate the expanded first servicing function comprises automatically identifying a set of template benchmarking code in a benchmarking code library and automatically adding the set of template benchmarking code to the first servicing function to generate the modified set of source code.

### Claim 6 (depends on 5)

The method of claim 5, wherein automatically identifying the set of template benchmarking code in the benchmarking code library comprises:
performing a natural language processing of the first servicing function to identify a benchmarking type; and
automatically identifying the set of template benchmarking code from the benchmarking code library according to the benchmarking type.

### Claim 7 (depends on 4)

The method of claim 4, wherein automatically expanding the first servicing function to generate the expanded first servicing function and including the expanded first servicing function in the modified set of source code comprises:
automatically determining a classification of the first servicing function;
identifying a set of servicing codes according to the classification; and
expanding the first servicing function to generate the expanded first servicing function and including the expanded first servicing function in the modified set of source code based on the set of servicing code.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
automatically identifying a second servicing function marked by a second predetermined servicing keyword within the class, the second predetermined servicing keyword being different from the first predetermined servicing keyword; and
automatically altering the second servicing function in the set of source code based on whether the compilation type matches the second predetermined servicing keyword to generate the modified set of source code.

### Claim 9 (depends on 8)

The method of claim 8, wherein the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation of the utility function and the second predetermined servicing keyword indicates that the second servicing function is for a testing of the utility function.

### Claim 10 (depends on 9)

The method of claim 9, wherein automatically revising the first servicing function and the second servicing function in the set of source code to generate the modified set of source code comprises:
when the compilation type matches the first predetermined servicing keyword, automatically generating the modified set of source code by removing the second servicing function and expanding the first servicing function to an expanded first servicing function;
when the compilation type matches the second predetermined servicing keyword, automatically generating the modified set of source code by removing the first servicing function and retaining the second servicing function in the set of source code; and
when the compilation type indicates a production release type, automatically generating the modified set of source code by removing both the first servicing function and the second servicing function from the set of source code.

### Claim 11

A device for processing computer source code, comprising a memory for storing a compiler program, and a processor configured to executed the compiler program to:
receiving a compilation request associated with a set of source code, the set of sourced code comprising a definition of a class, the class comprising a utility function;
retrieve the set of source code;
automatically a first servicing function demarcated by a first predetermined servicing keyword within the class; the first servicing function being configured to evaluate the utility function;
determine a compilation type from the compilation request;
automatically alter the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate modified set of source code; and
compile the modified set of source code to generate a set of objective code.

### Claim 12 (depends on 11)

The device of claim 11, wherein to automatically alter the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate the modified set of source code comprises:
when the compilation type does not match the first predetermined servicing keyword, automatically remove the first servicing function from the set of source code to generate the modified set of source code.

### Claim 13 (depends on 12)

The device of claim 12, wherein the compilation type comprises a production release type and the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation or a testing of the utility function, and the processor is configured to execute the compiler program to remove the first servicing function from the set of source code to generate the modified set of source code.

### Claim 14 (depends on 12)

The device of claim 12, wherein to automatically alter the first servicing function in the set of source code based on whether the compilation type matches the first predetermined servicing keyword to generate the modified set of source code further comprises:
when the compilation type matches the first predetermined servicing keyword, automatically expand the first servicing function to generate an expanded first servicing function and including the expanded first servicing function in the modified set of source code.

### Claim 15 (depends on 14)

The device of claim 14, wherein the compilation type comprises a benchmarking release type and the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation of the utility function, and wherein to expand the first servicing function to generate the expanded first servicing function comprise automatically identify a set of template benchmarking code in a benchmarking code library and automatically adding the set of template benchmarking code to the first servicing function to generate the modified set of source code.

### Claim 16 (depends on 15)

The device of claim 15, wherein to automatically identify the set of template benchmarking code in the benchmarking code library comprises:
perform a natural language processing of the first servicing function to identify a benchmarking type; and
automatically identify the set of template benchmarking code from the benchmarking code library according to the benchmarking type.

### Claim 17 (depends on 14)

The device of claim 14, wherein to automatically expand the first servicing function to generate the expanded first servicing function and including the expanded first servicing function in the modified set of source code comprises:
automatically determine a classification of the first servicing function;
identify a set of servicing codes according to the classification; and
expand the first servicing function to generate the expanded first servicing function and including the expanded first servicing function in the modified set of source code based on the set of servicing code.

### Claim 18 (depends on 11)

The device of claim 11, the processor is further configured to execute the compiler program to:
automatically identify a second servicing function marked by a second predetermined servicing keyword within the class, the second predetermined servicing keyword being different from the first predetermined servicing keyword; and
automatically alter the second servicing function in the set of source code based on whether the compilation type matches the second predetermined servicing keyword to generate the modified set of source code.

### Claim 19 (depends on 18)

The device of claim 18, wherein the first predetermined servicing keyword indicates that the first servicing function is for a benchmarking evaluation of the utility function and the second predetermined servicing keyword indicates that the second servicing function is for a testing of the utility function.

### Claim 20 (depends on 19)

The device of claim 19, wherein to automatically revise the first servicing function and the second servicing function in the set of source code to generate the modified set of source code comprises:
when the compilation type matches the first predetermined servicing keyword, automatically generate the modified set of source code by removing the second servicing function and expanding the first servicing function to an expanded first servicing function;
when the compilation type matches the second predetermined servicing keyword, automatically generate the modified set of source code by removing the first servicing function and retaining the second servicing function in the set of source code; and
when the compilation type indicates a production release type, automatically generate the modified set of source code by removing both the first servicing function and the second servicing function from the set of source code.
