Code processing method, code cross-architecture compiling method and computing equipment

By integrating processing tools for multiple operating systems and architectures into the code processing component, it automatically adapts to the target operating system and architecture, solving the problem of low compilation efficiency in the existing technology and realizing efficient adaptation and adaptation of code on multiple platforms. Simplify development.

CN118535167AInactive Publication Date: 2024-08-23JISHU (HANGZHOU) TECH CO LTD

Patent Information

Application Number
CN202410983542.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-08-23
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing compilation technology is inefficient in multi-platform support and requires manual modification and configuration of code. It is difficult to ensure the consistency and performance of the code across different platforms. Multi-language support is complex, resulting in heavy workload for developers.

Method used

Provide a code processing method and code cross-architecture compilation method. By integrating the processing suites and compilation suites of multiple operating systems in the code processing component, using processing tools and compilation tools that support multiple architectures, it can automatically adapt to the target operating system and architecture to generate target code that supports running on multiple platforms.

Benefits of technology

It improves the adaptability and efficiency of code processing and compilation results, reduces the need for manual adaptation of the operating system and architecture, simplifies the development process, and realizes the concept of writing once and running everywhere.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535167A
    Figure CN118535167A
Patent Text Reader

Abstract

The embodiment of the invention provides a code processing method, a code cross-architecture compiling method and computing equipment, the code processing method is applied to a code processing end, the code processing end comprises a code processing component, the code processing component is integrated with a processing suite of a plurality of operating systems, and the processing suite comprises a processing tool supporting a plurality of architectures; the method comprises the following steps: receiving a source code to be processed; and inputting the source code into the code processing component, calling the processing tool of the target processing suite to process the source code through the code processing component, and obtaining a target code supporting operation on the target architecture. When the source code is input into the code processing component, the suite integrated in the code processing component and the tool integrated in the suite are utilized to generate the target code applied to various operating systems and various architectures, so that the suitability and efficiency of a code processing result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular to a code processing method, a code cross-architecture compilation method, and a computing device. Background Art

[0002] With the development of technology, software products developed by programming languages ​​need to run on multiple operating systems and hardware platforms, especially in scenarios that require high performance and close to hardware-level operations. Programming languages ​​are widely used in system software, game development, embedded systems and other fields due to their powerful performance and flexibility.

[0003] However, different hardware platforms have different degrees of adaptability to programming codes, and programmers are usually required to process the code separately for each hardware platform in order to obtain programming code that is compatible with the hardware platform. For example, in software code compilation applications, traditional compilation methods usually require developers to manually compile and optimize the code for each target platform. This process is not only time-consuming but also inefficient, especially when facing multiple operating systems and multiple architectures. Therefore, there is an urgent need for a code processing method that improves adaptability. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a code processing method. One or more embodiments of the present invention also relate to a code cross-architecture compilation method, a code processing device, a code cross-architecture compilation device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.

[0005] According to a first aspect of an embodiment of the present invention, there is provided a code processing method, which is applied to a code processing terminal, wherein the code processing terminal includes a code processing component, wherein the code processing component integrates a processing suite of multiple operating systems, wherein the processing suite includes a processing tool that supports multiple architectures; the method includes: receiving source code to be processed; The source code is input into the code processing component, and the code processing component calls the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

[0006] According to a second aspect of an embodiment of the present invention, a method for cross-architecture code compilation is provided, which is applied to a code compilation end, wherein the code compilation end includes a code compilation component, wherein the code compilation component integrates compilation suites of multiple operating systems, and the compilation suite includes compilation tools that support multiple architectures; the method includes: receiving source code to be compiled; The source code is input into the code compiling component, and the code compiling component calls the compiling tool of the target compiling suite to compile the source code to obtain the target code that supports running on the target architecture.

[0007] According to a third aspect of an embodiment of the present invention, there is provided a code processing device, which is applied to a code processing end, wherein the code processing end includes a code processing component, wherein the code processing component integrates a processing suite of multiple operating systems, wherein the processing suite includes a processing tool that supports multiple architectures; the device includes: A first receiving module is configured to receive source code to be processed; The processing module is configured to input the source code into the code processing component, and through the code processing component, call the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

[0008] According to a fourth aspect of an embodiment of the present invention, a cross-architecture code compilation device is provided, which is applied to a code compilation end, the code compilation end includes a code compilation component, the code compilation component integrates a compilation suite of multiple operating systems, and the compilation suite includes a compilation tool that supports multiple architectures; the device includes: A third receiving module is configured to receive source code to be compiled; The compilation module is configured to input the source code into the code compilation component, and through the code compilation component, call the compilation tool of the target compilation suite to compile the source code to obtain the target code that supports running on the target architecture.

[0009] According to a fifth aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned code processing and code cross-architecture compilation methods are implemented.

[0010] According to a sixth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the instruction is executed by a processor, the steps of the above-mentioned code processing and code cross-architecture compilation method are implemented.

[0011] According to a seventh aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of executing the above-mentioned code processing and code cross-architecture compilation method.

[0012] An embodiment of the present invention is applied to a code processing end, which includes a code processing component, the code processing component integrates a processing suite of multiple operating systems, and the processing suite includes a processing tool that supports multiple architectures; including receiving source code to be processed; inputting the source code into the code processing component, and through the code processing component, calling the processing tool of the target processing suite to process the source code to obtain a target code that supports running on the target architecture. Through the code processing component, when the source code to be processed is received, the source code is input into the code processing component, and the processing suites of multiple operating systems integrated in the code processing component and the processing tools of multiple architectures integrated in each processing suite are applied to code process the source code to obtain the target code output by the code processing component, and the target code supports running on the target architecture under the target operating system of the target processing suite, that is, by integrating the processing suites of multiple operating systems in the code processing component and the processing tools of multiple architectures in the processing suite, when the source code is input into the code processing component, the suite integrated in the code processing component and the tools integrated in the suite are used to generate target codes applied to multiple operating systems and multiple architectures, thereby improving the adaptability and efficiency of the code processing results. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 is a system schematic diagram of a code processing system architecture provided by an embodiment of the present invention; Figure 2 is a flow chart of a code processing method provided by an embodiment of the present invention; Figure 3 is a system schematic diagram of another code processing system architecture provided by an embodiment of the present invention; Figure 4 is a flowchart of a code cross-architecture compilation method provided by an embodiment of the present invention; Figure 5a is a flow chart of a compilation process of a code processing method provided by an embodiment of the present invention; Figure 5b is a schematic diagram of a code compiling component in a code processing method provided by an embodiment of the present invention; Figure 6a is a processing flow chart of a code processing method provided by an embodiment of the present invention; Figure 6b It is a schematic diagram of the application of a code language conversion component in a code processing method provided by an embodiment of the present invention; Figure 7 is a schematic diagram of the structure of a code processing device provided by an embodiment of the present invention; Figure 8 It is a schematic diagram of the structure of a code cross-architecture compilation device provided by an embodiment of the present invention; Fig. 9 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0014] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.

