WO2022033229A1 - Procédé et système de compilation de code logiciel - Google Patents

Procédé et système de compilation de code logiciel Download PDF

Info

Publication number
WO2022033229A1
WO2022033229A1 PCT/CN2021/104177 CN2021104177W WO2022033229A1 WO 2022033229 A1 WO2022033229 A1 WO 2022033229A1 CN 2021104177 W CN2021104177 W CN 2021104177W WO 2022033229 A1 WO2022033229 A1 WO 2022033229A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
package
application
application package
file
Prior art date
Application number
PCT/CN2021/104177
Other languages
English (en)
Chinese (zh)
Inventor
董逢华
江俊
胡瑞璟
何涛
Original Assignee
武汉天喻信息产业股份有限公司
武汉天喻聚联科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 武汉天喻信息产业股份有限公司, 武汉天喻聚联科技有限公司 filed Critical 武汉天喻信息产业股份有限公司
Publication of WO2022033229A1 publication Critical patent/WO2022033229A1/fr

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Definitions

  • the present invention relates to the technical field of computers, in particular to a software code compilation method and system.
  • security modules have the characteristics of limited resources and high performance requirements, but traditional language systems cannot meet the changing user usage scenarios of embedded modules, and cannot meet high performance with limited resources. requirements, and cannot meet the requirements that the same software code can run on different embedded modules.
  • Embodiments of the present application provide a method and system for compiling software code, which pre-compiles the code to generate a download file that is easy to parse, reduces resource requirements in embedded development, and provides guarantee for performance requirements in embedded development , and at the same time, it can meet the requirements that the downloaded file can be executed across platforms.
  • a software code compilation method includes the following steps:
  • the input code includes an application package code and a reference package code, the target code including the application package target code generated by the application package code and the reference package target code generated by the reference package code, the application package code and the application package target code both include the code corresponding to the runtime environment interface;
  • a download file is generated according to the application package bytecode file and the reference package bytecode file.
  • the receiving the input code, extracting the word stream corresponding to the input code, generating a syntax tree according to a preset grammar rule, and performing semantic analysis to obtain the target code specifically includes the following steps:
  • the method further includes the following steps:
  • the constant pool is used to store programming general characters, programming language keywords, general application programming interface keywords and runtime environment interface keywords supported by the method in terms of entries respectively;
  • the constant pool is also used to store the variables and methods declared in the header file referenced by the input code, the variables and methods in the input code in turn in units of entries when the word stream corresponding to the input code is extracted. Defined variables and custom methods are stored in the constant pool in units of entries respectively;
  • the reference package bytecode file includes a binary bytecode file and a binary output mapping file
  • the binary output mapping file includes version information corresponding to the reference package bytecode file, application identification data and all Contains description information for the method.
  • the application package bytecode file includes a method component subfile, a memory component subfile, a runtime method component subfile, and a shared interface component subfile.
  • the method component subfile of the application package bytecode file includes the bytecodes of all methods in the application package, which are arranged in sequence according to the declaration order of each method in the source code of the application package.
  • the storage location and method name of the method in the application package are recorded in the constant pool in a one-to-one correspondence;
  • the memory component subfile records the size and initial value of the global non-volatile space in the corresponding application package and the global The size of the volatile space;
  • the runtime method component subfile includes an offset value of the runtime environment interface of the corresponding application package, which is used for invoking the corresponding application package during installation, deletion, activation, and deactivation;
  • the shared interface component subfile includes the number of shared interfaces declared by the corresponding application package and the offset value of each interface method.
  • generating the download file according to the application package bytecode file and the reference package bytecode file specifically includes the following steps:
  • the method component, the memory component, the runtime method component and the shared interface component are obtained by parsing, and combined with the preset data package and application identification data, according to the preset Format to generate download files.
  • a software code compilation system comprising:
  • a software code compiling unit which is used for receiving an input code, extracting a word stream corresponding to the input code, generating a syntax tree according to a preset grammar rule, and performing semantic analysis to obtain a target code, where the input code includes an application package code and a Reference package code, the target code includes application package target code generated by the application package code and reference package target code generated by the reference package code, both the application package code and the application package target code include running The code corresponding to the time environment interface;
  • an application package generation unit which is used for generating an application package bytecode file according to the data implementing the application function in the application package target code
  • a reference package generation unit which is used to generate a reference package bytecode file according to the data that implements the interface call in the reference package target code
  • a download file generating unit configured to generate a download file according to the application package bytecode file and the reference package bytecode file.
  • the software code compiling unit is specifically used for:
  • system is configured with a constant pool
  • the constant pool is used to store the programming general characters, programming language keywords, general application programming interface keywords and runtime environment interface keywords supported by the system respectively in terms of entries;
  • the constant pool is also used to sequentially store the variables and methods declared in the header file referenced by the input code,
  • the self-defined variables and self-defined methods in the above input code are stored in the constant pool in terms of entries respectively;
  • the reference package bytecode file includes a binary bytecode file and a binary output mapping file
  • the binary output mapping file includes version information corresponding to the reference package bytecode file, application identification data and all Contains description information for the method.
  • the application package bytecode file includes a method component subfile, a memory component subfile, a runtime method component subfile, and a shared interface component subfile.
  • the method component subfile of the application package bytecode file includes the bytecodes of all methods in the application package, which are arranged in sequence according to the declaration order of each method in the source code of the application package.
  • the storage location and method name of the method in the application package are recorded in the constant pool in one-to-one correspondence;
  • the memory component subfile records the size and initial value of the global non-volatile space and the size value of the global volatile space in the corresponding application package;
  • the runtime method component subfile includes an offset value of the runtime environment interface of the corresponding application package, which is used for invoking the corresponding application package during installation, deletion, activation, and deactivation;
  • the shared interface component subfile includes the number of shared interfaces declared by the corresponding application package and the offset value of each interface method.
  • the download file generating unit is specifically configured to parse and obtain a method component, a memory component, a runtime method component and a shared interface component according to the application package bytecode file and the reference package bytecode file, And combined with the preset data package and application identification data, the download file is generated according to the preset format.
  • the present application provides a method and system for compiling software code.
  • the code is pre-compiled according to preset grammar rules, and a download file that is easy to be parsed is generated. It provides guarantees for the performance requirements of the downloaded files and meets the requirements that the downloaded files can be executed across platforms.
  • FIG. 1 is a flowchart of steps of a software code compiling method provided in Embodiment 1 of the present application;
  • FIG. 3 is a flowchart of the software code compilation system provided in Embodiment 1 of the present application when a download file is generated;
  • FIG. 4 is a schematic block diagram of the runtime of a virtual machine in the software code compilation system provided by Embodiment 1 of the present application;
  • FIG. 5 is a structural block diagram of a software code compiling system provided by Embodiment 2 of the present application.
  • Embodiments of the present invention provide a method and system for compiling software code, which pre-compiles the code according to preset grammar rules, and generates a download file that is easy to parse.
  • the performance requirements in the file are guaranteed to meet the requirements that the downloaded files can be executed across platforms.
  • a software code compilation method includes the following steps:
  • S1 Receive an input code, extract a word stream corresponding to the input code, generate a syntax tree according to a preset grammar rule, and perform semantic analysis to obtain a target code, the input code includes an application package code and a reference package code, and the target code includes the application package code.
  • the application package target code generated by the code and the reference package target code generated by the reference package code, the application package code and the application package target code include the code corresponding to the runtime environment interface;
  • an embodiment of the present invention provides a software code compilation method, and the method includes the following steps:
  • S1 Receive an input code, extract a word stream corresponding to the input code, generate a syntax tree according to a preset grammar rule, and perform semantic analysis to obtain a target code, the input code includes an application package code and a reference package code, and the target code includes the application package code.
  • the application package target code generated by the code and the reference package target code generated by the reference package code, the application package code and the application package target code include the code corresponding to the runtime environment interface;
  • the input code is first received, and the specific workflow is performed:
  • the input code includes the application package code and the reference package code
  • the target code includes the application package target code generated by the application package code and the reference package target code generated by the reference package code
  • both the application package code and the application package target code include the runtime The code corresponding to the environment interface
  • the input code is scanned according to the coding order, and the acquired words are added to the preset constant pool according to certain rules.
  • Each entry in the constant pool contains the corresponding word of the word.
  • the object code generation process is to analyze the expression level, analyze various expressions in the program, and generate corresponding bytecode expressions.
  • the source file that is, the output of the compilation of the input code, that is, the target code is the application package bytecode file and the reference package bytecode file, which implements the runtime environment interface (process, select, deselect, install, uninstall, getSccLibInterface ) applications will generate corresponding application package bytecode files, while pure method packages (no runtime environment interface) and applications with shared interfaces will generate reference package bytecode files, each source file correspondingly generates a byte code file.
  • the runtime environment interface process, select, deselect, install, uninstall, getSccLibInterface
  • the code is pre-compiled according to the preset grammar rules, and a download file that is easy to parse is generated.
  • the demand for resources is reduced, and the performance demand in the embedded development is guaranteed to meet the requirements.
  • Download files can perform cross-platform requirements.
  • the characters in (1) to (3) are added to the constant pool in order.
  • the constant pool data in this part is fixed, and then in the code
  • the characters in (4) are added to the constant pool in order during compilation.
  • the string corresponding to each member in the constant pool is unique, and the sequence ID, complete string information and verification compression value of the string are marked in the member structure, which is used for the subsequent encoding of the read string. Compare and verify.
  • API keywords can be upgraded.
  • the newly added API keywords are added to the original API keywords in the constant pool, and they are arranged in the order of upgrade.
  • the higher version of the API can be compatible with the lower version of the API. Ensure backward compatibility of compilation results before and after the upgrade.
  • the file that implements the runtime environment interface in the input code and the target code is the application package.
  • the embedded module can call the runtime environment interface of the application package to select the function of activating and running the application package. Because the firewall security requires the application package Common methods and variables in can only be accessed in the current package, and different application packages can access each other's shared interface methods;
  • the files in the input code and the object code that do not implement the runtime environment interface are reference packages.
  • the reference packages provide a mapping to the outside so that their methods can be called by different application packages.
  • the download file obtained by the embodiment of the present application needs to rely on the virtual machine system and the runtime environment system during practical application,
  • the virtual machine system is used to process the downloaded file, parse the bytecode in the downloaded file, and execute the corresponding application package code function.
  • the runtime environment system is used to manage the life cycle of the application, access the runtime environment interface of the application, and manage the firewall when the application is running.
  • each source file that implements the runtime environment interface is regarded as a package, which is instantiated as an application applet.
  • the main functions of the runtime environment interface are:
  • Firewall management to prevent applications under different packages from accessing each other.
  • the core of the virtual machine system is the virtual machine bytecode.
  • the basic principle of the virtual machine system is that the bytecode, the stack and the interpreter work together.
  • the bytecode is responsible for the implementation of the syntax operators of the program, and the stack is responsible for the parameters, variables and temporary operations.
  • the storage of numbers and other data, the interpreter parses the bytecode obtained in the program pointer, and the three together realize the expression of the programming language.
  • the runtime environment system introduces the concept of package and application, so in the download file conversion tool, the developer can input the package of the current source file and the AID of the application as required, in each embedded module system , the AIDs of packages and applications are unique, and the runtime environment system can find the corresponding application according to the AID.
  • an application package code contains code corresponding to the runtime environment interface
  • an application package target code contains code corresponding to the runtime environment interface
  • the input code includes at least one application package code, and may contain one, more or no reference package code.
  • the target code includes at least one application package object code, and may contain one, more or no reference package object code;
  • one application package code may need to use multiple reference package codes, and similarly, one application package object code may need to use multiple reference package object codes in actual application.
  • the method before receiving the input code, the method further includes the following steps:
  • the constant pool is used to store the programming general characters, programming language keywords, general application programming interface keywords and runtime environment interface keywords supported by the method in terms of entries;
  • the constant pool is also used to store the variables and methods declared in the header file referenced by the input code, the custom variables and custom methods in the input code in terms of terms, respectively, when the word stream corresponding to the input code is extracted.
  • the unit is stored in the constant pool;
  • the constant pool is the basis of lexical analysis.
  • Each ID in the constant pool represents a word in the word stream, and its basic structure is identified by the word, compressed and encoded. , word name, word length, word type, used identifier, and method offset identifier, where the word identifier represents the position of the word in the constant pool, the compression encoding is the compression encoding representing the word string, and the word name is the word.
  • the word length is the string length of the word
  • the word type indicates the function type of the word
  • the used flag indicates whether the word is called in the source program
  • the method offset flag indicates that when the word is a function, the function is in bytes.
  • the offset value in the code method component is the basis of lexical analysis.
  • the offset value specifically refers to the data storage location.
  • Newly declared words searched when parsing source files and header files including new macro definitions, header file function declarations, variable declarations, etc. Since all words in C language are the rules of first declaration and then calling, so in When searching for a statement, first check whether the statement is in the constant pool, if not, add the word to the constant pool, where the word identifier is a fixed value, indicating that the constant pool member is a string;
  • the word identifier is a fixed value, indicating that the member is a string
  • the word identifier is the ordinal position in the general keyword enumeration
  • the general keyword enumeration is arranged in the order of type, programming language keyword and operator, and the starting value of the word identifier is 128;
  • the types in point 8 above include numbers, functions, system functions, shared functions, global variables, local variables, etc., indicating the type meaning of each constant pool member;
  • the compression encoding of the constant pool member is the compression encoding of the string name of the word. For members whose word ID is less than 128, the compression encoding is 0.
  • the compression encoding of other members is a hash value of the ASCII codes of all characters of the word. operation;
  • the word name and word length of the constant pool member is the complete string description of its word
  • the word type of the constant pool member is the type represented by the word, as shown in 9 above; especially when the word is a function input by referencing the package bytecode file, its type is a shared function;
  • the used identification attribute of the constant pool member indicates whether the word is used by the source file. If it is not used, it will not be considered in the final link, which can speed up the link speed and optimize the use space;
  • the method offset identification attribute of the constant pool member indicates that when the word is a function method, the offset value of the bytecode corresponding to the function in the bytecode interval, that is, the offset position, that is, the storage location, when the function is called After finding the corresponding member through the constant pool, use the method offset value to jump.
  • the function of the constant pool is to mark the keywords supported by the current compilation environment, as well as the variables, macro definitions, and function declarations of source files and header files, which are used to read words when parsing the source file code. Semantic Analysis.
  • the word string corresponding to each member in the constant pool is unique, but because the string composition and length of the word are uncontrollable, simply using string comparison will waste performance and space. Therefore, the embodiments of the present application provide A matching method with greatly improved performance and memory overhead is proposed, which is divided into three steps. The operation process is as follows:
  • the first level is the word identification comparison, which can search for all single character words and programming language keyword words, and the word identification of these words is unique;
  • the second level is compression encoding comparison, which can search for words corresponding to all unique word identifiers in the constant pool;
  • the third level is the word name comparison, which can completely match the words in the constant pool
  • the basic order of matching is 1, 2, 3, and the third-level full string comparison is performed only when the word identifier is not unique.
  • the code compilation is parsed according to the actual coding order.
  • the specific conditions are as follows:
  • the word read in the source file is a header file
  • the runtime environment interface is used for runtime environment selection and switching. Other functions cannot call the runtime environment interface;
  • API interface that is, the general embedded module API interface function, whose implementation method declaration and order are fixed in the API interface set, and can be called in the application;
  • Reference package shared function that is, an external custom function package. This function package has its own AID and method list. After the source file is referenced, the shared function in the package can be called;
  • the constant pool word type of the runtime environment interface and API interface is a system function, and the word identifier value corresponding to each function is fixed and unique;
  • the type of the reference package function is a shared function, and the word of the source file custom function
  • the type type is an ordinary function, and its word identification value is a string type;
  • the API interface is in the order declared in the API interface set, and each function corresponds to an ID, which is used for the input of the bytecode of the system function call in the virtual machine system;
  • the above steps implement the basic compilation process of the embedded module application, and the output is the application package bytecode file.
  • the reference package bytecode file includes a binary bytecode file and a binary output mapping file
  • the binary output mapping file includes version information corresponding to the reference package bytecode file, application identification data, and description information of the included methods.
  • the application package bytecode file includes a method component subfile, a memory component subfile, a runtime method component subfile, and a shared interface component subfile.
  • sub-files do not represent the relationship between the upper and lower levels, but there are multiple parts in the application package bytecode file, namely the method component part, the memory component part, the runtime method component part and the shared interface. Component parts, here for describing aspects, are called subfiles.
  • the method component subfile of the application package bytecode file includes the bytecodes of all methods in the application package, which are arranged in order according to the declaration order of each method in the source code of the application package, and the storage location of each method in the application package and the method name are recorded in the constant pool in one-to-one correspondence;
  • the memory component subfile records the size and initial value of the global non-volatile space (NVM, Non-volatile Memory) and the size value of the global volatile space (RAM, Random Access Memory) in the corresponding application package;
  • NVM global non-volatile space
  • RAM Random Access Memory
  • the runtime method component subfile includes the offset value of the runtime environment interface of the corresponding application package, which is used for invoking the corresponding application package during installation, deletion, activation, and deactivation;
  • the shared interface component subfile includes the number of shared interfaces declared by the corresponding application package and the offset value of each interface method.
  • generating a download file according to the application package bytecode file and the reference package bytecode file specifically includes the following steps:
  • the method components, memory components, runtime method components and shared interface components are obtained by parsing, and combined with the preset data package and application identification data, the download is generated according to the preset format document.
  • the virtual machine system is implemented on the embedded module, which can download the bytecode file corresponding to the virtual machine and execute the corresponding bytecode process in the card;
  • the stack, RAM (volatile storage space), and NVM (non-volatile storage space) resources when the virtual machine is running are all uniformly addressed.
  • the address structure distribution diagram of the virtual machine system defines the resources as follows:
  • Virtual machine stack including analog registers, operation stacks and program stacks
  • RAM RAM space applied for in the application
  • Static NVM The space occupied by the application package bytecode file downloaded to the card, the global NVM resource of a given size defined by the application, and other personalized resources;
  • Dynamic NVM NVM resources dynamically applied for during application running
  • Different virtual machine system implementations can allocate the proportion of each resource according to the actual situation.
  • the runtime management system is responsible for managing the life cycle of cards and applications, application selection and firewall protection, etc., where:
  • the life cycle of an application consists of five methods corresponding to the runtime environment structure.
  • the install method is responsible for the private instantiation of the application during installation, the select method is responsible for application activation, and the process method is the entry for application processing commands, responsible for receiving and processing APDU commands, deselect
  • the method is responsible for application deactivation, the uninstall method is responsible for the private de-instantiation operation when the application is deleted, and each function corresponds to a life cycle stage of the application;
  • the application selection is executed through the logical channel management and selection file commands. These two commands are used by the runtime environment system to specify an An activated application instance in a session of a logical channel, once an instance is selected, this application instance will receive all subsequent private commands distributed to that logical channel until the application instance becomes deselected.
  • Firewalls also provide protection against incorrect code. If incorrect code is loaded onto the card, the firewall can still protect existing data from being accessed by this malicious code.
  • the runtime environment system also provides a mechanism that allows different applications to interact, that is, the shared interface mechanism.
  • the shared interface defines the set of all interface methods that can be shared in the application. These methods can be used in different contexts. (package and application) environment.
  • the input of the download file conversion tool includes the package AID of the source file and the input application package bytecode file path;
  • the output of the download file conversion tool includes a fixed format download script file
  • the basic principle is to extract the data of method components, memory components, runtime method components, and shared interface method components in the application package bytecode file, and organize it into a fixed-format download file together with the input package AID.
  • Embodiment 2 Based on the same inventive concept, the present application provides an embodiment of the system corresponding to Embodiment 1. For details, please refer to Embodiment 2
  • an embodiment of the present invention provides a software code compilation system, the system includes:
  • a software code compiling unit 1 which is used for receiving input codes, extracting word streams corresponding to the input codes, generating syntax trees according to preset grammar rules, and performing semantic analysis to obtain target codes
  • the input codes include application package codes and reference package codes
  • the target code includes the application package target code generated by the application package code and the reference package target code generated by the reference package code
  • both the application package code and the application package target code include the code corresponding to the runtime environment interface
  • An application package generation unit 2 which is used to generate an application package bytecode file according to the data that realizes the application function in the application package target code;
  • a reference package generation unit 3 which is used to generate a reference package bytecode file according to the data that realizes the interface call in the reference package target code;
  • the download file generating unit 4 is configured to generate a download file according to the application package bytecode file and the reference package bytecode file.
  • first the software code compiling unit 1 receives the input code, and performs a specific workflow:
  • the input code includes the application package code and the reference package code
  • the target code includes the application package target code generated by the application package code and the reference package target code generated by the reference package code
  • both the application package code and the application package target code include the runtime The code corresponding to the environment interface
  • the input code is scanned according to the coding order, and the acquired words are added to the preset constant pool according to certain rules.
  • Each entry in the constant pool contains the corresponding word of the word.
  • the object code generation process is to analyze the expression level, analyze various expressions in the program, and generate corresponding bytecode expressions.
  • the source file that is, the output of the compilation of the input code, that is, the target code is the application package bytecode file and the reference package bytecode file, which implements the runtime environment interface (process, select, deselect, install, uninstall, getSccLibInterface ) application will generate the corresponding application package bytecode file, while the reference package (no runtime environment interface) and the application with shared interface will generate the reference package bytecode file, each source file correspondingly generates a binary byte code file (application package bytecode file or reference package bytecode file).
  • the runtime environment interface process, select, deselect, install, uninstall, getSccLibInterface
  • the code is pre-compiled according to the preset grammar rules, and a download file that is easy to parse is generated.
  • the demand for resources is reduced, and the performance demand in the embedded development is guaranteed to meet the requirements.
  • Download files can perform cross-platform requirements.
  • the characters in (1) to (3) are added to the constant pool in order.
  • the constant pool data in this part is fixed, and then in the code
  • the characters in (4) are added to the constant pool in order during compilation.
  • the string corresponding to each member in the constant pool is unique, and the sequence ID, complete string information and verification compression value of the string are marked in the member structure, which is used for the subsequent encoding of the read string. Compare and verify.
  • API keywords can be upgraded.
  • the newly added API keywords are added to the original API keywords in the constant pool, and they are arranged in the order of upgrade.
  • the higher version of the API can be compatible with the lower version of the API. Ensure backward compatibility of compilation results before and after the upgrade.
  • the file that implements the runtime environment interface in the input code and the target code is the application package.
  • the embedded module can call the runtime environment interface of the application package to choose to activate and run the application package function. Because the firewall security requires the application package Common methods and variables in can only be accessed in the current package, and different application packages can access each other's shared interface methods;
  • the files in the input code and the object code that do not implement the runtime environment interface are reference packages.
  • the reference packages provide a mapping to the outside so that their methods can be called by different application packages.
  • the download file obtained by the embodiment of the present application needs to rely on the virtual machine system and the runtime environment system during practical application,
  • the virtual machine system is used to process the downloaded file, parse the bytecode in the downloaded file, and execute the corresponding application package code function.
  • the runtime environment system is used to manage the life cycle of the application, access the runtime environment interface of the application, and manage the firewall when the application is running.
  • each source file that implements the runtime environment interface is regarded as a package, which is instantiated as an application applet.
  • the main functions of the runtime environment system are:
  • Firewall management to prevent applications under different packages from accessing each other.
  • the core of the virtual machine system is the virtual machine bytecode.
  • the basic principle of the virtual machine system is that the bytecode, the stack and the interpreter work together.
  • the bytecode is responsible for the implementation of the syntax operators of the program, and the stack is responsible for the parameters, variables and temporary operations.
  • a download file conversion tool When generating the download file, a download file conversion tool can be used specifically, the function of which is to convert the application package bytecode file and the reference package bytecode file into a standard GP (GP, GlobalPlatform, Global Platform International Standards Organization) download script.
  • GP GlobalPlatform, Global Platform International Standards Organization
  • an application package code contains code corresponding to the runtime environment interface
  • an application package target code contains code corresponding to the runtime environment interface
  • the input code includes at least one application package code, and may contain one, more or no reference package code.
  • the target code includes at least one application package object code, and may contain one, more or no reference package object code;
  • one application package code may need to use multiple reference package codes, and similarly, one application package object code may need to use multiple reference package object codes in actual application.
  • the system is configured with a constant pool
  • the constant pool is used to store the programming general characters, programming language keywords, general application programming interface keywords and runtime environment interface keywords supported by the system in terms of entries;
  • the constant pool is also used to store the variables and methods declared in the header file referenced by the input code, the custom variables in the input code, and the custom methods in the unit of entry when the software code compilation unit extracts the word stream corresponding to the input code.
  • the entries are stored in the constant pool respectively;
  • the constant pool is the basis of lexical analysis.
  • Each ID in the constant pool represents a word in the word stream, and its basic structure is identified by the word, compressed and encoded. , word name, word length, word type, used ID, and method offset ID, where the word ID indicates the position of the word in the constant pool, the compression encoding is the compression encoding for the word string, and the word name is the word.
  • the word length is the string length of the word
  • the word type indicates the function type of the word
  • the used flag indicates whether the word is called in the source program
  • the method offset flag indicates that when the word is a function, the function is in bytes.
  • the offset value in the code method component is the basis of lexical analysis.
  • the offset value specifically refers to the data storage location.
  • the function of the constant pool is to mark the keywords supported by the current compilation environment, as well as the variables, macro definitions, and function declarations of the source file and header file, which are used to read the words when parsing the source file code. Semantic Analysis.
  • the word string corresponding to each member in the constant pool is unique, but since the string composition and length of the word are uncontrollable, simply using string comparison will waste performance and space. Therefore, the embodiments of the present application provide A matching method with greatly improved performance and memory overhead is proposed. It is divided into three steps. The operation process is as follows:
  • the first level is the word identification comparison, which can search for all single character words and programming language keyword words, and the word identification of these words is unique;
  • the second level is compression encoding comparison, which can search for words corresponding to all unique word identifiers in the constant pool;
  • the third level is the word name comparison, which can completely match the words in the constant pool
  • the basic order of matching is 1, 2, 3, and the third-level full string comparison is performed only when the word identifier is not unique.
  • the reference package bytecode file includes a binary bytecode file and a binary output mapping file
  • the binary output mapping file includes version information corresponding to the reference package bytecode file, application identification data, and description information of the included methods.
  • the application package bytecode file includes a method component subfile, a memory component subfile, a runtime method component subfile, and a shared interface component subfile.
  • sub-files do not represent the relationship between the upper and lower levels, but there are multiple parts in the application package bytecode file, namely the method component part, the memory component part, the runtime method component part and the shared interface. Component parts, here for describing aspects, are called subfiles.
  • the method component subfile of the application package bytecode file includes the bytecodes of all methods in the application package, which are arranged in order according to the declaration order of each method in the source code of the application package, and the storage location of each method in the application package and the method name are recorded in the constant pool in one-to-one correspondence;
  • the memory component subfile records the size and initial value of the global non-volatile space (NVM, Non-volatile Memory) and the size value of the global volatile space (RAM, Random Access Memory) in the corresponding application package;
  • NVM global non-volatile space
  • RAM Random Access Memory
  • the runtime method component subfile includes the offset value of the runtime environment interface of the corresponding application package, which is used for invoking the corresponding application package during installation, deletion, activation, and deactivation;
  • the shared interface component subfile includes the number of shared interfaces declared by the corresponding application package and the offset value of each interface method.
  • the download file generation unit 4 is specifically configured to parse and obtain the method component, the memory component, the runtime method component and the shared interface component according to the application package bytecode file and the reference package bytecode file, and combine the preset
  • the data package and application identification data are generated according to the preset format to download the file.

