[go: up one dir, main page]

CN115037735A - Short name based linking method and system - Google Patents

Short name based linking method and system Download PDF

Info

Publication number
CN115037735A
CN115037735A CN202210402745.5A CN202210402745A CN115037735A CN 115037735 A CN115037735 A CN 115037735A CN 202210402745 A CN202210402745 A CN 202210402745A CN 115037735 A CN115037735 A CN 115037735A
Authority
CN
China
Prior art keywords
converted
name
static
names
class
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210402745.5A
Other languages
Chinese (zh)
Inventor
石玉平
郑江东
徐俊江
王幼君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing WatchSmart Technologies Co Ltd
Original Assignee
Beijing WatchSmart Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing WatchSmart Technologies Co Ltd filed Critical Beijing WatchSmart Technologies Co Ltd
Priority to CN202210402745.5A priority Critical patent/CN115037735A/en
Publication of CN115037735A publication Critical patent/CN115037735A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/301Name conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/3015Name registration, generation or assignment
    • H04L61/3025Domain name generation or assignment

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a short name-based linking method and system, and belongs to the technical field of program linking and mapping. The method of the invention sets the conversion rule of the member needing name conversion, sets the identification method of the internal member used by the internal member access instruction, and sets the expression method of the internal member used by the internal exception class of the exception handling program of the method; setting a conversion realization process for name conversion of members; generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for performing name conversion on the member and the internal member access instruction; and analyzing and installing the executable file. By adopting the method, the size of the constant pool can be effectively reduced, the index analysis operation of the constant pool of the instruction is further reduced, and the downloading and installation performance of the application can be obviously improved.

Description