[0015] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.

[0016] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0017] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0018] First, the terms involved in one or more embodiments of the present invention are explained.

[0019] Operating System (OS): It is a program that manages computer hardware and software resources, and also provides services for various application software. It acts as an interface between the user and the computer hardware, and manages files, memory, processes, and communications with peripheral devices.

[0020] Cross-architecture: refers to the ability of software or systems to run on different computer architectures without being restricted to a specific hardware structure. This usually involves the ability of software to run on different types of processors, such as x86 and ARM.

[0021] X86 architecture: The x86 architecture is a widely used computer processor architecture originally developed by Intel Corporation. It is a CISC (Complex Instruction Set Computing) based architecture mainly used in personal computers, servers and other devices. The X86 architecture is known for its wide compatibility and support.

[0022] ARM architecture: ARM architecture is a microprocessor architecture based on RISC (reduced instruction set computing) design. It is known for its low power consumption and high performance and is widely used in mobile devices, embedded systems, etc.

[0023] ARM64 architecture: also known as AArch64 or ARMv8, is a 64-bit processor architecture. It is an extension of the ARM architecture, supporting a larger addressing space and higher performance, and is commonly used in devices such as smartphones, tablets, high-performance computing, and servers. It has the following features: It provides higher data processing capabilities and improved energy efficiency, and supports more registers and new instruction sets.

[0024] Windows: Windows is a family of operating systems for personal computers, servers, mobile phones, and embedded devices. It is widely popular for its graphical user interface, versatility, and wide application support.

[0025] Linux: Linux is an open source Unix-like operating system. Its kernel was first released by Linus Torvalds in 1991. Linux is well-known for its stability, security and wide application in servers, desktops, embedded systems and other fields.

[0026] MacOS: MacOS (formerly known as OS X) is an operating system developed for the Mac series of computers. It is popular for its unique graphical user interface, powerful multimedia and creative software support, and tight integration with Apple products.

[0027] Program Compilation: Program compilation is the process of converting source code (written in a high-level language readable by humans) into machine code (a low-level language executable by computers). A compiler is a tool that performs this conversion.

[0028] Cross-compilation: Cross-compilation refers to the process of generating code on one platform (host) that runs on another different platform (target). For example, compiling a program for ARM architecture on an x86 architecture computer.

[0029] 86_64 architecture: The X86_64 architecture (also known as AMD64 or Intel 64) is a 64-bit extension of the X86 architecture, first introduced by AMD. It is compatible with the traditional 32-bit X86 architecture while providing a larger addressing space and performance improvements. It has the following features: support for a larger memory addressing space, more general registers and a new instruction set, and is widely used in modern personal computers and servers.

[0030] osxcross: osxcross is a cross-compiler toolchain that allows developers to compile software that can run on macOS on non-macOS platforms. It is open source and achieves cross-compilation by simulating a specific environment of macOS. It has the following features: It provides a way to build macOS applications on Linux or other systems, which is particularly useful for developers who do not have direct access to Apple hardware.

[0031] GCC: GCC (GNU Compiler Collection) is an open source compiler collection that supports multiple programming languages, including C, C++, Objective-C, Fortran, Ada, and Go. It has the following features: It is widely used in Unix-like systems, supports multiple architectures, and provides a wealth of compilation options and optimization functions.

[0032] MinGW-w64: MinGW-w64 is a branch of MinGW, providing a tool chain for 64-bit Windows. It includes compilers, libraries, and tools that can be used to generate 64-bit and 32-bit Windows applications. Its features: Compared with the original MinGW, MinGW-w64 supports more data types and processor architectures, and provides a wider range of Windows API support.

[0033] Write once, run anywhere (WORA): is a computing concept, mainly associated with the Java language, which means that program code can be written once and run on multiple platforms without modification. Its characteristics: WORA implementations usually rely on virtual machines (such as the Java virtual machine) to provide a unified runtime environment regardless of the underlying hardware or operating system. This reduces the platform dependency of the software and simplifies the development process.

[0034] Pybind: is an open source tool for seamlessly integrating C++ code with Python. It allows developers to write feature-rich modules in C++ and use them directly in Python without writing additional Python extension modules.

[0035] NAPI: NAPI (Node.js API) is a cross-platform API for developing Node.js extension modules. It is a stable C / C++ programming interface provided by Node.js to extend the functionality of Node.js.

[0036] SWIG: SWIG (Simplified Wrapper and Interface Generator) is an open source tool for wrapping C / C++ code into interfaces in multiple programming languages. It can automatically generate language binding code so that C / C++ libraries can be called by other programming languages ​​(such as Python, Java, Ruby, etc.).

[0037] WASM: WASM (WebAssembly) is a portable, high-performance low-level bytecode format designed to provide an efficient execution environment for web browsers. It is an open standard developed and maintained by W3C (World Wide Web Consortium). WASM is designed to provide a fast, secure, and scalable execution model in modern web browsers. It allows developers to write code in high-level languages ​​​​(such as C / C++, Rust, etc.) and compile it into WASM bytecode. These bytecodes can run in web browsers to achieve higher performance compared to JavaScript code.

[0038] AST: AST (Abstract Syntax Tree) parsing refers to the process of parsing source code into a syntax tree. It represents the syntax structure of the source code in the form of a tree, providing an abstract representation of the code structure and semantics. AST can be used for static analysis, code conversion, optimization, and generation. By traversing and manipulating AST, various forms of analysis and processing can be performed on the source code.

[0039] In the current era of rapid technological development, C / C++, as a representative of high-performance languages, is widely used in system-level applications. It is especially the first choice in the fields of operating systems, embedded systems, high-performance computing, etc. At the same time, with the diversification of architectures in the market, such as x86, ARM64, etc., software developers need to ensure that their applications or systems can run efficiently on these different platforms. In addition, with the rise of mobile devices, cloud computing, and the Internet of Things, the demand for the ability to quickly and consistently deploy software on a variety of devices is also growing.

