Background
The SDK (software development kit) is specified for external API (application programming interface) interfaces, for example, a click is called in a statistics service, an exposure buried point interface needs to be called after a PV operation, and the like, and if the calling sequence is not specified, a data concatenation error may be caused, for example, a click or an exposure event is matched to an error page, and the like.
Disclosure of Invention
The embodiment of the disclosure provides a code running method, a code running device and electronic equipment, which are used for simulating a real function calling sequence in a compiling period and reducing the problem of call nonstandard API (application program interface).
According to a first aspect of embodiments of the present disclosure, there is provided a code execution method, including:
acquiring a code file corresponding to a compiled code and an original calling sequence corresponding to the code file;
adjusting the original calling sequence into a target calling sequence according to the execution process of the compiled code;
and calling the code file according to the target calling sequence to run the compiled code.
Optionally, the obtaining a code file corresponding to the compiled code and an original calling sequence corresponding to the code file include:
acquiring the code file;
and determining the original calling sequence of the code file according to the compiling sequence corresponding to the code file.
Optionally, the adjusting the original calling sequence to a target calling sequence according to the execution process of the compiled code includes:
determining a target calling sequence corresponding to the compiled code according to the execution process of the compiled code;
and adjusting the original calling sequence corresponding to the code file into the target calling sequence.
Optionally, after the adjusting the original calling sequence to a target calling sequence according to the execution process of the compiled code, the method further includes:
calling the code file according to the target calling sequence to simulate and run the compiled code;
and determining the calling accuracy of the target calling sequence according to the simulation operation result.
According to a second aspect of embodiments of the present disclosure, there is provided a code execution apparatus including:
the system comprises an original calling sequence acquisition module, a compiling module and a calling module, wherein the original calling sequence acquisition module is used for acquiring a code file corresponding to a compiling code and an original calling sequence corresponding to the code file;
a target calling sequence adjusting module, configured to adjust the original calling sequence to a target calling sequence according to the execution process of the compiled code;
and the compiled code running module is used for calling the code file according to the target calling sequence so as to run the compiled code.
Optionally, the original calling sequence obtaining module includes:
a code file acquiring unit for acquiring the code file;
and the original calling sequence determining unit is used for determining the original calling sequence of the code file according to the compiling sequence corresponding to the code file.
Optionally, the target call order adjusting module includes:
a target calling sequence determining unit, configured to determine a target calling sequence corresponding to the compiled code according to an execution process of the compiled code;
and the target calling sequence adjusting unit is used for adjusting the original calling sequence corresponding to the code file into the target calling sequence.
Optionally, the method further comprises:
the code file simulation operation module is used for calling the code file according to the target calling sequence so as to simulate and operate the compiled code;
and the calling accuracy determining module is used for determining the calling accuracy of the target calling sequence according to the simulation operation result.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the code execution method of any one of the above when executing the program.
According to a fourth aspect of embodiments of the present disclosure, there is provided a readable storage medium, wherein instructions of the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform any one of the code execution methods described above.
The embodiment of the disclosure provides a code running scheme, which is to adjust an original calling sequence to a target calling sequence according to an execution process of a compiled code by acquiring a code file corresponding to the compiled code and the original calling sequence corresponding to the code file, and call the code file according to the target calling sequence to run the compiled code. The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
Detailed Description
Technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
Referring to fig. 1, a flowchart illustrating steps of a code running method provided by an embodiment of the present disclosure is shown, and as shown in fig. 1, the code running method may specifically include the following steps:
step 101: and acquiring a code file corresponding to the compiled code and an original calling sequence corresponding to the code file.
Embodiments of the present disclosure may be applied in scenarios where the code is run in the order of the actual calls of the simulation code file during code compilation.
Compiled code refers to code compiled by a business person, such as "objc (cs) yyy (cm) getEnv: callback: bridge type", and the like.
The code file refers to a file corresponding to a compiled code stored in the system, and specifically, in a process of compiling the code by service personnel, the corresponding code file may be stored, a section of programming code may include a plurality of code files, and in a specific implementation, in a process of compiling the code project, a file corresponding to a compiled parameter may be automatically generated, and a file name corresponding to each file may be generated.
The original calling sequence refers to the calling sequence of the code file determined according to the compiling sequence of the compiled code in the running process of the compiled code.
In this embodiment, after the compiled code compiled by the service staff is obtained, a code file corresponding to the compiled code may be obtained, and an original calling order of the code file may be determined by combining a compiling sequence of the compiled code, for example, the compiled code may include three sections of codes, which are a code a, a code b, and a code c in sequence according to the compiling sequence, where the code a corresponds to the code file 1, the code b corresponds to the code file 2, and the code b corresponds to the code file 3, and the code b runs line by line in a running process of the compiled code, and the original calling orders of the three code files are the code file 1, the code file 2, and the code file 3.
It should be understood that the above examples are only examples for better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitation to the embodiments.
After the code file corresponding to the compiled code and the original calling sequence corresponding to the code file are obtained, step 102 is executed.
Step 102: and adjusting the original calling sequence into a target calling sequence according to the execution process of the compiled code.
The execution process refers to the real execution sequence of the compiled code, and the target calling sequence refers to the real calling sequence of the code file determined by combining the real execution sequence.
After a code file corresponding to a compiled code and an original calling sequence corresponding to the code file are obtained, a target calling sequence corresponding to the code file, namely an actual calling sequence of the code file, can be determined according to an execution process of the compiled code, for example, the code file comprises a code file 1, a code file 2 and a code file 3, wherein in the running process of the compiled code, the code file runs line by line, and the original calling sequences of the three code files are the code file 1, the code file 2 and the code file 3; and in the actual execution process, the actual calling sequence of the three code files is code file 2, code file 1 and code file 3.
After determining the target calling sequence of the code file, the original calling sequence of the code file may be adjusted to the target calling sequence, for example, the code file includes code file 1, code file 2, and code file 3, the original calling sequences of the three code files are code file 1, code file 2, and code file 3, and during the actual execution process, the actual calling sequences of the three code files are code file 2, code file 1, and code file 3, at this time, the original calling sequences of the three code files may be adjusted to the target calling sequence, that is, the sequence of the adjusted code files is code file 2, code file 1, and code file 3.
It should be understood that the above examples are only examples for better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitation to the embodiments.
After the original calling order is adjusted to the target calling order according to the execution process of the compiled code, step 103 is executed.
Step 103: and calling the code file according to the target calling sequence to run the compiled code.
After the original calling sequence is adjusted to the target calling sequence, the code file can be called according to the target calling sequence in the process of running the compiled code according to the running of the compiled code, so that the running of the compiled code is completed.
The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
According to the code running method provided by the embodiment of the disclosure, the code file corresponding to the compiled code and the original calling sequence corresponding to the code file are obtained, the original calling sequence is adjusted to the target calling sequence according to the execution process of the compiled code, and the code file is called according to the target calling sequence so as to run the compiled code. The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
Referring to fig. 2, a flowchart illustrating steps of another code execution method provided by an embodiment of the present disclosure is shown, and as shown in fig. 2, the code execution method may specifically include the following steps:
step 201: and acquiring the code file.
The embodiment of the disclosure can be applied to a scene of simulating real calling sequence running codes of a code file in the code compiling period.
Compiled code refers to code compiled by a business person, such as "objc (cs) yyy (cm) getEnv: callback: bridge type", and the like.
The code file refers to a file corresponding to a compiled code stored in the system, and specifically, in a process of compiling the code by service personnel, the corresponding code file may be stored, a section of programming code may include a plurality of code files, and in a specific implementation, in a process of compiling the code project, a file corresponding to a compiled parameter may be automatically generated, and a file name corresponding to each file may be generated.
In this embodiment, after the compiled code compiled by the service staff is obtained, a code file corresponding to the compiled code may be obtained, and then step 202 is executed.
Step 202: and determining the original calling sequence of the code file according to the compiling sequence corresponding to the code file.
The compiling order refers to the compiling order of the code file, namely the writing order of the compiled code.
The original calling sequence refers to the calling sequence of the code file determined according to the compiling sequence of the compiled code in the running process of the compiled code.
In this embodiment, after the compiled code compiled by the service staff is obtained, a code file corresponding to the compiled code may be obtained, and an original calling order of the code file may be determined by combining a compiling sequence of the compiled code, for example, the compiled code may include three sections of codes, which are a code a, a code b, and a code c in sequence according to the compiling sequence, where the code a corresponds to the code file 1, the code b corresponds to the code file 2, and the code b corresponds to the code file 3, and the code b runs line by line in a running process of the compiled code, and the original calling orders of the three code files are the code file 1, the code file 2, and the code file 3.
It should be understood that the above examples are only examples for better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitation to the embodiments.
After the code file corresponding to the compiled code and the original calling sequence corresponding to the code file are obtained, step 203 is executed.
Step 203: and determining a target calling sequence corresponding to the compiled code according to the execution process of the compiled code.
The execution process refers to the real execution sequence of the compiled code, and the target calling sequence refers to the real calling sequence of the code file determined by combining the real execution sequence.
After a code file corresponding to a compiled code and an original calling sequence corresponding to the code file are obtained, a target calling sequence corresponding to the code file, namely an actual calling sequence of the code file, can be determined according to an execution process of the compiled code, for example, the code file comprises a code file 1, a code file 2 and a code file 3, wherein in the running process of the compiled code, the code file runs line by line, and the original calling sequences of the three code files are the code file 1, the code file 2 and the code file 3; and in the actual execution process, the actual calling sequence of the three code files is code file 2, code file 1 and code file 3.
After determining the target call sequence corresponding to the compiled code according to the execution process of the compiled code, step 204 is executed.
Step 204: and adjusting the original calling sequence corresponding to the code file into the target calling sequence.
After determining the target calling sequence of the code file, the original calling sequence of the code file may be adjusted to the target calling sequence, for example, the code file includes code file 1, code file 2, and code file 3, the original calling sequences of the three code files are code file 1, code file 2, and code file 3, and during the actual execution process, the actual calling sequences of the three code files are code file 2, code file 1, and code file 3, at this time, the original calling sequences of the three code files may be adjusted to the target calling sequence, that is, the sequence of the adjusted code files is code file 2, code file 1, and code file 3.
It should be understood that the above examples are only examples for better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitation to the embodiments.
After the original calling order is adjusted to the target calling order according to the execution process of the compiled code, step 205 is executed.
Step 205: and calling the code file according to the target calling sequence to simulate and run the compiled code.
After the target calling sequence corresponding to the code file is obtained, the compiled code can be simulated to run so as to verify the accuracy of the target calling sequence.
After the original calling sequence corresponding to the code file is adjusted to the target calling sequence, the compiled code can be simulated and run, and in the process of simulating running, the code file can be called according to the target calling sequence to finish running of the compiled code.
Step 206: and determining the calling accuracy of the target calling sequence according to the simulation operation result.
The calling accuracy refers to a degree for determining whether the target calling order is accurate.
After the compiled code is simulated and run, the calling accuracy of the target calling sequence can be determined according to the simulation running result, for example, when no abnormality occurs in the simulation running result, the adjusted target calling sequence is considered to be more accurate, and the compiled code can be run normally. And when a plurality of abnormal positions appear in the simulation operation result, the accuracy of the adjusted target calling sequence is considered to be low, and at the moment, the target calling sequence can be adjusted again according to the abnormal positions.
Step 207: and calling the code file according to the target calling sequence to run the compiled code.
After the original calling sequence is adjusted to the target calling sequence, the code file can be called according to the target calling sequence in the process of running the compiled code according to the running of the compiled code, so that the running of the compiled code is completed.
The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
According to the code running method provided by the embodiment of the disclosure, the code file corresponding to the compiled code and the original calling sequence corresponding to the code file are obtained, the original calling sequence is adjusted to the target calling sequence according to the execution process of the compiled code, and the code file is called according to the target calling sequence so as to run the compiled code. The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
Referring to fig. 3, a schematic structural diagram of a code running apparatus provided in an embodiment of the present disclosure is shown, and as shown in fig. 3, the code running apparatus 300 may specifically include the following modules:
an original calling sequence obtaining module 310, configured to obtain a code file corresponding to a compiled code and an original calling sequence corresponding to the code file;
a target calling sequence adjusting module 320, configured to adjust the original calling sequence to a target calling sequence according to the execution process of the compiled code;
and the compiled code running module 330 is configured to call the code file according to the target call sequence to run the compiled code.
According to the code running device provided by the embodiment of the disclosure, the original calling sequence is adjusted to the target calling sequence according to the execution process of the compiled code by acquiring the code file corresponding to the compiled code and the original calling sequence corresponding to the code file, and the code file is called according to the target calling sequence to run the compiled code. The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
Referring to fig. 4, a schematic structural diagram of another code running apparatus provided in the embodiment of the present disclosure is shown, and as shown in fig. 4, the code running apparatus 400 may specifically include the following modules:
an original calling sequence obtaining module 410, configured to obtain a code file corresponding to the compiled code and an original calling sequence corresponding to the code file;
a target calling sequence adjusting module 420, configured to adjust the original calling sequence to a target calling sequence according to the execution process of the compiled code;
a code file simulation operation module 430, configured to invoke the code file according to the target invocation sequence, so as to simulate and operate the compiled code;
a calling accuracy determining module 440, configured to determine a calling accuracy of the target calling sequence according to the simulation operation result;
and a compiled code running module 450, configured to call the code file according to the target call sequence to run the compiled code.
Optionally, the original call order obtaining module 410 includes:
a code file acquiring unit 411 for acquiring the code file;
and an original calling order determining unit 412, configured to determine an original calling order of the code file according to the compiling order corresponding to the code file.
Optionally, the target call order adjusting module 420 includes:
a target call sequence determining unit 421, configured to determine a target call sequence corresponding to the compiled code according to the execution process of the compiled code;
a target call sequence adjusting unit 422, configured to adjust an original call sequence corresponding to the code file to the target call sequence.
According to the code running device provided by the embodiment of the disclosure, the original calling sequence is adjusted to the target calling sequence according to the execution process of the compiled code by acquiring the code file corresponding to the compiled code and the original calling sequence corresponding to the code file, and the code file is called according to the target calling sequence to run the compiled code. The embodiment of the disclosure can reduce the problem of abnormal operation of the original code by simulating the real calling sequence of the code file in the code compiling period.
An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the code execution method of the foregoing embodiments when executing the program.
Embodiments of the present disclosure also provide a readable storage medium, in which instructions are executed by a processor of an electronic device to enable the electronic device to perform the code execution method of the foregoing embodiments.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present disclosure are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the embodiments of the present disclosure as described herein, and any descriptions of specific languages are provided above to disclose the best modes of the embodiments of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of the embodiments of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, claimed embodiments of the disclosure require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of an embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be understood by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a motion picture generating device according to an embodiment of the present disclosure. Embodiments of the present disclosure may also be implemented as an apparatus or device program for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present disclosure may be stored on a computer readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit embodiments of the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present disclosure and is not to be construed as limiting the embodiments of the present disclosure, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the embodiments of the present disclosure are intended to be included within the scope of the embodiments of the present disclosure.
The above description is only a specific implementation of the embodiments of the present disclosure, but the scope of the embodiments of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present disclosure, and all the changes or substitutions should be covered by the scope of the embodiments of the present disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.