Short name based linking method and system
Technical Field
The invention belongs to the technical field of program linking and mapping, and particularly relates to a linking method and system based on short names.
Background
In the field of security chips (including intelligent SE, secure MCU, etc.), a multi-application chip operating system supporting dynamic download applications has been widely deployed and used in the fields of finance, telecommunications, transportation, etc. The multi-application chip operating system generally writes an application program by using a high-level language, and the application program is compiled and converted into an executable binary file format supported by the chip operating system through a compiler and a related conversion tool, and can be downloaded and installed into a virtual machine of the chip operating system for execution.
The virtual machine is an abstract computer generated by a software application program or an instruction sequence executed by a processor, the platform independence refers to an application program written by an object-oriented high-level programming language such as Python, Java, Kotlin and the like, the application program can be executed on various different computer platforms through the virtual machine, and the instruction sequence of the virtual machine is one or more byte code streams coded by an independent platform. The high-level language virtual machine executes a high-level programming language and is used for 32-bit or 64-bit structures, and resource-limited devices such as intelligent SEs and safety MCUs are difficult to bear and realize the virtual machine based on 32-bit operation instructions. The high-level language virtual machine has the advantages that the instruction identifies program elements such as classes, methods and domains through symbolic names in the constant pool, large storage resources are required when the identification operation of the program elements is analyzed, and the high-level language virtual machine does not have practicability in resource-limited devices such as intelligent SE (sequence independent entity) and safety MCU (microprogrammed control unit). Therefore, the operation of the identification of the program instruction elements in the prior art method consumes a large amount of memory resources and cannot be applied to resource-constrained devices.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a short name based linking method and system. According to the method and the system, the element names of the high-level language are renamed, so that the size of the constant pool is reduced, the elements of the same type can be sequenced, the positions of the quoted elements can be conveniently positioned when the applications are installed in the device and class linking is carried out, meanwhile, the instruction for accessing the elements is specially designed, the instruction for accessing the internal elements and the abnormal class of the abnormal processing program of the method directly use the offset position of the internal part, the size of the constant pool is effectively reduced, further, the constant pool index analysis operation of the instruction is reduced, and the downloading and installation performance of the applications can be remarkably improved.
In order to achieve the above purposes, the invention adopts the technical scheme that: a short name based linking method comprises the following steps:
if receiving an input application file to be converted, setting a conversion rule of a member needing name conversion, wherein the member comprises a public class and an interface, all instance domains of the class, a public and protected static domain, a public and protected static method, a virtual method and an interface method; setting an internal member access instruction to use an internal member representation method, wherein the internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction; setting a conversion implementation process for name conversion of the member; generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for performing name conversion on the member and the internal member access instruction; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment; and analyzing and installing the executable file.
Further, the setting of the conversion rule of the member needing to perform name conversion includes: setting the name of the open class and the interface to be converted into a short name with less ordered character number; converting names of all instance domains of the set class into short names with fewer ordered characters; setting the name of a virtual method to be converted into a short name with less ordered character number; the names of the set static domain, the static method and the interface method are all converted into short names with less ordered characters.
Further, the process of setting the member to perform name conversion includes: acquiring the names of the open classes and the interfaces in the application file to be converted and sequentially converting the names into 2-character short names consisting of capital letters: AA. AB, AC … AZ, BA, BB …; sequencing and grouping the example domains in the application file to be converted according to the sequence so as to group the example domains into public/protected basic types, public/protected reference types, packages or private application types, packages or private basic types, and sequentially converting the names of the example domains into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first reference type and the number of all reference types; acquiring the name of the virtual method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters, wherein the public/protected virtual method in the virtual method is sequentially converted into aa, ab, ac … az, ba and bb … mz from the virtual method of the root superclass; the virtual method defined by the subclass is continuously named after the virtual method of the superclass, and the virtual method defined by the subclass covering the superclass is kept consistent with the name of superclass conversion; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class in the same package, and the virtual method covering the super class statement of the same package is consistent with the name converted by the super class; acquiring the name of the interface method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters: aa. ab, ac … az, ba, bb …; acquiring the names of the static domains which are disclosed and protected in the application file to be converted and judging whether the static domains are static domains of the Fianl basic data type; if so, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, the name of the static domain is sequentially converted into other 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …; acquiring the static methods disclosed and protected in the application file to be converted and sequentially converting the names of the static methods into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb ….
Further, the generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to the conversion rule of the member for name conversion and the internal member access instruction includes: acquiring the mapping relation between the element name of each member in the application file to be converted and the converted name so as to generate a corresponding name mapping file; acquiring the offset of the identification information and the installation method of the application in the application file to be converted in the code segment, and the configuration parameter combination of the input implementation class of the application to generate a corresponding application information segment, wherein the installation method of the application is implemented by a static method of the application class; acquiring information of all types and interfaces declared in the application file to be converted to generate a corresponding dynamic binding data segment; the information of the class comprises all information required by a new instance instruction; acquiring information of all static domains declared in the application file to be converted to generate a corresponding static binding data segment; generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet sub-segment, a constant pool sub-segment, a code constant pool index position sub-segment and a present packet output item sub-segment; and acquiring byte codes of methods defined by all classes in the application file to be converted and exception handler information to generate corresponding code segments.
Further, the generating a link data segment corresponding to the application file to be converted according to the name mapping file includes: obtaining the expression information of each import package from the name mapping file to generate corresponding import package subsections; acquiring classes, methods and domains referenced by the instructions from the code segments of the application files to be converted to generate corresponding constant pool subsections; acquiring the positions of all constant pool indexes in the application file to be converted to generate corresponding code constant pool index position subsections; and acquiring the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in the static domain mirror image in the class and the offset of each static method in the class in the code section to generate a corresponding output item subsection of the package.
A short name based linking system comprising the following means: a conversion rule setting device, configured to set a conversion rule of a member that needs name conversion if an input application file to be converted is received, where the member includes a public class and an interface, all instance domains of the class, a public and protected static domain, a public and protected static method, a virtual method, and an interface method; the device comprises a representation method setting device, a display method setting device and a display device, wherein the representation method setting device is used for setting a representation method of using an internal member by an internal member access instruction, and the internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction; a conversion implementation flow setting device for setting a conversion implementation flow for the name conversion of the member; the file generating device is used for generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for the name conversion of the member and the internal member access instruction; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment; and the file analysis and installation device is used for analyzing and installing the executable file.
Further, the conversion rule setting device includes a unit: the first setting unit is used for setting that the names of the open classes and the interfaces are converted into short names with fewer ordered characters; the second setting unit is used for setting that the names of all the example domains of the class are converted into short names with fewer ordered characters; a third setting unit, for setting the name of the virtual method to be converted into a short name with less ordered character number; and the fourth setting unit is used for setting that the names of the static domain, the static method and the interface method are all converted into ordered short names with less character quantity.
Further, the conversion implementation flow setting device includes a unit: a first conversion implementation unit, configured to obtain names of the public classes and the interfaces in the application file to be converted, and sequentially convert the names into 2-character short names composed of capital letters: AA. AB, AC … AZ, BA, BB …; a second conversion implementation unit, configured to sort and group the instance domains in the application file to be converted in order, so as to group the instance domains into a public/protected basic type, a public/protected reference type, a package or a private application type, a package or a private basic type, and sequentially convert names of the instance domains into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first reference type and the number of all reference types; a third conversion implementation unit, configured to obtain names of virtual methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters, where a public/protected virtual method in the virtual methods is sequentially converted from a root super class virtual method into aa, ab, ac … az, ba, bb … mz; the virtual method defined by the subclass is continuously named after the virtual method of the superclass, and the virtual method defined by the subclass covering the superclass is kept consistent with the name of superclass conversion; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class in the same package, and the virtual method covering the super class statement of the same package is consistent with the name converted by the super class; a fourth conversion implementation unit, configured to obtain names of interface methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …; a fifth conversion implementation unit, configured to obtain names of the static domains disclosed and protected in the application file to be converted and determine whether the static domains are static domains of the fianl basic data type; if yes, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, converting the name of the static domain into other 2-character short names consisting of lower case letters in sequence: aa. ab, ac … az, ba, bb …; a sixth conversion implementation unit, configured to obtain the static methods disclosed and protected in the application file to be converted, and sequentially convert names of the static methods into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb ….
Further, the file generating apparatus includes a unit: the name mapping file generating unit is used for acquiring the mapping relation between the element names of all members in the application file to be converted and the converted names so as to generate a corresponding name mapping file; an application information segment generating unit, configured to acquire the identification information of the application in the application file to be converted and the offset of the installation method in the code segment, and combine the configuration parameters of the implementation class of the input application to generate a corresponding application information segment, where the installation method of the application is implemented by a static method of the application class; the dynamic binding data segment generating unit is used for acquiring the information of all types and interfaces declared in the application file to be converted so as to generate a corresponding dynamic binding data segment; the information of the class comprises all information required by a new instance instruction; the static binding data segment generating unit is used for acquiring the information of all static domains declared in the application file to be converted so as to generate a corresponding static binding data segment; the link data segment generating unit is used for generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet subsection, a constant pool subsection, a code constant pool index position subsection and a local packet output item subsection; and the code segment generating unit is used for acquiring the byte codes of the methods defined by all the classes in the application file to be converted and the exception handler information so as to generate corresponding code segments.
Further, the linkage data segment generating unit includes a unit: the import package subsection generating unit is used for acquiring the expression information of each import package from the name mapping file so as to generate a corresponding import package subsection; the constant pool subsection generating unit is used for acquiring the class, the method and the domain referred by the instruction from the code section of the application file to be converted so as to generate a corresponding constant pool subsection; the constant pool index position sub-segment generation unit is used for acquiring the positions of all constant pool indexes in the application file to be converted so as to generate a corresponding code constant pool index position sub-segment; the package output item sub-section generating unit is used for acquiring the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in a static domain mirror image in the class and the offset of each static method in the class in the code section so as to generate the corresponding package output item sub-section.
The invention has the following effects: by renaming the element names of the high-level language, the method not only reduces the size of the constant pool, but also can sequence the elements of the same type, is convenient for positioning and quoting the element positions when the application is installed in the device and is subjected to class linking, and simultaneously specially designs the instruction of accessing the elements, and the instruction of accessing the internal elements directly uses the offset positions of the internal components, thereby effectively reducing the size of the constant pool, further reducing the constant pool index analysis operation of the instruction and obviously improving the downloading and installation performance of the application.
Drawings
FIG. 1 is a flow chart of a method of the present invention;
FIG. 2 is a schematic sub-flow diagram of the process of the present invention;
FIG. 3 is a schematic view of another sub-flow of the process of the present invention;
FIG. 4 is a schematic view of another sub-flow of the method of the present invention;
FIG. 5 is a schematic view of another sub-flow of the method of the present invention;
FIG. 6 is a block diagram of the system of the present invention;
Detailed Description
The invention is further described with reference to the following figures and detailed description.
As shown in fig. 1, a link method based on a short name is applied to a user terminal, where the link method based on a short name is executed through application software installed in the user terminal, and the user terminal is a terminal device, such as a desktop computer, a notebook computer, a tablet computer, or a mobile phone, that is used for executing the link method based on a short name to convert classes and interfaces defined in a program file to obtain an executable file and a name mapping file and input the executable file and the name mapping file into other devices for installation, and the executable file is quickly parsed and installed through the name mapping file and installed in resource-limited devices, such as an intelligent SE and a secure MCU.
A method for representing object-oriented program link information in a compact, secure file format and a proprietary instruction format is described. With this method the program can be downloaded, linked and executed on a resource-constrained device. While certain implementations are described below with reference to intelligent SEs, the present invention may also be used with other similar resource-constrained devices. The method comprises the steps that a user writes a program package comprising one or more classes, a high-level language compiler is adopted to compile source codes to generate one or more class files, a conversion program running on a workstation is adopted to convert all the class files in one package into a compact loadable program file, the conversion program receives one or more name mapping files as input except the converted class files, the name mapping files comprise package information of an imported package, character name mapping information of the classes and character name mapping information of class members, and the program file is downloaded and installed to a resource-limited device through an installation program running on the workstation.
The name mapping file includes identification information of the program package, and the name mapping file further includes symbolic names of externally visible program elements declared or defined by the source program and corresponding converted short symbolic names. The name mapping file comprises name mappings of all public classes and interfaces defined by the program package and name mappings of all public and protected domains and methods defined in the classes and interfaces, the name mapping file is used for converting the program package, and the name mapping file of all packages imported by the packages to be converted needs to be provided during conversion.
Typically the program file includes all the classes and interfaces defined in a single package, represented by an 8-bit byte stream, a 16-bit integer represented by two consecutive 8-bit bytes, and a 32-bit integer represented by four consecutive 8-bit bytes. The program file comprises an application information section, a dynamic binding data section, a static binding data section, a code section and a link data section.
The application information segment includes application installation information; the dynamic binding data segment comprises all kinds of information in the packet; the static binding data segment comprises static domain information of all class declarations; the code segment comprises the byte codes, exception handling and other contents of all class definition methods; the link data section further comprises a constant pool subsection, a lead-in package subsection, a code constant pool index position subsection and a package lead-out item subsection, wherein the constant pool subsection, the lead-in package subsection and the code constant pool index position subsection comprise data required when the package link operation is installed, and the package lead-out item subsection is stored in a persistent storage area of the SE after being installed and is used when other package links led in the package are installed.
The constant pool subsection generally comprises name-converted short symbol names of one or more externally visible classes, domains and methods, and the method short symbol names can be used for positioning method positions in the code subsection of the import package; the class short symbol name can be used for positioning a class position in a dynamic binding data section of the import package, and the domain short symbol name can be used for positioning position information of a domain in a static binding data section of the import package.
The method comprises the steps that a package containing application is called an application package, a package not containing application is called a library package, symbol name mapping files are output when a program is converted into the library package, each library package corresponds to one output symbol name mapping file, and the symbol name mapping files only contain public information, such as AID and version information of the package or information of other identification packages, original symbol names of program elements, short symbol names after conversion and the like, and do not relate to the details of library package realization; the conversion application package does not usually output the symbol name mapping file, the symbol name mapping file is only needed to be output when the application package uses the shared interface, and the symbol name mapping file provides the name conversion information of the method of the shared interface and does not relate to the sensitive content of the application.
The members of the package definition are called internal members, the members of the import package definition are called external members, the instruction of the external member is used for realizing through constant pool index, and the instruction for accessing the internal member is realized through the internal representation of the member.
In order to reduce the size of the constant pool and conveniently identify the positions of the members, the conversion program needs to convert the names of external visible members of the package, and uniformly convert the original symbol names with any length into the character names of the specified characters, the invention selects 2 character name examples for explanation, and the method is also suitable for the character names with other lengths. The length of the 2 characters is selected by considering the premise of meeting the requirement of mapping member number, and names as short as possible are selected, and the 2 character names only containing English letters can name 26 × 26 members, so that the use on equipment with limited resources can be met. As shown in fig. 1, the method of the present invention comprises the steps of:
s110, if the input application file to be converted is received, setting a conversion rule of a member needing name conversion, wherein the member comprises a public class and an interface, all instance domains of the class, a public and protected static domain, a public and protected static method, a virtual method and an interface method.
In an embodiment, as shown in fig. 2, step S110 includes sub-steps S111, S112, S113, and S114.
And S111, converting the names of the set open classes and interfaces into short names with fewer ordered characters.
Specifically, the members that need to be name-converted include public classes and interfaces, all instance domains of a class, exposed and protected static domains, exposed and protected static methods, and construct methods.
In the conversion rule of name conversion, the class, the interface and the domain are all represented by short names with fewer characters, that is, the number of characters of the short names is less than that of characters contained in the names of the class and the interface. For example, classes, methods, and domains may all be identified with 2-character short names. For example, the short name format of the class (interface) adopts capital English letters according to the commonly agreed initial characters of high-level languages, the second character adopts capital English letters, the class (interface) is numbered continuously from AA, and the short names of the class and the interface, namely AA, AB, AC … AZ, BA, BB, BC … BZ, CA, CB and CC …, are sequentially assigned according to the alphabetical order.
The above example is only a conversion form of short names, and actually, there may be no limitation on the character types, the number of characters, the sequential or reverse arrangement, or other arrangements. For example, the character type may be a letter, punctuation, or other symbol, etc., and the number of characters may be 2, 3, or 4, etc. For example, Aa, Ab, Ac, or other initial character combinations are also possible; or not from AA, sorted by Ccc, or a combination of letters and numbers, such as a1, a2, … …, or a1, a2, … …, etc.
S112, converting the names of all the example domains of the setting class into short names with less ordered characters.
The names of the method and the domain name can be converted into short names with a smaller number of characters, i.e., the number of characters of the short names is smaller than the number of characters contained in the names of the method and the domain name. For example, it is generally agreed that the first character is in lower case English letters, the second character is in lower case English letters, and names are assigned in alphabetical order to short names aa, ab, ac … az, ba, bb, bc … bz, ca, cb, cc … of the method and domain name. Wherein all the instance fields of each class are named consecutively from aa, and the instance fields following the int type instance field need to skip one name.
S113, the name of the virtual method is set to be converted into a short name with less ordered character number.
In the conversion rule of name conversion, the virtual methods are specifically divided into two types, and the open/protected and packet visible virtual methods are named and numbered respectively. For example, the names of virtual methods are converted to short names of 2 characters consisting of lower case letters, the public/protected virtual methods are named consecutively starting from aa, starting from the virtual method of the root superclass, the packet-visible virtual methods are named consecutively starting from the virtual method of the class without the packet superclass, and starting from na.
S114, setting the names of the static domain, the static method and the interface method, and converting the names into short names with less ordered character quantity.
In the conversion rule of name conversion, the names of the static domain, the static method and the interface method can be converted into short names with less characters, that is, the number of the characters of the short names is less than that of the characters contained in the names of the static domain, the static method and the interface method. For example, the public/protected static domains of each class are named consecutively from aa, the public/protected static methods (including the construction method) of each class are named consecutively from aa, and the methods of each interface are named consecutively from aa.
S120, setting an internal member access instruction to use an internal member representation method, wherein the internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction; the internal class of the exception handler for setting a method uses the representation method of the internal member.
The following three types of instructions are specially designed, the internal member access instruction uses an internal member representation method and does not use a constant pool index mode, so that the size of the constant pool subsegment can be reduced, the operation of constant pool index analysis is reduced, and the downloading performance of the program package can be obviously improved. The internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction.
For static domain access instructions, the instructions generally include two types of functions, a read static domain and a write static domain, and each type of instruction can be implemented as one or more instructions; the command comprises constant pool index and static domain mirror image offset, and the most significant bit is used for distinguishing the constant pool index from the static domain mirror image offset; and an independent access outsourcing static domain instruction and an internal package static instruction can be designed, wherein the outsourcing static domain instruction uses a constant pool index parameter, and the internal package static instruction uses the offset of the static domain mirror image.
For a static method call instruction, the instruction comprises a constant pool index and an offset of a code segment, and the most significant bit is used for distinguishing the constant pool index from the offset of the code segment; it is also possible to design separate instructions for invoking out-packed static methods and instructions for in-packed static methods, the out-packed static method instructions using constant pool index parameters and the in-packed static method instructions using offsets of code segments.
For object access instructions, three instructions are usually included, a new instance instruction, a checkcast instruction, and an instanceof instruction; the command comprises a constant pool index and an offset of the dynamic binding data segment, and the constant pool index and the offset of the dynamic binding data segment are distinguished through the highest bit; it is also possible to design separate instructions to call out the outsource and the endoconch, the outsource instruction using the constant pool index parameter, and the endoconch instruction using the offset of the dynamically bound data segment.
Furthermore, parameters of the internal member representation method are typically not included for the following instructions: the instance domain access instruction contains a constant pool index parameter pointing to the instance domain reference type, the virtual method call instruction contains a constant pool index parameter pointing to the virtual method reference type, and the super method call instruction contains a constant pool index parameter pointing to the super method reference type. The interface method calling instruction does not use the constant pool index, and uses the interface method index of the class for realizing the interface table.
S130, setting a conversion implementation process of name conversion of the members.
In an embodiment, as shown in fig. 3, step S130 includes sub-steps S131, S132, S133, S134, S135 and S136.
S131, acquiring the names of the open classes and the interfaces in the application file to be converted and sequentially converting the names into 2-character short names consisting of capital letters: AA. AB, AC … AZ, BA, BB ….
And acquiring the public class and the interface in the program package, and sequentially converting the names of the class or the interface into 2-character short names, namely AA, AB, AC … AZ, BA and BB ….
S132, sequencing and grouping the instance domains in the application file to be converted in sequence to group the instance domains into public/protected basic types, public/protected reference types, packages or private application types, packages or private basic types, and sequentially converting the names of the instance domains into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first referenced type therein and the number of all referenced types.
Specifically, all the instance domains of the class are obtained, the instance domains are grouped according to the following 4 classification modes, and the grouping is ordered according to the following sequence: a public/protected base type, a public/protected reference type, a package or private application type, a package or private base type. The names of the instance fields are sequentially converted into 2-character short names, aa, ab, ac … az, ba, bb, bc …, and the name of the first reference type and the number of all reference types are recorded.
S133, acquiring the name of the virtual method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters, wherein the public/protected virtual method in the virtual method is sequentially converted into aa, ab, ac … az, ba and bb … mz from the virtual method of the root superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class, and the virtual method defined by the subclass covering the super class is consistent with the name converted by the super class; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual methods defined by the subclasses are then named consecutively with the virtual methods of the superclasss in the same package, and the virtual methods covering the superclass declaration in the same package are kept consistent with the names of the superclass conversions.
The following two virtual methods are respectively subjected to name conversion: public and protected virtual methods of the public class, packet visible virtual methods. The name conversion rules for the open and protected virtual methods of the open class are: and (3) converting the name of the root super virtual method, starting from the root super virtual method, converting the first virtual method into aa, converting the second virtual method into ab, and so on.
For subclass virtual method name conversion, a virtual method defined by a subclass is continuously named after a virtual method defined by a super class, and the virtual method defined by the subclass covering the super class is consistent with the name converted by the super class; if the super class is not defined by the packet, the name of the virtual method with the maximum number of the super class needs to be obtained through the name mapping table of the super class packet.
The name conversion rule of the packet visible virtual method comprises the following steps: the class without the same-package superclass starts to be converted from the virtual method of the root superclass, the first virtual method is converted into na, the second virtual method is converted into nb, and the rest is done in sequence; the class with the same-package superclass, the virtual method defined by the subclass is continuously named after the virtual method of the superclass in the same package, and the virtual method covering the same-package superclass statement is consistent with the name converted by the superclass.
S134, obtaining the name of the interface method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters: aa. ab, ac … az, ba, bb ….
For each interface, acquiring a method list, and sequentially converting the names of the interface methods into 2-character short names, aa, ab, ac … az, ba, bb and bc ….
S135, acquiring the names of the static domains which are disclosed and protected in the application file to be converted and judging whether the static domains are static domains of the basic data types of the fianl; if yes, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, converting the name of the static domain into other 2-character short names consisting of lower case letters in sequence: aa. ab, ac … az, ba, bb ….
For each open class or interface, if the static domain of the open and protected types is the static domain of the final basic data type (i.e. compile time constant), the domain name is converted into zz, and the corresponding constant value is recorded in the name mapping file. Otherwise, the names of the static domains are converted into 2-character short names, aa, ab, ac … az, ba, bb and bc … in sequence.
S136, obtaining the static methods disclosed and protected in the application file to be converted and sequentially converting the names of the static methods into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb ….
For each disclosure class, the static methods and construction methods of the disclosed and protected types are obtained, and the names of the static methods are converted into 2-character short names aa, ab, ac … az, ba, bb, bc … in turn.
S140, generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for name conversion of the member and the internal member access instruction; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment.
In an embodiment, as shown in fig. 4, step S140 includes sub-steps S141, S142, S143, S144, S145, and S146.
S141, obtaining the mapping relation between the element name of each member in the application file to be converted and the converted name to generate a corresponding name mapping file. The installation of the executable file does not require a name mapping file, which is only used when converting files.
And acquiring the mapping relation between the names of the elements of the open class and the interface, all the example domains of the class, the open and protected static domains, the open and protected static methods, the virtual methods and the interface methods in the application file to be converted and the converted name, and generating a corresponding name mapping file.
S142, obtaining the identification information of the application in the application file to be converted and the offset of the installation method in the code segment, and combining the configuration parameters of the input implementation class of the application to generate a corresponding application information segment, wherein the installation method of the application is implemented by a static method of the application class.
The application information section comprises identification information of each application and offset of an installation method in the code section, the implementation class of the application is provided by an input configuration parameter (or an input configuration file) mode of the conversion program, and the installation method of the application is implemented by a static method of the application class, for example: the subclass of Application class requires implementation of the install method.
S143, acquiring information of all types and interfaces declared in the application file to be converted to generate a corresponding dynamic binding data segment; the class information includes all information required by the new instance instruction.
The dynamic binding data section comprises all classes and interfaces declared in the package, the class information comprises all information required by a new instance instruction, and each class comprises the following information: class marking, number of implementation interfaces, super class reference of the class, number of declared instance domains, short symbol name of the first reference type, number of reference types, defined minimum sequence public/protected virtual method short symbol name, defined minimum sequence package visible virtual method short symbol name, public/protected virtual method table, package visible virtual method table, and implemented interface information table. Each interface contains the following information: marking the interfaces, realizing the number of the super interfaces and the reference type of the super interfaces.
The virtual method table is constructed by the following steps: sequentially arranging the names of the virtual methods in the application file to be converted to construct a virtual method table; the virtual method table comprises a public/protected virtual method table and a package visible virtual method table, the virtual method defined by the package is the method offset in the code segment, and the virtual method defined by the outsourcing sets a special value different from the effective offset. The interface table is constructed by the following steps: and sequentially arranging the names of the interface methods in the application file to be converted, acquiring the short names corresponding to the virtual methods to construct an interface table, designating the short symbol names of the virtual methods corresponding to the short symbol names of the interface methods, sequencing the interface methods of the interface table according to the short symbol names, and arranging the short symbol names corresponding to the interface methods in the interface method list.
S144, obtaining the information of all static domains stated in the application file to be converted to generate a corresponding static binding data segment.
The static binding data segment includes all static domain information declared by the package, and specifically includes: there are an array reference type with an initial value, a reference type with null initially, a base type with default values initialized, and a base type with non-default values initialized. All the quote types need to be classified and stored continuously, so that the garbage collection algorithm can be realized conveniently.
And S145, generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet sub-segment, a constant pool sub-segment, a code constant pool index position sub-segment and a present packet output item sub-segment.
In an embodiment, as shown in fig. 5, step S145 includes sub-steps S1451, S1452, S1453 and S1454.
S1451, obtaining the description information of each import package from the name mapping file to generate a corresponding import package sub-segment.
The import package subsection includes identification information for each import package, which is obtainable from the name map file for each package.
S1452, obtaining the class, the method and the domain referenced by the instruction from the code segment of the application file to be converted so as to generate a corresponding constant pool sub-segment.
The constant pool subsection comprises classes, methods and domains referenced by instructions in the code section, and specifically comprises the following steps: the method comprises the steps of declaring public classes of outsourced declarations, declaring instance fields of the outsourced public classes and the inner packages, declaring virtual methods of the outsourced public classes and the inner packages, defining public or protected static methods and initialing methods of the outsourced public classes, defining public or protected static fields of the outsourced public classes, and converting short symbolic names of the members.
S1453, obtaining the positions of all constant pool indexes in the application file to be converted to generate corresponding code constant pool index position sub-segments.
The code constant pool index location sub-segment may be used to indicate the location of all constant pool indices in the code segment that the installation package needs to resolve to an internal representation of the SE.
S1454, obtaining the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in the static domain mirror image in the class and the offset of each static method in the class in the code section to generate a corresponding output item subsection of the package.
The package output item subsection includes an offset for each class in the dynamically bound data section, an offset for each static domain in the class in the static domain mirror, and an offset for each static method in the class in the code section.
An example storage layout is as follows:
class AA
Static Domain list of classes aa, ab, ac …
Class static method categories aa, ab, ac …
Class AB
Static Domain lists of classes aa, ab, ac …
Class static method categories aa, ab, ac …
Wherein, the arrangement sequence of the classes must be consistent with the alphabetical sequence from small to large of the short names of the classes, namely AA, AB, AC …; the arrangement sequence of the static domains of the class must be consistent with the alphabetical sequence from small to large of the short names of the domains, namely aa, ab, ac …; the arrangement sequence of the static methods of the class must be consistent with the short names of the static methods from small to large in alphabetical order, namely aa, ab, ac …; the short name information may be obtained from a name mapping file of the import package. Other storage means may be used as long as the order of each class member is consistent with the alphabetical order of the symbol names.
S146, acquiring byte codes of methods defined by all classes in the application file to be converted and exception handler information to generate corresponding code segments.
The code segment comprises byte codes of all class-defined methods and exception handler information, and specifically comprises exception handler information and method information, wherein the method information comprises the number of parameters of the methods, the number of registers used by the methods, and the byte codes of the exception handlers.
And S150, analyzing and installing the executable file.
Analyzing and installing an application package containing one or more applications and an installation of a library package without the applications, wherein the specific process of analyzing and installing comprises the following steps: downloading each segment of the executable file into the resource-constrained device; storing the application information to a persistent storage area of the resource-constrained device; analyzing the constant pool reference of the dynamic link segment and then saving the constant pool reference to a persistent storage area of the resource-limited device; analyzing the constant pool reference of the code segment and then saving the code segment to a persistent storage area of the resource-limited device; creating a static domain mirror image according to the content of the static binding data segment; saving the content of the export item subsection of the package; the contents of the constant pool sub-segments may be discarded.
For class linking, external symbol references in the executable file can be resolved on the device from symbolic and indexed forms to internal representations of virtual machine usage.
The index conversion mode of the short symbol name is as follows:
AA AB AC … sequentially converts indexes 0, 1 and 2 …
aa ab ac … sequentially converting indexes 0, 1, 2 …
And na nb nc … sequentially converts indexes 0, 1 and 2 ….
For the analysis of the external class, the position information of the SE-installed package can be inquired according to the identification information of the lead-in package in the lead-in package sub-section, the external class short name is converted into a lead-out item sub-section class index of the lead-in package, and the class index is used for inquiring the offset of the class in the dynamic binding data section.
For the analysis of the external static domain, the short symbol name of the external static domain can be converted into a domain index of the specified class of the export sub-segment of the import packet, and the domain index is used for querying the offset of the domain in the static domain mirror image.
For the analysis of the external static method, the short symbol name of the external static method can be converted into a static method index of the specified class of the export item subsection of the import package, and the offset of the static method in the code segment is inquired by using the method index. For instance domain resolution, the short symbolic name of the instance domain may be converted to an instance domain index. For the virtual method analysis, the analysis process of outsourcing the public/protected virtual method is as follows: and converting the short symbol names of the virtual methods into public/protected virtual method indexes, and searching the super-class virtual method table to obtain the offset positions of the virtual methods in the code segment. The analysis process of the inner virtual inclusion method comprises the following steps: and converting the virtual method short symbol name into a packet visible virtual method index, and searching a virtual method table to obtain the offset position of the virtual method in the code segment.
When the resource-limited device dynamically downloads and installs the application and library written in the object-oriented language, the method for converting the program package into the short symbol name containing the positioning information and the access instruction format of the special design member by adopting the compact format and the external symbol name can obviously improve the installation speed of the program package, reduce the SE persistent storage space occupied by the program package and improve the execution performance of the application.
Compared with the existing link method based on single byte mark (up to 256 members), the link method based on short name supports to refer more external package members, and the 2-character length adopted by the technical scheme can support 26 × 26 ═ 676 member numbers.
In this embodiment, a conversion rule of a member to be subjected to name conversion is set, an identification method of an internal member is used for setting an internal member access instruction, and a conversion implementation flow for the member to perform name conversion is set; generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for performing name conversion on the member and the internal member access instruction; and analyzing and installing the executable file. By the method, the size of the constant pool can be effectively reduced, so that the constant pool index analysis operation of the instruction is reduced, and the downloading and installation performance of the application can be remarkably improved.
As shown in fig. 6, a short name based linking system, which can be configured in a user terminal, is configured to perform any one of the embodiments of the short name based linking method described above, and includes the following devices: conversion rule setting means 110, presentation method setting means 120, conversion realization flow setting means 130, file generation means 140, and file analysis installation means 150.
A conversion rule setting device 110, configured to set a conversion rule of a member that needs to perform name conversion if an input application file to be converted is received, where the member includes a public class and an interface, all instance domains of a class, a public and protected static domain, a public and protected static method, a virtual method, and an interface method.
In one embodiment, the conversion rule setting device 110 includes: the first setting unit is used for setting that names of the open classes and the interfaces are converted into short names with fewer ordered characters; the second setting unit is used for setting that the names of all the example domains of the class are converted into short names with fewer ordered characters; a third setting unit, configured to set that the name of the virtual method is converted into a short name with a smaller number of ordered characters; and the fourth setting unit is used for setting that the names of the static domain, the static method and the interface method are all converted into short names with less ordered character quantity.
A representation method setting device 120, configured to set a representation method that an internal member access instruction uses an internal member, where the internal member access instruction includes a static domain access instruction, a static method call instruction, and an object access instruction; the inner class of the exception handler that is also used to set the method uses the method of representation of the inner member.
A conversion implementation flow setting device 130, configured to set a conversion implementation flow for name conversion performed by the member.
In an embodiment, the conversion implementation flow setting device 130 includes: the first conversion implementation unit is used for acquiring the names of the open classes and the interfaces in the application files to be converted and sequentially converting the names into 2-character short names consisting of capital letters: AA. AB, AC … AZ, BA, BB …; a second conversion implementation unit, configured to sequentially sort and group the instance domains in the application file to be converted, so as to group the instance domains into public/protected basic types, public/protected reference types, packages or private application types, packages or private basic types, and sequentially convert names of the instance domains into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first reference type and the number of all reference types; a third conversion implementation unit, configured to obtain names of virtual methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters, where a public/protected virtual method in the virtual methods is sequentially converted from a root super class virtual method into aa, ab, ac … az, ba, bb … mz; the virtual method defined by the subclass is continuously named after the virtual method of the super class, and the virtual method defined by the subclass covering the super class is consistent with the name converted by the super class; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual method defined by the subclass is continuously named after the virtual method of the superclass in the same package, and the virtual method covering the superclass statement in the same package is consistent with the name of superclass conversion; a fourth conversion implementation unit, configured to obtain names of interface methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …; a fifth conversion implementation unit, configured to obtain names of the static domains disclosed and protected in the application file to be converted and determine whether the static domains are static domains of the fianl basic data type; if so, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, converting the name of the static domain into other 2-character short names consisting of lower case letters in sequence: aa. ab, ac … az, ba, bb …; a sixth conversion implementation unit, configured to obtain the static methods disclosed and protected in the application file to be converted, and sequentially convert names of the static methods into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb ….
A file generating device 140, configured to generate an executable file and a name mapping file corresponding to the application file to be converted according to a conversion rule for name conversion performed by the member and the internal member access instruction by using an internal member representation method; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment.
In a specific embodiment, the file generating apparatus 140 includes: the name mapping file generating unit is used for acquiring the mapping relation between the element names of all members in the application file to be converted and the converted names so as to generate a corresponding name mapping file; an application information segment generating unit, configured to acquire the identification information of the application in the application file to be converted and the offset of the installation method in the code segment, and combine the configuration parameters of the implementation class of the input application to generate a corresponding application information segment, where the installation method of the application is implemented by a static method of the application class; the dynamic binding data segment generating unit is used for acquiring the information of all types and interfaces declared in the application file to be converted so as to generate a corresponding dynamic binding data segment; the information of the class comprises all information required by a new instance instruction; the static binding data segment generating unit is used for acquiring the information of all static domains declared in the application file to be converted so as to generate a corresponding static binding data segment; the link data segment generating unit is used for generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet sub-segment, a constant pool sub-segment, a code constant pool index position sub-segment and a present packet output item sub-segment; and the code segment generating unit is used for acquiring the byte codes of the methods defined by all the classes in the application file to be converted and the exception handler information so as to generate corresponding code segments.
In a specific embodiment, the link data segment generating unit includes: the import package subsection generating unit is used for acquiring the expression information of each import package from the name mapping file so as to generate a corresponding import package subsection; the constant pool subsection generating unit is used for acquiring the class, the method and the domain referred by the instruction from the code section of the application file to be converted so as to generate a corresponding constant pool subsection; the constant pool index position sub-segment generation unit is used for acquiring the positions of all constant pool indexes in the application file to be converted so as to generate a corresponding code constant pool index position sub-segment; the package output item sub-section generating unit is used for acquiring the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in a static domain mirror image in the class and the offset of each static method in the class in the code section so as to generate the corresponding package output item sub-section.
And a file parsing and installing device 150, configured to parse and install the executable file.
In this embodiment, a conversion rule of a member to be subjected to name conversion is set, an identification method of an internal member is used for setting an internal member access instruction, and a conversion implementation flow for the member to perform name conversion is set; generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for performing name conversion on the member and the internal member access instruction; and analyzing and installing the executable file. By the method, the size of the constant pool can be effectively reduced, so that the constant pool index analysis operation of the instruction is reduced, and the downloading and installation performance of the application can be remarkably improved.
It will be appreciated by those skilled in the art that the method and system of the present invention are not limited to the embodiments described in the detailed description, which is for the purpose of explanation and not limitation. Other embodiments will be apparent to those skilled in the art from the following detailed description, which is intended to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A link method based on short name is characterized in that the method is used for converting classes and interfaces defined in a program file to obtain an executable file and a name mapping file, and the executable file is quickly analyzed and installed through the name mapping file, and the method comprises the following steps:
if receiving an input application file to be converted, setting a conversion rule of a member needing name conversion, wherein the member comprises a public class and an interface, all instance domains of the class, a public and protected static domain, a public and protected static method, a virtual method and an interface method;
setting an internal member access instruction to use an internal member representation method, wherein the internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction;
the method is set, and the method for representing the internal members is used for the internal exception class of the exception handler;
setting a conversion implementation process for name conversion of the member;
generating an executable file and a name mapping file corresponding to the application file to be converted according to a conversion rule for performing name conversion on the member and a representation method for accessing and using the internal member by the internal member; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment;
and analyzing and installing the executable file.
2. The method for linking based on short name as claimed in claim 1, wherein the setting of the conversion rule of the member needing name conversion comprises:
setting names of open classes and interfaces to be converted into short names with fewer ordered characters;
converting names of all instance domains of the set class into short names with fewer ordered characters;
setting the name of a virtual method to be converted into a short name with less ordered character number;
the names of the set static domain, the static method and the interface method are all converted into short names with less ordered characters.
3. The linking method based on short name as claimed in claim 1, wherein the conversion implementation process for setting the member to perform name conversion includes:
acquiring the names of the open classes and the interfaces in the application file to be converted and sequentially converting the names into 2-character short names consisting of capital letters: AA. AB, AC … AZ, BA, BB …;
sequencing and grouping the example domains in the application file to be converted according to the sequence so as to group the example domains into public/protected basic types, public/protected reference types, packages or private application types, packages or private basic types, and sequentially converting the names of the example domains into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first reference type and the number of all reference types;
acquiring the name of the virtual method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters, wherein the public/protected virtual method in the virtual method is sequentially converted into aa, ab, ac … az, ba and bb … mz from the virtual method of the root superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class, and the virtual method defined by the subclass covering the super class is consistent with the name converted by the super class; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class in the same package, and the virtual method covering the super class statement of the same package is consistent with the name converted by the super class;
acquiring the name of the interface method in the application file to be converted and sequentially converting the name into a 2-character short name consisting of lower case letters: aa. ab, ac … az, ba, bb …;
acquiring the names of the static domains which are disclosed and protected in the application file to be converted and judging whether the static domains are static domains of the Fianl basic data type; if so, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, the name of the static domain is sequentially converted into other 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …;
acquiring the static methods disclosed and protected in the application file to be converted and sequentially converting the names of the static methods into 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb ….
4. The linking method based on short name as claimed in claim 1, wherein the generating of the executable file and the name mapping file corresponding to the application file to be converted by using the representation method of the internal member according to the conversion rule of the name conversion of the member and the access instruction of the internal member comprises:
acquiring the mapping relation between the element name of each member in the application file to be converted and the converted name so as to generate a corresponding name mapping file;
acquiring the offset of the identification information and the installation method of the application in the application file to be converted in the code segment, and the configuration parameter combination of the input implementation class of the application to generate a corresponding application information segment, wherein the installation method of the application is implemented by a static method of the application class;
acquiring information of all types and interfaces declared in the application file to be converted to generate a corresponding dynamic binding data segment; the information of the class comprises all information required by a new instance instruction;
acquiring information of all static domains declared in the application file to be converted to generate a corresponding static binding data segment;
generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet sub-segment, a constant pool sub-segment, a code constant pool index position sub-segment and a present packet output item sub-segment;
and acquiring byte codes of methods defined by all classes in the application file to be converted and exception handler information to generate corresponding code segments.
5. The method for linking based on short name as claimed in claim 4, wherein the generating of the linking data segment corresponding to the application file to be converted according to the name mapping file comprises:
obtaining the expression information of each import package from the name mapping file to generate corresponding import package subsections;
acquiring classes, methods and domains referenced by the instructions from the code segments of the application files to be converted to generate corresponding constant pool subsections;
acquiring the positions of all constant pool indexes in the application file to be converted to generate corresponding code constant pool index position subsections;
and acquiring the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in the static domain mirror image in the class and the offset of each static method in the class in the code section to generate a corresponding output item subsection of the package.
6. A short name based linking system, comprising:
a conversion rule setting device, configured to set a conversion rule of a member that needs name conversion if an input application file to be converted is received, where the member includes a public class and an interface, all instance domains of the class, a public and protected static domain, a public and protected static method, a virtual method, and an interface method;
the device comprises a representation method setting device, a display method setting device and a display device, wherein the representation method setting device is used for setting a representation method of using an internal member by an internal member access instruction, and the internal member access instruction comprises a static domain access instruction, a static method calling instruction and an object access instruction; the internal exception class of the exception handler for setting the method uses the representation method of the internal member;
a conversion implementation flow setting device for setting a conversion implementation flow for the name conversion of the member;
the file generating device is used for generating an executable file and a name mapping file corresponding to the application file to be converted by using an internal member representation method according to a conversion rule for the name conversion of the member and the internal member access instruction; the executable file comprises an application information segment, a link data segment, a dynamic binding data segment, a static binding segment and a code segment;
and the file analysis and installation device is used for analyzing and installing the executable file.
7. The short-name based link system as claimed in claim 6, wherein said conversion rule setting means includes means for:
the first setting unit is used for setting that the names of the open classes and the interfaces are converted into short names with fewer ordered characters;
the second setting unit is used for setting that the names of all the example domains of the class are converted into short names with fewer ordered characters;
a third setting unit, configured to set that the name of the virtual method is converted into a short name with a smaller number of ordered characters;
and the fourth setting unit is used for setting that the names of the static domain, the static method and the interface method are all converted into short names with less ordered character quantity.
8. The system of claim 6, wherein the means for setting the conversion implementation flow comprises:
a first conversion implementation unit, configured to obtain names of the public classes and the interfaces in the application file to be converted, and sequentially convert the names into 2-character short names composed of capital letters: AA. AB, AC … AZ, BA, BB …;
a second conversion implementation unit, configured to sequentially sort and group the instance domains in the application file to be converted, so as to group the instance domains into public/protected basic types, public/protected reference types, packages or private application types, packages or private basic types, and sequentially convert names of the instance domains into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …, recording the name of the first reference type and the number of all reference types;
a third conversion implementation unit, configured to obtain names of virtual methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters, where a public/protected virtual method in the virtual methods is sequentially converted from a root super class virtual method into aa, ab, ac … az, ba, bb … mz; the virtual method defined by the subclass is continuously named after the virtual method of the super class, and the virtual method defined by the subclass covering the super class is consistent with the name converted by the super class; the virtual method of the class without the same-packet superclass is converted into na, nb and nc … zz in turn from the virtual method of the class without the same-packet superclass; the virtual method defined by the subclass is continuously named after the virtual method of the super class in the same package, and the virtual method covering the super class statement of the same package is consistent with the name converted by the super class;
a fourth conversion implementation unit, configured to obtain names of interface methods in the application file to be converted and sequentially convert the names into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb …;
a fifth conversion implementation unit, configured to obtain names of the static domains disclosed and protected in the application file to be converted and determine whether the static domains are static domains of the fianl basic data type; if so, converting the name of the static domain into a 2-character short name zz and acquiring a corresponding constant value; if not, the name of the static domain is sequentially converted into other 2-character short names consisting of lower case letters: aa. ab, ac … az, ba, bb …;
a sixth conversion implementation unit, configured to obtain the static methods disclosed and protected in the application file to be converted, and sequentially convert names of the static methods into 2-character short names composed of lower case letters: aa. ab, ac … az, ba, bb ….
9. The short name based linking system as claimed in claim 6, wherein said file generating means comprises means for:
the name mapping file generating unit is used for acquiring the mapping relation between the element names of all members in the application file to be converted and the converted names so as to generate a corresponding name mapping file;
an application information segment generating unit, configured to acquire the identification information of the application in the application file to be converted and the offset of the installation method in the code segment, and combine the configuration parameters of the implementation class of the input application to generate a corresponding application information segment, where the installation method of the application is implemented by a static method of the application class;
the dynamic binding data segment generating unit is used for acquiring the information of all types and interfaces declared in the application file to be converted so as to generate a corresponding dynamic binding data segment; the information of the class comprises all information required by a new instance instruction;
the static binding data segment generating unit is used for acquiring the information of all static domains declared in the application file to be converted so as to generate a corresponding static binding data segment;
the link data segment generating unit is used for generating a link data segment corresponding to the application file to be converted according to the name mapping file, wherein the link data segment comprises a lead-in packet sub-segment, a constant pool sub-segment, a code constant pool index position sub-segment and a present packet output item sub-segment;
and the code segment generating unit is used for acquiring the byte codes of the methods defined by all the classes in the application file to be converted and the exception handler information so as to generate corresponding code segments.
10. The short-name based linking system according to claim 9, wherein the linking-data-segment generating unit includes a unit that:
the import package subsection generating unit is used for acquiring the expression information of each import package from the name mapping file so as to generate a corresponding import package subsection;
the constant pool subsection generating unit is used for acquiring the class, the method and the domain referred by the instruction from the code section of the application file to be converted so as to generate a corresponding constant pool subsection;
the constant pool index position sub-segment generation unit is used for acquiring the positions of all constant pool indexes in the application file to be converted so as to generate a corresponding code constant pool index position sub-segment;
the package output item sub-section generating unit is used for acquiring the offset of each class in the application file to be converted in the dynamic binding data section, the offset of each static domain in a static domain mirror image in the class and the offset of each static method in the class in the code section so as to generate the corresponding package output item sub-section.
CN202210402745.5A 2022-04-18 2022-04-18 Short name based linking method and system Pending CN115037735A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210402745.5A CN115037735A (en) 2022-04-18 2022-04-18 Short name based linking method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210402745.5A CN115037735A (en) 2022-04-18 2022-04-18 Short name based linking method and system