[0040] However, existing compilation technologies face multiple challenges: Difficulty in supporting multiple platforms: Languages ​​such as C / C++ require different compilers and runtime environments to compile for each target platform. Manual code modification and environment configuration are not only time-consuming and error-prone, but also difficult to ensure the consistency and performance of the code across different platforms; Inefficiency: Compiling software for each target architecture separately is a repetitive and inefficient process, especially when the software needs to be updated and maintained frequently. This inefficiency is particularly evident when dealing with large or complex projects; Multi-language support is too complicated: Due to the good performance and versatility of C / C++, in daily development, C / C++ code is often compiled into a dynamic link library (usually so files under Linux and usually dll files under Windows) for other high-level programming languages ​​to call, such as Java, Golang, Python, NodeJs, JavaScript and other languages. In this process, developers need to make corresponding adaptations for this. For example, although Java programs can access C / C++ written code through mechanisms such as JNI, developers need to do a lot of adaptation and write corresponding glue code. In addition to Java, there are many commonly used programming languages ​​such as Golang, Python, Nodejs, JavaScript, etc., which brings a lot of workload to developers. Therefore, there is a need for an efficient cross-architecture compilation method and device.

[0041] Based on this, in the present invention, a code processing method is provided. The present invention also relates to a code cross-architecture compilation method, a code processing device, a code cross-architecture compilation device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.

[0042] See also Figure 1 , Figure 1 FIG. 1 shows a system schematic diagram of a code processing system architecture provided by an embodiment of the present invention. Figure 1 As shown, the system includes a code processing terminal 100 and a client 200. The code processing terminal 100 includes a code processing component 01. The code processing component 01 integrates a processing suite 0101 of multiple operating systems. The processing suite includes a processing tool 010101 supporting multiple architectures.

[0043] Client 200: used to send source code to be processed; The code processing terminal 100 is used to receive source code to be processed, input the source code into the code processing component, and through the code processing component, call the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

[0044] By applying the solution of the embodiment of the present invention, when source code is input into a code processing component, the kit integrated in the code processing component and the tools integrated in the kit are used to generate target codes for application in multiple operating systems and multiple architectures, thereby improving the adaptability and efficiency of the code processing results.

[0045] See also Figure 2 , Figure 2 A flowchart of a code processing method provided by an embodiment of the present invention is shown, which is applied to a code processing end, the code processing end includes a code processing component, the code processing component integrates a processing suite of multiple operating systems, the processing suite includes a processing tool that supports multiple architectures, and specifically includes the following steps.

[0046] Step 202: Receive source code to be processed.

[0047] Specifically, the code processing end refers to a code development platform. When the code development is performed on the code development platform, the code program is generally developed in a specific programming language, such as C / C++, JavaScript, Python, etc. The code processing component refers to the software that processes the code. The code processing component is used to generate target codes that support running on multiple architectures under multiple operating systems. The code processing component can be a software device of the code processing end. The code processing component integrates processing kits for multiple operating systems to generate target codes that support running on multiple operating systems through the processing kits. The processing kit includes processing tools that support multiple architectures, which are used to generate target codes that support running on multiple architectures through the processing kits. The code processing component integrates processing kits for multiple operating systems, and the processing kit includes processing tools that support multiple architectures, so that the code processing component can generate target codes that support running on the target architecture based on the source code, reducing the problem of manual adaptation of the operating system and architecture. For example, the processing tools can be osxcross, GCC and MinGW-w64. The processing capabilities of the code processing component and the code processing end are corresponding. For example, there are 3 programming languages ​​processed by the code processing end, and the corresponding source code programming languages ​​that can be processed by the code processing component are also 3. Source code refers to code written in a programming language. By processing the source code, target code that can be recognized by a machine running on a target architecture can be obtained.

[0048] There are many ways to receive the source code to be processed. One way is to receive the code processing instruction sent by the front end and obtain the source code to be processed by parsing the code processing instruction. Another way is to receive the address of the source code sent by the front end and obtain the source code to be processed by indexing the address.

[0049] Optionally, after the source code is obtained, the source code may be converted into a high-level programming language or a general programming language, and the converted code may be processed to improve the efficiency of the code processing.

[0050] Optionally, the code processing component can provide a code interface to the outside. After the code processing end receives the source code to be processed and performs code processing, it does not output the target code, but directly provides the interface. The corresponding code running end obtains the target code by calling the interface to run the target code.

[0051] By receiving the source code to be processed, it is possible to process based on the source code and generate target code that supports running on the corresponding operating system and architecture, so as to improve the adaptability of the source code running on the operating system and architecture.

[0052] Step 204: input the source code into the code processing component, and through the code processing component, call the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

[0053] Specifically, target code refers to the code language that can be recognized by the machine, that is, the code that can be directly run by the code execution end. The target code can be intermediate bytecode, program code, etc. Based on the different code processing methods, the corresponding target code is also different. For example, code processing refers to the generation of virtual machine code, then the target code can be intermediate bytecode, and the intermediate bytecode is executed by running the virtual machine on each platform; code processing refers to compiling the code, then the target code is program code, and the target code is sent to each platform to run the target code.

[0054] The target architecture is one or more of the multiple architectures, which is specifically determined based on the information received by the code processing component. For example, if the code processing end also receives architecture information, the target architecture is the architecture corresponding to the architecture information, and the number of architectures corresponding to the architecture included in the architecture information can be one or more; if the code processing end does not receive architecture information, the target architecture is the architecture corresponding to the processing tool under the corresponding operating system. Operating system A includes 3 architectures, and the processing kit of operating system A includes processing tools for 3 architectures, then the corresponding target architectures are the 3 architectures.

[0055] Optionally, the code processing end can also receive operating system information. Based on the operating system information, the code processing end determines the target processing suite of the target operating system, so that when the source code is input into the code processing component, the processing component in the target processing suite is called to process the source code to obtain the target code that supports running on multiple architectures under the target operating system.

[0056] Optionally, the code processing end can also receive operating system information and architecture information, and determine the target processing suite of the target operating system and the target processing tool of the target architecture based on the operating system information and architecture information. When the source code is input into the code processing component, the target processing component in the target processing suite is called to process the source code to obtain the target code that supports running on the target architecture under the target operating system.

[0057] By setting up a code processing component at the code processing end, developers only need to write once to obtain the source code, and process the source code based on the code processing component so that the processed target code can run on various platforms and various architectures under various operating systems, realizing the concept of write once and run everywhere.

[0058] In an optional embodiment of the present invention, the above step of receiving the source code to be processed includes the following steps: In response to the code processing instruction, obtaining source code to be processed, wherein the code processing instruction carries source code and operating system information; The source code is input into the code processing component, and the code processing component calls the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture, including: Based on the operating system information, determining a target processing kit of a target operating system corresponding to the operating system information; The source code is input into the code processing component, and through the code processing component, the processing tool of the target processing suite is called, and the processing tool is used to process the source code to obtain the target code that supports running on the target architecture.

