CN105589729A - Dynamic compiling method and device based on embedded virtual machine - Google Patents

Dynamic compiling method and device based on embedded virtual machine Download PDF

Info

Publication number
CN105589729A
CN105589729A CN201510998967.8A CN201510998967A CN105589729A CN 105589729 A CN105589729 A CN 105589729A CN 201510998967 A CN201510998967 A CN 201510998967A CN 105589729 A CN105589729 A CN 105589729A
Authority
CN
China
Prior art keywords
code
local
code block
default
focus
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
CN201510998967.8A
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 Ruian Technology Co Ltd
Original Assignee
Beijing Ruian Technology 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 Ruian Technology Co Ltd filed Critical Beijing Ruian Technology Co Ltd
Priority to CN201510998967.8A priority Critical patent/CN105589729A/en
Publication of CN105589729A publication Critical patent/CN105589729A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Abstract

The embodiment of the invention discloses a dynamic compiling method and device based on an embedded virtual machine, wherein the method comprises the following steps: obtaining a code block in a byte code; determining whether the code block accords with a preset hotspot threshold value condition or not according to operation information of the code block; and, if the code block accords with the preset hotspot threshold value condition, compiling the code block to a local code, and storing the local code in a preset register. According to the dynamic compiling method and device based on the embedded virtual machine provided in the embodiment of the invention, the commonly compiled code block in the byte code is extracted; the commonly compiled code block is compiled and stored in the rapid access register; therefore, the repetitive execution time of the commonly compiled code block is reduced; a lot of processes of invoking and re-interpreting can be omitted; furthermore, the execution speed can be increased greatly when the code block is stored in the register; and the time is saved.

Description

