Compilation period parameter classification method and device, target code generation method and device and computer equipment
By determining the formal parameter list and return value type of the function during the compilation period, generating classification rules using recursive methods, and automatically classifying parameter types, the complexity of parameter management under IDL file dependence is solved, and system performance and development efficiency are improved.
Patent Information
- Application Number
- CN202510399437.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-08-15
AI Technical Summary
The prior art relies on manual writing and maintenance of IDL files, which leads to complex management of parameter types of remote procedure call interfaces and high maintenance costs, making it difficult to realize automatic classification of parameter types without relying on IDL files.
During the compilation period, determine the formal parameter list and return value type of the function to be extracted, and generate classification rules based on function behavior recursively, and automatically classify the formal parameters into the input and output parameter tuple list to avoid running classification processing.
It realizes automatic classification of parameter types without relying on IDL files, improves system performance, reduces runtime errors, and reduces developer workload and resource overhead, which is suitable for the diversified needs of complex distributed systems.
Smart Images

Figure CN120491937A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of code generation, and in particular to a compile-time parameter classification method, a target code generation method, an apparatus, and a computer device. Background Art
[0002] When generating remote procedure call client and server code, accurately distinguishing between input and output parameters is crucial to generating efficient and reliable code.
[0003] Traditional technologies rely primarily on Interface Definition Language (IDL) to describe and manage the input and output parameters of remote procedure call (RPC) interfaces. IDL specifies the parameter type, order, and transmission direction of a function, and uses code generation tools to automatically generate client and server code.
[0004] However, current IDL files need to be written manually and become complex as the interface grows, resulting in a significant increase in maintenance costs. Summary of the Invention
[0005] Based on this, it is necessary to provide a compile-time parameter classification method, target code generation method, device and computer equipment that can realize automatic classification of parameter types without relying on IDL files to address the above technical problems.
[0006] In a first aspect, the present application provides a method for compile-time parameter classification, the method comprising:
[0007] Determine the type information of the parameter list and return value type of the function to be extracted during compilation;
[0008] Based on the function behavior of the function to be extracted, each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type;
[0009] Each formal parameter belonging to the input parameter type is classified into an input parameter tuple list, and each formal parameter belonging to the output parameter type is classified into an output parameter tuple list.
[0010] In one embodiment, determining the type information of the parameter list of the function to be extracted includes:
[0011] Determine the function type of the function to be extracted;
[0012] Based on the function type, type information of the parameter list is obtained by parsing.
[0013] In one embodiment, determining the function type of the function to be extracted includes:
[0014] In the case where the function to be extracted is a template function or an overloaded function, obtaining an explicitly specified function type;
[0015] In the case that the function to be extracted is a common function, the function type is determined based on the function signature of the function to be extracted.
[0016] In one embodiment, based on the function behavior of the function to be extracted, each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type, including:
[0017] Obtaining classification rules generated based on the function behavior of the function to be extracted;
[0018] Based on the classification rule, each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type.
[0019] In one embodiment, the classification rules include: the parameter type corresponding to the type information of the formal parameter list that is a value type, a non-constant left value reference type, a constant left value reference type, or an right value reference type is an input parameter type; the parameter type corresponding to the type information of the formal parameter list that is a non-constant left value reference type and the parameter type corresponding to the return value type are output parameter types.
[0020] In one embodiment, the function to be extracted is a client function; and before obtaining the input parameter type and the output parameter type by recursively processing the type information of the parameter list and the return value type based on the function behavior of the function to be extracted, the method further includes:
[0021] Get the parameter list passed by the client;
[0022] Performing compile-time checking based on the argument list;
[0023] If the compile-time check passes, continue to execute the function behavior based on the function to be extracted, and recursively process the type information of the parameter list and the return value type to obtain the input parameter type and the output parameter type;
[0024] If the compile-time check fails, a compilation error message is output.
[0025] In one embodiment, the compile-time check includes at least one of comparison of the actual parameter list and the formal parameter list and implicit conversion.
[0026] In one embodiment, the implicit conversion includes at least one of the following:
[0027] During the transfer of the actual parameter list, receiving a forced conversion instruction, the forced conversion instruction being used to forcibly convert at least one first type information of the actual parameter list into target type information, the first type information being different from the target type information; or
[0028] Obtain type information of the actual parameter list;
[0029] If the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, output a compilation warning message; or
[0030] When the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, and the type of the actual parameter list is deduced by default, the type information of the actual parameter list is converted into the type information of the formal parameter list of the to-be-extracted function before deduction.
[0031] In one embodiment, comparing the actual parameter list and the formal parameter list includes:
[0032] Compare the formal parameter list with the actual parameter list;
[0033] If the comparison result shows that the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check passes;
[0034] If the comparison result is that the type information of the formal parameter list is inconsistent with the type information of the actual parameter list, or the number of formal parameters in the formal parameter list is inconsistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check has failed.
[0035] In a second aspect, the present application further provides a method for generating a target code, the method comprising:
[0036] Determine the function to be extracted;
[0037] Obtaining an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the compile-time parameter classification method in any one of the above embodiments;
[0038] A target function is generated based on the input parameter tuple list and the output parameter tuple list during compilation.
[0039] In one embodiment, the input parameter tuple list includes a client input parameter tuple list and / or a server input parameter tuple list; the output parameter tuple list includes a client output parameter tuple list and / or a server output parameter tuple list;
[0040] In a case where the input parameter tuple list is a client input parameter tuple list and the output parameter tuple list is a client output parameter tuple list, the target function includes at least one of a serialization function for serializing the client input parameter tuple list, a deserialization function for deserializing the client output parameter tuple list, a request sending function, a request return function, and a return value processing function;
[0041] When the input parameter tuple list is a server-side input parameter tuple list and the output parameter tuple list is a server-side output parameter tuple list, the target function includes at least one of a deserialization function for deserializing the server-side input parameter tuple list, a serialization function for serializing the server-side output parameter tuple list, a request parsing function, a service function calling function, and a request return function.
[0042] In one embodiment, the method further comprises:
[0043] Fill the client actual parameter list into the client input parameter tuple list and the client output parameter tuple list;
[0044] Generating the target function based on the input parameter tuple list and the output parameter tuple list during compile time includes:
[0045] Extract the client actual parameter list from the client input parameter tuple list;
[0046] Generate a first serialization function of the client input parameter tuple list, wherein the input parameter of the first serialization function is the client actual parameter list;
[0047] Generate a request sending function based on the serialized data obtained by the first serialization function;
[0048] Generate a request return function, receive result data sent by the server based on the request return function, and generate a target function return value type based on the result data;
[0049] A first deserialization function is generated based on the output parameter tuple list and the target function return value type, wherein the target function return value type is the same as the return value type of the function to be extracted.
[0050] In one embodiment, the method further comprises:
[0051] Storing the data obtained by the first deserialization function into a new data structure;
[0052] The data in the new data structure is exchanged with the originally referenced data by means of an exchange method, wherein the originally referenced data is the original data corresponding to the parameter of the non-constant left value reference type in the client output parameter tuple list.
[0053] In one embodiment, generating a target function based on the input parameter tuple list and the output parameter tuple list during compile time includes:
[0054] Declare and zero-initialize the server-side input parameter tuple list to obtain a server-side actual parameter list;
[0055] Generate a second deserialization function corresponding to the server-side input parameter tuple list based on the client's request data, wherein the input parameter of the second deserialization function is the server-side actual parameter list;
[0056] Generate request parsing function and service function calling function;
[0057] Calling a function based on the service function and obtaining a return value from the deserialized parameter list;
[0058] Generate a second serialization function based on the return value and the server-side output parameter tuple list;
[0059] A request return function is generated based on the serialized data of the second serialization function.
[0060] In a third aspect, the present application further provides a compile-time parameter classification device, the device comprising:
[0061] The parsing module is used to determine the type information of the parameter list and the return value type of the function to be extracted during compilation;
[0062] A type classification module is used to recursively process the type information of the parameter list and the return value type based on the function behavior of the function to be extracted to obtain the input parameter type and the output parameter type;
[0063] The parameter classification module is used to classify each formal parameter belonging to the input parameter type into an input parameter tuple list, and classify each formal parameter belonging to the output parameter type into an output parameter tuple list.
[0064] In a fourth aspect, the present application further provides a target code generation device, the device comprising:
[0065] A function determination module, used to determine the function to be extracted;
[0066] a target classification module, configured to obtain an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the above-mentioned compile-time parameter classification device;
[0067] The function generation module is used to generate a target function based on the input parameter tuple list and the output parameter tuple list during compilation.
[0068] In a fifth aspect, the present application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in any one of the above embodiments when executing the computer program.
[0069] The above-mentioned compile-time parameter classification method, target code generation method, device and computer equipment determine the type information of the parameter list and the return value type of the function to be extracted during the compile-time; based on the function behavior of the function to be extracted, the various type information and return value types of the parameter list are processed recursively to obtain the input parameter type and the output parameter type; each parameter belonging to the input parameter type is classified into an input parameter tuple list, and each parameter belonging to the output parameter type is classified into an output parameter tuple list, so that the type information and return value type of the parameter list of the function to be extracted are extracted during the compile-time, and the various type information and return value types of the parameter list are processed recursively to obtain the input parameter type and the output parameter type, and a tuple list is generated. It can realize automatic classification of parameter types without relying on IDL files, complete parameter classification during the compile-time, avoid classification processing at runtime, and significantly improve system performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0071] Figure 1 1 is a flow chart of a method for classifying compile-time parameters in one embodiment;
[0072] Figure 2 Schematic diagram of a process for generating target code in one embodiment;
[0073] Figure 3 Schematic diagram of a flow chart of a method for generating target code in another embodiment;
[0074] Figure 4A flowchart of a method for generating a client objective function in one embodiment;
[0075] Figure 5 A flowchart of a method for generating a server-side target function in one embodiment;
[0076] Figure 6 is a structural block diagram of a compile-time parameter classification device in one embodiment;
[0077] Figure 7 is a structural block diagram of an object code generating device in one embodiment;
[0078] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0080] In one embodiment, Figure 1 As shown, a compile-time parameter classification method is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0081] S102: Determine the type information of the parameter list and the return value type of the function to be extracted during compilation.
[0082] The parameter list and return value of the function to be extracted are located in the signature of the function to be extracted. By identifying the signature of the function to be extracted, the parameter list and return value type can be determined, and then the type information of the parameter list can be obtained by identifying the parameter list.
[0083] Optionally, the type information of the parameter list includes value type, non-constant lvalue reference type, constant lvalue reference type, and rvalue reference type. Similarly, the return value type also includes value type, non-constant lvalue reference type, constant lvalue reference type, and rvalue reference type.
[0084] The signature of the function to be extracted includes the function name, parameter list, and return value type. The function name is used to call the function, and the parameter list includes the types and order of the parameters involved in the function. Each parameter in the parameter list usually includes the parameter type and parameter name. Therefore, the parameter type of each parameter can be obtained by identifying the parameter list, and then the type information of the parameter list can be determined based on the parameter type of each parameter. For example, the parameter type of each parameter can be combined to obtain the type information of the parameter list.
[0085] S104: Based on the function behavior of the function to be extracted, the type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type.
[0086] The function behavior of the function to be extracted includes the function signature, function body, side effects of the function, input and output of the function, function calling method, function documentation and comments, function exception handling, function recursive behavior, function closure and context, and function concurrent behavior, etc. In this application, the classification rules corresponding to the various type information of the formal parameter list and the return value type can be determined based on the function behavior of the function to be extracted, and then the various type information of the formal parameter list and the return value type can be processed based on the classification rules to obtain the input parameter type and output parameter type.
[0087] The input parameter type refers to the parameter as function input, and the output parameter type refers to the parameter as function output.
[0088] Among them, in this application, each type information of the parameter list and the return value type are recursively processed. For example, the first type information of the parameter list can be processed first, and then the input and output types corresponding to the first type information can be determined based on the classification rules. Then, the parameters corresponding to the first type information are obtained, and the obtained parameters are processed. Then, the second type information of the parameter list is obtained until all the type information of the parameter list is processed. Subsequently, the first return value type is processed until all the return value types are processed.
[0089] S106: Classify each formal parameter belonging to the input parameter type into an input parameter tuple list, and classify each formal parameter belonging to the output parameter type into an output parameter tuple list.
[0090] The process of processing each parameter and return value type is the process of storing each parameter and return value type in a corresponding tuple list.
[0091] Optionally, the present application includes two tuple lists, one for storing parameters corresponding to the input parameter type, and the other for storing parameters corresponding to the output parameter type. Each tuple list can store multiple parameters, each of which can belong to the type corresponding to each type information of a different formal parameter list and the return value type.
[0092] In actual applications, two empty tuple lists are initialized at the beginning of compilation. Subsequently, classification rules determined based on the function behavior of the function to be extracted are obtained. Then, based on the classification rules, the parameters and return value types in the formal parameter list are classified to obtain the type information of the formal parameter list and the return value type. Finally, the type information of the formal parameter list and the return value type are recursively processed, and the corresponding parameters are stored in the corresponding tuples until all parameters are traversed.
[0093] The above-mentioned compile-time parameter classification method determines the type information of the parameter list and the return value type of the function to be extracted during the compile-time; based on the function behavior of the function to be extracted, the type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type; each parameter belonging to the input parameter type is classified into the input parameter tuple list, and each parameter belonging to the output parameter type is classified into the output parameter tuple list. In this way, automatic classification of parameter types can be achieved without relying on IDL files. Parameter classification is completed during the compile-time, which avoids classification processing at runtime and significantly improves system performance.
[0094] In one optional embodiment, determining the type information of the formal parameter list of the function to be extracted includes: determining the function type of the function to be extracted; and parsing to obtain the type information of the formal parameter list based on the function type.
[0095] The function type is derived based on the function signature. Different function signatures correspond to different function types. The function signature can be parsed to obtain the function type.
[0096] Optionally determining the function type of the function to be extracted includes: when the function to be extracted is a template function or an overloaded function, obtaining an explicitly specified function type; when the function to be extracted is an ordinary function, determining the function type based on the function signature of the function to be extracted.
[0097] Among them, this application supports parsing of types such as ordinary functions, template functions, and overloaded functions. For template functions and overloaded functions, overloading cannot be directly supported during the function parsing stage. Therefore, the function type needs to be explicitly specified. Therefore, the function type needs to be explicitly specified during the compilation stage. In this way, the explicitly specified function type can be directly obtained during compilation to facilitate the subsequent parsing of the parameter list, etc. If the function type is not explicitly specified, the function parsing fails, and the compilation output fails with the reason for the failure, etc., to prompt the user to explicitly specify the function type.
[0098] For ordinary functions, the function type is obtained directly from the function signature.
[0099] After obtaining the function type, the corresponding parameter list can be determined based on the function type, and then the type information of the corresponding parameter list can be obtained based on the parameter list. Specifically, the value type, constant characteristics and type reference of each parameter in the function to be extracted are analyzed.
[0100] In the above embodiment, compile-time checking is performed on the parsing of complex function signatures and the method of explicitly specifying types to ensure the uniqueness of the function signature and reduce potential conflicts.
[0101] In one of the optional embodiments, based on the function behavior of the function to be extracted, the various type information of the formal parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type, including: obtaining the classification rules generated based on the function behavior of the function to be extracted; based on the classification rules, the various type information of the formal parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type.
[0102] The classification rules are generated based on function behavior. Optionally, the classification rules include: the parameter type corresponding to the type information of the formal parameter list of value type (including left value or right value type), non-constant left value reference type, constant left value reference type or right value reference type is the input parameter type; the parameter type corresponding to the type information of the formal parameter list of non-constant left value reference type and the parameter type corresponding to the return value type are the output parameter type.
[0103] Among them, this application adopts a recursive method to process each type information of the formal parameter list and the return value type in turn, recursively processing one type information each time, determining the input and output types of the parameters corresponding to the type information based on the classification rules, and then storing the parameters to the corresponding input parameter type or output parameter type.
[0104] In other embodiments, if the function behavior is other function behavior, the corresponding classification rules can be regenerated based on the function behavior. That is to say, if other functions are processed in this application, other classification rules can be configured, thereby expanding the scope of use of the method of this application.
[0105] In the above embodiment, dynamic definition of classification rules is supported, allowing developers to flexibly adjust the classification logic according to different scenario requirements, no longer limited by the static characteristics of IDL files. This dynamic adaptation capability can meet the diverse needs of complex distributed systems.
[0106] In one of the optional embodiments, the function to be extracted is a client function; based on the function behavior of the function to be extracted, each type of information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type, and it also includes: obtaining the actual parameter list passed by the client; performing a compile-time check based on the actual parameter list; if the compile-time check passes, continuing to execute the function behavior based on the function to be extracted, recursively processing each type of information of the parameter list and the return value type to obtain the input parameter type and the output parameter type; if the compile-time check fails, outputting compilation error information.
[0107] In this application, an additional parameter list is passed to the client function during compilation. In order to avoid runtime errors caused by mismatch in the number or type of parameters, compile-time checking is performed based on the parameter list in this application.
[0108] Optionally, the compile-time check includes at least one of comparison of the actual parameter list and the formal parameter list and implicit conversion.
[0109] In one of the optional embodiments, comparing the actual parameter list and the formal parameter list includes: comparing the formal parameter list and the actual parameter list; if the comparison result is that the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, determining that the compile-time check has passed; if the comparison result is that the type information of the formal parameter list is inconsistent with the type information of the actual parameter list, or the number of formal parameters in the formal parameter list is inconsistent with the number of actual parameters in the actual parameter list, determining that the compile-time check has failed.
[0110] When the type information of the actual parameter list is recursively processed, the parameter type is checked against the type of the extracted formal parameter list. Specifically, the formal parameter list and the actual parameter list are compared, for example, the amount and type of formal parameters in the formal parameter list are compared with the amount and type of actual parameters in the actual parameter list. If the comparison result is that the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the amount of formal parameters in the formal parameter list is consistent with the amount of actual parameters in the actual parameter list, it is determined that the compile-time check has passed, and the subsequent filling of the actual parameter list into the input parameter elements and output parameter tuples is continued. If at least one comparison result is that the type information of the formal parameter list is inconsistent with the type information of the actual parameter list, or the amount of formal parameters in the formal parameter list is inconsistent with the amount of actual parameters in the actual parameter list, a compilation error message is output.
[0111] The type information of the actual parameter list is parsed, and type checking is performed on the extracted function parameter list and actual parameter types. This type check verifies the inferred type to prevent changes in type characteristics caused by inference rules. This check ensures that the actual parameters of the call match the target function, including the number and types of the actual parameters and the number and types of the formal parameter list, thus avoiding runtime errors caused by mismatched parameter numbers or types.
[0112] In one optional embodiment, the implicit conversion includes at least one of the following:
[0113] During the transfer of the actual parameter list, a forced conversion instruction is received, where the forced conversion instruction is used to forcibly convert at least one first type information of the actual parameter list into target type information, where the first type information is different from the target type information; or
[0114] Get the type information of the actual parameter list; if the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, output a compilation warning message; or
[0115] If the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, and the type of the actual parameter list is deduced by default, the type information of the actual parameter list is converted to the type information of the formal parameter list of the function to be extracted before deduction.
[0116] Among them, for the case of supporting arbitrary parameter templates, the universal reference deduction rule is used to handle parameter passing in the indefinite actual parameter list. However, under the universal reference deduction rule, the value type parameter passed in the function may be deduced as an left value reference type or an right value reference type. Due to the deduction rule, the value type input parameter may be incorrectly processed as an input or output parameter. Therefore, in order to avoid such situations, this application adopts at least one of the following methods to handle it:
[0117] First: Due to the type change caused by the universal reference deduction rule, the type conversion is forced in real time according to the function parameter type before deduction to ensure the accuracy and consistency of parameter passing. That is, when passing the actual parameter list, the forced conversion instruction input by the user is received, and the forced conversion instruction is used to force at least one first type information of the actual parameter list to be converted into the target type information.
[0118] Second: In addition, it can also provide compilation warning detection to reduce possible errors and support default behavior, that is, when the type information of the actual parameter list and the type information of the formal parameter list are inconsistent, compilation warning information is output.
[0119] Third: Provide default optimized reference inference logic. When the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, and the type of the actual parameter list is deduced by default, the type information of the actual parameter list is converted to the type information of the formal parameter list of the function to be extracted before deduction.
[0120] It's also worth noting that users can cast a value type to an rvalue, which will be inferred as an rvalue reference by the reference rules. Since both value types and rvalue reference types are defined as input parameters, and rvalue references can accept a value type, there's no ambiguity.
[0121] In the above embodiment, by detecting implicit conversion and type inconsistency issues, the security of the parameter list is ensured. Furthermore, potential errors can be identified and fixed during the development phase, reducing debugging time caused by runtime errors and improving development efficiency.
[0122] In an exemplary embodiment, Figure 2 As shown, a method for generating a target code is provided, comprising the following steps 202 to 206. In which:
[0123] S202: Determine the function to be extracted.
[0124] The function to be extracted is a function to be compiled. Optionally, before compiling, it can be determined whether the function to be extracted is a client function or a server function, and input into the compiler.
[0125] S204: Obtain an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the compile-time parameter classification method in any one of the above embodiments.
[0126] The method of classifying parameters can be found above and will not be described in detail here.
[0127] S206: Generate a target function based on the input parameter tuple list and the output parameter tuple list during compilation.
[0128] Wherein, a common target function of the remote procedure call client and the server is generated according to the input parameter tuple list and the output parameter tuple list, and the target function includes the content of serializing and deserializing the classified parameter list.
[0129] In some optional embodiments, the input parameter tuple list includes a client input parameter tuple list and / or a server input parameter tuple list; the output parameter tuple list includes a client output parameter tuple list and / or a server output parameter tuple list.
[0130] When the input parameter tuple list is a client input parameter tuple list and the output parameter tuple list is a client output parameter tuple list, the target function includes at least one of a serialization function for serializing the client input parameter tuple list, a deserialization function for deserializing the client output parameter tuple list, a request sending function, a request return function, and a return value processing function.
[0131] When the input parameter tuple list is a server-side input parameter tuple list and the output parameter tuple list is a server-side output parameter tuple list, the target function includes at least one of a deserialization function for deserializing the server-side input parameter tuple list, a serialization function for serializing the server-side output parameter tuple list, a request parsing function, a service function calling function, and a request return function.
[0132] Generate serialization logic for the client input parameter list, implement deserialization logic for output parameters and return values, generate deserialization logic for the server input parameter list, implement deserialization logic for output parameters and return values. In addition, the client target function also includes the call of the RPC stub function, and the server target function also includes the call of the RPC stub function and the target service stub function.
[0133] One point that needs to be explained is that since the server code does not pass the actual parameter list, the target code provides variable declaration and zero initialization of the corresponding tuple type based on the input parameter tuple list and the output parameter tuple list, providing the actual parameter list for server serialization, deserialization and target stub function calls.
[0134] Another point that needs to be explained is that after processing one function to be extracted, the next function to be extracted is obtained until all functions to be extracted have generated corresponding target functions during compilation.
[0135] For ease of understanding, combined Figure 3 As shown, Figure 3This is a flowchart of a method for generating a target function in another embodiment. In this embodiment, parameter classification is first performed during compilation, and then a corresponding target function is generated based on the result of the parameter classification.
[0136] Specifically, the steps of parameter classification during compilation include: obtaining the function type of the function to be extracted, and obtaining the type information of the corresponding formal parameter list based on the function type; if the function to be extracted is a client function, deducing the type information of the actual parameter list, and processing the implicit conversion brought about by the deduced type information of the actual parameter list; then comparing the actual parameter list with the formal parameter list; if they are different, reporting a compilation error; if the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, then recursively processing the type information of the formal parameter list and the return value type to generate an input parameter tuple list and an output parameter tuple list.
[0137] Subsequently, the target function is generated based on the input parameter tuple list and the output parameter tuple list, and it is determined whether the function to be extracted is the last function. If not, the above process is repeated until all the functions to be extracted have generated corresponding target functions and the compilation is completed.
[0138] In one of the optional embodiments, the method also includes: filling the client actual parameter list into the client input parameter tuple list and the client output parameter tuple list; generating a target function based on the input parameter tuple list and the output parameter tuple list during compilation, including: extracting the client actual parameter list from the client input parameter tuple list; generating a first serialization function for the client input parameter tuple list, the input parameter of the first serialization function being the client actual parameter list; generating a request sending function based on the serialized data obtained by the first serialization function, the request sending function being used to send the client's request data; generating a request return function, and receiving the result data sent by the server based on the request return function, and generating the target function return value type based on the result data; generating a first deserialization function based on the output parameter tuple list and the target function return value type, wherein the target function return value type is the same as the return value type of the function to be extracted.
[0139] Specifically, combined Figure 4 As shown, Figure 4The present invention is a flowchart of a client target function generation method in one embodiment. In this embodiment, the function to be extracted is a client function, wherein the type information of the formal parameter list of the function to be extracted is first obtained, and then the derived actual parameter list is recursively processed, the derived actual parameter list is implicitly converted, and then the actual parameter list is compared with the formal parameter list. If they are different, a compilation error is reported. If the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, the actual parameter type in the actual parameter list is added to the input parameter tuple list and the output parameter tuple list, wherein the input parameter tuple list and the output parameter tuple list are obtained by recursively processing the type information of the formal parameter list and the return value type.
[0140] Subsequently, the client actual parameter list is extracted from the client input parameter tuple list; and a first serialization function of the client input parameter tuple list is generated, where the input parameter of the first serialization function is the client actual parameter list.
[0141] Then, based on the serialized data obtained by the first serialization function, a request sending function is generated (the request sending function is used to send the client's request data), that is, a remote procedure call stub function, which sends the serialized data to the server through the inter-process communication mechanism; and a request return function is generated, which is used to receive the result data returned by the server, receives the result data sent by the server based on the request return function, and generates the target function return value type based on the result data, and generates the first deserialization function based on the output parameter tuple list and the target function return value type, wherein since the return value type is at the end of the output parameter tuple list, the last parameter of the deserialization is the return value, wherein the target function return value type is the same as the return value type of the function to be extracted.
[0142] Then, the return value type is declared and zero-initialized, and deserialized. According to the deduced return value type, the deserialized return value is returned, and other functions, such as other return value processing functions, are processed until all client functions are processed.
[0143] In one of the optional embodiments, the above method also includes: storing the data obtained by the first deserialization function in a new data structure; exchanging the data in the new data structure with the original referenced data through an exchange method, wherein the original referenced data is the original data corresponding to the parameter of the non-constant left value reference type in the client output parameter tuple list.
[0144] Among them, because the classification rules in this application use non-constant left-value references as both input parameters and output parameters, and because serialization does not remove historical retained data during the transmission of the left-value reference of the input data, dirty data will exist. When the above conditions exist, deserialization at the time of output may cause unexpected data merging behavior. In order to avoid this problem, a swap technology is proposed. Specifically, the data obtained by the first deserialization function is stored in a new data structure, and the swap technology is used to swap the new data with the original referenced data. The original referenced data is the original data corresponding to the parameter of the non-constant left-value reference type in the client output parameter tuple list, that is, the input data. In this way, the swap technology is used to avoid outputting the input data, so that the output is the data obtained by the first deserialization function, thereby avoiding unexpected errors.
[0145] In the above embodiment, since the classification rule uses non-constant lvalue references as both input parameters and output parameters, it is necessary to implement the swapping technology for the input and output parameters, otherwise potential unexpected errors will be introduced.
[0146] In one of the optional embodiments, a target function is generated based on the input parameter tuple list and the output parameter tuple list during compilation, including: declaring and zero-initializing the service input parameter tuple list to obtain a server-side actual parameter list; generating a second deserialization function corresponding to the server-side input parameter tuple list based on the client's request data, wherein the input parameter of the second deserialization function is the server-side actual parameter list; generating a request parsing function and a service function calling function; obtaining a return value based on the service function calling function and the deserialized actual parameter list; generating a second serialization function based on the return value and the server-side output parameter tuple list; and generating a request return function based on the serialized data of the second serialization function.
[0147] Among them, combined Figure 5 As shown, Figure 5This is a flowchart of a method for generating a server-side target function in one embodiment. In this embodiment, the function to be extracted is a server-side function. First, the parameter list type of the server-side function is recursively processed based on the compile-time parameter classification mentioned above, and the input parameter tuple list and the output parameter tuple list are extracted according to the classification rules, wherein the return value type is classified into the output parameter tuple list. Then, the input parameter tuple list is declared and zero-initialized, wherein zero initialization is to provide an actual parameter list, receive the request data from the client, that is, the output data of the first serialization function, and generate a second deserialization function corresponding to the server-side input parameter tuple list based on the client's request data. The second deserialization function is used to declare and zero-initialize the actual parameter list. The initialized server input parameter tuple list is deserialized, and then the server function is called to transmit the deserialized actual parameter list, wherein the server function includes a request parsing function and a service function calling function, and a return value is obtained based on the service function calling function and the deserialized actual parameter list. Based on the return value and the server output parameter tuple list, a second serialization function is generated. The second serialization function is used to serialize the server output parameter tuple list and the return value obtained by the service function calling function, and a request return function is generated based on the serialized data of the second serialization function to return the serialized data to the client, so that the client's first deserialization function continues to process.
[0148] One thing that needs to be explained is that the non-constant lvalue reference type variable in the server input parameter tuple list is used to initialize the reference of the server output parameter tuple list.
[0149] In each of the above-described embodiments, the target function is generated by efficiently classifying and processing the parameters at compile time using the parameter list of the function to be extracted, combined with user-defined classification rules. This method is applicable to both remote procedure call (RPC) client and server code generation scenarios. For the input, output, and return values of a specific function, the client is responsible for serializing the input parameter list and deserializing the output parameter list and function return value returned by the server. The server, in turn, deserializes the received input parameter list and serializes the output parameter list and function return value.
[0150] By completing parameter classification and code generation at compile time, runtime classification processing is avoided, significantly improving system performance. This method is particularly suitable for RPC interfaces that require frequent calls, significantly reducing runtime resource overhead.
[0151] Eliminating the need to manually write and maintain IDL files reduces developer workload. For example, automated parameter classification and code generation reduce the risk of human error. For new or modified interfaces, simply updating the classification rules or function signatures automatically completes the process, eliminating the need to redesign the entire architecture.
[0152] This approach can generate customized code based on specific needs, rather than being limited to fixed templates. For example, serialization and deserialization logic can be optimized based on parameter usage. It also supports parsing and processing complex template functions.
[0153] Leveraging metaprogramming techniques, efficient code for specific interfaces is generated at compile time, avoiding redundant code. This improves code reusability and maintainability while reducing potential performance bottlenecks. For large distributed systems, template specialization enables rapid generation of optimized code adapted to different call scenarios.
[0154] It provides support for different platforms and compilers, and implements cross-platform parameter classification and code generation through unified rules. For example, for heterogeneous systems, it can automatically generate client and server code that adapts to various calling specifications, improving the portability and scalability of the system.
[0155] Static checks are performed during compile time to ensure consistency between parameter types and classification rules, avoiding runtime errors. Support for parsing and verification of multiple complex signatures, including template overloaded functions, improves code security.
[0156] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0157] Based on the same inventive concept, embodiments of the present application further provide a compile-time parameter classification device for implementing the aforementioned compile-time parameter classification method and a target function generation device for the target function generation method. The implementation solutions provided by these devices are similar to those described in the aforementioned methods. Therefore, the specific limitations in the embodiments of one or more compile-time parameter classification devices and target function generation devices provided below can be found in the above-mentioned limitations on the compile-time parameter classification method and will not be further elaborated here.
[0158] In an exemplary embodiment, Figure 6 As shown, a compile-time parameter classification device is provided, including: a parsing module 601, a type classification module 602 and a parameter classification module 603, wherein:
[0159] Parsing module 601, used to determine the type information of the parameter list and the return value type of the function to be extracted during compilation;
[0160] A type classification module 602 is used to recursively process the type information of the parameter list and the return value type based on the function behavior of the function to be extracted to obtain the input parameter type and the output parameter type;
[0161] The parameter classification module 603 is used to classify each formal parameter belonging to the input parameter type into an input parameter tuple list, and classify each formal parameter belonging to the output parameter type into an output parameter tuple list.
[0162] In one optional embodiment, the parsing module 601 is specifically used to determine the function type of the function to be extracted; based on the function type, the type information of the parameter list is parsed.
[0163] In one of the optional embodiments, the above-mentioned parsing module 601 is specifically used to obtain an explicitly specified function type when the function to be extracted is a template function or an overloaded function; when the function to be extracted is an ordinary function, determine the function type based on the function signature of the function to be extracted.
[0164] In one of the optional embodiments, the above-mentioned type classification module 602 is specifically used to obtain classification rules generated based on the function behavior of the function to be extracted; based on the classification rules, the various type information of the formal parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type.
[0165] In one of the optional embodiments, the classification rules include: the parameter type corresponding to the type information of the formal parameter list of value type, non-constant left value reference type, constant left value reference type or right value reference type is the input parameter type; the parameter type corresponding to the type information of the formal parameter list of non-constant left value reference type and the parameter type corresponding to the return value type are the output parameter type.
[0166] In one of the optional embodiments, the function to be extracted is a client function; the above-mentioned device also includes: a checking module, which is used to obtain a list of actual parameters passed by the client; a compile-time check is performed based on the actual parameter list; if the compile-time check passes, the function behavior based on the function to be extracted is continued to be executed, and each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type; if the compile-time check fails, a compilation error message is output.
[0167] In one of the optional embodiments, the compile-time check includes at least one of comparison of the actual parameter list and the formal parameter list and implicit conversion.
[0168] In one of the optional embodiments, the implicit conversion involved in the above-mentioned detection module includes at least one of the following: receiving a forced conversion instruction during the transmission of the actual parameter list, the forced conversion instruction is used to force at least one first type information of the actual parameter list to be converted into target type information, and the first type information is different from the target type information; or obtaining the type information of the actual parameter list; when the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, outputting a compilation warning information; or when the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, and the type of the actual parameter list is deduced by default, converting the type information of the actual parameter list into the type information of the formal parameter list of the function to be extracted before derivation.
[0169] In one of the optional embodiments, the comparison of the actual parameter list and the formal parameter list involved in the above-mentioned detection module includes: comparing the formal parameter list and the actual parameter list; when the comparison result is that the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check has passed; when the comparison result is that the type information of the formal parameter list is inconsistent with the type information of the actual parameter list, or the number of formal parameters in the formal parameter list is inconsistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check has failed.
[0170] In an exemplary embodiment, Figure 7 As shown, a target function generation device is provided, including: a function determination module 701, a target classification module 702 and a function generation module 703, wherein:
[0171] Function determination module 701, used to determine the function to be extracted;
[0172] A target classification module 702 is configured to obtain an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the compile-time parameter classification device in any of the above embodiments;
[0173] The function generation module 703 is used to generate a target function based on the input parameter tuple list and the output parameter tuple list during compilation.
[0174] In one optional embodiment, the input parameter tuple list includes a client input parameter tuple list and / or a server input parameter tuple list; the output parameter tuple list includes a client output parameter tuple list and / or a server output parameter tuple list;
[0175] In a case where the input parameter tuple list is a client input parameter tuple list and the output parameter tuple list is a client output parameter tuple list, the target function includes at least one of a serialization function for serializing the client input parameter tuple list, a deserialization function for deserializing the client output parameter tuple list, a request sending function, a request return function, and a return value processing function;
[0176] When the input parameter tuple list is a server-side input parameter tuple list and the output parameter tuple list is a server-side output parameter tuple list, the target function includes at least one of a deserialization function for deserializing the server-side input parameter tuple list, a serialization function for serializing the server-side output parameter tuple list, a request parsing function, a service function calling function, and a request return function.
[0177] In one of the optional embodiments, the apparatus further comprises: a filling module, configured to fill the client actual parameter list into the client input parameter tuple list and the client output parameter tuple list;
[0178] The above-mentioned function generation module 703 is also used to extract the client actual parameter list from the client input parameter tuple list; generate a first serialization function for the client input parameter tuple list, and the input parameter of the first serialization function is the client actual parameter list; generate a request sending function based on the serialized data obtained by the first serialization function; generate a request return function, and receive the result data sent by the server based on the request return function, and generate the target function return value type based on the result data; generate a first deserialization function based on the output parameter tuple list and the target function return value type, wherein the target function return value type is the same as the return value type of the function to be extracted.
[0179] In one of the optional embodiments, the above-mentioned device also includes: an exchange module, which is used to store the data obtained by the first deserialization function into a new data structure; and exchange the data in the new data structure with the original referenced data through an exchange method, wherein the original referenced data is the original data corresponding to the parameter of the non-constant left value reference type in the client output parameter tuple list.
[0180] In one of the optional embodiments, the above-mentioned function generation module 703 is also used to declare and zero-initialize the service input parameter tuple list to obtain the server actual parameter list; generate a second deserialization function corresponding to the service input parameter tuple list based on the client's request data, wherein the input parameter of the second deserialization function is the server actual parameter list; generate a request parsing function and a service function calling function; obtain a return value based on the service function calling function and the deserialized actual parameter list; generate a second serialization function based on the return value and the server output parameter tuple list; and generate a request return function based on the serialized data of the second serialization function.
[0181] Each module in the aforementioned compile-time parameter classification device and target function generation device may be implemented in whole or in part via software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0182] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a compile-time parameter classification method and an objective function generation method are implemented.
[0183] Those skilled in the art will understand that Figure 8The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0184] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0185] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0186] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0187] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0188] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a programmable logic unit (PLC), a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, and the like.
[0189] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0190] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A compile-time parameter classification method, characterized in that: The method comprises: Determine the type information of the parameter list and return value type of the function to be extracted during compilation; Based on the function behavior of the function to be extracted, each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type; Each formal parameter belonging to the input parameter type is classified into an input parameter tuple list, and each formal parameter belonging to the output parameter type is classified into an output parameter tuple list.
2. The method according to claim 1, characterized in that The determining of the type information of the parameter list of the function to be extracted includes: Determine the function type of the function to be extracted; Based on the function type, type information of the parameter list is obtained by parsing.
3. The method according to claim 2, characterized in that The determining of the function type of the function to be extracted includes: In the case where the function to be extracted is a template function or an overloaded function, obtaining an explicitly specified function type; In the case that the function to be extracted is a common function, the function type is determined based on the function signature of the function to be extracted.
4. The method according to claim 1, wherein The function behavior based on the function to be extracted is recursively processing each type information of the parameter list and the return value type to obtain the input parameter type and the output parameter type, including: Obtaining classification rules generated based on the function behavior of the function to be extracted; Based on the classification rule, each type information of the parameter list and the return value type are processed recursively to obtain the input parameter type and the output parameter type.
5. The method according to claim 4, characterized in that The classification rules include: the parameter type corresponding to the type information of the formal parameter list that is a value type, a non-constant left value reference type, a constant left value reference type or an right value reference type is an input parameter type; the parameter type corresponding to the type information of the formal parameter list that is a non-constant left value reference type and the parameter type corresponding to the return value type are output parameter types.
6. The method according to claim 1, characterized in that The function to be extracted is a client function; and based on the function behavior of the function to be extracted, the method further includes: Get the parameter list passed by the client; Performing compile-time checking based on the argument list; If the compile-time check passes, continue to execute the function behavior based on the function to be extracted, and recursively process the type information of the parameter list and the return value type to obtain the input parameter type and the output parameter type; If the compile-time check fails, a compilation error message is output.
7. The method according to claim 6, characterized in that The compile-time checking includes at least one of comparing the actual parameter list with the formal parameter list and implicit conversion.
8. The method according to claim 7, characterized in that The implicit conversion includes at least one of the following: During the transfer of the actual parameter list, receiving a forced conversion instruction, the forced conversion instruction being used to forcibly convert at least one first type information of the actual parameter list into target type information, the first type information being different from the target type information; or Obtain type information of the actual parameter list; When the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, outputting a compilation warning message; or When the type information of the actual parameter list is inconsistent with the type information of the formal parameter list, and the type of the actual parameter list is deduced by default, the type information of the actual parameter list is converted into the type information of the formal parameter list of the to-be-extracted function before deduction.
9. The method according to claim 7, characterized in that The comparison between the actual parameter list and the formal parameter list includes: Compare the formal parameter list with the actual parameter list; If the comparison result shows that the type information of the formal parameter list is consistent with the type information of the actual parameter list, and the number of formal parameters in the formal parameter list is consistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check passes; If the comparison result is that the type information of the formal parameter list is inconsistent with the type information of the actual parameter list, or the number of formal parameters in the formal parameter list is inconsistent with the number of actual parameters in the actual parameter list, it is determined that the compile-time check has failed.
10. A method for generating a target code, characterized in that: The method comprises: Determine the function to be extracted; Obtaining an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the compile-time parameter classification method according to any one of claims 1 to 9; A target function is generated based on the input parameter tuple list and the output parameter tuple list during compilation.
11. The method according to claim 10, characterized in that The input parameter tuple list includes a client input parameter tuple list and / or a server input parameter tuple list; the output parameter tuple list includes a client output parameter tuple list and / or a server output parameter tuple list; In a case where the input parameter tuple list is a client input parameter tuple list and the output parameter tuple list is a client output parameter tuple list, the target function includes at least one of a serialization function for serializing the client input parameter tuple list, a deserialization function for deserializing the client output parameter tuple list, a request sending function, a request return function, and a return value processing function; When the input parameter tuple list is a server-side input parameter tuple list and the output parameter tuple list is a server-side output parameter tuple list, the target function includes at least one of a deserialization function for deserializing the server-side input parameter tuple list, a serialization function for serializing the server-side output parameter tuple list, a request parsing function, a service function calling function, and a request return function.
12. The method according to claim 11, characterized in that The method further comprises: Fill the client actual parameter list into the client input parameter tuple list and the client output parameter tuple list; Generating the target function based on the input parameter tuple list and the output parameter tuple list during compile time includes: Extract the client actual parameter list from the client input parameter tuple list; Generate a first serialization function of the client input parameter tuple list, wherein the input parameter of the first serialization function is the client actual parameter list; Generate a request sending function based on the serialized data obtained by the first serialization function; Generate a request return function, receive result data sent by the server based on the request return function, and generate a target function return value type based on the result data; A first deserialization function is generated based on the output parameter tuple list and the target function return value type, wherein the target function return value type is the same as the return value type of the function to be extracted.
13. The method according to claim 12, characterized in that The method further comprises: Storing the data obtained by the first deserialization function into a new data structure; The data in the new data structure is exchanged with the originally referenced data by means of an exchange method, wherein the originally referenced data is the original data corresponding to the parameter of the non-constant left value reference type in the client output parameter tuple list.
14. The method according to claim 11, characterized in that Generating the target function based on the input parameter tuple list and the output parameter tuple list during compile time includes: Declare and zero-initialize the server-side input parameter tuple list to obtain a server-side actual parameter list; Generate a second deserialization function corresponding to the server-side input parameter tuple list based on the client's request data, wherein the input parameter of the second deserialization function is the server-side actual parameter list; Generate request parsing function and service function calling function; Calling a function based on the service function and obtaining a return value from the deserialized parameter list; Generate a second serialization function based on the return value and the server-side output parameter tuple list; A request return function is generated based on the serialized data of the second serialization function.
15. A compile-time parameter classification device, characterized in that: The device comprises: The parsing module is used to determine the type information of the parameter list and the return value type of the function to be extracted during compilation; A type classification module is used to recursively process the type information of the parameter list and the return value type based on the function behavior of the function to be extracted to obtain the input parameter type and the output parameter type; The parameter classification module is used to classify each formal parameter belonging to the input parameter type into an input parameter tuple list, and classify each formal parameter belonging to the output parameter type into an output parameter tuple list.
16. A target code generating device, characterized in that: The device comprises: A function determination module, used to determine the function to be extracted; a target classification module, configured to obtain an input parameter tuple list and an output parameter tuple list corresponding to the function to be extracted, wherein the input parameter tuple list and the output parameter tuple list are obtained based on the compile-time parameter classification device according to claim 15; The function generation module is used to generate a target function based on the input parameter tuple list and the output parameter tuple list during compilation.
17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.