[0059] Specifically, the code processing instruction refers to a code processing instruction generated based on the requirement for code processing. The operating system information is used to specify the operating system, and the operating system information may be an identification, attribute information, etc. of the operating system.

[0060] The implementation method of obtaining the source code to be processed in response to the code processing instruction can be to receive the code processing instruction sent by the front end, the code processing instruction carries the code content of the source code, parse the code processing instruction, and obtain the source code to be processed; or it can be to receive the code processing instruction, the code processing instruction carries the address of the source code and operating system information, and obtain the source code to be processed by indexing through the address.

[0061] An implementation method for determining a target processing suite of a target operating system corresponding to the operating system information based on the operating system information may be to parse the operating system information, determine the target operating system corresponding to the operating system information, and determine the target processing suite of the target operating system based on the target operating system; or it may be to identify keywords of the operating system information, compare the keywords with information of the operating system corresponding to the code processing component, determine the target operating system based on the comparison result, and determine the target processing suite of the target operating system based on the target operating system.

[0062] By determining the target processing suite of the target operating system, the source code is input into the code processing component, and the code processing component calls the processing tools in the target processing suite to process the source code, so that the generated target code supports running on the target operating system, realizing a closed loop with the input content, improving the accuracy of generating the target code, and improving the user experience.

[0063] In an optional embodiment of the present invention, the code processing instruction also carries architecture information; the above step inputs the source code into the code processing component, calls the processing tool of the target processing suite through the code processing component, processes the source code using the processing tool, and obtains the target code that supports running on the target architecture, including the following steps: Based on the architecture information, determining a target processing tool in the target processing suite that supports the target architecture corresponding to the architecture information; The source code is input into the code processing component, and through the code processing component, the target processing tool in the target processing suite is called, and the target processing tool is used to process the source code to obtain the target code that supports running on the target architecture.

[0064] Specifically, the architecture information is used to specify the target architecture on which the generated target code can run. The architecture information may be an architecture identifier, architecture attribute information, and the like.

[0065] An implementation method for determining the target processing tool for the target architecture corresponding to the architecture information in the target processing suite based on the architecture information may be to parse the structural information, obtain the target architecture, and determine the target processing tool for the target architecture corresponding to the architecture information in the target processing suite based on the target architecture; or it may be to identify keywords in the architecture information, compare the keywords with information of multiple architectures of the target processing suite, determine the target architecture based on the comparison result, and determine the target processing tool for the target architecture corresponding to the architecture information in the target processing suite based on the target architecture.

[0066] By determining the target processing suite of the target operating system and the target processing tool in the target processing suite that supports the target architecture, the source code is input into the code processing component, and the code processing component calls the target processing tool of the target processing suite to process the source code, so that the generated target code supports running on the target architecture of the target operating system, thereby realizing a closed loop with the input content, improving the accuracy of generating the target code, and improving the user experience.

[0067] In an optional embodiment of the present invention, after the source code is input into the code processing component in the above steps, and the code processing component calls the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture, the following steps are also included: The target code is sent to a code execution end so that the code execution end executes the target code on a target architecture of a target operating system, wherein the target operating system is an operating system corresponding to the target processing suite.

[0068] Specifically, the code running end is a terminal device that runs the target code. For example, the code running end may be a terminal device equipped with a target framework of a target operating system.

[0069] Optionally, the target code may be in the form of a code program that is directly run or an intermediate bytecode, and the corresponding running platforms are corresponding. If the target code is an intermediate bytecode, a corresponding virtual machine is run on the code running end to execute the target code to realize the running of the target code. If the target code is a code program, the target code is run on the code running end to obtain the application corresponding to the target code.

[0070] Sending the target code to the code running end can be based on the target operating system and target architecture that support running the target code to determine the code running end, and sending the target code to the corresponding code running end so that the target code can be run on the target architecture of the target operating system at the code running end.

[0071] Optionally, the code processing end and the code running end may be the same terminal or different terminal devices. If the code processing end and the code running end are different terminals, if the code processing is code compilation, the code compilation in the code processing end uses a cross-compilation method.

[0072] After the source code is processed to obtain the target code, the target code is sent to a code running terminal that supports running the target code, thereby realizing the application of the code processing result and realizing a closed loop of code processing and application.

[0073] In an optional embodiment of the present invention, before the above step of receiving the source code to be processed, the following step is further included: For any operating system, obtaining at least one processing tool corresponding to any operating system for processing code to support running on different architectures; Based on at least one processing tool corresponding to any operating system, a processing kit of any operating system is integrated; Based on the processing suites of each operating system, code processing components are integrated.

[0074] Before receiving the source code to be processed, a code processing component is generated, and the code processing component is used to generate target code that supports running on multiple architectures of multiple operating systems. Based on the relationship between the operating system and the architecture, first for any operating system, obtain at least one processing tool corresponding to any operating system that processes the code to support running on different architectures, integrate the processing tools to obtain the processing suite, integrate the processing suite to obtain the code processing component, and obtain the code processing component through sequential integration from low to high.

[0075] The implementation method of obtaining the code corresponding to any operating system to process the code into at least one processing tool supporting running on different architectures can be based on any operating system, obtaining at least one architecture supported by the any operating system, and obtaining at least one processing tool supported by the at least one architecture.

[0076] An implementation method for integrating a processing kit for any operating system based on at least one processing tool corresponding to any operating system may be to establish a first calling relationship between the processing kit and the processing tool of at least one architecture according to at least one architecture under any operating system, and to obtain the processing kit for any operating system based on the first calling relationship and at least one architecture.

[0077] The implementation method of integrating the code processing component based on the processing suite of each operating system may be to establish a second calling relationship between the code processing component and each operating system, and obtain the code processing component based on the second calling relationship and each operating system.

[0078] For example, for MacOS, the open source osxcross is used as the processing tool for the architecture; for Linux, GCC is used as the processing tool for the architecture; for Windows, MinGW-w64 is used as the processing tool for the architecture.

[0079] Based on at least one processing tool corresponding to the operating system that processes the code into a tool that supports running on different architectures, the two are integrated to obtain a code processing component, so that the entire process of processing the code is integrated into the code processing component, so that in the application of the code processing component, the source code can be input into the code processing component to generate the target code that supports running on the target architecture, which simplifies the process of code processing on the source code and improves the efficiency of generating the target code that supports running on the target architecture based on the source code.

[0080] In an optional embodiment of the present invention, the code processing end further includes a code language conversion component, and the code language conversion component integrates conversion tools of multiple languages; the method further includes the following steps: Through the code language conversion component, the target conversion tool is called to convert the language of the source code to generate the code data to be called that supports being called by the target language.