A kind of method of the on-the-flier compiler based on embedded type virtual machine and device
Technical field
The embodiment of the present invention relates to the technical field of embedded type virtual machine, relates in particular to a kind of based on embedded voidThe method of the on-the-flier compiler of plan machine and device.
Background technology
Due to this many restriction that exist in hardware resource aspect of embedded platform, and embedded type virtual machineIn the application of carrying out, have a large amount of circulations, such as interrupt call and security strategy etc. are called repeatedly, meetingEfficiency to virtual machine affects. When embedded type virtual machine is in the time carrying out mass data transmission, gestureMust impact the transmission of data, thus the whole system of having influence on.
If make full use of the various functions of embedded type virtual machine, such as safety monitoring, code identification, numberAccording to isolation etc., the optimization of systematic function has much room for improvement.
Summary of the invention
The embodiment of the present invention proposes a kind of method and device of the on-the-flier compiler based on embedded type virtual machine, is intended toSolve the problem that how to improve embedded type virtual machine runnability.
First aspect, a kind of method of the on-the-flier compiler based on embedded type virtual machine, described method comprises:
Obtain the code block in bytecode;
If described code block is known hotspot, from default register, obtains local code and compile;
If described code block is not known hotspot, obtain the operation information of described code block;
Determine according to the operation information of described code block whether described code block meets the threshold value bar of default focusPart, described operation information comprises the history compiling number of times of described code block;
If described code block meets the threshold condition of default focus, described code block is compiled as to local code,And described local code is stored in default register, return and carry out the behaviour who obtains the code block in bytecodeDo.
Preferably, described described code block is compiled as to local code, and described local code is stored in advanceIf in register, comprising:
Analyzer reads in the code block of described focus, described code block is converted into generation by the method for syntactic analysisThe inside semantic information that code generator can use;
Described code generator generates local code according to described inner semantic information, and by described local codeSend to code to dispose device;
Described code is disposed device described local code is stored in described default register.
Preferably, described code is disposed device described local code is stored in described default register, comprising:
It is that described local code distributes a default minimum list that described code is disposed device in described default registerThe memory space of position;
If the capacity of described local code increases, described code is disposed device and is continued as described local code distributionThe memory space of the described least unit of at least one times, and by the end of the memory space of newly assigned least unitTail address and linking by pointer with the start address of the memory space of the least unit of a upper distribution.
Preferably, described described local code is stored in default register after, also comprise:
Obtain described local code and be stored in the address information in described default register, and by described address letterBreath substitutes the raw address of all code blocks identical with corresponding code block in described bytecode.
Preferably, describedly from default register, obtain local code and compile, comprising:
Read the address information of the focus in described bytecode, the address information of described focus is described focus pairThe local code of answering is in the address information of described default register;
Obtain according to the address information of described focus the local code that described focus is corresponding, and according to described this localityCode compiles.
Preferably, described method also comprises:
Obtain the operation information of described local code at interval of Preset Time, according to the operation of described local codeInformation determines whether described local code meets the threshold condition of default focus, the operation letter of described local codeBreath comprises the number of run of described local code;
If described local code does not meet the threshold condition of default focus, in described default register, deleteDescribed local code.
Second aspect, a kind of device of the on-the-flier compiler based on embedded type virtual machine, described device comprises:
The first acquisition module, for obtaining the code block of bytecode;
Collector if be known hotspot for described code block, is obtained local generation from default registerCode compiles;
The second acquisition module, if be not known hotspot for described code block, obtains the fortune of described code blockRow information;
The first determination module, for determining according to the operation information of described code block whether described code block meetsThe threshold condition of default focus, described operation information comprises the history compiling number of times of described code block;
Return to module, if meet the threshold condition of default focus for described code block, by described code blockBe compiled as local code, and described local code is stored in default register, return to execution first and obtainThe function of module.
Second aspect, described in return to module, comprising:
Analyzer, for reading in the code block of described focus, turns described code block by the method for syntactic analysisTurn to the inside semantic information that code generator can use;
Code generator, for generating local code according to described inner semantic information, and by described local generationCode sends to code to dispose device;
Code is disposed device, for described local code being stored in to described default register.
Preferably, described code is disposed device, for:
It in described default register, is the memory space that described local code distributes a default least unit;
If the capacity of described local code increases, continue as described local code distribute at least one times described inThe memory space of least unit, and by the end address of the memory space of newly assigned least unit with upper oneThe start address of the memory space of the least unit of individual distribution links by pointer.
Preferably, described device also comprises:
Alternative module, is stored in the address information of described default register for obtaining described local code,And by the original place of all code blocks identical with corresponding code block in alternative described address information described bytecodeLocation.
Preferably, described collector, comprising:
Reading unit, for reading the address information of focus of described bytecode, the address letter of described focusBreath is for local code corresponding to described focus is in the address information of described default register;
Compilation unit, for obtaining according to the address information of described focus the local code that described focus is corresponding,And compile according to described local code.
Preferably, described device also comprises:
The second determination module, for obtain the operation information of described local code at interval of Preset Time, according toThe operation information of described local code determines whether described local code meets the threshold condition of default focus, instituteThe operation information of stating local code comprises the number of run of described local code;
Removing module, if do not meet the threshold condition of default focus, described pre-for described local codeIf delete described local code in register.
The embodiment of the present invention provides a kind of method and device of the on-the-flier compiler based on embedded type virtual machine, extractsThe code block of the conventional compiling in bytecode, and the code block of this conventional compiling is compiled and leaves in access soonIn the register of speed, reduce the number of times of repeatedly carrying out of the code block of conventional compiling, saved a large amount of callingWith the process reinterpreting, and leave in register and more can improve execution speed, save time.
Brief description of the drawings
Fig. 1 is the method for a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention oneSchematic flow sheet;
Fig. 2 is the structural representation of a kind of compiled code piece of providing of the embodiment of the present invention;
Fig. 3 is a kind of structural representation of storing local code that the embodiment of the present invention provides;
Fig. 4 is the method for a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention twoSchematic flow sheet;
Fig. 5 is the structural representation of a kind of collector of providing of the embodiment of the present invention;
Fig. 6 is the mapping relations figure between the embodiment of the present invention a kind of operand stack and the register that provide;
Fig. 7 is the device of a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention threeStructural representation;
Fig. 8 is the system architecture schematic diagram of a kind of embedded type virtual machine of providing of the embodiment of the present invention four.
Detailed description of the invention
Further illustrate technical scheme of the present invention below in conjunction with accompanying drawing and by detailed description of the invention. CanUnderstand, specific embodiment described herein is only for explaining the present invention, but not to limit of the present inventionFixed. It also should be noted that, for convenience of description, in accompanying drawing, only show portion related to the present inventionDivide but not entire infrastructure.
Before in further detail exemplary embodiment being discussed, it should be mentioned that some exemplary embodiment quiltsBe described as processing or the method described as flow chart. Although every step is described as locating of order by flow chartReason, but many steps wherein can be implemented concurrently, concomitantly or simultaneously. In addition Ge Xiangbu,Rapid order can be rearranged. Described in the time that its step completes, process and can be terminated, but all rightThere is the additional step not comprising in the accompanying drawings. Described processing can be corresponding to method, function, code, sonRoutine, subprogram etc.
Embodiment mono-
Fig. 1 is the method for a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention oneSchematic flow sheet, the method can be carried out by the device of the on-the-flier compiler based on embedded type virtual machine, wherein shouldDevice can be realized by software and/or hardware. As shown in Figure 1, the method comprises:
Step 101, obtains the code block in bytecode;
Concrete, carry out, in the process of code compilation, first obtaining the code in bytecode at embedded type virtual machineThe content of piece, code block refers to one section of code that use " { } " brackets, according to position and statement keywordDifference, code block can be divided into four kinds of normal codes pieces, building block, static code piece, synchronized code block.
After starting to compile bytecode, first obtain first code block, carry out follow-up compilation operations,After first code block has compiled, then obtain next code block, by that analogy, until bytecodeCompiling completes.
Step 102 if described code block is known hotspot, is obtained local code and is carried out from default registerCompiling;
Concrete, embedded type virtual machine, according to the setting of " focus " threshold value, is dynamically compiled into bytecodeLocal bytecode is also stored in embedded memory space.
Step 103, if described code block is not known hotspot, obtains the operation information of described code block;
Concrete, if the code block obtaining is not focus, the operation that can further obtain described code blockInformation, described operation information comprises the history compiling number of times of described code block, the i.e. historical multiple words that compiledThe number of times having compiled of this code block in joint code.
Step 104, determines according to the operation information of described code block whether described code block meets default focusThreshold condition, described operation information comprises the history compiling number of times of described code block;
Concrete, described embedded type virtual machine can be identified " focus " in bytecode, carried out, so-called focusRefer to the code block that can repeatedly be carried out in application program. The feature of carrying out according to application program, these programsExecution be all order carry out.
Step 105, if described code block meets the threshold condition of default focus, is compiled as described code blockLocal code, and described local code is stored in default register, return to carry out and obtain in bytecodeThe operation of code block.
Concrete, after program segment is determined to be as " focus ", need by a native compile device itCompiling becomes local code and stores, and during for follow-up execution, calls. So just can reduce fetching, solutionRelease the time overhead of execution. Improve the speed of service of program.
Preferably, described described code block is compiled as to local code, and described local code is stored in advanceIf in register, comprising:
Analyzer reads in the code block of described focus, described code block is converted into generation by the method for syntactic analysisThe inside semantic information that code generator can use;
Described code generator generates local code according to described inner semantic information, and by described local codeSend to code to dispose device;
Described code is disposed device described local code is stored in described default register.
Concrete, with reference to figure 2, Fig. 2 is the structural representation of a kind of compiled code piece of providing of the embodiment of the present inventionFigure. The core frame of compiled code piece is disposed device by analyzer, code generator and code and is formed. AnalyzerRead in bytecode, be translated into code generator according to the requirement of virtual machine specification by the method for syntactic analysisThe inside semantic information that can utilize, and then produces object code by code generator again, can be in this localityThe instruction that platform is carried out. Then, code generator passes to code by output and disposes device, dynamic by the latterThe code portions of generation is deployed to the space of virtual machine inside for deposit method local code. To a sideAfter method completes compiling, whole compiling core can be returned to interpreter the entry address of compiled nation method,The latter can be called repeatedly.
Preferably, described code is disposed device described local code is stored in described default register, comprising:
It is that described local code distributes a default minimum list that described code is disposed device in described default registerThe memory space of position;
If the capacity of described local code increases, described code is disposed device and is continued as described local code distributionThe memory space of the described least unit of at least one times, and by the end of the memory space of newly assigned least unitTail address and linking by pointer with the start address of the memory space of the least unit of a upper distribution.
Concrete, with reference to figure 3, Fig. 3 is that a kind of structure of storing local code that the embodiment of the present invention provides is shownIntention. In compiling out local code, code is disposed device and is responsible for them to write actual depositing local generationThe region of code, in the time that needs are deposited local code, first for it distributes a relatively little space, ifIf the insufficient memory of former distribution in the process producing, more then for local code distributes a twice largeSpace, distributes four times of large spaces when space is not enough again, so continue, until reach one solidThe fixed upper limit, the space size distributing afterwards no longer increases. In order to solve each discontinuous command sequenceProblem, only need to insert at the end of each block a unconditional jump instruction and point to next blockFirst address, in addition, four bytes of the head of block also should stay the head that deposits next block in advanceAddress is so that correct release becomes possibility.
The embodiment of the present invention provides a kind of method of the on-the-flier compiler based on embedded type virtual machine, extracts bytecodeIn the code block of conventional compiling, and code block of this conventional compiling compiled and leave in access post fastIn storage, reduce the number of times of repeatedly carrying out of the code block of conventional compiling, saved a large amount of call and againThe process of explaining, and leave in register and more can improve execution speed, save time.
Further, in the realization of original virtual machine, carry out void by the sets of threads of calling underlying platformThe application of plan machine, makes to realize in this way multithreading, thereby accelerates the speed of service of embedded type virtual machine.
Embodiment bis-
Fig. 4, Fig. 4 is the side of a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention twoThe schematic flow sheet of method. As shown in Figure 4, the method comprises:
Step 401, obtains the code block in bytecode;
Step 402 if described code block is known hotspot, is obtained local code and is carried out from default registerCompiling;
Obtaining local code compile specifically from default register in step 402: read described wordThe address information of the focus in joint code, the address information of described focus is that the local code that described focus is corresponding existsThe address information of described default register; Obtain according to the address information of described focus the basis that described focus is correspondingGround code, and compile according to described local code. Step 403, if described code block is not known hotspot,Obtain the operation information of described code block;
Step 404, determines according to the operation information of described code block whether described code block meets default focusThreshold condition, described operation information comprises the history compiling number of times of described code block;
Step 405, if described code block meets the threshold condition of default focus, is compiled as described code blockLocal code, and described local code is stored in default register, return to carry out and obtain in bytecodeThe operation of code block;
Step 406, obtains described local code and is stored in the address information in described default register, and by instituteState the raw address that address information substitutes all code blocks identical with corresponding code block in described bytecode;
Step 407, obtains the operation information of described local code at interval of Preset Time, according to described local generationThe operation information of code determines whether described local code meets the threshold condition of default focus, described local codeOperation information comprise the number of run of described local code; If described local code does not meet default focusThreshold condition is deleted described local code in described default register.
Concrete, with reference to figure 5, Fig. 5 is the structural representation of a kind of collector of providing of the embodiment of the present invention.In original collector, increased dynamic compiler module, code analysis module, linker module,Carry out the fast and code Unload module of tracker module. Dynamic compiler module is in the generation that meets " focus " conditionCode block is dynamically compiled into local code. Code analysis module is mainly that performed local code is dividedAnalyse, determine whether code segment meets the requirement of " focus ". Determine according to the threshold value that is " focus ", superThe code block of crossing this threshold value just can be compiled into it local code. In this module, be by a countingThe cumulative function that realizes data statistics of device. Connector modules is mainly the local code that on-the-flier compiler is becomeLink with original bytecode. Local code emptier is to be mainly no longer the generation of " focus " by thoseCode uninstalls from local memory space, prevents that limited resource space from unrestrictedly being taken. Pass judgment on correspondingWhether method is that the standard of focus is the time of calling the method last time, the more first quilt of the method for not calling more of a specified durationDischarge.
Concrete, with reference to figure 6, Fig. 6 is between the embodiment of the present invention a kind of operand stack and register that provideMapping relations figure.
In embedded type virtual machine, in order to raise the efficiency, not by operand stack but register is deposited behaviourThe data of counting on stack. So, set up in the present invention the correspondence between operand stack and physical registerRelation. For the operation of stack, must design the register manipulation of answering in contrast. By what push on and popReplacement is read in and write out to operation with register. In this case, resetting by practical operation objectTo need dynamic compiler record virtual machine in translation process operand stack top pointer (sp register) work asFront value is also upgraded according to the Semantic Actions of interpretive order at any time. In this Fig. 6, shown operand stack,Relation between register, execution stack frame.
The embodiment of the present invention provides a kind of method of the on-the-flier compiler based on embedded type virtual machine, by local codeThe address information being stored in default register substitutes the raw address in corresponding bytecode, when defaultBetween obtain the operation information of described local code, if described local code does not meet the threshold condition of default focus,In described default register, delete described local code, thus energy fast access after guarantee compiling focus,And storage is constantly updated to focus.
Embodiment tri-
Fig. 7, Fig. 7 is the dress of a kind of on-the-flier compiler based on embedded type virtual machine of providing of the embodiment of the present invention threeThe structural representation of putting. This device can be realized by software and/or hardware, can be by carrying out embedded type virtual machineThe method of on-the-flier compiler realizes. As shown in Figure 7, this device comprises:
The first acquisition module 701, for obtaining the code block of bytecode;
Collector 702 if be known hotspot for described code block, is obtained this locality from default registerCode compiles;
The second acquisition module 703, if be not known hotspot for described code block, obtains described code blockOperation information;
The first determination module 704, for determining according to the operation information of described code block whether described code block accords withClose the threshold condition of default focus, described operation information comprises the history compiling number of times of described code block;
Return to module 705, if meet the threshold condition of default focus for described code block, by described codePiece is compiled as local code, and described local code is stored in default register, returns to execution first and obtainsThe function of delivery piece.
Preferably, described in return to module 705, comprising:
Analyzer, for reading in the code block of described focus, turns described code block by the method for syntactic analysisTurn to the inside semantic information that code generator can use;
Code generator, for generating local code according to described inner semantic information, and by described local generationCode sends to code to dispose device;
Code is disposed device, for described local code being stored in to described default register.
Preferably, described code is disposed device, for:
It in described default register, is the memory space that described local code distributes a default least unit;
If the capacity of described local code increases, continue as described local code distribute at least one times described inThe memory space of least unit, and by the end address of the memory space of newly assigned least unit with upper oneThe start address of the memory space of the least unit of individual distribution links by pointer.
Further, described device also comprises:
Alternative module, is stored in the address information of described default register for obtaining described local code,And by the original place of all code blocks identical with corresponding code block in alternative described address information described bytecodeLocation.
Preferably, described collector, comprising:
Reading unit, for reading the address information of focus of described bytecode, the address letter of described focusBreath is for local code corresponding to described focus is in the address information of described default register;
Compilation unit, for obtaining according to the address information of described focus the local code that described focus is corresponding,And compile according to described local code.
Further, described device also comprises:
The second determination module, for obtain the operation information of described local code at interval of Preset Time, according toThe operation information of described local code determines whether described local code meets the threshold condition of default focus, instituteThe operation information of stating local code comprises the number of run of described local code;
Removing module, if do not meet the threshold condition of default focus, described pre-for described local codeIf delete described local code in register.
The embodiment of the present invention provides a kind of method and device of the on-the-flier compiler based on embedded type virtual machine, extractsThe code block of the conventional compiling in bytecode, and the code block of this conventional compiling is compiled and leaves in access soonIn the register of speed, reduce the number of times of repeatedly carrying out of the code block of conventional compiling, saved a large amount of callingWith the process reinterpreting, and leave in register and more can improve execution speed, save time.
Embodiment tetra-
Fig. 8 is the system architecture schematic diagram of a kind of embedded type virtual machine of providing of the embodiment of the present invention four.
As shown in Figure 8, load-on module be responsible for java class file and when operation required data loading and closeMethod checks. Data module is responsible for a java class information and method information is saved in runtime data area, numberThe access of data field while also monitoring state, the controlling run of whole virtual machine according to module; In this model, voidPlan machine is GreenThread structure of each Green thread creation, for preserving this Green thread fortuneInformation when row, simultaneously also for it creates a Native thread structure body, for preserving respective operations systemThe information of level thread. Equally, virtual machine is that the Java bytecode moving creates a corresponding Native generationCode structure body, for preserving corresponding local code. These information are also in charge of by data module. CompilingWhen compiler directive that module is received data module, from data field, read bytecode, through code analysis, codeConversion generates local code, afterwards compiled local code is linked to after original bytecode, andThis section of local code of pointed of java class method. For Executive Module, it is responsible for notification data module willBytecode is compiled into local code, and after having compiled, Executive Module just can be carried out this local code.
Note, above are only preferred embodiment of the present invention and institute's application technology principle. Those skilled in the artWill appreciate that, the invention is not restricted to specific embodiment described here, can enter for a person skilled in the artThe various obvious variations of row, readjust and substitute and can not depart from protection scope of the present invention. Therefore, thoughSo by above embodiment, the present invention is described in further detail, but the present invention be not limited only toUpper embodiment, in the situation that not departing from the present invention's design, can also comprise more other equivalent embodiment,And scope of the present invention is determined by appended claim scope.

