CN107368347A - The filter method and device of code to be compiled - Google Patents
The filter method and device of code to be compiled Download PDFInfo
- Publication number
- CN107368347A CN107368347A CN201610317585.9A CN201610317585A CN107368347A CN 107368347 A CN107368347 A CN 107368347A CN 201610317585 A CN201610317585 A CN 201610317585A CN 107368347 A CN107368347 A CN 107368347A
- Authority
- CN
- China
- Prior art keywords
- compiled
- code unit
- code
- information
- compiling
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
- G06F9/45516—Runtime code conversion or optimisation
Abstract
The present invention provides a kind of filter method and device of code to be compiled, wherein, this method includes:Before each code unit to be compiled in compiling queue is compiled, the activity value enlivened information, determine each code unit to be compiled in compiling queue respectively of each code unit to be compiled in compiling queue;According to the activity value of each code unit to be compiled, the doubtful zombie code unit in each code unit to be compiled is determined, and doubtful zombie code unit is deleted from compiling queue.To these doubtful zombie code units without compiling, and then the ratio of the zombie code unit in virtual machine can be effectively reduced, reduce the expense during operation of dummy machine system, while also shorten the compiling delay of remaining code unit to be compiled, improve the performance of dummy machine system.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of filter method and dress of code to be compiled
Put.
Background technology
During computer application, it will usually use virtual machine.Virtual machine (Virtual Machine,
Abbreviation VM) mainly by software or it is aided with the method for a small amount of hardware to fictionalize a computer,
And this virtual computer generally also supports a set of instruction set of oneself, referred to as virtual machine instructions
Collection.Virtual machine relies on local physical machine, by its enforcement engine to given virtual machine instructions sequence
Row or target program simulate execution on the local machine.The enforcement engine of virtual machine can by interpreter Lai
Realize.Due to interpreter have the characteristics that it is portable high, realize that cost is low and EMS memory occupation is few, greatly
The enforcement engine of most virtual machines all includes interpreter.Interpreter is entered in units of a virtual machine instructions
Row instruction fetch, instruction dispatch, extract operation number and execution.But simple explanation execution performance is low, from
And dynamic compilation system is introduced in virtual machine to improve its performance.Compiler is the core of dynamic compilation system
The heart.Compiler is integrally compiled into local cpu in units of one group of continuous virtual machine instruction sequence and referred to
Make sequence, that is, be compiled into nation method, wherein, virtual machine instruction sequence include basic block, function,
Method, the nation method after compiling is then directly performed by hardware.Compiler is due to eliminating repetition
The process such as instruction fetch and instruction dispatch, while a large amount of fruitful optimizations are carried out in translation again, because
This its performance is often more than 10 times of interpreter.Because compiler is entered in program operation process
Mobile state compiling, therefore instant compiler (Just-in-time Compiler, abbreviation JIT) is referred to as again.
Also, on-the-flier compiler is to determine the key of virtual machine performance.It is different with the static compilation such as traditional C/C++,
On-the-flier compiler behavior occurs that during program is run, extra compiling expense can be introduced.Research shows,
The Annual distribution of program operation has obvious locality characteristic, i.e., the most of the time collection that program performs
In on fraction code.It is modern empty in order to reduce the overhead as caused by on-the-flier compiler as far as possible
The dynamic compilation system of plan machine generally enters according to " selectivity compiling " (selective compilation) theory
Row design and realization.
In the prior art, meeting, will according to the principle selectively compiled in the running of virtual machine
The code snippet that frequency is higher, is had a great influence to program feature is performed, is identified as code to be compiled.Tool
For body, virtual machine can be that each code snippet in virtual machine determines a calling counter respectively
With an inner loop counter, counter is called to determine the called number of code snippet, inside is followed
Inner loop counter determines the number of loop iteration in code snippet, when call the number determined of counter with
When the number sum that inner loop counter is determined reaches predetermined threshold value, by such code piece
Section is defined as code to be compiled.Then, by code to be compiled be added to compiling queue it is medium to be compiled;
And then the compiling thread of virtual machine can respectively be treated according to certain compiling scheduling strategy by compiling in queue
Compiled code is compiled, and then generates the local code of each code to be compiled.So as to complete to void
The on-the-flier compiler of code to be compiled in plan machine.After treating compiled code and having carried out on-the-flier compiler,
Can directly performs the local code generated after compiling to the code to be compiled after compiling.
But in the prior art, it is determined that be compiled code to be compiled when, due to program behavior
Mutability, it may appear that non-code to be compiled is mistaken for the situation of code to be compiled;Meanwhile right
After some codes to be compiled are compiled, it is found that these codes to be compiled are not performed.It is right
The compiling of these codes to be compiled can increase the expense during operation of dummy machine system, and then can increase pair
The compiling delay of code to be compiled being compiled really is needed, and then reduces the performance of dummy machine system.
The content of the invention
The present invention provides a kind of filter method and device of code to be compiled, right in the prior art to solve
The compiling of code to be compiled can increase the expense during operation of dummy machine system, increase and really needs are compiled
The compiling delay for the code to be compiled translated, and then the problem of the performance of reduction dummy machine system.
It is an aspect of the present invention to provide a kind of filter method of code to be compiled, including:
Before each code unit to be compiled in compiling queue is compiled, according to the compiling queue
In each code unit to be compiled enliven information, determine each generation to be compiled in the compiling queue respectively
The activity value of code unit;
According to the activity value of each code unit to be compiled, the doubtful deadlock in each code unit to be compiled is determined
Corpse code unit, and doubtful zombie code unit is deleted from the compiling queue.
Another aspect of the present invention is to provide a kind of filter of code to be compiled, including:
Determining module, before being compiled for each code unit to be compiled in compiling queue, root
Information is enlivened according to each code unit to be compiled in the compiling queue, determines the compiling queue respectively
In each code unit to be compiled activity value;
Removing module, for the activity value according to each code unit to be compiled, determine each code to be compiled
Doubtful zombie code unit in unit, and doubtful zombie code unit is deleted from the compiling queue.
Before the present invention is compiled by each code unit to be compiled in compiling queue, it is determined that compiling
The activity value of each code unit to be compiled in queue is translated, then according to the work of each code unit to be compiled
Jump property value, determines the doubtful zombie code unit in each code unit to be compiled, and by doubtful zombie code
Unit is deleted from compiling queue.Because doubtful zombie code unit has been deleted from compiling queue, therefore
To need not be compiled to these doubtful zombie code units, that is equivalent to treat code progress
Filtering, and then can effectively reduce the ratio of the zombie code unit in virtual machine, reduce virtual
The expense during operation of machine system, while the compiling delay of remaining code unit to be compiled is also shortened, carry
The performance of dummy machine system is risen.
Brief description of the drawings
Fig. 1 is the flow chart of the filter method for the code to be compiled that the embodiment of the present invention one provides;
The virtual machine that Fig. 2 is belonged to by the filter method for the code to be compiled that the embodiment of the present invention one provides
The flow chart of system implementation;
Fig. 3 is the flow chart of the filter method for the code to be compiled that the embodiment of the present invention two provides;
Fig. 4 is the structural representation of the filter for the code to be compiled that the embodiment of the present invention three provides;
Fig. 5 is the structural representation of the filter for the code to be compiled that the embodiment of the present invention four provides.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with this hair
Accompanying drawing in bright embodiment, the technical scheme in the embodiment of the present invention is clearly and completely described,
Obviously, described embodiment is part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained under the premise of creative work is not made
The every other embodiment obtained, belongs to the scope of protection of the invention.
The flow chart of the filter method for the code to be compiled that Fig. 1 provides for the embodiment of the present invention one, such as Fig. 1
Shown, the method for the present embodiment includes:
Step 101, to compiling queue in each code unit to be compiled be compiled before, according to volume
That translates each code unit to be compiled in queue enlivens information, determines respectively each to be compiled in compiling queue
The activity value of code unit.
In the present embodiment, specifically, Fig. 2 is the mistake for the code to be compiled that the embodiment of the present invention one provides
The flow chart for the dummy machine system implementation procedure that filtering method is belonged to, as shown in Fig. 2 virtual machine starts simultaneously
After initialization is completed, start the code snippet in configuration processor.For the code snippet frequently executed,
On-the-flier compiler can virtually be carried out.The code snippet being compiled is referred to as compilation unit, can be one in method
Code in individual fragment or whole method, the combination of code snippet in even multiple methods.
After explaining execution to each code to be compiled, a calling is determined respectively for each code snippet
Counter and an inner loop counter, counter is called to determine the called number of code snippet, it is interior
Portion's cycle counter determines the number of code snippet loop iteration, call the number determined of counter with
When the number sum that inner loop counter is determined reaches predetermined threshold value, by such code snippet
It is defined as code unit to be compiled.
The code unit to be compiled of determination is put into compiling queue.Include at least one so as to compile queue
Individual code unit to be compiled, it is known that, it can be one in method to compile the code unit to be compiled in queue
Code in individual fragment or whole method, the combination of code snippet in even multiple methods.
Before each code to be compiled in compiling queue is compiled, due to each code unit to be compiled
It is performed or calls in virtual machine, and then each code unit to be compiled can be determined each
Enliven information, this enlivens information representation code unit to be compiled in virtual machine or in application program
The situation for being performed or calling.Then, it is true respectively just according to the information of enlivening of each code unit to be compiled
Delimit the organizational structure the activity value of each code unit to be compiled translated in queue, may thereby determine that out in compiling queue
The activity of each code unit to be compiled.
Step 102, the activity value according to each code unit to be compiled, determine each code unit to be compiled
In doubtful zombie code unit, and by doubtful zombie code unit from compiling queue in delete.
In the present embodiment, specifically, respectively waiting to compile in the compiling queue determined in step 101
The activity value of code unit is translated, going mark to compile in queue, which is non-live in each code unit to be compiled
The code unit to be compiled of jump, while can determine which is in each code unit to be compiled in compiling queue
Active code unit to be compiled.Can be so as in inactive code unit to be compiled, determining doubtful
Zombie code unit.
Zombie code unit is compiled code unit to be compiled to obtain to some code units to be compiled
After (being compiled code unit), not being performed for code unit kind is compiled at these
It is compiled code unit.When the code of the whole method during zombie code unit is application program,
Such zombie code unit can be referred to as corpse method;Meanwhile for any side in application program
Method, the method for meeting following condition are referred to as " corpse method ":And if only if, and this method has been compiled;
And the number that this method performs after being compiled is 0.
And then it can be determined according to the activity value of each code unit to be compiled in each code unit to be compiled
Doubtful zombie code unit, so as to by doubtful zombie code from compiling queue in delete.
Then each code unit to be compiled in the compiling queue to deleting doubtful zombie code unit, successively
Scheduling is compiled, then it is compiled, until code unit to be compiled is not present in compiling queue.
So as to but will no longer be performed after compiling in virtual machine, i.e. activity relatively low doubtful zombie code
Unit, deleted so as to compile in queue, to so doubtful zombie code unit without compiling.
Before the present invention is compiled by each code unit to be compiled in compiling queue, it is determined that compiling
The activity value of each code unit to be compiled in queue is translated, then according to the work of each code unit to be compiled
Jump property value, determines the doubtful zombie code unit in each code unit to be compiled, and by doubtful zombie code
Unit is deleted from compiling queue.To these doubtful zombie code units without compiling, and then can have
Effect reduces the ratio of the zombie code unit in virtual machine, opening when reducing the operation of dummy machine system
Pin, while the compiling delay of remaining code unit to be compiled is also shortened, improve the property of dummy machine system
Energy.
Fig. 3 is the flow chart of the filter method for the code to be compiled that the embodiment of the present invention two provides, and is being implemented
On the basis of example one, as shown in figure 3, the method for the present embodiment, step 101, including:
Step 1011, to compiling queue in each code to be compiled be compiled before, obtain compiling team
The overall situation of each code unit to be compiled in row enlivens information and part enlivens information.
Wherein, step 1011, specifically include:
For each code unit to be compiled in compiling queue, total execution of code unit to be compiled is determined
Number, and according to total execution number of code unit to be compiled, and the focus knowledge in default virtual machine
Other threshold value, determine that the overall situation of code unit to be compiled enlivens information, wherein, total number that performs is to be compiled
Called number and inner loop iterations sum of the code unit in virtual machine;
Determine that the section of code unit to be compiled performs number, and held according to the section of code unit to be compiled
Places number, determine that the part of code unit to be compiled enlivens information, wherein, section performs number to wait to compile
Translate code unit holding within the period of the predetermined time period before at the time of it is determined that part enlivens information
Places number.
In the present embodiment, specifically, after virtual machine starts and initialize completion, configuration processor is started
In code snippet.For the code snippet frequently executed, on-the-flier compiler can be virtually carried out.It is compiled
Code snippet is referred to as compilation unit, can be in a fragment or the whole method in method
Code, the combination of code snippet in even multiple methods.Execution is explained to each code to be compiled
Afterwards, a calling counter and an inner loop counter are determined respectively for each code snippet,
Counter is called to determine the called number of code snippet, inner loop counter determines that code snippet circulates
The number of iteration, call number that the number determined of counter determines with inner loop counter it
When with predetermined threshold value is reached, such code snippet is defined as code unit to be compiled.
Then, the overall situation for obtaining each code unit to be compiled in compiling queue enlivens information and part actively
Information.Specifically, compiling in queue has multiple each code units to be compiled.First, for each
Individual unit to be compiled, start to calculate when so as to virtual machine startup, determine code unit to be compiled in void
Plan machine starts at the time of startup between being started at the time of the calculating overall situation enlivens information, code list to be compiled
Called number and inner loop iterations sum of the member in virtual machine, and then determine code to be compiled
Total execution number execute (m) of unit.Wherein, m is a code list to be compiled in queue to be compiled
Member.
Then, can be according to total execution of code unit to be compiled and for each unit to be compiled
Focus recognition threshold HotThreshold in number execute (m), and default virtual machine, will always be performed
Focus recognition threshold HotThreshold in number execute (m) divided by default virtual machine, is obtained to be compiled
The overall situation of code unit enlivens information global_activeness (m)=execute (m)/HotThreshold;Wherein,
Focus recognition threshold HotThreshold in default virtual machine can be using value as 10,000.
It is then determined that predetermined time period a Δ t, Δ t are a period;Also, predetermined time period Δ t
For one that the time span before starting to calculate at the time of part enlivens information so as to unit to be compiled is Δ t
Period.Likewise, being directed to each code unit to be compiled, determine that code unit to be compiled is calculating
Part enlivens the execution number sum in the predetermined time period Δ t before information, and then counts to be compiled
Section of the code unit in preset time difference length Δ t performs number Δ execute (m), and then can determine
Code unit to be compiled is within the period that the time span before at the time of it is determined that part enlivens information is Δ t
Execution number.Wherein, predetermined time period Δ t can be using value as 5 microseconds.
Then, for each code unit to be compiled, the section of code unit to be compiled can be performed
Number Δ execute (m) is respectively divided by predetermined time period Δ t, the part that can obtain code unit to be compiled are living
Jump information local_activeness (m)=Δ execute (m)/Δ t.
Step 1012, information is enlivened according to the overall situation of each code unit to be compiled and locally enlivens information, really
The activity value of fixed each code unit to be compiled.
Wherein, step 1012, specifically include:
For each code unit to be compiled, the activity value of code unit to be compiled is
Activeness (m)=[global_activeness (m)+1] × [local_activeness (m)+1];
Wherein, m is a code unit to be compiled in queue to be compiled, and activeness (m) is to wait to compile
The activity value of code unit is translated, global_activeness (m) is that the overall situation of code unit to be compiled is actively believed
Breath, local_activeness (m) are that the part of code unit to be compiled enlivens information.
In the present embodiment, can be according to be compiled specifically, being directed to each code unit to be compiled
The overall situation of code unit enlivens information and part enlivens information, calculates the activity of code unit to be compiled
Value.Specifically, actively believe for each code unit to be compiled, the overall situation of code unit to be compiled
Breath global_activeness (m) and part enliven information local_activeness (m), are counted according to preset formula
Calculate, the activity value of code unit to be compiled can be calculated
Activeness (m)=[global_activeness (m)+1] × [local_activeness (m)+1].Wherein, m is to be compiled
A code unit to be compiled in queue.
Step 102, specifically include:
Step 1021, in the activity value of each code unit to be compiled, activity value is less than default live
The code unit to be compiled of jump property threshold value is defined as inactive code unit to be compiled;In each generation to be compiled
In the activity value of code unit, activity value is more than or equal to the code list to be compiled of default activity threshold value
Member is defined as active code unit to be compiled.
In the present embodiment, specifically, because each unit to be compiled is provided with an activity value,
By the activity value of each code unit to be compiled, carried out respectively with default activity threshold value A ctiveThreshold
Compare;If the activity value for compiling the arbitrary code unit to be compiled in queue is less than default activity threshold
Value ActiveThreshold, then it can determine that activity value is less than default activity threshold value A ctiveThreshold
Code unit to be compiled be inactive code unit to be compiled;If arbitrarily wait to compile in compiling queue
The activity value for translating code unit is more than or equal to default activity threshold value A ctiveThreshold, then can determine
The code unit to be compiled that activity value is more than or equal to default activity threshold value A ctiveThreshold is active
Code unit to be compiled.Wherein, presetting activity threshold value A ctiveThreshold can be using value as 32.
Step 1022, doubtful zombie code unit is determined in inactive code unit to be compiled is defined as,
And doubtful zombie code unit is deleted from compiling queue.
Wherein, step 1022, specifically include:
If the code unit to be compiled in compiling queue is marked as active code unit to be compiled, really
Surely it is marked as respective Counter Value victim (m)=0 of active code unit to be compiled;
If the code unit to be compiled in compiling queue is marked as inactive code unit to be compiled, and
The part for being confirmed as inactive code unit to be compiled enlivens the value of information equal to zero, it is determined that is marked
It is designated as respective Counter Value victim (m)=victim (m)+1 of inactive code unit to be compiled;
Determines counting device value is more than or equal to inactive code unit to be compiled of default count threshold, is doubtful
Like zombie code unit.
In the present embodiment, specifically, being defined as inactive code unit to be compiled in step 1021
In, doubtful zombie code unit is told, then deletes doubtful zombie code unit from compiling queue.
Specifically, although inactive code unit to be compiled has very high risk to become in compiling queue
Zombie code, but due to the mutability of the program behavior in virtual machine, delete quilt from compiling queue immediately
Inactive code unit to be compiled of mark is unadvisable.Therefore, only when compiling certain in queue
When individual code unit to be compiled is in an inactive state for a long time, just by the code unit to be compiled from compiling
Deleted in queue.If some code unit to be compiled is chronically at an inactive state in compiling queue, claim
It is " doubtful zombie code unit ".In order to identify doubtful zombie code unit, compiling team can be directed to
Each code unit to be compiled in row, has separately designed entitled victim counter.
During doubtful zombie code unit is identified, for each code unit to be compiled, in real time
Treat the respective counter victim of compiled code unit to be updated respectively, renewal rule is:Each time
Before compiling, if the code unit to be compiled in compiling queue is marked as active code unit to be compiled,
Then Counter Value victim (m)=0 of active code unit to be compiled, and then by active code to be compiled
The Counter Value of unit is zeroed out processing;If the code unit to be compiled in compiling queue is marked as non-
Active code unit to be compiled, and enliven information labeled as the part of inactive code unit to be compiled
Value be equal to zero, then Counter Value victim (m)=victim (m)+1 of inactive code unit to be compiled,
The Counter Value of inactive code unit to be compiled before this time compiling now is accumulated one 1.
It is required for performing the calculating process of the Counter Value of above-mentioned each code unit to be compiled before each compiling;
And then the Counter Value of each code unit to be compiled is subjected to accumulation calculating or clearing, i.e., compiled each time
Before translating, the Counter Value that will determine as inactive code unit to be compiled adds up one 1, will determine
Counter Value for active code unit to be compiled is zeroed out.
For one default count threshold VictimThreshold of counter value of code unit to be compiled,
It is determined that before this time compiling, the Counter Value of inactive code unit to be compiled, if be more than or equal to
Default count threshold VictimThreshold;If the Counter Value of inactive code unit to be compiled be more than etc.
In default count threshold VictimThreshold, it is determined that Counter Value is more than or equal to default count threshold
VictimThreshold code unit to be compiled, it is doubtful zombie code unit.Wherein, counting threshold is preset
Value VictimThreshold can be using value as 10.
Then can deletes doubtful zombie code unit from compiling queue;Then it is doubtful to deleting
Each code unit to be compiled in the compiling queue of zombie code unit, is compiled scheduling successively, then right
It is compiled, until code unit to be compiled is not present in compiling queue.It is not present in queue is compiled
When code unit to be compiled, it is possible to continue waiting for that code unit to be compiled is put into volume in virtual machine
Translate in queue.
Before the present embodiment is compiled by each code unit to be compiled in compiling queue, obtain
The overall situation of each code unit to be compiled in compiling queue enlivens information and part enlivens information, then basis
The overall situation of each code unit to be compiled enlivens information and part enlivens information, determines each code to be compiled respectively
The activity value of unit;And then, it may be determined that activity value is less than the generation to be compiled of default activity threshold value
Code unit is inactive code unit to be compiled, and determines that activity value is more than or equal to default activity threshold
The code unit to be compiled of value is active code unit to be compiled;For each code unit to be compiled
The Counter Value of code unit to be compiled is counted, it is then determined that Counter Value is more than or equal to default counting threshold
Inactive code unit to be compiled of value is doubtful zombie code;By doubtful zombie code unit from compiling
Deleted in queue.To these doubtful zombie code units without compiling, and then void can be effectively reduced
The ratio of zombie code unit in plan machine, reduces the expense during operation of dummy machine system, also simultaneously
The compiling delay of remaining code unit to be compiled is shortened, improves the performance of dummy machine system.
Fig. 4 is the structural representation of the filter for the code to be compiled that the embodiment of the present invention three provides, such as
Shown in Fig. 4, the filter for the code to be compiled that the present embodiment provides, including:
Determining module 31, before being compiled for each code unit to be compiled in compiling queue,
Information is enlivened according to each code unit to be compiled compiled in queue, determined respectively each in compiling queue
The activity value of code unit to be compiled;
Removing module 32, for the activity value according to each code unit to be compiled, determine each generation to be compiled
Doubtful zombie code unit in code unit, and doubtful zombie code unit is deleted from compiling queue.
The filter of the code to be compiled of the present embodiment can perform the to be compiled of the offer of the embodiment of the present invention one
The filter method of code, its realization principle is similar, and here is omitted.
Before the present invention is compiled by each code unit to be compiled in compiling queue, it is determined that compiling
The activity value of each code unit to be compiled in queue is translated, then according to the work of each code unit to be compiled
Jump property value, determines the doubtful zombie code unit in each code unit to be compiled, and by doubtful zombie code
Unit is deleted from compiling queue.To these doubtful zombie code units without compiling, and then can have
Effect reduces the ratio of the zombie code unit in virtual machine, opening when reducing the operation of dummy machine system
Pin, while the compiling delay of remaining code unit to be compiled is also shortened, improve the property of dummy machine system
Energy.
Fig. 5 is the structural representation of the filter for the code to be compiled that the embodiment of the present invention four provides,
On the basis of embodiment three, as shown in figure 5, the filter for the code to be compiled that the present embodiment provides,
Determining module 31, including:
Acquisition submodule 311, it is compiled for each code unit to be compiled in compiling queue
Before, the overall situation of each code unit to be compiled in acquisition compiling queue enlivens information and part enlivens information;
Determination sub-module 312, lived for enlivening information according to the overall situation of each code unit to be compiled with local
Jump information, determines the activity value of each code unit to be compiled.
Acquisition submodule 311, is specifically used for:
Before each code unit to be compiled in compiling queue is compiled, in compiling queue
Each code unit to be compiled, total execution number of code unit to be compiled is determined, and according to generation to be compiled
Total execution number of code unit, and the focus recognition threshold in default virtual machine, determine generation to be compiled
The overall situation of code unit enlivens information, wherein, total execution number is code unit to be compiled in virtual machine
Called number and inner loop iterations sum;
Determine that the section of code unit to be compiled performs number, and held according to the section of code unit to be compiled
Places number, determine that the part of code unit to be compiled enlivens information, wherein, section performs number to wait to compile
Translate code unit holding within the period of the predetermined time period before at the time of it is determined that part enlivens information
Places number.
Determination sub-module 312, is specifically used for:
For each code unit to be compiled, the activity value of code unit to be compiled is
Activeness (m)=[global_activeness (m)+1] × [local_activeness (m)+1];
Wherein, m is a code unit to be compiled in queue to be compiled, and activeness (m) is to wait to compile
The activity value of code unit is translated, global_activeness (m) is that the overall situation of code unit to be compiled is actively believed
Breath, local_activeness (m) are that the part of code unit to be compiled enlivens information.
Removing module 32, including:
First mark submodule 321, for that in the activity value of each code unit to be compiled, will enliven
Property value be less than the code unit to be compiled of default activity threshold value and be defined as inactive code list to be compiled
Member;
Submodule 322 is deleted, for determining doubtful deadlock in inactive code unit to be compiled is defined as
Corpse code unit, and doubtful zombie code unit is deleted from compiling queue.
Removing module 32, in addition to:
Second mark submodule 323, is being defined as inactive generation to be compiled for deleting submodule 322
Before doubtful zombie code unit being determined in code unit, in the activity value of each code unit to be compiled,
By activity value be more than or equal to default activity threshold value code unit to be compiled be defined as it is active to be compiled
Code unit.
Submodule 322 is deleted, is specifically used for:
If the code unit to be compiled in compiling queue is marked as active code unit to be compiled, really
Surely it is marked as respective Counter Value victim (m)=0 of active code unit to be compiled;
If the code unit to be compiled in compiling queue is marked as inactive code unit to be compiled, and
The part for being confirmed as inactive code unit to be compiled enlivens the value of information equal to zero, it is determined that is marked
It is designated as respective Counter Value victim (m)=victim (m)+1 of inactive code unit to be compiled;
Determines counting device value is more than or equal to inactive code unit to be compiled of default count threshold, is doubtful
Deleted like zombie code unit, and by doubtful zombie code unit from compiling queue.
The filter of the code to be compiled of the present embodiment can perform the to be compiled of the offer of the embodiment of the present invention two
The filter method of code, its realization principle is similar, and here is omitted.
Before the present embodiment is compiled by each code unit to be compiled in compiling queue, obtain
The overall situation of each code unit to be compiled in compiling queue enlivens information and part enlivens information, then basis
The overall situation of each code unit to be compiled enlivens information and part enlivens information, determines each code to be compiled respectively
The activity value of unit;And then, it may be determined that activity value is less than the generation to be compiled of default activity threshold value
Code unit is inactive code unit to be compiled, and determines that activity value is more than or equal to default activity threshold
The code unit to be compiled of value is active code unit to be compiled;For each code unit to be compiled
The Counter Value of code unit to be compiled is counted, it is then determined that Counter Value is more than or equal to default counting threshold
Inactive code unit to be compiled of value is doubtful zombie code;By doubtful zombie code unit from compiling
Deleted in queue.To these doubtful zombie code units without compiling, and then void can be effectively reduced
The ratio of zombie code unit in plan machine, reduces the expense during operation of dummy machine system, also simultaneously
The compiling delay of remaining code unit to be compiled is shortened, improves the performance of dummy machine system.
One of ordinary skill in the art will appreciate that:Realize all or part of step of above-mentioned each method embodiment
Suddenly can be completed by the related hardware of programmed instruction.Foregoing program can be stored in a computer can
Read in storage medium.The program upon execution, execution the step of including above-mentioned each method embodiment;And
Foregoing storage medium includes:ROM, RAM, magnetic disc or CD etc. are various can be with store program codes
Medium.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than to it
Limitation;Although the present invention is described in detail with reference to the foregoing embodiments, the ordinary skill of this area
Personnel should be understood:It can still modify to the technical scheme described in foregoing embodiments, or
Person carries out equivalent substitution to which part technical characteristic;And these modifications or replacement, do not make corresponding skill
The essence of art scheme departs from the spirit and scope of various embodiments of the present invention technical scheme.
Claims (14)
- A kind of 1. filter method of code to be compiled, it is characterised in that including:Before each code unit to be compiled in compiling queue is compiled, according to the compiling queue In each code unit to be compiled enliven information, determine each generation to be compiled in the compiling queue respectively The activity value of code unit;According to the activity value of each code unit to be compiled, the doubtful deadlock in each code unit to be compiled is determined Corpse code unit, and doubtful zombie code unit is deleted from the compiling queue.
- 2. according to the method for claim 1, it is characterised in that each in the compiling queue Code unit to be compiled enlivens information, determines each code unit to be compiled in the compiling queue respectively Activity value, including:The overall situation for obtaining each code unit to be compiled in the compiling queue enlivens information and local active letter Breath;Information is enlivened according to the overall situation of each code unit to be compiled and part enlivens information, is determined each to be compiled The activity value of code unit.
- 3. according to the method for claim 2, it is characterised in that described to obtain in the compiling queue Each code unit to be compiled the overall situation enliven information and it is local enliven information, including:For each code unit to be compiled in the compiling queue, the code unit to be compiled is determined Total execution number, and according to total execution number of the code unit to be compiled, and default virtual Focus recognition threshold in machine, determine that the overall situation of the code unit to be compiled enlivens information, wherein, institute It is called number and inner loop iteration time of the code unit to be compiled in virtual machine to state total number that performs Number sum;Determine that the section of the code unit to be compiled performs number, and according to the code unit to be compiled Section perform number, determine that the part of the code unit to be compiled enlivens information, wherein, the area Between perform number be the code unit to be compiled it is determined that it is local enliven information at the time of before it is default when Between length period in execution number.
- 4. according to the method for claim 2, it is characterised in that described according to each code list to be compiled The overall situation of member enlivens information and part enlivens information, determines the activity value of each code unit to be compiled, wraps Include:For each code unit to be compiled, the activity value of code unit to be compiled is Activeness (m)=[global_activeness (m)+1] × [local_activeness (m)+1];Wherein, m is a code unit to be compiled in the queue to be compiled, and activeness (m) is The activity value of code unit to be compiled, global_activeness (m) are that the overall situation of code unit to be compiled is living Jump information, and local_activeness (m) is that the part of code unit to be compiled enlivens information.
- 5. according to the method described in claim any one of 1-4, it is characterised in that the basis is respectively waited to compile The activity value of code unit is translated, determines the doubtful zombie code unit in each code unit to be compiled, is wrapped Include:In the activity value of each code unit to be compiled, activity value is less than default activity threshold value Code unit to be compiled is defined as inactive code unit to be compiled;Doubtful zombie code unit is determined in inactive code unit to be compiled is defined as.
- 6. according to the method for claim 5, it is characterised in that described according to each code list to be compiled The activity value of member, determines the doubtful zombie code unit in each code unit to be compiled, in addition to:In the activity value of each code unit to be compiled, activity value is more than or equal to default activity threshold The code unit to be compiled of value is defined as active code unit to be compiled.
- 7. according to the method for claim 5, it is characterised in that described to be defined as inactive treat Doubtful zombie code unit is determined in compiled code unit, including:If the code unit to be compiled in the compiling queue is marked as active code unit to be compiled, Then determination is marked as respective Counter Value victim (m)=0 of active code unit to be compiled;If the code unit to be compiled in the compiling queue is marked as inactive code list to be compiled Member, and the part for being confirmed as inactive code unit to be compiled enlivens the value of information equal to zero, then really Surely it is marked as the respective Counter Value of inactive code unit to be compiled Victim (m)=victim (m)+1;Determines counting device value is more than or equal to inactive code unit to be compiled of default count threshold, is doubtful Like zombie code unit.
- A kind of 8. filter of code to be compiled, it is characterised in that including:Determining module, before being compiled for each code unit to be compiled in compiling queue, root Information is enlivened according to each code unit to be compiled in the compiling queue, determines the compiling queue respectively In each code unit to be compiled activity value;Removing module, for the activity value according to each code unit to be compiled, determine each code to be compiled Doubtful zombie code unit in unit, and doubtful zombie code unit is deleted from the compiling queue.
- 9. device according to claim 8, it is characterised in that the determining module, including:Acquisition submodule, before being compiled for each code unit to be compiled in compiling queue, The overall situation for obtaining each code unit to be compiled in the compiling queue enlivens information and locally enlivens information;Determination sub-module, for enlivening information and local active letter according to the overall situation of each code unit to be compiled Breath, determine the activity value of each code unit to be compiled.
- 10. device according to claim 9, it is characterised in that the acquisition submodule, specifically For:Before each code unit to be compiled in compiling queue is compiled, for the compiling queue In each code unit to be compiled, determine total execution number of the code unit to be compiled, and according to Total execution number of the code unit to be compiled, and the focus recognition threshold in default virtual machine, Determine that the overall situation of the code unit to be compiled enlivens information, wherein, total number that performs is to be compiled Called number and inner loop iterations sum of the code unit in virtual machine;Determine that the section of the code unit to be compiled performs number, and according to the code unit to be compiled Section perform number, determine that the part of the code unit to be compiled enlivens information, wherein, the area Between perform number be the code unit to be compiled it is determined that it is local enliven information at the time of before it is default when Between length period in execution number.
- 11. device according to claim 9, it is characterised in that the determination sub-module, specifically For:For each code unit to be compiled, the activity value of code unit to be compiled is Activeness (m)=[global_activeness (m)+1] × [local_activeness (m)+1];Wherein, m is a code unit to be compiled in the queue to be compiled, and activeness (m) is The activity value of code unit to be compiled, global_activeness (m) are that the overall situation of code unit to be compiled is living Jump information, and local_activeness (m) is that the part of code unit to be compiled enlivens information.
- 12. according to the device described in claim any one of 8-11, it is characterised in that the removing module, Including:First mark submodule, in the activity value of each code unit to be compiled, by activity value Code unit to be compiled less than default activity threshold value is defined as inactive code unit to be compiled;Submodule is deleted, for determining doubtful corpse generation in inactive code unit to be compiled is defined as Code unit, and doubtful zombie code unit is deleted from the compiling queue.
- 13. device according to claim 12, it is characterised in that the removing module, in addition to:Second mark submodule, in the activity value of each code unit to be compiled, by activity value Code unit to be compiled more than or equal to default activity threshold value is defined as active code unit to be compiled.
- 14. device according to claim 12, it is characterised in that the deletion submodule, specifically For:If the code unit to be compiled in the compiling queue is marked as active code unit to be compiled, Then determination is marked as respective Counter Value victim (m)=0 of active code unit to be compiled;If the code unit to be compiled in the compiling queue is marked as inactive code list to be compiled Member, and the part for being confirmed as inactive code unit to be compiled enlivens the value of information equal to zero, then really Surely it is marked as the respective Counter Value of inactive code unit to be compiled Victim (m)=victim (m)+1;Determines counting device value is more than or equal to inactive code unit to be compiled of default count threshold, is doubtful Deleted like zombie code unit, and by doubtful zombie code unit from the compiling queue.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610317585.9A CN107368347B (en) | 2016-05-12 | 2016-05-12 | Method and device for filtering to-be-compiled code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610317585.9A CN107368347B (en) | 2016-05-12 | 2016-05-12 | Method and device for filtering to-be-compiled code |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107368347A true CN107368347A (en) | 2017-11-21 |
CN107368347B CN107368347B (en) | 2020-08-04 |
Family
ID=60304447
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610317585.9A Active CN107368347B (en) | 2016-05-12 | 2016-05-12 | Method and device for filtering to-be-compiled code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107368347B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160147575A1 (en) * | 2014-11-26 | 2016-05-26 | Ca, Inc. | Prioritizing and distributing workloads between storage resource classes |
CN105893104A (en) * | 2016-03-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Code compiling method and device |
CN104854642B (en) * | 2012-12-17 | 2017-12-05 | 英艾克斯图股份有限公司 | For the method and apparatus using physical features mark manufacture article |
-
2016
- 2016-05-12 CN CN201610317585.9A patent/CN107368347B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104854642B (en) * | 2012-12-17 | 2017-12-05 | 英艾克斯图股份有限公司 | For the method and apparatus using physical features mark manufacture article |
US20160147575A1 (en) * | 2014-11-26 | 2016-05-26 | Ca, Inc. | Prioritizing and distributing workloads between storage resource classes |
CN105893104A (en) * | 2016-03-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Code compiling method and device |
Non-Patent Citations (1)
Title |
---|
第06期: ""嵌入式交叉汇编器的设计与优化"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Also Published As
Publication number | Publication date |
---|---|
CN107368347B (en) | 2020-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3844691B2 (en) | How to change code generation mode | |
KR102112081B1 (en) | Method and device for identifying high-use intermediate code in a language virtual machine | |
JP3790683B2 (en) | Computer apparatus, exception handling program thereof, and compiling method | |
US20040255279A1 (en) | Block translation optimizations for program code conversation | |
JPH04225431A (en) | Method for compiling computer instruction for increasing instruction-cache efficiency | |
WO2007095642A2 (en) | Dynamic incremental compiler and method | |
JPH08328870A (en) | Compiling processor | |
Franzén et al. | Applying SMT in symbolic execution of microcode | |
JP3924256B2 (en) | COMPILER DEVICE, COMPILER PROGRAM, RECORDING MEDIUM, COMPILING METHOD, RUNTIME INFORMATION GENERATION DEVICE, AND RUNTIME INFORMATION GENERATION PROGRAM | |
US9182956B2 (en) | Flattening conditional statements | |
Gal et al. | Incremental dynamic code generation with trace trees | |
Nobre et al. | Use of previously acquired positioning of optimizations for phase ordering exploration | |
WO2018086494A1 (en) | Method, apparatus and system for prefetching data | |
Kuramitsu | Packrat parsing with elastic sliding window | |
US10146565B2 (en) | Method for executing a computer program with a parameterised function | |
CN103106097B (en) | Stack operation optimization method in a kind of Just-In-Time system | |
CN104809067B (en) | Towards the method for generating test case and device of equality constraint | |
CN108536514B (en) | Hot spot method identification method and device | |
CN107368347A (en) | The filter method and device of code to be compiled | |
US7698534B2 (en) | Reordering application code to improve processing performance | |
CN106325963B (en) | Self-adaptive dynamic compiling and scheduling method and device | |
CN111095197B (en) | Code processing method and device | |
CN106325964B (en) | On-the-flier compiler dispatching method and device | |
Kim et al. | Comparison of LLVM and GCC on the ARM Platform | |
Prokesch et al. | Towards automated generation of time-predictable code |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder |
Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Patentee after: Loongson Zhongke Technology Co.,Ltd. Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Patentee before: LOONGSON TECHNOLOGY Corp.,Ltd. |
|
CP01 | Change in the name or title of a patent holder |