[0081] Specifically, the code language conversion component is a component used to convert the programming language of the source code. The code language conversion component can correspond to a variety of different programming languages, that is, the code language conversion component can be the code data to be called in different programming languages. For example, the programming language corresponding to the code language conversion component can be Golang, Java, Python, JavaScript, and Node. The target conversion tool refers to a conversion tool that generates code data to be called that supports being called by the target language. The conversion tool can be SWIG, Python, WASM, and NAPI. The code data to be called refers to the result after language conversion, which can be directly called by the target language. The code data to be called is the code of the programming language corresponding to the target language.

[0082] The source code is input into the code language conversion component, and the code language conversion component calls the target conversion tool to convert the language of the source code to generate the code data to be called that can be called by the target language.

[0083] Optionally, calling a target conversion tool to perform language conversion on the source code through a code language conversion component to generate code data to be called that supports being called by the target language may also include obtaining source code to be converted in response to a code language conversion instruction, the code language conversion instruction carries language information of the source code to be converted and the target language, wherein the source code to be converted may also be the source code carried by the code processing instruction.

[0084] When the language information of the target language is received, a target conversion tool of the target language corresponding to the language information is determined based on the language information, and the target conversion tool is called to perform language conversion on the source code through the code language conversion component to generate code data to be called that supports being called by the target language.

[0085] Optionally, after the code data to be called is generated, the code data to be called may be stored in a code library corresponding to the target language, so that the code platform of the target language can call the source code by calling the code library.

[0086] The code processing end includes a code language conversion component, which performs language conversion on the source code to generate code data to be called that supports being called by the target language. When the programming language of the target language is different from that of the source code, the code language conversion component is used to generate code data to be called, thereby enabling the code platform of the target language to call the code data.

[0087] By setting up a code language conversion component, multi-language support is provided. Developers only need to write source code to use the code language conversion component to complete development support for multiple languages, greatly improving development efficiency and narrowing the language gap.

[0088] See also Figure 3 , Figure 3 FIG. 1 shows a system schematic diagram of another code processing system architecture provided by an embodiment of the present invention. Figure 3 As shown, the code processing end also includes a code language conversion component 02, and the code language conversion component integrates conversion tools of multiple languages.

[0089] In an optional embodiment of the present invention, before the target conversion tool is called to convert the source code into a language through the code language conversion component to generate the code data to be called that supports being called by the target language, the following steps are also included: receiving a code language conversion instruction, wherein the code language conversion instruction includes language information of a target language; The target conversion tool is called to convert the source code through the code language conversion component to generate code data to be called by the target language, including: Based on the language information, determining a target conversion tool for a target language corresponding to the language information; Through the code language conversion component, the target conversion tool is called to convert the language of the source code to generate the code data to be called that supports being called by the target language.

[0090] Specifically, the code language conversion instruction refers to a code language conversion instruction generated based on the requirement of code language conversion. The language information is used to specify the language, and the language information can be a language identifier, language attribute information, etc.

[0091] An implementation method for determining a target conversion tool for a target language corresponding to the language information based on the language information may be to parse the language information, determine the target language corresponding to the language information, and determine the target conversion tool for the target language based on the target language; or it may be to identify keywords of the language information, compare the keywords with information of the language corresponding to a code language conversion component, determine the target language based on the comparison result, and determine the target conversion tool for the target language based on the target language.

[0092] By determining the target conversion tool of the target language, the source code is input into the code language conversion component, and the code language conversion component calls the target conversion tool to process the source code, so that the generated code data to be called can be called by the target language, realizing a closed loop with the input content, improving the accuracy of generating the code data to be called, and improving the user experience.

[0093] In an optional embodiment of the present invention, the above steps further include the following steps before the code language conversion component calls the target conversion tool to convert the source code language to generate the code data to be called that supports being called by the target language: Perform syntax analysis on the source code to determine the associated dependency information of the source code; Build the target interface file based on the associated dependency information; The target conversion tool is called to convert the source code through the code language conversion component to generate code data to be called by the target language, including: The target interface file and the code content of the source code are input into the code language conversion component, and the target conversion tool is called to perform language conversion based on the target interface file and the code content to generate the code data to be called that supports being called by the target language.

[0094] Specifically, the key dependency information refers to the dependency relationship between the method functions contained in the source code, for example, the dependency relationship can be the calling relationship between the method functions. The target interface file refers to the method functions in the source code and the dependency relationship between the method functions, and the target interface file can be an Interface file with the suffix ".i".

[0095] Perform syntax analysis on the source code to determine the implementation method of the associated dependency information of the source code. This can be based on the abstract syntax tree to extract the syntax in the source code, obtain the method functions and the dependency relationship between method functions, and generate the key dependency information of the source code.

[0096] Optionally, the abstract syntax tree may be an AST abstract syntax tree.

[0097] Based on the key dependency information, the target interface file may be constructed by writing the dependency relationship between method functions into the target interface file.

[0098] The code contents of the target interface file and the source code are input into the code language conversion component, and the target conversion tool is called through the code language conversion component to perform language conversion on the code contents of the source code based on the target interface file to generate code data to be called that supports being called by the target language.

[0099] By performing syntax analysis on the source code, the target interface file is obtained, and the target interface file is input into the code language conversion component, so that the code language conversion tool calls the target conversion tool to perform language conversion on the code content of the source code based on the target interface, and generates the code data to be called. Through the target interface file, the development complexity is reduced and the efficiency of language conversion of the code content of the source code is improved.

[0100] In an optional embodiment of the present invention, after generating the code data to be called that supports being called by the target language, the following steps are also included: The code data to be called is stored in a code library corresponding to the target language, wherein the code library is used to send each code data to be called corresponding to the target task to the task end in response to a task request from the task end.

[0101] Specifically, the code library corresponding to the target language may be a class library, a second-party library, a second-party package, and the like.

[0102] After the source code is converted into a language based on the code language conversion component to generate the code data to be called, the code data to be called is stored in the code library corresponding to the target language according to the method function. That is, the code data to be called is stored in the code library for storage and integration, so as to respond to the task request of the task end and send the code data to be called corresponding to the target task to the task end. The task end is the task end corresponding to the target language.

[0103] Optionally, when storing the code data to be called in the code library corresponding to the target language, the code data to be called can be integrated in the code library, or when storing the code data to be called in the code library corresponding to the target language, it can be classified and stored according to types such as method functions, code classes, and variables.

[0104] After the code data to be called is generated, the code data to be called is written into a code library to facilitate subsequent calling of the data in the code library.