Claims (12)

1. a method for the on-the-flier compiler based on embedded type virtual machine, is characterized in that, described method comprises:
Obtain the code block in bytecode;
If described code block is known hotspot, from default register, obtains local code and compile;
If described code block is not known hotspot, obtain the operation information of described code block;
Determine according to the operation information of described code block whether described code block meets the threshold value bar of default focusPart, described operation information comprises the history compiling number of times of described code block;
If described code block meets the threshold condition of default focus, described code block is compiled as to local code,And described local code is stored in default register, return and carry out the behaviour who obtains the code block in bytecodeDo.
2. method according to claim 1, is characterized in that, described described code block is compiled as to thisGround code, and described local code is stored in default register, comprising:
Analyzer reads in the code block of described focus, described code block is converted into generation by the method for syntactic analysisThe inside semantic information that code generator can use;
Described code generator generates local code according to described inner semantic information, and by described local codeSend to code to dispose device;
Described code is disposed device described local code is stored in described default register.
3. method according to claim 2, is characterized in that, described code is disposed device by described this localityCode storage, in described default register, comprising:
It is that described local code distributes a default minimum list that described code is disposed device in described default registerThe memory space of position;
If the capacity of described local code increases, described code is disposed device and is continued as described local code distributionThe memory space of the described least unit of at least one times, and by the end of the memory space of newly assigned least unitTail address and linking by pointer with the start address of the memory space of the least unit of a upper distribution.
4. according to the method described in claims 1 to 3 any one, it is characterized in that, described by describedGround code storage, after presetting in register, also comprises:
Obtain described local code and be stored in the address information in described default register, and by described address letterBreath substitutes the raw address of all code blocks identical with corresponding code block in described bytecode.
5. method according to claim 4, is characterized in that, the described basis of obtaining from preset registerGround code compiles, and comprising:
Read the address information of the focus in described bytecode, the address information of described focus is described focus pairThe local code of answering is in the address information of described default register;
Obtain according to the address information of described focus the local code that described focus is corresponding, and according to described this localityCode compiles.
6. according to the method described in claim 1 to 4 any one, it is characterized in that, described method is also wrappedDraw together:
Obtain the operation information of described local code at interval of Preset Time, according to the operation of described local codeInformation determines whether described local code meets the threshold condition of default focus, the operation letter of described local codeBreath comprises the number of run of described local code;
If described local code does not meet the threshold condition of default focus, in described default register, deleteDescribed local code.
7. a device for the on-the-flier compiler based on embedded type virtual machine, is characterized in that, described device comprises:
The first acquisition module, for obtaining the code block of bytecode;
Collector if be known hotspot for described code block, is obtained local generation from default registerCode compiles;
The second acquisition module, if be not known hotspot for described code block, obtains the fortune of described code blockRow information;
The first determination module, for determining according to the operation information of described code block whether described code block meetsThe threshold condition of default focus, described operation information comprises the history compiling number of times of described code block;
Return to module, if meet the threshold condition of default focus for described code block, by described code blockBe compiled as local code, and described local code is stored in default register, return to execution first and obtainThe function of module.
8. device according to claim 7, is characterized in that, described in return to module, comprising:
Analyzer, for reading in the code block of described focus, turns described code block by the method for syntactic analysisTurn to the inside semantic information that code generator can use;
Code generator, for generating local code according to described inner semantic information, and by described local generationCode sends to code to dispose device;
Code is disposed device, for described local code being stored in to described default register.
9. device according to claim 8, is characterized in that, described code is disposed device, for:
It in described default register, is the memory space that described local code distributes a default least unit;
If the capacity of described local code increases, continue as described local code distribute at least one times described inThe memory space of least unit, and by the end address of the memory space of newly assigned least unit with upper oneThe start address of the memory space of the least unit of individual distribution links by pointer.
10. according to the device described in claim 7 to 9 any one, it is characterized in that, described device alsoComprise:
Alternative module, is stored in the address information of described default register for obtaining described local code,And by the original place of all code blocks identical with corresponding code block in alternative described address information described bytecodeLocation.
11. devices according to claim 10, is characterized in that, described collector, comprising:
Reading unit, for reading the address information of focus of described bytecode, the address letter of described focusBreath is for local code corresponding to described focus is in the address information of described default register;
Compilation unit, for obtaining according to the address information of described focus the local code that described focus is corresponding,And compile according to described local code.
12. according to the device described in claim 7 to 9 any one, it is characterized in that, described device alsoComprise:
The second determination module, for obtain the operation information of described local code at interval of Preset Time, according toThe operation information of described local code determines whether described local code meets the threshold condition of default focus, instituteThe operation information of stating local code comprises the number of run of described local code;
Removing module, if do not meet the threshold condition of default focus, described pre-for described local codeIf delete described local code in register.
CN201510998967.8A 2015-12-28 2015-12-28 Dynamic compiling method and device based on embedded virtual machine Pending CN105589729A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510998967.8A CN105589729A (en) 2015-12-28 2015-12-28 Dynamic compiling method and device based on embedded virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510998967.8A CN105589729A (en) 2015-12-28 2015-12-28 Dynamic compiling method and device based on embedded virtual machine