Abstract

L'invention concerne un procédé et un système de compilation de code logiciel, se rapportant au domaine technique des ordinateurs. Le procédé comporte les étapes consistant à: recevoir un code d'entrée, extraire un flux de mots correspondant au code d'entrée, générer un arbre de grammaire selon des règles de grammaire prédéfinies, et procéder à une analyse sémantique pour obtenir un code cible (S1), le code d'entrée comportant un code de lot d'application et un code de lot de référence, et le code cible comportant un code cible de lot d'application et un code cible de lot de référence; d'après des données servant à mettre en œuvre une fonction d'application dans le code cible de lot d'application, générer un fichier en code à octets de lot d'application (S2); d'après des données servant à mettre en œuvre un appel d'interface dans le code cible de lot de référence, générer un fichier en code à octets de lot de référence (S3); d'après le fichier en code à octets de lot d'application et le fichier en code à octets de lot de référence, générer un fichier de téléchargement (S4). Le présent procédé précompile le code et génère le fichier de téléchargement qui facilite l'interprétation, ce qui permet de réduire les demandes de ressources en développement intégré, de s'assurer que les exigences de performances en développement intégré sont satisfaites, et de satisfaire une exigence d'aptitude du fichier de téléchargement à être exécuté d'une plate-forme à une autre.
PCT/CN2021/104177 2020-08-12 2021-07-02 Procédé et système de compilation de code logiciel WO2022033229A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010815520.3A CN112052006B (zh) 2020-08-12 2020-08-12 一种软件代码编译方法及系统
CN202010815520.3 2020-08-12