[0105] One or more embodiments of the present invention can be applied to multiple scenarios, for example, in high-performance computing and big data processing scenarios, specifically: for applications that require huge computing power, such as scientific computing, data analysis, and graphics processing, C / C++ is widely used due to its high efficiency. The present invention can simplify the process of deploying these applications on various architectures, especially in multi-architecture cloud computing environments and high-performance computing clusters; in game and graphics software development scenarios, specifically: game and graphics software development often relies on C / C++ to obtain optimal performance and control. Through the present invention, developers can more easily compile games and graphics applications to multiple platforms, including different desktop operating systems and game consoles, thereby broadening the market and accelerating the release cycle; in embedded systems and Internet of Things (IoT) scenarios, specifically: embedded systems and IoT devices widely use C / C++ because these languages ​​allow tight control of hardware and optimize resource usage. The present invention can make these applications easier to compile and deploy across different microcontrollers and processor platforms, supporting the rapid development and update of IoT devices; in system software and middleware development scenarios, specifically: operating systems, databases, network protocol stacks and other system-level software are usually written in C / C++. The present invention can accelerate the development and deployment of these system software and middleware on a variety of servers and devices, and improve their performance and compatibility in different environments. At the same time, since system software is often written in multiple languages, the multi-language support implemented by this solution can improve the stability of system software and middleware in terms of consistency and stability.

[0106] See also Figure 4 , Figure 4 A flowchart of a code cross-architecture compilation method provided by an embodiment of the present invention is shown, which is applied to a code compilation end, wherein the code compilation end includes a code compilation component, and the code compilation component integrates compilation suites of multiple operating systems. The compilation suite includes compilation tools that support multiple architectures, and specifically includes the following steps.

[0107] Step 402: Receive source code to be compiled.

[0108] Step 404: input the source code into the code compilation component, and through the code compilation component, call the compilation tool of the target compilation suite to compile the source code to obtain the target code that supports running on the target architecture.

[0109] Specifically, the code compilation end refers to a code development platform. When developing code on a code development platform, code programs are generally developed in a specific programming language. For example, the specific programming language may be C / C++, JavaScript, Python, etc. A code compilation component refers to software that compiles code. The code compilation component is used to generate target code that supports running on multiple architectures under multiple operating systems. The code compilation component may be a software device at the code compilation end. The code compilation component integrates compilation suites for multiple operating systems to generate target code that supports running on multiple operating systems through the compilation suite. The compilation suite includes compilation tools that support multiple architectures, which are used to generate target code that supports running on multiple architectures through the compilation suite.

[0110] The code compilation component integrates compilation kits for multiple operating systems. The compilation kits include compilation tools that support multiple architectures, so that the code compilation component can generate target code that supports running on the target architecture based on the source code, reducing the problem of manual adaptation of the operating system and architecture. For example, the compilation tools can be osxcross, GCC, and MinGW-w64. The compilation capabilities of the code compilation component correspond to those of the code compilation end. For example, there are three programming languages ​​that the code compilation end compiles, and the corresponding source code that the code compilation component can compile is also three programming languages. Source code refers to code written in a programming language. By compiling the source code, you can obtain machine-recognizable target code that supports running on the target architecture. Target code refers to the code language that the machine can recognize, that is, the code that the code running end can run directly. The target code can be an intermediate bytecode, program code, etc.

[0111] There are many ways to receive the source code to be compiled. You can receive the code compilation instruction sent by the front end, and obtain the source code to be compiled by parsing the code compilation instruction; you can also receive the address of the source code sent by the front end, index it through the address, and obtain the source code to be compiled.

[0112] Optionally, after the source code is obtained, the source code may be converted into a high-level programming language or a general programming language, and the converted code may be compiled to improve the efficiency of code compilation.

[0113] Optionally, the code compilation component can provide a code interface to the outside. After the code compilation end receives the source code to be compiled and compiles the code, it does not output the target code, but directly provides the interface. The corresponding code execution end obtains the target code by calling the interface to execute the target code.

[0114] By receiving the source code to be compiled, compilation can be performed based on the source code to generate target code that supports running on the corresponding operating system and architecture, so as to improve the adaptability of the source code running on the operating system and architecture.

[0115] The target architecture is one or more of the multiple architectures, which is specifically determined based on the information received by the code compilation component. For example, if the code compilation end also receives architecture information, the target architecture is the architecture corresponding to the architecture information, and the number of architectures corresponding to the architecture included in the architecture information can be one or more; if the code compilation end does not receive architecture information, the target architecture is the architecture corresponding to the compilation tool under the corresponding operating system. Operating system A includes 3 architectures, and the compilation suite of operating system A includes compilation tools for 3 architectures, then the corresponding target architectures are the 3 architectures.

[0116] Optionally, the code compilation end can also receive operating system information. Based on the operating system information, the code compilation end determines the target compilation suite of the target operating system, so that when the source code is input into the code compilation component, the compilation component in the target compilation suite is called to compile the source code to obtain the target code that supports running on multiple architectures under the target operating system.

[0117] Optionally, the code compilation end can also receive operating system information and architecture information, and determine the target compilation suite of the target operating system and the target compilation tool of the target architecture based on the operating system information and architecture information. When the source code is input into the code compilation component, the target compilation component in the target compilation suite is called to compile the source code to obtain the target code that supports running on the target architecture under the target operating system.

[0118] By setting the code compilation component, you can compile and output the target code of the corresponding application for multiple operating systems and multiple architectures. The code compilation component is highly extensible. Although it is currently explained with MacOS, Linux, and Windows, it can actually adapt to more operating systems, such as FreeBSD.

[0119] By applying the solution of the embodiment of the present invention, when source code is input into a code compilation component, a kit integrated in the code compilation component and tools integrated in the kit are used to generate target codes for use in multiple operating systems and multiple architectures, thereby improving the adaptability and efficiency of the code compilation results.

[0120] The following combination Figure 5a , taking the application of the code processing method provided by the present invention in program compilation as an example, the code processing method is further described. Figure 5a A flow chart of the compilation process of a code processing method provided by an embodiment of the present invention is shown, which specifically includes the following steps.

[0121] Step 502: For any operating system, obtain at least one compilation tool corresponding to any operating system for compiling code to support running on different architectures.

[0122] Step 504: Based on at least one compilation tool corresponding to any operating system, a compilation suite of any operating system is integrated.

[0123] Step 506: Based on the compilation suites of each operating system, integrate and obtain a code compilation component.

[0124] See also Figure 5b , Figure 5b A schematic diagram of a code compilation component in a code processing method provided by an embodiment of the present invention is shown. Combining the above steps 502 to 506, the generated code compilation component integrates a compilation suite for MacOS, a compilation suite for Linux, and a compilation suite for Windows, wherein the compilation suite for MacOS includes a compilation tool for X86 and a compilation tool for AMR64, and the compilation tool used for the architecture under the MacOS operating system is osxcross; the compilation suite for Linux includes a compilation tool for X86 and a compilation tool for AMR64, and the compilation tool used for the architecture under the Linux operating system is GCC; the compilation suite for Windows includes a compilation tool for X86 and a compilation tool for AMR64, and the compilation tool used for the architecture under the Windows operating system is MinGW-w64.