Publications (1)

Publication Number Publication Date
CN105589729A true CN105589729A (en) 2016-05-18

Family

ID=55929335

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510998967.8A Pending CN105589729A (en) 2015-12-28 2015-12-28 Dynamic compiling method and device based on embedded virtual machine

Country Status (1)

Country Link
CN (1) CN105589729A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334325A (en) * 2017-12-26 2018-07-27 努比亚技术有限公司 A kind of Compilation Method, computer and computer readable storage medium
CN108717374A (en) * 2018-04-24 2018-10-30 阿里巴巴集团控股有限公司 The method, apparatus and computer equipment that Java Virtual Machine preheats when starting
CN110764771A (en) * 2018-07-27 2020-02-07 龙芯中科技术有限公司 Dynamic compiling method and device, readable storage medium and electronic equipment
CN111258557A (en) * 2020-01-16 2020-06-09 Oppo(重庆)智能科技有限公司 Code processing method and device, electronic equipment and computer readable medium
US10871976B2 (en) 2015-12-02 2020-12-22 Huawei Technologies Co, Ltd. Method and apparatus for identifying hotspot intermediate code in language virtual machine
CN112445483A (en) * 2019-08-27 2021-03-05 龙芯中科技术股份有限公司 Instruction generation method and device, electronic equipment and storage medium
WO2021135988A1 (en) * 2019-12-31 2021-07-08 Oppo广东移动通信有限公司 Hotspot code processing method, request method, apparatus, and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510115A (en) * 2009-03-26 2009-08-19 浙江大学 Method for controlling processor frequency when program operation by using dynamic compiler
CN102736943A (en) * 2012-06-12 2012-10-17 电子科技大学 Dynamic compiling and executing method of embedded browser engine
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN103729235A (en) * 2013-12-24 2014-04-16 华为技术有限公司 Java virtual machine (JVM) and compiling method thereof
CN101344856B (en) * 2007-06-04 2014-06-04 三星电子株式会社 Apparatus and method for increasing the speed of performing task

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101344856B (en) * 2007-06-04 2014-06-04 三星电子株式会社 Apparatus and method for increasing the speed of performing task
CN101510115A (en) * 2009-03-26 2009-08-19 浙江大学 Method for controlling processor frequency when program operation by using dynamic compiler
CN102736943A (en) * 2012-06-12 2012-10-17 电子科技大学 Dynamic compiling and executing method of embedded browser engine
CN102736943B (en) * 2012-06-12 2015-06-17 电子科技大学 Dynamic compiling and executing method of embedded browser engine
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN103729235A (en) * 2013-12-24 2014-04-16 华为技术有限公司 Java virtual machine (JVM) and compiling method thereof

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
何巍: "嵌入式Java运行环境的性能优化与分析", 《中国优秀博硕士学位论文全文数据库(硕士)》 *
凌勇: "一种嵌入式Java虚拟机编译技术优化研究", 《中国优秀硕博士学位论文全文数据库(硕士)》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10871976B2 (en) 2015-12-02 2020-12-22 Huawei Technologies Co, Ltd. Method and apparatus for identifying hotspot intermediate code in language virtual machine
CN108334325A (en) * 2017-12-26 2018-07-27 努比亚技术有限公司 A kind of Compilation Method, computer and computer readable storage medium
CN108717374A (en) * 2018-04-24 2018-10-30 阿里巴巴集团控股有限公司 The method, apparatus and computer equipment that Java Virtual Machine preheats when starting
CN108717374B (en) * 2018-04-24 2021-08-17 创新先进技术有限公司 Method and device for preheating during starting of Java virtual machine and computer equipment
CN110764771A (en) * 2018-07-27 2020-02-07 龙芯中科技术有限公司 Dynamic compiling method and device, readable storage medium and electronic equipment
CN110764771B (en) * 2018-07-27 2024-04-05 龙芯中科技术股份有限公司 Dynamic compiling method and device, readable storage medium and electronic equipment
CN112445483A (en) * 2019-08-27 2021-03-05 龙芯中科技术股份有限公司 Instruction generation method and device, electronic equipment and storage medium
CN112445483B (en) * 2019-08-27 2023-11-24 龙芯中科技术股份有限公司 Instruction generation method and device, electronic equipment and storage medium
WO2021135988A1 (en) * 2019-12-31 2021-07-08 Oppo广东移动通信有限公司 Hotspot code processing method, request method, apparatus, and electronic device
CN113126995A (en) * 2019-12-31 2021-07-16 Oppo广东移动通信有限公司 Hotspot code processing method, request method and device and electronic equipment
CN111258557A (en) * 2020-01-16 2020-06-09 Oppo(重庆)智能科技有限公司 Code processing method and device, electronic equipment and computer readable medium
CN111258557B (en) * 2020-01-16 2023-08-18 Oppo(重庆)智能科技有限公司 Code processing method, device, electronic equipment and computer readable medium