Publications (1)

Publication Number Publication Date
CN115037735A true CN115037735A (en) 2022-09-09

Family

ID=83119737

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210402745.5A Pending CN115037735A (en) 2022-04-18 2022-04-18 Short name based linking method and system

Country Status (1)

Country Link
CN (1) CN115037735A (en)

Similar Documents

Publication Publication Date Title
KR100713738B1 (en) Zero overhead exception handling
AU771699B2 (en) Token-based linking
KR100518584B1 (en) Shared library system and method for constructing the system
US6446254B1 (en) Packaging memory image files
RU2390837C2 (en) Method and system for security policy embodiment using virtual security machine
CN112052006B (en) Software code compiling method and system
EP0528028B1 (en) Automatic flowgraph generation for program analysis and translation
US5923878A (en) System, method and apparatus of directly executing an architecture-independent binary program
EP0529059B1 (en) Branch resolution via backward symbolic execution
US6314445B1 (en) Native function calling
US7788652B2 (en) Representing type information in a compiler and programming tools framework
US6592628B1 (en) Modular storage method and apparatus for use with software applications
CN114968282A (en) Optimization method and system for exception handling execution
US7181724B2 (en) Representation of Java® data types in virtual machines
CN115037735A (en) Short name based linking method and system
US6934726B2 (en) Storing and retrieving of field descriptors in Java computing environments
Marlet Syntax of the JCVM language to be studied in the SecSafe project
CN111767033A (en) Programming system for mechanical arm program development and function extension method
US20020198698A1 (en) Representation of objects in a Java programming environment
Dewar et al. Micro Spitbol
CN119847605A (en) Instruction expansion management method of blockchain intelligent contract
Klinger et al. Günther Haslinger
Zhou et al. BSD/I18N—Internationalization of the 4.3 BSD UNIX system
Reiser BAIL

Legal Events

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