Publications (1)

Publication Number Publication Date
WO2022033229A1 true WO2022033229A1 (fr) 2022-02-17

Family

ID=73601687

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/104177 WO2022033229A1 (fr) 2020-08-12 2021-07-02 Procédé et système de compilation de code logiciel

Country Status (2)

Country Link
CN (1) CN112052006B (fr)
WO (1) WO2022033229A1 (fr)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826991A (zh) * 2023-02-14 2023-03-21 江西曼荼罗软件有限公司 软件脚本生成方法、系统、计算机及可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112052006B (zh) * 2020-08-12 2021-06-15 武汉天喻信息产业股份有限公司 一种软件代码编译方法及系统
CN113568620B (zh) * 2021-06-16 2023-08-22 杭州华橙软件技术有限公司 一种代码文件处理方法、装置、设备及介质
CN113703779B (zh) * 2021-09-06 2024-04-16 王喆 一种跨平台的多语言编译方法和超轻量物联网虚拟机

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790268A (zh) * 2004-12-14 2006-06-21 艾克斯麦提克方案私人有限公司 通过散列技术的编译时间链接
US20120222021A1 (en) * 2008-01-09 2012-08-30 Kan Zhao Method and System for presenting and analyzing software source code through intermediate representation
CN110162306A (zh) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 系统的提前编译方法和装置
CN111240982A (zh) * 2020-01-09 2020-06-05 华东师范大学 源代码静态分析方法
CN111381817A (zh) * 2020-03-25 2020-07-07 北京字节跳动网络技术有限公司 实现跨平台多语言开发的方法、装置、介质和电子设备
CN112052006A (zh) * 2020-08-12 2020-12-08 武汉天喻信息产业股份有限公司 一种软件代码编译方法及系统

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1306400C (zh) * 2004-05-20 2007-03-21 北京大学 二进制软件构件的制作方法
CN100339831C (zh) * 2005-12-14 2007-09-26 浙江大学 应用于Java操作系统中虚拟机的编译体系实现方法
CN101408849A (zh) * 2008-12-01 2009-04-15 中国科学技术大学 Ttcn-3语言的编译执行方法及系统
CN103123590A (zh) * 2011-11-18 2013-05-29 中国科学院沈阳计算技术研究所有限公司 指令表il程序到c语言程序的编译方法
CN102880452A (zh) * 2012-02-01 2013-01-16 日照市国软软件有限公司 一种可跨语言重用的编程语言
CN104182267B (zh) * 2013-05-21 2019-10-25 南京中兴新软件有限责任公司 编译方法、解释方法、装置及用户设备
CN104239115A (zh) * 2014-07-24 2014-12-24 汕头大学 一种plc编程语言的编译方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790268A (zh) * 2004-12-14 2006-06-21 艾克斯麦提克方案私人有限公司 通过散列技术的编译时间链接
US20120222021A1 (en) * 2008-01-09 2012-08-30 Kan Zhao Method and System for presenting and analyzing software source code through intermediate representation
CN110162306A (zh) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 系统的提前编译方法和装置
CN111240982A (zh) * 2020-01-09 2020-06-05 华东师范大学 源代码静态分析方法
CN111381817A (zh) * 2020-03-25 2020-07-07 北京字节跳动网络技术有限公司 实现跨平台多语言开发的方法、装置、介质和电子设备
CN112052006A (zh) * 2020-08-12 2020-12-08 武汉天喻信息产业股份有限公司 一种软件代码编译方法及系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826991A (zh) * 2023-02-14 2023-03-21 江西曼荼罗软件有限公司 软件脚本生成方法、系统、计算机及可读存储介质