Similar Documents

Publication Publication Date Title
CN105589729A (en) Dynamic compiling method and device based on embedded virtual machine
CN100489778C (en) Method for implementing dynamic update of Java program
CN101799763B (en) Method, device and system for patching kernel on line
CN100432931C (en) Method for implementing long jumping dynamic patch in embedded system
CN104820586A (en) On-orbit maintenance method for spacecraft embedded software
JP3706065B2 (en) Porting various source languages to execution media
CN103793249A (en) Multithreading preloading method for class library in Java virtual machine
US8056061B2 (en) Data processing device and method using predesignated register
CN103927187A (en) Program execution method of embedded system
CN101650663A (en) Database system and upgrading method thereof
CN102103489A (en) Method for improving execution efficiency of static field access command
JP2009037546A (en) Memory management method utilizing thread-inherent area and computer using same method
US6959430B2 (en) Specialized heaps for creation of objects in object-oriented environments
CN103617060B (en) Method for accelerating starting procedure of embedded software by using super state storage
CN109871274B (en) Multitask construction and processing method for embedded environment application
CN104063329B (en) 64-bit immediate operand processing method and device
CN102262537B (en) Method for processing abnormities of execution engine working in mixed model
CN112487092A (en) Intelligent contract calling method and device based on block chain
CN106547606B (en) Storehouse self checking method and device
CN100375029C (en) Memory disposition methods and systems
CN106020812B (en) A kind of in-orbit maintaining method of dynamic for DSP platform spacecraft software
CN109656868B (en) Memory data transfer method between CPU and GPU
CN110990018B (en) Compiling method and compiling system of embedded system
US8566813B2 (en) Method and system generating execution file system device
US20080077912A1 (en) Software development methods, systems, and storage media storing software developed thereby

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160518