[go: up one dir, main page]

CN118939275B - Compiling method, calling method, device, equipment and program product of classification parameters - Google Patents

Compiling method, calling method, device, equipment and program product of classification parameters Download PDF

Info

Publication number
CN118939275B
CN118939275B CN202411405893.8A CN202411405893A CN118939275B CN 118939275 B CN118939275 B CN 118939275B CN 202411405893 A CN202411405893 A CN 202411405893A CN 118939275 B CN118939275 B CN 118939275B
Authority
CN
China
Prior art keywords
parameter
called
tuple
instantiated
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411405893.8A
Other languages
Chinese (zh)
Other versions
CN118939275A (en
Inventor
钟锋浩
李成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Changchuan Technology Co Ltd
Original Assignee
Hangzhou Changchuan Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Changchuan Technology Co Ltd filed Critical Hangzhou Changchuan Technology Co Ltd
Priority to CN202411405893.8A priority Critical patent/CN118939275B/en
Publication of CN118939275A publication Critical patent/CN118939275A/en
Application granted granted Critical
Publication of CN118939275B publication Critical patent/CN118939275B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本申请涉及一种分类参数的编译方法、调用方法、装置、设备和程序产品。所述方法包括:在编译期获取对待调用参数包装得到的参数包装器,所述参数包装器包括参数类型;在编译期通过递归模板函数以及参数类型对所述参数包装器包装的待调用参数进行分类,得到至少一个多元组,并对所述至少一个多元组进行实例化得到各实例化的参数收集器,每个多元组中存储一类待调用参数。采用本方法能够在编译期实现对调用参数的分类,简化编码和提高运行效率。

The present application relates to a compilation method, a calling method, an apparatus, a device and a program product for classifying parameters. The method comprises: obtaining a parameter wrapper obtained by wrapping the parameters to be called at the compile time, wherein the parameter wrapper comprises a parameter type; classifying the parameters to be called wrapped by the parameter wrapper through a recursive template function and a parameter type at the compile time to obtain at least one tuple, and instantiating the at least one tuple to obtain each instantiated parameter collector, wherein each tuple stores a type of parameters to be called. The method can realize the classification of calling parameters at the compile time, simplify the coding and improve the operation efficiency.

Description

Classification parameter compiling method, calling method, device, equipment and program product
Technical Field
The present application relates to the field of meta programming technology, and in particular, to a compiling method, a calling method, a device, equipment and a program product for classifying parameters.
Background
Static type language systems require that the specific type of run be determined at compile time. The RTTI (Run Time Type Identification) technology generally brings about running overhead and risks in a static language system, and is forbidden to be used in various types of coding specifications.
Thus, in the conventional technology, when the application layer makes differentiated calls to various types of parameters according to types, it is generally dependent on a manually encoded, stable RTTI library or a code generation tool. Manual coding is often difficult to maintain and error-prone when handling complex parameter delivery, large projects, complex call logic, and RTTI libraries introduce additional coding and runtime overhead, and code generation tools require additional IDLs (INTERACTIVE DATA Language) and specially designed generation tools.
In a first aspect, IDL is a method of defining interfaces, parameters, and data types across different programming languages. In the RPC framework, a distinction between in-and out-of-parameters may be achieved. Different programs rely on the same IDL so that the different programs can logically interface with each other to invoke and implement data exchanges. The IDL-based code generator system can automatically generate client stub and server stub codes, so that developers do not need to write complicated communication codes manually.
In a second aspect, the code generator needs to parse a specific file and translate the code into code required for the target programming language based on information in the file. The file needs to conform to specific grammatical rules and a good code generator can accurately indicate defects in the user code and give corrective comments. But the user may give many cases where the specific grammar rules are not met. Therefore, the code generator needs to analyze and generate codes supported by various programming languages based on specific rules, and is very complex in design based on the above description.
Thus, these methods lack versatility, and in batch processing of different types of parameter scenarios, they do not simplify coding and improve operating efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a compiling method, a calling method, an apparatus, a device, and a program product that can classify parameters at compile time, simplify encoding, and improve the running efficiency of classifying parameters.
In a first aspect, the present application provides a compiling method for classification parameters, the method comprising:
Acquiring a parameter wrapper obtained by packaging parameters to be called at the compiling period, wherein the parameter wrapper comprises a parameter type;
classifying parameters to be called packaged by the parameter packager through a recursive template function and a parameter type at the compiling period to obtain at least one multi-element group, instantiating the at least one multi-element group to obtain each instantiated parameter collector, and storing one type of parameters to be called in each multi-element group.
In one embodiment, before the obtaining the parameter wrapper obtained by packaging the parameter to be invoked, the method includes:
and packaging the parameters to be called to obtain a parameter wrapper comprising the reference information of the parameters to be called and the parameter types, wherein the parameter types are reserved only in compiling.
In one embodiment, the classifying the parameters to be invoked packaged by the parameter wrapper through the recursive template function and the parameter type to obtain at least one multi-tuple, and instantiating the at least one multi-tuple to obtain each instantiated parameter collector includes:
Based on the parameter wrapper, storing parameters to be called into a target parameter part;
Acquiring a current parameter to be called from the target parameter part, and instantiating the tuple part to obtain a current instantiated parameter collector after adding the current parameter to be called to the tuple part based on the parameter type;
generating a next parameter calling function based on the remaining parameters to be called of the target parameter part;
and acquiring a next parameter to be called from the target parameter part based on the next parameter calling function as a current parameter to be called, continuously executing the step of adding the current parameter to be called to the tuple part based on the parameter type, instantiating the tuple part to obtain a current instantiated parameter collector until the parameter to be called of the target parameter part is classified, generating a termination condition, and acquiring each instantiated parameter collector.
In one embodiment, the adding the current parameters to be invoked to the tuple portion based on the parameter type includes:
When the current parameter to be called is a first parameter to be called, adding the current parameter to be called into an empty tuple of the tuple part based on the parameter type of the current parameter to be called to obtain a first target tuple, and modifying the parameter type of the first target tuple;
When the current parameter to be called is not the first parameter to be called and the parameter types of the tuples in the instantiated tuple part are different from the type of the current parameter to be called, adding the current parameter to be called into a new empty tuple of the tuple part to obtain a second target tuple based on the parameter type of the current parameter to be called, and modifying the parameter type of the second target tuple;
and adding the current parameter to be called into a third target tuple in the instantiated tuple part when the current parameter to be called is not the first parameter to be called and the parameter type of the third target tuple in the instantiated tuple part is the same as the type of the current parameter to be called.
In one embodiment, the method further comprises:
instantiating a user program for invoking each instantiated parameter collector;
Instantiating calling functions of corresponding types based on the at least one multi-element group to obtain instantiated parameter executors, wherein the calling functions in the instantiated parameter executors are used for calling the parameters to be called of the corresponding types;
compiling results are obtained based on the instantiated user program, the instantiated parameter collector and the instantiated parameter executor.
In one embodiment, instantiating the calling function of the corresponding type based on the at least one multi-element group to obtain each instantiated parameter executor includes:
Acquiring a current multi-tuple from the tuple part, and calling a template function in a parameter executor based on the current multi-tuple;
instantiating the template function based on the current multi-tuple to obtain a calling function, and obtaining an instantiated parameter executor based on the calling function;
And acquiring the next multi-tuple as the current multi-tuple, and continuing to execute the step of calling the template function in the parameter executor through the current multi-tuple until the multi-tuple is processed.
In one embodiment, before instantiating the user program, the method further includes:
configuring the calling sequence and calling condition of each instantiated parameter executor in the user program;
And acquiring the configured user program.
In a second aspect, the present application further provides a classification parameter calling method, where the method includes:
and calling each instantiated parameter collector obtained based on the compiling method of the classification parameters in any one embodiment to obtain at least one multi-element group, wherein each multi-element group stores a collected class of parameters to be called, and the types of the parameters to be called corresponding to each multi-element group are different.
In one embodiment, the invoking each instantiated parameter collector results in at least one tuple comprising:
acquiring a current parameter to be called, and calling a current instantiated parameter collector to process the current parameter to be called to obtain a current multi-element group;
acquiring a next parameter collector as a currently instantiated parameter collector;
And transmitting the remaining parameters to be called to the current instantiated parameter collector, and continuously executing the step of acquiring the current parameters to be called until the termination condition of the instantiated parameter collector is met, and acquiring the obtained multi-element group.
In one embodiment, the invoking each instantiated parameter collector to obtain at least one tuple further includes:
And circularly calling each instantiated parameter collector through the instantiated user program to obtain at least one multi-element group, wherein the instantiated user program is triggered based on the interface calling instruction after receiving the interface calling instruction.
In one embodiment, the method further comprises:
And sequentially calling each instantiated parameter executor through the instantiated user program, and processing the multiple groups of the corresponding parameter types to obtain a calling result.
In one embodiment, the termination condition of the instantiated parameter collector is the parameter collector termination condition function, and the parameter collector termination condition function is generated after all parameters to be called of the target parameter part are classified when the parameter collector compiles.
In a third aspect, the present application also provides a compiling apparatus for classifying parameters, the apparatus comprising:
The parameter wrapper obtaining module is used for obtaining a parameter wrapper obtained by packaging parameters to be called at the compiling period, and the parameter wrapper comprises a parameter type;
and the parameter collector instantiation module is used for classifying parameters to be called, which are packaged by the parameter wrapper, through a recursive template function and a parameter type at the compiling period to obtain at least one multi-element group, instantiating the at least one multi-element group to obtain each instantiated parameter collector, and storing one type of parameters to be called in each multi-element group.
In a fourth aspect, the present application further provides a classification parameter calling device, where the device includes:
And the parameter collector calling module is used for calling the instantiated parameter collectors obtained by the compiling device based on the classification parameters in any one embodiment to obtain at least one multi-element group, wherein the collected parameters to be called are stored in each multi-element group, and the types of the parameters to be called corresponding to each multi-element group are different.
In a fifth aspect, the present application also provides a computer device comprising a memory storing a computer program and a processor implementing the steps of the method described in any one of the embodiments above when the computer program is executed by the processor.
In a sixth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described in any of the embodiments above.
The compiling method, the calling method, the device, the equipment and the program product for classifying parameters, the compiling method, the compiling device, the calling device, the computer equipment and the computer program product for classifying parameters acquire the parameter wrapper obtained by packaging the parameters to be called at the compiling period, the parameter wrapper comprises a parameter type, the parameters to be called packaged by the parameter wrapper are classified by a recursive template function and the parameter type at the compiling period to obtain at least one multi-element group, the at least one multi-element group is instantiated to obtain each instantiated parameter collector, and one class of parameters to be called is stored in each multi-element group, so that the classification of the parameters to be called is realized at the compiling period, the coding is simplified, and the running efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are needed in the description of the embodiments of the present application or the related technologies will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other related drawings may be obtained according to these drawings without inventive effort to those of ordinary skill in the art.
FIG. 1 is an application environment diagram of a compiling method of classification parameters in one embodiment;
FIG. 2 is a flow diagram of a method for compiling classification parameters in one embodiment;
FIG. 3 is a diagram of a parameter wrapper compile information and memory layout in one embodiment;
FIG. 4 is a schematic diagram of a recursive template function in one embodiment;
FIG. 5 is a flow chart illustrating the steps for instantiating a parameter collector in one embodiment;
FIG. 6 is a schematic diagram of the types of parameter entries that are assumed to be invoked in one embodiment;
FIG. 7 is a workflow diagram of tuple type transformation with recursive call type in one embodiment;
FIG. 8 is a flow diagram of a function-specific process for parameter actuator multi-tuple parameter transfer in one embodiment;
FIG. 9 is a compile-time flow diagram in one embodiment;
FIG. 10 is a schematic diagram of a template element programming technique in one embodiment handling different types of parameters;
FIG. 11 is a flow diagram of a method of invoking classification parameters in one embodiment;
FIG. 12 is a user program workflow diagram that is instantiated in one embodiment;
FIG. 13 is a runtime workflow diagram in one embodiment;
FIG. 14 is a diagram of the operation of a subject logic RPC application in one embodiment;
FIG. 15 is a block diagram showing a structure of a compiling apparatus for classifying parameters in one embodiment;
FIG. 16 is a block diagram of an apparatus for invoking classification parameters in one embodiment;
Fig. 17 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The compiling method of the classification parameters provided by the embodiment of the application can be applied to an application environment shown in figure 1. The compiler in this embodiment includes a parameter wrapper, a parameter collector, a parameter executor, and a logic executor. The parameter wrapper is used for adding additional compiling time information for the parameters to be called, wherein the compiling time information comprises parameter types, and the parameter types are used for calling parameter classification. After the calling parameters are packaged, the parameters are transferred to a parameter collector for processing. The parameter collector is a recursive template function which classifies one parameter to be called at a time and recursively transmits the remaining parameters to be called to itself until all parameters to be called are classified, and the termination recursion condition of the parameter collector is satisfied. At this time, the parameter set is stored in the tuples, and the parameter collector satisfying the condition of terminating the recursion passes the target type of tuples to the parameter executor. At this point, the template-based meta-programming method has recursively derived all parameter types and all calling functions that ultimately need to be called.
In the actual code running process, the parameter executor can be dynamically bound with specific calling functions. The logic executor is responsible for calling the parameter executor method according to the expected logic of the user, and the method can change the execution sequence or select not to call in some cases, so that the binding between parameter transmission and calling is stripped, and the instantiated logic executor is an instantiated user program for facilitating understanding. The compiler realizes parameter compiling time classification, and the logic operation determines parameter calling.
In an exemplary embodiment, as shown in fig. 2, a compiling method of classification parameters is provided, including the following steps 202 to 204. Wherein:
S202, acquiring a parameter wrapper obtained by packaging parameters to be called at the compiling period, wherein the parameter wrapper comprises a parameter type.
Parameter wrappers are used to package different types of parameters and may be referred to as parameter wrapper classes. The application corresponding to the target is actually stored in the parameter wrapper, and the parameter type is reserved only in the compiling period, and the parameter wrapper type information can be also called wrapper type information.
In one optional embodiment, before the parameter wrapper obtained by packaging the parameter to be invoked is obtained, the parameter wrapper comprises packaging the parameter to be invoked to obtain the parameter wrapper comprising the reference information of the parameter to be invoked and the parameter type, wherein the parameter type is only reserved in compiling.
Specifically, referring to fig. 3, fig. 3 is a schematic diagram of parameter wrapper compiling information and a memory layout in an embodiment, in which the wrapper class conforms to a zero-overhead abstract design rule, and the memory layout only includes reference information of a parameter to be invoked, for example, an address of the parameter to be invoked, so that the memory occupancy is only that the address of the parameter to be invoked occupies memory, and the runtime overhead is equal to the parameter to be invoked, that is, the memory occupancy in the runtime is the parameter to be invoked. And only parameter wrapper class information, i.e. parameter types, is reserved at compile time, which are compile symbols, no memory occupancy, and only exist at compile time.
S204, classifying parameters to be called packaged by the parameter wrapper through a recursive template function and a parameter type at the compiling period to obtain at least one multi-element group, instantiating the at least one multi-element group to obtain each instantiated parameter collector, and storing one type of parameters to be called in each multi-element group.
The recursive template function is realized based on a template element programming technology, and is used for classifying and collecting parameters to be called packaged by different parameter packagers and calling corresponding processing functions.
Alternatively, the recursive template function is a variable parameter template that may receive any number of parameters to be invoked. Referring to fig. 4, fig. 4 is a schematic diagram of a recursive template function in one embodiment, where the parameter list includes two parts, a first part is a tuple part and a second part is a target parameter part.
Where the tuple portion implements parameter collection to be invoked, the tuple portion of the recursive template function may include at least one tuple (i.e., generic tuple 1, generic tuple 2, etc. in fig. 4), optionally the number of tuples may be set at initialization, the number of tuples being based on the number of parameter types corresponding to the parameter wrapper, e.g., equal to each other. Each tuple in the tuple portion is responsible for the collection of one parameter type. The tuple changes its type when the parameters are collected, so this operation must be implemented using a compile-time syntax. The tuple can comprise a tuple and a tuple, wherein the tuple stores one parameter, the tuple stores a plurality of parameters, and the tuple store the same type of parameters to be called.
The target parameter part is used for dividing the parameter to be called into a parameter to be called (i.e. the target parameter in fig. 4) of the current processing and a parameter to be called of the next processing (i.e. the remaining parameters to be processed in fig. 4) of the recursive call. Because in the recursive template function only one classification of parameters to be invoked is processed at a time. When each specific parameter to be called is processed, the condition processing should be realized by using the compiling period grammar, so that useless code expansion generated by unnecessary code calling is avoided. The parameters to be called in the target parameter portion may be of various types, for example, the parameters to be called may be of the same type, or the parameters to be called may be of different types. Wherein the number of types of parameters to be invoked is less than or equal to the number of tuples of the tuple portion.
The recursive template function in this embodiment classifies only one parameter to be invoked at a time, and obtains a corresponding instantiated parameter collector, specifically, after classifying the parameter to be invoked into a corresponding tuple, instantiating the tuple to obtain a corresponding instantiated parameter collector, and finally obtaining a plurality of instantiated parameter collectors to complete classification of the parameter to be invoked, and then, when running, directly invoking the instantiated parameter collectors, so as to obtain the classified parameter to be invoked.
The compiling method of the classifying parameters obtains the parameter wrapper obtained by packaging the parameters to be invoked at the compiling period, the parameter wrapper comprises the parameter types, the parameters to be invoked packaged by the parameter wrapper are classified by the recursive template function and the parameter types at the compiling period to obtain at least one multi-element group, the at least one multi-element group is instantiated to obtain each instantiated parameter collector, and one class of parameters to be invoked is stored in each multi-element group, so that the classification of the parameters to be invoked is realized at the compiling period, the coding is simplified, and the running efficiency is improved.
In an alternative embodiment, as shown in connection with fig. 5, fig. 5 is a flowchart illustrating an exemplary step of instantiating a parameter collector in an embodiment, where the step of categorizing parameters to be invoked in a parameter wrapper by a recursive template function and a parameter type to obtain at least one tuple, and instantiating the at least one tuple to obtain each instantiated parameter collector includes:
s502, storing parameters to be called into a target parameter part based on the parameter wrapper.
The parameters to be invoked packaged by each parameter wrapper are stored in a target parameter portion, and as described in connection with fig. 6, fig. 6 is a schematic diagram of a type of parameter to be invoked, where the target parameter portion of the parameter list includes each parameter wrapper class, according to an embodiment. Two types of parameter wrappers are included in FIG. 6, namely parameter wrapper A and parameter wrapper B, parameter 1 int and parameter 2double belong to the same parameter type, and parameter 3 bol belongs to another parameter type.
S504, acquiring a current parameter to be called from the target parameter part, and after adding the current parameter to be called to the tuple part based on the parameter type, instantiating the tuple part to obtain a current instantiated parameter collector.
Wherein, in general, the null tuple is one of the entries called by default for the first recursion. For example, the initialized tuple part is recursively called, the current parameters to be called are obtained from the target parameter part, and the current parameters to be called are added to the tuple part based on the parameter type to realize the recursion call, and the tuple part is transformed into various types of tuples. A plurality of groups, i.e. a plurality of objects with the same type of parameters to be called collected for temporary storage. The type of transformation is also a main feature of interface element programming and distinguishing from common runtime code, and any type of transformation cannot be realized through runtime code in static type system languages.
The recursive template function will be classified according to the type provided by the parameter packager, which requires that the incoming parameters be parameter packaged or unwrapped. The wrapped parameters retain the original data references and are additionally accompanied by specific wrapper class information, i.e., parameter types. After the recursive template function performs type comparison on the first parameter to be called, the parameter is determined to be connected in a specific tuple according to the comparison result, and then the tuple part is instantiated to obtain a corresponding instantiated parameter collector.
The method comprises the steps of adding a current to-be-called parameter to a tuple part based on a parameter type, wherein the method comprises the steps of obtaining a first target tuple by adding the current to-be-called parameter to an empty tuple of the tuple part based on the parameter type of the current to-be-called parameter when the current to-be-called parameter is the first to-be-called parameter, and modifying the parameter type of the first target tuple, and adding the current to-be-called parameter to a new empty tuple of the tuple part based on the parameter type of the current to-be-called parameter when the current to-be-called parameter is not the first to-be-called parameter and the parameter type of each tuple in the instantiated tuple part is different from the parameter type of the current to-be-called parameter when the current to-be-called parameter is not the first to-be-called parameter, and the current to-be-called parameter is the same as the parameter type of the current to-be-called parameter.
And under the condition that the current parameter to be called is the first parameter to be called, directly storing the current parameter to be called into a first empty tuple of the tuple part to obtain a first target tuple, and modifying the parameter type of the first target tuple.
And if the current parameter to be called is not the first parameter to be called, determining whether a third target tuple with the same parameter type as the current parameter to be called exists in the target tuple part, if so, directly adding the parameter to be called into the third target tuple, and if not, storing the current parameter to be called into a second empty tuple of the tuple part to obtain a second target tuple, and modifying the parameter type of the second target tuple.
S506, generating a next parameter calling function based on the remaining parameters to be called of the target parameter part.
S508, obtaining a next parameter to be called from the target parameter part based on the next parameter calling function as a current parameter to be called, continuously executing the step of adding the current parameter to be called to the tuple part based on the parameter type, instantiating the tuple part to obtain a current instantiated parameter collector until the parameters to be called of the target parameter part are classified, generating a termination condition, and obtaining the instantiated parameter collectors.
After the current parameters to be called are processed, the recursive template function generates a next parameter calling function based on the remaining parameters to be called in the target parameter part, then acquires the next parameter to be called from the target parameter part based on the next parameter calling function as the current parameters to be called, and continues to execute the steps. And finally, after all parameters to be called of the target parameter part are classified, generating a termination condition, wherein the recursive termination function is responsible for reserving the parameters to be called transmitted in a recursion mode. The recursive template termination function transfers the collected classified parameters to be called to the corresponding functions in the parameter executor.
For ease of understanding, as shown in connection with FIG. 7, FIG. 7 is a workflow diagram of tuple type transformation with recursive call type in one embodiment. The method comprises the steps of firstly using a zero-tuple A and a zero-tuple B to instantiate a parameter collector, then processing a first parameter to be invoked, changing the zero-tuple A into a tuple A1tupe < int > according to a parameter type, then using a tuple A1 and a zero-tuple B to instantiate the parameter collector, acquiring the next parameter based on a parameter invoking function, namely processing the 2 nd parameter to be invoked, changing the tuple A1 into a tuple A2tupe < int, double > according to the parameter type, using the tuple A2 and the zero-tuple B to instantiate the parameter collector, then continuing processing the 3 rd parameter, changing the zero-tuple B into a tuple B1tupe < bool > according to the parameter type, then using the tuple A2 and the tuple B1 to instantiate the parameter collector, entering a termination condition after no parameter is processable, and subsequently using the tuple A2 and the tuple B1 to instantiate the parameter executor.
In the above embodiment, the collection of the compile-time classification of the different types of parameters is realized by the template element programming technology, and the more general function calling method of parameter binding delay calling is realized. The method improves maintainability and readability of codes, reduces logic overhead of parameter classification to a compiling period, does not need running overhead, and has wide application prospect in library programming.
In one optional embodiment, the method further comprises the steps of instantiating a user program, wherein the user program is used for calling each instantiated parameter collector, instantiating calling functions of corresponding types based on at least one multi-element group to obtain each instantiated parameter executor, wherein the calling functions in each instantiated parameter executor are used for calling parameters to be called of corresponding types, and obtaining compiling results based on the instantiated user program, each instantiated parameter collector and each instantiated parameter executor.
Wherein the user program may be for defining the execution order of the subject logic, invoking the instantiated parameter collector and the instantiated parameter executor, respectively, according to the designer's predetermined logic. The designer may design the execution logic as desired.
The parameter executor is a function for processing the classified parameters to be called, and the parameter executor can store a function pointer and transfer the classified parameters to be called to the corresponding calling function through the function pointer, so that the parameters to be called can be processed through the calling function.
The parameter executor parameter acceptance comprises any number and any type of tuples, unpacks the tuples inside the parameter executor and transmits the parameters to the target calling function, so that the compiling period and the running period calling are flexibly supported.
In this embodiment, the instantiated user program may call each instantiated parameter collector in a circulating manner to implement classification of parameters, and subsequently call each instantiated parameter executor corresponding to each parameter type to process the classified parameter to be called, so as to complete call of the parameter to be called.
In one optional embodiment, before instantiating the user program, the method further comprises the steps of configuring the calling sequence and the calling condition of each instantiated parameter executor in the user program, and acquiring the configured user program.
The user program in this embodiment may invoke an instantiated parameter actuator. The call sequence of the instantiated parameter executors is the call sequence of each instantiated parameter executor, and the call sequence of each parameter executor can be defined in the user program. The calling condition comprises that the instantiated parameter executor is called or not called, and the calling condition of each parameter executor can be set in the user program.
The method can change the calling sequence of the parameter executor or select that the parameter executor does not call under certain conditions, thereby stripping the binding of parameter transmission and calling.
In one alternative embodiment, the step of instantiating the calling function of the corresponding type to obtain each instantiated parameter executor based on at least one tuple comprises the steps of obtaining a current tuple from a tuple part and calling a template function in the parameter executor based on the current tuple, instantiating the template function based on the current tuple to obtain a calling function and obtaining an instantiated parameter executor based on the calling function, obtaining a next tuple as the current tuple, and continuing to execute the step of calling the template function in the parameter executor through the current tuple until all the tuples are processed.
Specifically, in conjunction with fig. 8, fig. 8 is a flowchart of a function-specific procedure for parameter transfer of a parameter executor multi-tuple, where the multi-tuple portion includes a plurality of multi-tuples, each multi-tuple is called by a calling function, so that a template function inside the parameter executor can be called by using a specific multi-tuple, for example, a template function inside the parameter executor is called based on a current multi-tuple, for example, a function pointer inside the parameter executor is determined based on the current multi-tuple, then a template function inside the parameter executor is called based on the function pointer, a calling function is obtained based on the current multi-tuple, for example, the parameter executor instantiates a function supporting the multi-tuple, the parameter executor stores the packaged calling function, and then processes the next multi-tuple until each multi-tuple is processed, that is, each instantiated parameter executor is stored as the specific calling function, and instantiation of each parameter executor is achieved.
For ease of understanding, fig. 9 and 10 are combined, where fig. 9 is a compile-time flow diagram in one embodiment, and fig. 10 is a schematic diagram of processing different types of parameters by a template element programming technique in one embodiment.
In fig. 9, at compile time, parameters to be invoked are first packaged to obtain parameter wrappers, each parameter wrapper includes a parameter type and a reference to the parameters to be invoked, and the parameter type exists only at the compile time and is a compile symbol.
Then compiling the current target interface, instantiating the user program, then instantiating a specific parameter collector, generating a target calling function of the next parameter, instantiating the parameter executor based on the multiple groups obtained by the last instantiated parameter collector until the termination condition of the parameter collector is met, judging whether all interfaces are compiled completely, if not, acquiring the next interface, continuing the compiling process, namely instantiating the user program and the like, so as to complete the compiling of the interfaces.
In connection with fig. 10, first, a parameter wrapper packages parameters to be invoked to obtain parameter wrappers corresponding to the parameters to be invoked, where the parameter wrappers include parameter types. The user program is then instantiated for the first time, so that a logic executor is obtained, that is, the instantiated compile-time objective function C is obtained, that is, the instantiated user program, wherein the objective function C is also the user program.
Instantiating the compiling period objective function cluster D for the second time to finally obtain each instantiated parameter collector, wherein the objective function cluster D comprises each parameter collector for parameter classification to be called, according to the method, the parameters to be invoked corresponding to the parameter wrappers are classified in sequence until the termination condition of the parameter collector is met, and the final tuple cluster An and tuple cluster Bm are obtained. The procedure of recursive call is shown in fig. 7, and will not be described here.
The third instantiation is a parameter executor, that is, the compile-time objective functions E and F, where only the parameter executor includes two objective functions E and F in the present application is described as an example, and in other embodiments, the number of objective functions corresponding to the parameter executor may be other values, which is not limited in detail herein.
In an exemplary embodiment, as shown in fig. 11, a method for invoking classification parameters is provided, including the following step 1102. Wherein:
And S1102, calling the instantiated parameter collectors to obtain at least one multi-element group, wherein each multi-element group stores a collected type of parameters to be called, and the types of the parameters to be called corresponding to each multi-element group are different.
The embodiment is a processing procedure in the running process, and when in the running process, each instantiated parameter collector is called to obtain at least one multi-tuple, and because each instantiated parameter collector is used for classifying one parameter to be called, when in the running process, the instantiated parameter collectors are executed in sequence, so that the classification of the calling parameters can be realized.
The result of the classification is at least one multi-element group, each multi-element group can comprise at least one parameter to be called, and the types of the parameters to be called corresponding to each multi-element group are different.
The parameter wrapper obtained by packaging the parameters to be called is obtained at the compiling period, the parameter wrapper comprises the parameter types, the parameters to be called packaged by the parameter wrapper are classified through the recursive template function and the parameter types at the compiling period to obtain at least one multi-element group, the at least one multi-element group is instantiated to obtain each instantiated parameter collector, and one class of parameters to be called is stored in each multi-element group, so that the classification of the parameters to be called is realized at the compiling period, the parameter collectors are directly called to obtain the parameter classification result at the running period, the coding is simplified, and the running efficiency is improved.
In one optional embodiment, calling each instantiated parameter collector to obtain at least one multi-element group comprises the steps of obtaining a current parameter to be called, calling the current instantiated parameter collector to process the current parameter to be called to obtain a current multi-element group, obtaining a next parameter collector to serve as the current instantiated parameter collector, transmitting the remaining parameter to be called to the current instantiated parameter collector, and continuing to execute the step of obtaining the current parameter to be called until the termination condition of the instantiated parameter collector is met, and obtaining the obtained multi-element group.
Specifically, an instantiated parameter collector for processing a first parameter is called at running, then the remaining parameters are transferred to a next instantiated parameter collector to obtain a current multi-element group, the next parameter collector is continuously obtained as the current instantiated parameter collector until the termination condition of the instantiated parameter collector is met, and the obtained multi-element group is obtained.
Optionally, the termination condition of the instantiated parameter collector is a parameter collector termination condition function, and the parameter collector termination condition function is generated after all parameters to be called of the target parameter part are classified when the parameter collector compiles.
In one alternative embodiment, invoking each instantiated parameter collector to obtain at least one tuple further comprises invoking each instantiated parameter collector through an instantiated user program loop to obtain at least one tuple, wherein the instantiated user program is triggered based on the interface invocation instruction after receiving the interface invocation instruction.
In one optional embodiment, the method further comprises the step of calling each instantiated parameter executor in turn through the instantiated user program, and processing the multiple groups of the corresponding parameter types to obtain a calling result.
Referring to fig. 12, fig. 12 is a workflow diagram of an instantiated user program in an embodiment, after an interface is triggered, an instantiated user program is called first, each instantiated parameter collector is circularly called through the instantiated user program to obtain at least one multi-element group, so that each parameter to be called is collected in a classified manner, each instantiated parameter executor is sequentially called through the instantiated user program, and a call result is obtained by processing the multi-element group of the corresponding parameter type.
Referring to fig. 13, fig. 13 is a runtime workflow diagram in an embodiment, where the process of circularly calling each instantiated parameter collector by the instantiated user program to obtain at least one tuple includes calling an instantiated parameter collector that processes a first parameter, then transferring the remaining parameters to a next instantiated parameter collector, determining whether a termination condition function of the instantiated parameter collector is satisfied, if yes, continuing to use the tuple after parameter collection to call the instantiated parameter executor, and finally calling the instantiated parameter executor according to the instantiated user program.
For convenience of understanding, referring to fig. 14, the input and output parameters are respectively classified in a remote procedure call, the input parameter is serialized and the output parameter is deserialized, and two parameter executors can be defined, namely, the serialized executor and the deserialized executor are defined, and parameters are transferred in a parameter collector end processing function, and the specific procedure comprises the steps of calling a logic executor with 5 specific parameter instantiations, namely, an instantiated user program, calling a parameter collector with 1 st parameter processing, transferring the rest 4 parameters to the parameter collector with the next specific instantiation, calling a parameter collector with 2 nd parameter processing, transferring the rest 3 parameters to the parameter collector with the next specific instantiation, calling the parameter collector with the 3 rd parameter processing, transferring the rest 2 parameters to the parameter collector with the next specific instantiation, calling the parameter collector with the 4 th parameter processing, transferring the rest 1 parameter to the parameter collector with the next specific instantiation, waiting for the subsequent parameter to be subjected to the subsequent parameter instantiation to be processed in the specific instantiation, and waiting for the subsequent parameter to be transferred in the subsequent parameter instantiation to the subsequent parameter collector with the next specific instantiation, and waiting for the subsequent parameter to be subjected to the subsequent parameter to the subsequent instantiation is performed in the frame. The parameter collectors used in the calling process are all instantiated parameter collectors, and the parameter executors used in the calling process are all instantiated parameter executors.
In the above embodiment, the collection of the compile-time classification of the different types of parameters is realized by the template element programming technology, and the more general function calling method of parameter binding delay calling is realized. The method improves maintainability and readability of codes, reduces logic overhead of parameter classification to a compiling period, does not need running overhead, and has wide application prospect in library programming.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a compiling device for realizing the classification parameters of the compiling method of the classification parameters, and a calling device for calling the classification parameters of the classifying parameters. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the method, so the specific limitation in the embodiment of the compiling device for one or more classification parameters and the invoking device for the classification parameters provided below can be referred to the limitation of the compiling method for the classification parameters in the above description, and is not repeated here.
In one exemplary embodiment, as shown in FIG. 15, a compiling apparatus for classifying parameters is provided, comprising a parameter wrapper obtaining module 1501 and a parameter collector instantiating module 1502, wherein:
A parameter wrapper obtaining module 1501, configured to obtain, at compile time, a parameter wrapper obtained by packaging a parameter to be invoked, where the parameter wrapper includes a parameter type;
The parameter collector instantiation module 1502 is configured to classify parameters to be invoked packaged by the parameter wrapper at compile time through a recursive template function and a parameter type, obtain at least one tuple, and instantiate the at least one tuple to obtain each instantiated parameter collector, where each tuple stores a class of parameters to be invoked.
In one optional embodiment, the device further comprises a parameter packaging module, configured to package the parameter to be invoked, to obtain a parameter wrapper including the reference information of the parameter to be invoked and the parameter type, where the parameter type is only reserved during compiling.
In one optional embodiment, the parameter collector instantiation module 1502 is specifically configured to store parameters to be invoked to a target parameter portion based on a parameter wrapper, obtain a current parameter to be invoked from the target parameter portion, instantiate the tuple portion to obtain a current instantiated parameter collector after the current parameter to be invoked is added to the tuple portion based on a parameter type, generate a next parameter invocation function based on remaining parameters to be invoked in the target parameter portion, obtain the next parameter to be invoked from the target parameter portion as the current parameter to be invoked based on the next parameter invocation function, and continuously execute the step of instantiating the tuple portion to obtain the current instantiated parameter collector after the current parameter to be invoked is added to the tuple portion based on the parameter type until the parameters to be invoked in the target parameter portion are all classified, generate a termination condition, and obtain each instantiated parameter collector.
In one alternative embodiment, the parameter collector instantiation module 1502 is specifically configured to, when the current parameter to be invoked is the first parameter to be invoked, add the current parameter to be invoked to an empty tuple of the tuple portion to obtain a first target tuple based on the parameter type of the current parameter to be invoked, and modify the parameter type of the first target tuple, and when the current parameter to be invoked is not the first parameter to be invoked and the parameter type of each tuple in the instantiated tuple portion is different from the type of the current parameter to be invoked, add the current parameter to be invoked to a new empty tuple of the tuple portion to obtain a second target tuple based on the parameter type of the current parameter to be invoked, and modify the parameter type of the second target tuple, and when the current parameter to be invoked is not the first parameter to be invoked and there is a parameter type of the third target tuple in the instantiated tuple portion that is the same as the type of the current parameter to be invoked, add the current parameter to the third target tuple.
In one optional embodiment, the user program instantiation module is specifically configured to instantiate a user program, where the user program is configured to call each instantiated parameter collector, instantiate a calling function of a corresponding type based on at least one tuple to obtain each instantiated parameter executor, where the calling function in each instantiated parameter executor is configured to call a parameter to be called of the corresponding type, and obtain a compiling result based on the instantiated user program, each instantiated parameter collector, and each instantiated parameter executor.
In one optional embodiment, the user program instantiation module is specifically configured to obtain a current tuple from the tuple portion, call a template function in the parameter executor based on the current tuple, instantiate the template function based on the current tuple, obtain a call function, and obtain an instantiated parameter executor based on the call function, obtain a next tuple as the current tuple, and continue executing the step of calling the template function in the parameter executor through the current tuple until each tuple is processed.
In one optional embodiment, the device further comprises a configuration module, which is used for configuring the calling sequence and the calling condition of each instantiated parameter executor in the user program, and acquiring the configured user program.
In one exemplary embodiment, as shown in FIG. 16, there is provided a calling device of classification parameters, comprising a parameter collector calling module 1601, wherein:
and the parameter collector calling module 1601 is configured to call each instantiated parameter collector to obtain at least one multi-tuple, where each multi-tuple stores a collected class of parameters to be called, and the type of the parameters to be called corresponding to each multi-tuple is different.
In one optional embodiment, the parameter collector invoking module 1601 is specifically configured to obtain a current parameter to be invoked, invoke a current instantiated parameter collector to process the current parameter to be invoked to obtain a current tuple, obtain a next parameter collector as the current instantiated parameter collector, transfer the remaining parameter to be invoked to the current instantiated parameter collector, and continue to execute the step of obtaining the current parameter to be invoked until the termination condition of the instantiated parameter collector is met, and obtain the obtained tuple.
In one alternative embodiment, the parameter collector invoking module 1601 is specifically configured to loop-invoke each instantiated parameter collector by an instantiated user program to obtain at least one tuple, where the instantiated user program is triggered based on the interface invoking instruction after receiving the interface invoking instruction.
In an optional embodiment, the parameter executor calling module is specifically configured to call each instantiated parameter executor sequentially through an instantiated user program, and process the multiple groups of the corresponding parameter types to obtain a calling result.
In one alternative embodiment, the instantiated termination condition of the parameter collector is a parameter collector termination condition function, which is generated after the parameters to be invoked of the target parameter portion are all classified at the time of compiling the parameter collector.
The above-mentioned compiling means of the classification parameter and the calling means of the classification parameter may be implemented in whole or in part by software, hardware or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In an exemplary embodiment, a computer device, which may be a terminal, is provided, and an internal structure thereof may be as shown in fig. 17. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured 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 and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The Communication interface of the computer device is used for conducting wired or wireless Communication with an external terminal, and the wireless Communication can be realized through WIFI, a mobile cellular network, near field Communication (NEAR FIELD Communication) or other technologies. The computer program, when executed by the processor, implements a compiling method of classification parameters and a calling method of classification parameters. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 17 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile memory and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (RESISTIVE RANDOM ACCESS MEMORY, reRAM), magneto-resistive Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computation, an artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) processor, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the present application.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (16)