Also Published As

Publication number Publication date
CN112052006A (zh) 2020-12-08
CN112052006B (zh) 2021-06-15

Similar Documents

Publication Publication Date Title
WO2022033229A1 (fr) Procédé et système de compilation de code logiciel
TWI730654B (zh) 部署和執行智能合約的方法及裝置
CN111770113B (zh) 一种执行智能合约的方法、区块链节点和节点设备
US20200379738A1 (en) Extending a virtual machine instruction set architecture
CN106462425B (zh) 使用复常量的方法和系统
CN107041158B (zh) 用于模块化反射的限制性访问控制
JP3689368B2 (ja) データ処理リソースを備えたマルチアプリケーション組込システムにアプリケーションをローディングする方法、対応するシステムおよび実行方法
US8863079B2 (en) Efficient and expansive conversions between reference and primitive
US8850414B2 (en) Direct access of language metadata
CN107924326B (zh) 对经更新的类型的迁移方法进行覆盖
US9417931B2 (en) Unified metadata for external components
US20040268301A1 (en) Adding new compiler methods to an integrated development environment
US10853096B2 (en) Container-based language runtime loading an isolated method
US8141035B2 (en) Method for accessing internal states of objects in object oriented programming
WO2024045382A1 (fr) Mise en œuvre d'un mécanisme réfléchissant dans une chaîne de blocs
CN111522558B (zh) 基于Java的动态配置规则的方法、装置、系统和可读介质
US6898786B1 (en) Javascript interpreter engine written in Java
CN113703779B (zh) 一种跨平台的多语言编译方法和超轻量物联网虚拟机
US10394610B2 (en) Managing split packages in a module system
US7036120B2 (en) Two tier clusters for representation of objects in Java programming environments
CN115309405B (zh) 一种代码链接优化方法
CN115269058B (zh) 一种wpf资源加载方法及装置
CN114253523A (zh) 读取裸设备的方法、装置、计算机设备和介质
US20020198698A1 (en) Representation of objects in a Java programming environment
CN115037735A (zh) 一种基于短名称的链接方法和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21855282

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 06.07.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21855282

Country of ref document: EP

Kind code of ref document: A1