CN101739404B - Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod - Google Patents

Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod Download PDF

Info

Publication number
CN101739404B
CN101739404B CN200810174452A CN200810174452A CN101739404B CN 101739404 B CN101739404 B CN 101739404B CN 200810174452 A CN200810174452 A CN 200810174452A CN 200810174452 A CN200810174452 A CN 200810174452A CN 101739404 B CN101739404 B CN 101739404B
Authority
CN
China
Prior art keywords
bytecode
java card
static function
section
specific
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.)
Expired - Fee Related
Application number
CN200810174452A
Other languages
Chinese (zh)
Other versions
CN101739404A (en
Inventor
刘子瑛
李丞倍
金亨一
罗栋元
李相研
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SK Telecom China Holdings Co Ltd
Original Assignee
SK Telecom China Holdings 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 SK Telecom China Holdings Co Ltd filed Critical SK Telecom China Holdings Co Ltd
Priority to CN200810174452A priority Critical patent/CN101739404B/en
Publication of CN101739404A publication Critical patent/CN101739404A/en
Application granted granted Critical
Publication of CN101739404B publication Critical patent/CN101739404B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention relates to a bytecode-optimized database and an establishing method thereof and a bytecode optimizing method. The method for establishing a JAVA card bytecode-optimized database comprises the following steps of: scanning a bytecode sequence which can be arranged on a JAVA card to acquire given bytecode segments in the scanned bytecode sequence, wherein the given bytecode segments comprise one or more bytecode segments repeatedly used to the preset times; constructing static functions to correspond to the acquired given bytecode segments respectively; and storing an incidence relation between the given bytecode segments and the corresponding static functions so as to establish the JAVA card bytecode-optimized database. The bytecode optimizing method can obviously optimize the repeated bytecodes, reduces storage consumption, improves efficiency, and realizes compatibility.

Description

Bytecode-optimized database and method for building up thereof and bytecode-optimized method
Technical field
The present invention relates to field of intelligent cards, relate in particular to the optimization method of bytecode-optimized database and method for building up thereof and JAVA card bytecode.
Background technology
The JAVA card is JAVA virtual machine technique and the product that the traditional intelligence card technique combines, and is a kind of smart card that can move the JAVA program.
The JAVA program implementation process that can operate on the smart card is following.At first, write the JAVA source code (.java program file) of this JAVA program by the developer, source code generates the class file of being made up of the bytecode that meets the JAVA virtual machine specification (.class) through compiler compiling back.When this JAVA program was moved on smart card, class loaders was packed into from the bytecode of class file, behind the verifier safety verification, read bytecode by the JAVA virtual machine, converted the local code of JAVA card into, in the CPU of smart card, moved.
Usually; There are a large amount of byte code sequences that repeat in the class file of forming by bytecode; And also there are a large amount of byte code sequences that repeat in different being installed in the program on the JAVA card, and this can be caused the lot of consumption of storage space undoubtedly, also certainly will reduce the execution efficient of bytecode.
Carry out efficient for the consumption and the raising bytecode that reduce storage space, proposed the byte code sequence that a kind of optimisation technique is optimized a large amount of repetitions at present.This technology considers and remains with some undefined bytecodes in the JAVA virtual machine specification, so, utilize these undefined bytecodes to replace a large amount of byte code sequences that repeat as macro definition.For example; The instruction sload 4 of certain application program often is used on the JAVA card, and the value of the 4th parameter is read in this instruction expression from storehouse, be 0x16 and 0x04 by the byte code sequence after compiling; Two bytes will be taken, and when operation, two bytecodes need be scanned.According to the method described above; Can replace 0x16 and 0x04 as macro definition with undefined bytecode 0xEF in the JAVA virtual machine specification; Like this; The instruction of originally representing with two bytecodes only need just can be represented with a bytecode now, when carrying out, also only needs bytecode of scanning, so can save storage space and improve the execution efficient of bytecode.
Though existing method can reduce storage consumption and raise the efficiency, still there are many problems in this method.At first, owing to used the undefined byte sign indicating number that keeps,, will cause whole JAVA card system incompatible so if therefore use the bytecode of these reservations during the upgrading of JAVA virtual machine specification.Secondly, undefined bytecode is very limited, and this makes existing method can only on very limited degree, reduce storage consumption and raise the efficiency.At last, the bytecode according to after the above-mentioned optimization method optimization can only be loaded on the specific JAVA card, is carried out by specific JAVA virtual machine, otherwise will produce ambiguity, and causes program normally to carry out.
Summary of the invention
The object of the present invention is to provide the optimization method of bytecode-optimized database and method for building up thereof and JAVA card bytecode, utilize the present invention can significantly optimize the bytecode of repetition, compatibility is raised the efficiency and realized to the reduction storage consumption.
For realizing the foregoing invention purpose, the present invention proposes a kind of method that is used to set up JAVA card bytecode-optimized database, comprises step:
Scanning can be installed in the byte code sequence of the application program on the said JAVA card, and with specific bytecode section in the byte code sequence that obtains to be scanned, wherein, specific bytecode section comprises that one or more repeated uses reach the bytecode section of pre-determined number;
The structure static function is come the corresponding respectively specific bytecode section that is obtained; With
Store the incidence relation of specific bytecode section and corresponding static function, to set up JAVA card bytecode-optimized database.
The present invention also provides a kind of JAVA card bytecode-optimized database, comprising:
Scan module; Be used to scan the byte code sequence that can be installed in the application program on the said JAVA card; With specific bytecode section in the byte code sequence that obtains to be scanned, wherein, specific bytecode section comprises that one or more repeated uses reach the bytecode section of pre-determined number;
The static function constructing module, the specific corresponding static function of bytecode section that is used to construct Yu is obtained; With
Memory module is used to store the incidence relation of specific bytecode section and corresponding static function.
The present invention also provides a kind of optimization method of JAVA card bytecode, comprises step:
Bytecode-optimized database is arranged to the module of quoting of application program; Wherein, This bytecode-optimized database comprises specific bytecode section and corresponding static function thereof, and specific bytecode section comprises that one or more repeated uses reach the bytecode section of pre-determined number;
Static function included in the said bytecode-optimized database is placed the constant pool of said application program;
The specific bytecode section that said application program is included replaces with corresponding static function; With
Upgrade exception process range and reference position in the byte code sequence of said application program.
Description of drawings
Other characteristics of the present invention, purpose and benefit will become more obvious through the detailed description below in conjunction with accompanying drawing.Wherein:
Fig. 1 is the method flow diagram that is used to set up JAVA card bytecode-optimized database;
Fig. 2 is the exemplary relation tabulation that is used to store specific bytecode section and corresponding static function thereof;
Fig. 3 is the process flow diagram of the optimization method of JAVA card bytecode.
Embodiment
Below, will combine accompanying drawing to describe each embodiment of the present invention in detail.
Fig. 1 is the method flow diagram that is used to set up JAVA card bytecode-optimized database.This method was carried out before the JAVA card dispatches from the factory, and the JAVA card bytecode-optimized database that utilizes this method to set up places on the JAVA card.
Before this method of execution; At first collect the application program that can on the JAVA card, install, comprise JAVA card system self application program, JAVA application program that current main-stream is used and the JAVA application program in the applied field of JAVA card etc. in the intrinsic routine library.The source code of these application programs generates byte code sequence through compiling.
As shown in Figure 1; Application program to collecting scans through the byte code sequence that compiling is generated; To obtain bytecode section specific in these byte code sequences, wherein, specific bytecode section comprises reuses the bytecode section (step S100) that reaches pre-determined number.
Each specific bytecode section is all constructed a corresponding with it static function (step S110).
Store the incidence relation of each specific bytecode section and corresponding static function, to set up JAVA card bytecode-optimized database (step S120).
A simple JAVA card bytecode-optimized database is as shown in Figure 2; It is used to store each specific bytecode section and corresponding static function thereof; To represent the incidence relation between the two, be convenient to when follow-up use, replace corresponding specific bytecode section with static function.As shown in Figure 2, store two specific bytecode sections and corresponding static function thereof in the relation list, specific bytecode section A is corresponding to static function a, and specific bytecode section B is corresponding to static function b.So, when set up applications, can bytecode section A all in the program file be replaced to static function a, all bytecode section B are replaced to static function b.Usually, the specific shared storage space of bytecode section is far longer than the shared storage space of static function, like this, and through replacement; Application program just can not take so big space, and when program run, only scans the code of much less yet; So, can reduce storage consumption, raise the efficiency.
Below, describe JAVA card referring to Fig. 3 and realize bytecode-optimized process with JAVA card bytecode-optimized database of setting up according to method shown in Figure 1.Fig. 3 shows the process flow diagram of the optimization method of JAVA card bytecode.This optimization method is being carried out when the JAVA card is installed new application program; For example; New application program Y will be installed on the JAVA card; There is specific bytecode section in the installation file of this application program in the byte code sequence that compiling generated, there is corresponding static function in these specific bytecode sections in JAVA card bytecode-optimized database.
As shown in Figure 3, at first, with placing the bytecode-optimized database on this JAVA card to be arranged to the module of quoting of application program Y, so that in the process of set up applications Y, can use this bytecode-optimized database (step S300).
Then, static function included in the bytecode-optimized database is placed the constant pool (step S310) of application program Y;
In the process that this application program Y installs, included specific bytecode section all replaces with static function (step S320) corresponding in the bytecode-optimized database in the file with installing;
Consider the exception process range and the reference position of JAVA LISP program LISP; Because specific bytecode section has been replaced to corresponding static function; So exception process range and reference position in the installation file will change to some extent; So, upgrade exception process range and reference position (the step S330) of whole byte code sequence.
Further, specific bytecode section can comprise that also those take the more bytecode section of storage resources.Like this, every application program of this bytecode section that comprises can replace this specific bytecode section with static function when mounted, thereby reduces storage consumption greatly.
In addition; If on known specific JAVA card, bytecode-optimized database is set; So can also be in advance static function be realized with the local code of this specific JAVA card, like this, be installed in application program on this JAVA card when operation; Directly carry out local code, this will significantly improve the efficient of whole virtual machine and running environment.
It will be appreciated by those skilled in the art that top each embodiment disclosed method can utilize software, hardware or way of hardware and software combination to realize.
Those skilled in the art are to be understood that; Under the enlightenment of the above embodiment of the present invention; Can obtain the various distortion of the embodiment of the invention, and under the situation that does not depart from the spirit or scope of the present invention, defined General Principle can be applied among other embodiment also among this paper.Therefore the present invention is not limited to the embodiment shown in this paper, and requirement and principle and novel feature the widest corresponding to scope disclosed herein.

Claims (8)

1. method that is used to set up JAVA card bytecode-optimized database comprises step:
Scanning can be installed in the byte code sequence of the application program on the said JAVA card, and with specific bytecode section in the byte code sequence that obtains to be scanned, wherein, specific bytecode section is to take the bytecode section that resource reaches predeterminated level;
The structure static function is come the corresponding respectively specific bytecode section that is obtained; With
Store the incidence relation of specific bytecode section and corresponding static function, to set up JAVA card bytecode-optimized database.
2. the method that is used to set up JAVA card bytecode-optimized database as claimed in claim 1, wherein, the byte code sequence that can be installed in the application program on the said JAVA card comprises:
The byte code sequence of intrinsic routine library on the said JAVA card.
3. like each described method that is used to set up JAVA card bytecode-optimized database among the claim 1-2, also comprise:
Said static function is compiled into the local code of said JAVA card, and stores the incidence relation between said static function and the said local code.
4. device that is used to set up JAVA card bytecode-optimized database comprises:
Scan module is used to scan the byte code sequence that can be installed in the application program on the said JAVA card, and with specific bytecode section in the byte code sequence that obtains to be scanned, wherein, specific bytecode section is to take the bytecode section that resource reaches predeterminated level;
The static function constructing module, the specific corresponding static function of bytecode section that is used to construct Yu is obtained; With
Memory module is used to store the incidence relation of specific bytecode section and corresponding static function.
5. the device that is used to set up JAVA card bytecode-optimized database as claimed in claim 4, wherein, said scan module scans the bytecode of intrinsic routine library on the said JAVA card.
6. like claim 4 or the 5 described devices that are used to set up JAVA card bytecode-optimized database, also comprise:
The local code generation module is used for said static function is compiled into the local code of said JAVA card; And
Said memory module also is used to store the incidence relation between said static function and the said local code.
7. the optimization method of a JAVA card bytecode comprises step:
Bytecode-optimized database is arranged to the module of quoting of application program, and wherein, this bytecode-optimized database comprises specific bytecode section and corresponding static function thereof, and specific bytecode section is to take the bytecode section that resource reaches predeterminated level;
Static function included in the said bytecode-optimized database is placed the constant pool of said application program;
The specific bytecode section that said application program is included replaces with corresponding static function; With
Upgrade exception process range and reference position in the byte code sequence of said application program.
8. optimization method as claimed in claim 7, wherein, said bytecode-optimized database also comprises and the corresponding local code of said static function; And
When said application program is moved, directly carry out said local code.
CN200810174452A 2008-11-05 2008-11-05 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod Expired - Fee Related CN101739404B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200810174452A CN101739404B (en) 2008-11-05 2008-11-05 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200810174452A CN101739404B (en) 2008-11-05 2008-11-05 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod

Publications (2)

Publication Number Publication Date
CN101739404A CN101739404A (en) 2010-06-16
CN101739404B true CN101739404B (en) 2012-08-29

Family

ID=42462897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200810174452A Expired - Fee Related CN101739404B (en) 2008-11-05 2008-11-05 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod

Country Status (1)

Country Link
CN (1) CN101739404B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063208B (en) * 2013-03-21 2017-11-17 北京百度网讯科技有限公司 Optimization method, system and the server of code file
CN105653351B (en) * 2015-12-30 2019-08-06 北京博思汇众科技股份有限公司 The optimization method and system of java card virtual machine
CN106227576A (en) * 2016-08-18 2016-12-14 北京智芯微电子科技有限公司 The function realizing method of a kind of Java card application and device
CN108153530B (en) * 2017-12-26 2020-06-16 网易(杭州)网络有限公司 Byte code optimization method and device, storage medium, processor and terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1292114A (en) * 1998-11-06 2001-04-18 布尔Cp8公司 Data compaction method for intermediate object code program executable in onboard system
CN1493983A (en) * 2003-09-05 2004-05-05 浙江大学 Parallel compiling apparatus based on J2EE construction unit
CN1687900A (en) * 2005-06-16 2005-10-26 北京航空航天大学 Method for controlling smart card running environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1292114A (en) * 1998-11-06 2001-04-18 布尔Cp8公司 Data compaction method for intermediate object code program executable in onboard system
CN1493983A (en) * 2003-09-05 2004-05-05 浙江大学 Parallel compiling apparatus based on J2EE construction unit
CN1687900A (en) * 2005-06-16 2005-10-26 北京航空航天大学 Method for controlling smart card running environment

Also Published As

Publication number Publication date
CN101739404A (en) 2010-06-16

Similar Documents

Publication Publication Date Title
US9519466B2 (en) Executable code for constrained computing environments
CN103955363B (en) A kind of manufacture method of program upgrade installation package
CN105022630B (en) A kind of assembly management system and assembly management method
CN103718159B (en) Image processing software development approach, image processing software development device
CN107077379B (en) A kind of virtual machine creation method and device
CN103729235A (en) Java virtual machine (JVM) and compiling method thereof
CN111857765B (en) Plug-in system for drug design system, and generation method and updating method thereof
US20170052764A1 (en) Pluggable components for runtime-image generation
CN101739404B (en) Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod
CN102289380B (en) firefox starting acceleration method
CN101025696A (en) Method of providing partially isolated execution environment and its digital information apparatus
US8615743B2 (en) Adaptive compiled code
CN106293870A (en) Computer system and strategy thereof guide compression method
KR102052776B1 (en) Installation engine and package format for parallelizable, reliable installations
CN112799677A (en) Hook method, device, equipment and storage medium for compilation period
CN105224309A (en) A kind of method and apparatus transferring function
US8578352B1 (en) Optimizing object oriented programs using limited customization
US20090187897A1 (en) Compiling method and compiling program
CN107450937B (en) Application program running method and running device
CN112527315A (en) Automatic conversion method, device, computer equipment and medium for programming language function
CN114490103A (en) Operating system interface calling method and device and electronic equipment
EP3396536A1 (en) Application program running method and apparatus
US20060074931A1 (en) Configuring a shared library to accommodate relocatable data in a pervasive device
US20170083298A1 (en) Resilient format for distribution of ahead-of-time compiled code components
CN112241268A (en) Keil engineering compiling method, system and equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120829

Termination date: 20121105