1.一种分类参数的编译方法,其特征在于,所述方法包括:1. A method for compiling classification parameters, characterized in that the method comprises: 在编译期获取对待调用参数包装得到的参数包装器,所述参数包装器包括参数类型;Obtaining a parameter wrapper obtained by wrapping the parameters to be called during compile time, wherein the parameter wrapper includes a parameter type; 在编译期通过递归模板函数以及参数类型对所述参数包装器包装的待调用参数进行分类,得到至少一个多元组,并对所述至少一个多元组进行实例化得到各实例化的参数收集器,每个多元组中存储一类待调用参数;其中所述递归模板函数的参数列表包括元组部分和目标参数部分,所述元组部分用于实现待调用参数收集,所述目标参数部分用于将待调用参数分为本次处理的待调用参数和递归调用下次处理的待调用参数。During the compile time, the parameters to be called wrapped by the parameter wrapper are classified by the recursive template function and the parameter type to obtain at least one tuple, and the at least one tuple is instantiated to obtain each instantiated parameter collector, each tuple stores a type of parameters to be called; wherein the parameter list of the recursive template function includes a tuple part and a target parameter part, the tuple part is used to realize the collection of parameters to be called, and the target parameter part is used to divide the parameters to be called into the parameters to be called for this processing and the parameters to be called for the next processing of the recursive call. 2.根据权利要求1所述的方法,其特征在于,所述获取对待调用参数包装得到的参数包装器之前,包括:2. The method according to claim 1, characterized in that before obtaining the parameter wrapper obtained by wrapping the parameter to be called, it comprises: 对待调用参数进行包装,得到包括所述待调用参数的引用信息和参数类型的参数包装器,其中,所述参数类型仅在编译时保留。The parameter to be called is packaged to obtain a parameter wrapper including reference information and parameter type of the parameter to be called, wherein the parameter type is only retained during compilation. 3.根据权利要求1所述的方法,其特征在于,所述通过递归模板函数以及参数类型对所述参数包装器包装的待调用参数进行分类,得到至少一个多元组,并对所述至少一个多元组进行实例化得到各实例化的参数收集器,包括:3. The method according to claim 1, characterized in that the method classifies the parameters to be called wrapped by the parameter wrapper by recursive template functions and parameter types to obtain at least one tuple, and instantiates the at least one tuple to obtain each instantiated parameter collector, comprising: 基于所述参数包装器,将待调用参数存储至目标参数部分;Based on the parameter wrapper, storing the parameters to be called into the target parameter part; 从所述目标参数部分获取当前待调用参数,并基于所述参数类型将所述当前待调用参数添加至所述元组部分后,实例化所述元组部分得到当前实例化的参数收集器;Acquire the current parameter to be called from the target parameter part, add the current parameter to be called to the tuple part based on the parameter type, and then instantiate the tuple part to obtain a currently instantiated parameter collector; 基于所述目标参数部分剩余的待调用参数生成下一参数调用函数;Generate a next parameter calling function based on the remaining parameters to be called in the target parameter part; 基于所述下一参数调用函数从所述目标参数部分中获取下一待调用参数作为当前待调用参数,并继续执行基于所述参数类型将所述当前待调用参数添加至所述元组部分后,实例化所述元组部分得到当前实例化的参数收集器的步骤,直至所述目标参数部分的待调用参数均被分类完成后,生成终止条件,并获取各实例化的参数收集器。Based on the next parameter, the function is called to obtain the next parameter to be called from the target parameter part as the current parameter to be called, and continues to add the current parameter to be called to the tuple part based on the parameter type, and then instantiates the tuple part to obtain the currently instantiated parameter collector, until all the parameters to be called in the target parameter part are classified, generate a termination condition, and obtain each instantiated parameter collector. 4.根据权利要求3所述的方法,其特征在于,所述基于所述参数类型将所述当前待调用参数添加至所述元组部分,包括:4. The method according to claim 3, characterized in that the adding the current parameter to be called to the tuple part based on the parameter type comprises: 在所述当前待调用参数为第一个待调用参数的情况下,基于所述当前待调用参数的参数类型,将所述当前待调用参数添加至所述元组部分的一空元组中得到第一目标元组,并修改所述第一目标元组的参数类型;In the case where the current parameter to be called is the first parameter to be called, based on the parameter type of the current parameter to be called, the current parameter to be called is added to an empty tuple of the tuple part to obtain a first target tuple, and the parameter type of the first target tuple is modified; 在所述当前待调用参数不为第一个待调用参数,且已经实例化的元组部分中各元组的参数类型与所述当前待调用参数的参数类型均不相同的情况下,基于所述当前待调用参数的参数类型,将所述当前待调用参数添加至所述元组部分的一新的空元组中得到第二目标元组,并修改所述第二目标元组的参数类型;In the case where the current parameter to be called is not the first parameter to be called, and the parameter types of the tuples in the instantiated tuple part are all different from the parameter type of the current parameter to be called, based on the parameter type of the current parameter to be called, the current parameter to be called is added to a new empty tuple in the tuple part to obtain a second target tuple, and the parameter type of the second target tuple is modified; 在所述当前待调用参数不为第一个待调用参数,且存在已经实例化的元组部分中第三目标元组的参数类型与所述当前待调用参数的参数类型相同的情况下,将所述当前待调用参数添加至所述第三目标元组中。When the current parameter to be called is not the first parameter to be called, and there is a third target tuple in the instantiated tuple part whose parameter type is the same as the parameter type of the current parameter to be called, the current parameter to be called is added to the third target tuple. 5.根据权利要求3所述的方法,其特征在于,所述方法还包括:5. The method according to claim 3, characterized in that the method further comprises: 实例化用户程序,所述用户程序用于调用各实例化的参数收集器;Instantiating a user program, wherein the user program is used to call each instantiated parameter collector; 基于所述至少一个多元组,实例化对应类型的调用函数得到各实例化的参数执行器;所述各实例化的参数执行器中的调用函数用于调用对应类型的所述待调用参数;Based on the at least one tuple, instantiate a corresponding type of calling function to obtain each instantiated parameter executor; the calling function in each instantiated parameter executor is used to call the corresponding type of the to-be-called parameter; 基于实例化的所述用户程序、各实例化的所述参数收集器以及各实例化的所述参数执行器得到编译结果。A compilation result is obtained based on the instantiated user program, each instantiated parameter collector, and each instantiated parameter executor. 6.根据权利要求5所述的方法,其特征在于,所述基于所述至少一个多元组,实例化对应类型的调用函数得到各实例化的参数执行器,包括:6. The method according to claim 5, characterized in that instantiating a corresponding type of calling function based on the at least one tuple to obtain each instantiated parameter executor comprises: 从所述元组部分中获取当前多元组,并基于所述当前多元组调用参数执行器内部的模板函数;Obtaining a current tuple from the tuple part, and calling a template function inside the parameter executor based on the current tuple; 基于所述当前多元组实例化所述模板函数,得到调用函数,并基于所述调用函数得到实例化的参数执行器;Instantiating the template function based on the current tuple to obtain a calling function, and obtaining an instantiated parameter executor based on the calling function; 获取下一多元组作为当前多元组,并继续执行通过当前多元组调用参数执行器内部的模板函数的步骤,直至各所述多元组均处理完成。The next tuple is obtained as the current tuple, and the step of calling the template function inside the parameter executor through the current tuple is continued until all the tuples are processed. 7.根据权利要求5所述的方法,其特征在于,所述实例化用户程序之前,还包括:7. The method according to claim 5, characterized in that before instantiating the user program, it also includes: 对所述用户程序中各实例化的参数执行器的调用顺序以及调用情况进行配置;Configure the calling order and calling status of each instantiated parameter executor in the user program; 获取配置后的所述用户程序。Obtain the configured user program. 8.一种分类参数调用方法,其特征在于,所述方法包括:8. A classification parameter calling method, characterized in that the method comprises: 调用基于权利要求1至7任意一项所述的分类参数的编译方法得到的各实例化的参数收集器,得到至少一个多元组,其中每一所述多元组中存储有收集的一类待调用参数,每个所述多元组对应的待调用参数的类型不同。Call each instantiated parameter collector obtained by the compilation method based on the classification parameters described in any one of claims 1 to 7 to obtain at least one tuple, wherein each of the tuples stores a class of collected parameters to be called, and the type of parameters to be called corresponding to each of the tuples is different. 9.根据权利要求8所述的方法,其特征在于,所述调用各实例化的参数收集器,得到至少一个多元组,包括:9. The method according to claim 8, characterized in that the calling of each instantiated parameter collector to obtain at least one tuple comprises: 获取当前待调用参数,并调用当前实例化的参数收集器对所述当前待调用参数进行处理,得到当前多元组;Obtain the current parameters to be called, and call the currently instantiated parameter collector to process the current parameters to be called to obtain the current tuple; 获取下一参数收集器作为当前实例化的参数收集器;Get the next parameter collector as the currently instantiated parameter collector; 将剩余待调用参数传递至所述当前实例化的参数收集器,并继续执行获取当前待调用参数的步骤,直至满足所述实例化的参数收集器的终止条件后,获取得到的多元组。The remaining parameters to be called are passed to the currently instantiated parameter collector, and the step of obtaining the currently instantiated parameters to be called is continued until the termination condition of the instantiated parameter collector is met, and the obtained tuple is obtained. 10.根据权利要求8所述的方法,其特征在于,所述调用各实例化的参数收集器,得到至少一个多元组,还包括:10. The method according to claim 8, characterized in that the calling of each instantiated parameter collector to obtain at least one tuple further comprises: 通过实例化的用户程序循环调用各实例化的参数收集器,得到至少一个多元组,其中所述实例化的用户程序是在接收接口调用指令后,基于所述接口调用指令触发的。At least one tuple is obtained by cyclically calling each instantiated parameter collector through an instantiated user program, wherein the instantiated user program is triggered based on the interface calling instruction after receiving the interface calling instruction. 11.根据权利要求10所述的方法,其特征在于,所述方法还包括:11. The method according to claim 10, characterized in that the method further comprises: 通过所述实例化的用户程序依次调用各实例化的参数执行器,对相应参数类型的所述多元组进行处理得到调用结果。Each instantiated parameter executor is called in sequence through the instantiated user program, and the tuple of corresponding parameter types is processed to obtain a calling result. 12.根据权利要求8所述的方法,其特征在于,所述实例化的参数收集器的终止条件为所述参数收集器终止条件函数,所述参数收集器终止条件函数是在所述参数收集器编译时目标参数部分的待调用参数均被分类完成后生成的。12. The method according to claim 8 is characterized in that the termination condition of the instantiated parameter collector is the parameter collector termination condition function, and the parameter collector termination condition function is generated after all the to-be-called parameters of the target parameter part are classified when the parameter collector is compiled. 13.一种分类参数的编译装置,其特征在于,所述装置包括:13. A device for compiling classification parameters, characterized in that the device comprises: 参数包装器获取模块,用于在编译期获取对待调用参数包装得到的参数包装器,所述参数包装器包括参数类型;A parameter wrapper acquisition module, used to acquire a parameter wrapper obtained by wrapping the parameters to be called during compilation, wherein the parameter wrapper includes a parameter type; 参数收集器实例化模块,用于在编译期通过递归模板函数以及参数类型对所述参数包装器包装的待调用参数进行分类,得到至少一个多元组,并对所述至少一个多元组进行实例化得到各实例化的参数收集器,每个多元组中存储一类待调用参数;其中所述递归模板函数的参数列表包括元组部分和目标参数部分,所述元组部分用于实现待调用参数收集,所述目标参数部分用于将待调用参数分为本次处理的待调用参数和递归调用下次处理的待调用参数。A parameter collector instantiation module is used to classify the parameters to be called wrapped by the parameter wrapper through the recursive template function and the parameter type during the compilation period to obtain at least one tuple, and to instantiate the at least one tuple to obtain each instantiated parameter collector, each tuple storing a type of parameters to be called; wherein the parameter list of the recursive template function includes a tuple part and a target parameter part, the tuple part is used to realize the collection of parameters to be called, and the target parameter part is used to divide the parameters to be called into the parameters to be called for this processing and the parameters to be called for the next processing of the recursive call. 14.一种分类参数调用装置,其特征在于,所述装置包括:14. A classification parameter calling device, characterized in that the device comprises: 参数收集器调用模块,用于调用基于权利要求13所述的分类参数的编译装置得到的各实例化的参数收集器,得到至少一个多元组,其中每一所述多元组中存储有收集的一类待调用参数,每个所述多元组对应的待调用参数的类型不同。A parameter collector calling module is used to call each instantiated parameter collector obtained by the compilation device based on the classification parameters described in claim 13 to obtain at least one tuple, wherein each of the tuples stores a class of collected parameters to be called, and the type of parameters to be called corresponding to each tuple is different. 15.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7或8至12中任一项所述的方法的步骤。15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 7 or 8 to 12 when executing the computer program. 16.一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求1至7或8至12中任一项所述的方法的步骤。16. A computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 or 8 to 12 are implemented.
CN202411405893.8A 2024-10-10 2024-10-10 Compiling method, calling method, device, equipment and program product of classification parameters Active CN118939275B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411405893.8A CN118939275B (en) 2024-10-10 2024-10-10 Compiling method, calling method, device, equipment and program product of classification parameters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411405893.8A CN118939275B (en) 2024-10-10 2024-10-10 Compiling method, calling method, device, equipment and program product of classification parameters