[0125] Step 508: Receive code compilation instructions.

[0126] Step 510: Based on the code compilation instruction, the source code to be compiled, the operating system information and the architecture information are obtained.

[0127] Step 512: Based on the operating system information, determine a target compilation suite for the target operating system corresponding to the operating system information; based on the architecture information, determine a target compilation tool in the target compilation suite that supports the target architecture corresponding to the architecture information.

[0128] Step 514: input the source code into the code compilation component, and through the code compilation component, call the target compilation tool in the target compilation suite, and use the target compilation tool to compile the source code to obtain the target code that supports running on the target architecture.

[0129] Step 516: Send the target code to the code execution end so that the code execution end executes the target code on the target architecture of the target operating system, wherein the target operating system is the operating system corresponding to the target compilation suite.

[0130] By applying the solution of the embodiment of the present invention, by setting the code compilation component, the target code of the corresponding application program can be compiled and output for multiple operating systems and multiple architectures. The code compilation component has strong extensibility. Although MacOS, Linux, and Windows are currently used for illustration, it can actually adapt to more operating systems, such as FreeBSD.

[0131] The following combination Figure 6a and attached Figure 6b , taking the application of the code processing method for code language conversion provided by the present invention as an example, the code processing method is further described. Figure 6a A flowchart of a code processing method provided by an embodiment of the present invention is shown. Figure 6b A schematic diagram of the application of a code language conversion component in a code processing method provided by an embodiment of the present invention is shown, which specifically includes the following steps.

[0132] Step 602: receiving source code to be processed and a code language conversion instruction, wherein the code language conversion instruction includes language information of a target language.

[0133] Among them, the source code is C / C++ code, which can be divided into .c / .cpp source code and . / .hpp header files.

[0134] Step 604: Perform syntax analysis on the source code to determine the associated dependency information of the source code.

[0135] The syntax analysis of the source code may be performed by using an AST abstract syntax tree to perform syntax analysis on the source code, determine the associated dependency information of the source code, and write the associated dependency information into a target interface file, and the target interface file may be an Interface interface.

[0136] Step 606: Build a target interface file based on the associated dependency information.

[0137] Step 608: Based on the language information, determine a target conversion tool for the target language corresponding to the language information.

[0138] Step 610: Through the code language conversion component, call the target conversion tool to perform language conversion on the source code to generate code data to be called that supports being called by the target language.

[0139] For Golang and Jave, SWIG will compile the source code here into a dynamic link library file (a file with the suffix ".so" under Linux, a file with the suffix ".dll" under Windows, and a file with the suffix ".dylib" on MACos), and write glue code files (code data to be called) for Java and Golang.

[0140] For Python, Pybind can bind source code classes, functions, and variables to Python. Pybind provides a concise application programming interface (API) that makes it simple to define binding specifications in source code, and then access and call source code classes, functions, and variables in Python.

[0141] For JaveScript, WASM can compile source code written in high-level languages ​​​​(such as C / C++) into WASM bytecode, which can be called by the JavaScript language running in the browser.

[0142] For Node, NAPI provides a set of C / C++ functions and macros for interacting with the JavaScript runtime of Node.js. It provides access and manipulation of JavaScript objects, functions, module loading, exception handling, etc. Using NAPI, developers can seamlessly integrate C / C++ code with JavaScript code to achieve high-performance extension functions.

[0143] Step 612: Store the code data to be called into a code library corresponding to the target language, wherein the code library is used to send each code data to be called corresponding to the target task to the task end in response to a task request from the task end.

[0144] The solution of the embodiment of the present invention provides multi-language support capabilities by setting a code language conversion component. Developers only need to write C / C++ code to use the code language conversion component to complete development support for multiple languages, greatly improving development efficiency and narrowing the language gap.

[0145] Corresponding to the above method embodiment, the present invention also provides a code processing device embodiment, Figure 7 The schematic diagram of the structure of a code processing device provided by an embodiment of the present invention is shown, which is applied to a code processing terminal, wherein the code processing terminal includes a code processing component, wherein the code processing component integrates a processing suite of multiple operating systems, and the processing suite includes a processing tool that supports multiple architectures. Figure 7 As shown, the device comprises: A first receiving module 702 is configured to receive source code to be processed; The processing module 704 is configured to input the source code into the code processing component, and through the code processing component, call the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

[0146] Optionally, the first receiving module 702 is further configured to obtain source code to be processed in response to a code processing instruction, wherein the code processing instruction carries source code, operating system information and architecture information; the processing module 704 is further configured to determine, based on the operating system information, a target processing suite of the target operating system corresponding to the operating system information; based on the architecture information, determine a target processing tool in the target processing suite that supports the target architecture corresponding to the architecture information; input the source code into the code processing component, call the target processing tool in the target processing suite through the code processing component, and use the target processing tool to process the source code to obtain target code that supports running on the target architecture.

[0147] Optionally, the code processing device further comprises a generation module configured to call a target conversion tool to perform language conversion on the source code via the code language conversion component, and generate code data to be called that supports being called by the target language.

[0148] Optionally, the code processing device also includes a second receiving module, configured to receive a code language conversion instruction, wherein the code language conversion instruction includes language information of a target language; a generating module, further configured to determine, based on the language information, a target conversion tool of the target language corresponding to the language information; and via the code language conversion component, calling the target conversion tool to perform language conversion on the source code to generate code data to be called that supports being called by the target language.

[0149] Optionally, the code processing device also includes an analysis module, which is configured to perform syntax analysis on the source code to determine the associated dependency information of the source code; based on the associated dependency information, construct a target interface file; and a generation module, which is further configured to input the code content of the target interface file and the source code into a code language conversion component, and through the code language conversion component, call a target conversion tool to perform language conversion based on the target interface file and the code content to generate code data to be called that supports being called by the target language.

[0150] Optionally, the code processing device also includes a storage module, which is configured to store the code data to be called into a code library corresponding to the target language, wherein the code library is used to send each code data to be called corresponding to the target task to the task end in response to a task request from the task end.

[0151] The solution of the embodiment of the present invention is applied, by integrating processing suites of multiple operating systems in the code processing component, and integrating processing tools of multiple architectures in the processing suite, so that when source code is input into the code processing component, the suite integrated in the code processing component and the tools integrated in the suite are used to generate target codes for multiple operating systems and multiple architectures, thereby improving the adaptability and efficiency of the code processing results.