Publications (2)

Publication Number Publication Date
CN118939275A CN118939275A (en) 2024-11-12
CN118939275B true CN118939275B (en) 2025-01-24

Family

ID=93348703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411405893.8A Active CN118939275B (en) 2024-10-10 2024-10-10 Compiling method, calling method, device, equipment and program product of classification parameters

Country Status (1)

Country Link
CN (1) CN118939275B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108633310A (en) * 2015-07-31 2018-10-09 慧与发展有限责任合伙企业 Scheduling is executed based on classification
CN110383247A (en) * 2017-04-28 2019-10-25 伊纽迈茨有限公司 Method, computer-readable medium and heterogeneous computing system performed by computer

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5905894A (en) * 1997-10-29 1999-05-18 Microsoft Corporation Meta-programming methods and apparatus
CN115185533A (en) * 2022-07-14 2022-10-14 龙芯中科技术股份有限公司 Compiling processing method, device and equipment
CN118170385A (en) * 2022-12-09 2024-06-11 腾讯科技(深圳)有限公司 Code compiling method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108633310A (en) * 2015-07-31 2018-10-09 慧与发展有限责任合伙企业 Scheduling is executed based on classification
CN110383247A (en) * 2017-04-28 2019-10-25 伊纽迈茨有限公司 Method, computer-readable medium and heterogeneous computing system performed by computer