[0152] The above is a schematic scheme of a code processing device of this embodiment. It should be noted that the technical scheme of the code processing device and the technical scheme of the above-mentioned code processing method belong to the same concept, and the details not described in detail in the technical scheme of the code processing device can be referred to the description of the technical scheme of the above-mentioned code processing method.

[0153] Corresponding to the above method embodiment, the present invention also provides a code cross-architecture compilation device embodiment, Figure 8 The schematic diagram of the structure of a code cross-architecture compilation device provided by an embodiment of the present invention is shown, which is applied to a code compilation end, and the code compilation end includes a code compilation component, and the code compilation component integrates a compilation suite of multiple operating systems, and the compilation suite includes a compilation tool that supports multiple architectures, such as Figure 8 As shown, the device comprises: A third receiving module 802 is configured to receive source code to be compiled; The compilation module 804 is configured to input the source code into the code compilation component, and through the code compilation component, call the compilation tool of the target compilation suite to compile the source code to obtain the target code that supports running on the target architecture.

[0154] The solution of the embodiment of the present invention is applied, by integrating compilation suites of multiple operating systems in a code compilation component, and integrating compilation tools of multiple architectures in the compilation suite, so that when source code is input into the code compilation component, the suite integrated in the code compilation component and the tools integrated in the suite are used to generate target codes for multiple operating systems and multiple architectures, thereby improving the adaptability and efficiency of the code compilation results.

[0155] The above is a schematic scheme of a code cross-architecture compilation device of this embodiment. It should be noted that the technical scheme of the code cross-architecture compilation device and the technical scheme of the code cross-architecture compilation method described above belong to the same concept, and the details not described in detail in the technical scheme of the code cross-architecture compilation device can be referred to the description of the technical scheme of the code cross-architecture compilation method described above.

[0156] Fig. 9 The block diagram of a computing device provided by an embodiment of the present invention is shown. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and the database 950 is used to store data.

[0157] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 940 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).

[0158] In one embodiment of the present invention, the above components of the computing device 900 and Fig. 9 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig. 9 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.

[0159] The computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 may also be a mobile or stationary server.

[0160] Among them, the processor 920 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-mentioned code processing and code cross-architecture compilation method.

[0161] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned code processing and code cross-architecture compilation method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned code processing and code cross-architecture compilation method.

[0162] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned code processing and code cross-architecture compilation method when executed by a processor.

[0163] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the code processing and code cross-architecture compilation method described above belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the code processing and code cross-architecture compilation method described above.

[0164] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned code processing and cross-architecture code compilation method when executed by a processor.

[0165] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned code processing and code cross-architecture compilation method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned code processing and code cross-architecture compilation method.

[0166] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0167] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0168] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.

[0169] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0170] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A code processing method, characterized in that: Applied to a code processing end, the code processing end includes a code processing component, the code processing component integrates a processing suite of multiple operating systems, and the processing suite includes a processing tool that supports multiple architectures; the method includes: receiving source code to be processed; The source code is input into the code processing component, and the code processing component calls the processing tool of the target processing suite to process the source code to obtain the target code that supports running on the target architecture.

2. The method according to claim 1, characterized in that The receiving source code to be processed includes: In response to the code processing instruction, obtaining source code to be processed, wherein the code processing instruction carries the source code, operating system information and architecture information; The step of inputting the source code into the code processing component, and invoking a processing tool of a target processing suite to process the source code through the code processing component to obtain a target code that supports running on a target architecture includes: Based on the operating system information, determining a target processing suite of a target operating system corresponding to the operating system information; Based on the architecture information, determining a target processing tool in the target processing suite that supports the target architecture corresponding to the architecture information; The source code is input into the code processing component, and the target processing tool in the target processing suite is called through the code processing component. The source code is processed by the target processing tool to obtain the target code that supports running on the target architecture.

3. The method according to claim 1 or 2, characterized in that: The code processing end further includes a code language conversion component, wherein the code language conversion component integrates conversion tools of multiple languages; the method further includes: The target conversion tool is called through the code language conversion component to perform language conversion on the source code, and to generate code data to be called that supports being called by the target language.

4. The method according to claim 3, characterized in that Before the code language conversion component calls a target conversion tool to convert the source code into a language and generates code data to be called that supports being called by the target language, the method further includes: receiving a code language conversion instruction, wherein the code language conversion instruction includes language information of a target language; The code language conversion component calls a target conversion tool to perform language conversion on the source code to generate code data to be called that supports being called by the target language, including: Based on the language information, determining a target conversion tool for a target language corresponding to the language information; The target conversion tool is called through the code language conversion component to perform language conversion on the source code, and to generate code data to be called that supports being called by the target language.

5. The method according to claim 3, characterized in that: Before the code language conversion component calls a target conversion tool to convert the source code into a language and generates code data to be called that supports being called by the target language, the method further includes: Performing syntax analysis on the source code to determine associated dependency information of the source code; Based on the associated dependency information, construct a target interface file; The code language conversion component calls a target conversion tool to convert the source code to generate code data to be called that supports being called by the target language, including: The target interface file and the code content of the source code are input into the code language conversion component, and the target conversion tool is called by the code language conversion component to perform language conversion based on the target interface file and the code content to generate code data to be called that supports being called by the target language.

6. The method according to claim 3, characterized in that After the code data to be called that supports being called by the target language is generated, the method further includes: The code data to be called is stored in a code library corresponding to the target language, wherein the code library is used to send each code data to be called corresponding to the target task to the task end in response to a task request from the task end.

7. A code cross-architecture compilation method, characterized in that: Applied to a code compiling end, the code compiling end includes a code compiling component, the code compiling component integrates a compiling suite of multiple operating systems, the compiling suite includes a compiling tool supporting multiple architectures; the method includes: receiving source code to be compiled; The source code is input into the code compiling component, and the code compiling component calls the compiling tool of the target compiling suite to compile the source code to obtain the target code that supports running on the target architecture.

8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the code processing method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the code processing method described in any one of claims 1 to 6.

10. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the code processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Code generation method and device based on syntax tree, electronic equipment and storage medium

    CN115016793A

  • Software package construction method and device

    CN115639986A

  • Code downloading method and device, equipment and medium

    CN116319747A

  • Cross-platform mobile APP development method and system

    CN117724692A

  • Container packaging method and device, equipment and storage medium

    CN118276884A

Cited By

  • Method for realizing deep fusion of artificial intelligence and scientific numerical calculation by Python-Fortran hybrid programming

    CN121300760A

  • Invocation method, invocation apparatus and computer device

    WO2026103476A1