Also Published As

Publication number Publication date
CN118939275A (en) 2024-11-12

Similar Documents

Publication Publication Date Title
US11010681B2 (en) Distributed computing system, and data transmission method and apparatus in distributed computing system
CN106663010B (en) Execute graph-based program specification
CN107077364B (en) Compilation of graph-based program specifications using automatic clustering of graph components based on identification of specific data port connections
US20100162230A1 (en) Distributed computing system for large-scale data handling
CN113177034B (en) A cross-platform unified distributed graph data processing method
US20090037478A1 (en) Dependency processing of computer files
CN110457260A (en) File processing method, device, device, and computer-readable storage medium
US11907296B2 (en) Method and system for traversing an object graph using traversal context objects
CN113946321B (en) Processing method of computing logic, electronic device and readable storage medium
CN111104120A (en) Neural network compiling method and system and corresponding heterogeneous computing platform
CN111966383B (en) Method, system and medium for quantitatively analyzing kernel compatibility of operating system
WO2023124425A1 (en) Data processing method and apparatus, electronic device, and storage medium
US20090204953A1 (en) Transforming data structures between different programming languages
CN115934093A (en) Applet cross-terminal application method, related device and computer storage medium
US20090007115A1 (en) Method and apparatus for parallel XSL transformation with low contention and load balancing
CN118939275B (en) Compiling method, calling method, device, equipment and program product of classification parameters
CN113835904A (en) Remote procedure call control method, device, equipment and storage medium
WO2024046458A1 (en) Hierarchical system, operation method and apparatus, and electronic device and storage medium
CN108804088B (en) Protocol processing method and device
CN113688982A (en) Processing unit, related device and method
CN116578287A (en) Service processing method, intelligent terminal and storage medium
CN114328486A (en) Data quality checking method and device based on model
CN115729648A (en) Operator scheduling method, device and system based on directed acyclic graph
US20240281737A1 (en) Data compilation and execution device and data compilation and execution method
CN119002928B (en) DOTS-oriented structure optimization method, system, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant