CN108509202A - Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring - Google Patents

Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring Download PDF

Info

Publication number
CN108509202A
CN108509202A CN201810279057.8A CN201810279057A CN108509202A CN 108509202 A CN108509202 A CN 108509202A CN 201810279057 A CN201810279057 A CN 201810279057A CN 108509202 A CN108509202 A CN 108509202A
Authority
CN
China
Prior art keywords
multiplication
integers
jit
instruction
engines
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
CN201810279057.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.)
Tianjin Kylin Information Technology Co Ltd
Original Assignee
Tianjin Kylin Information 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 Tianjin Kylin Information Technology Co Ltd filed Critical Tianjin Kylin Information Technology Co Ltd
Priority to CN201810279057.8A priority Critical patent/CN108509202A/en
Publication of CN108509202A publication Critical patent/CN108509202A/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 present invention provides the multiplication of integers optimization method based on platform red fox browser JIT engines of soaring, and in turn includes the following steps:S110:Start to optimize jit compiling process;S120:MIR is generated;S130:Execute optimization time;S140:MIR degrades;S150:Code building, including:A. multiplication of integers code building;B. right operand in LMulI objects is read, corresponding operation is executed according to the type of right operand;S160:Terminate.The beneficial effects of the invention are as follows the categorical datas collected according to JS engines to do type inference and data analysis, floating-point multiply instruction before is replaced with into other equivalent instructions in optimizing JIT code generation processes, it realizes and completes multiplication operation in an instruction cycle, to achieve the purpose that optimize multiplication of integers efficiency.

Description

Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring
Technical field
The invention belongs to communication technique fields, more particularly, to a kind of based on platform red fox browser JIT engines of soaring Multiplication of integers optimization method.
Background technology
Along with the fast development of internet, browser becomes the main Internet portal of desktop terminal user.Now Web site contents it is more and more abundant, function also becomes increasingly complex, most dynamic in order to which the Fast rendering page promotes user experience State page rendering and data processing work can be carried out in browser end.This performance to browser, the especially performance of JS engines More stringent requirements are proposed.
The JS engines of early stage are all based on interpreter realization, and it is short that interpreter has the advantages that code load and execution is delayed, but It is that the code executed repeatedly is needed to reinterpret every time, results in the reduction of operational efficiency.It is executed to promote JS engines Performance, browser manufacturer have developed the JIT optimisation techniques suitable for dynamic languages such as JS.
JIT:Just-In-Time (Just-in-time compilation), a kind of form of on-the-flier compiler are a kind of raisings The method of program operational efficiency.In red fox browser, there are two JIT compilers:Baseline JIT compiler and optimization jit compiling Device.
Bailout:Also be " going to optimize " (Deoptimize), height optimization level JIT done very radical optimization (such as Assuming that it be not centainly the pointed object of null, some reference must be some that some class, which will not have other subclass, some reference, Concrete type, etc.), and if if this radical hypothesis fails, must just return to do not do these optimization " peace Low optimization level JIT entirely " goes to continue to execute.
The code operation information that JIT compiler is recorded according to interpreter, by hot spot code by compiling optimization means compiling Corresponding JIT codes are directly executed at local machine code, when running to respective code next time, so as to which JS is substantially improved Engine performance.There are two JIT compilers inside red fox browser at present:Baseline compiler and Optimizing Compiler.Baseline compiler It can be by " " code compilation will not do code structure and optimize hot spot at local machine code;It was executed in baseline compiler Many times " very it is hot " code can be admitted to optimization JIT compiler, and a variety of optimization hands can be called by optimizing inside JIT compiler Section (constant folding, dead code elimination etc.), adjustment code structure is to generate most efficient local machine code.
Red fox browser does not support optimization JIT functions in platform of soaring at present, because lacking the optimization for platform of soaring JIT code buildings rear end.And baseline JIT degree of optimization is insufficient, causes the complicated webpage timeliness rate of JS engines processing too low, to draw It is slow to play page response.Especially JS codes are required for first judging to operate in the multiplying of interpreter and baseline JIT compiler Then operand is converted to floating number again, then passes through floating-point multiply instruction result of calculation by several types.Floating-point multiply instruction exists Platform of soaring needs five clock cycle, and other arithmetic instructions can execute completion in clock cycle greatly, especially When recycling execution, performance issue is more prominent.
In the existing browser technology based on red fox exploitation, a kind of JS engines for upper red fox browser of soaring without energy solution The performance issue of multiplication of integers.Multiplication operation in current basic line JIT compiler is completed by floating-point multiply instruction, is needed more A clock cycle, inefficiency.
Chinese invention patent " the JIT code buildings that profile is oriented to " (application number 201210330925.3), the invention propose A kind of JIT code generating methods that profile is oriented to, specific implementation are:First, the source code encoded with dynamic language is received Bytecode is converted to through parsing;Then, interpreter explains bytecode, generates the profile information about bytecode, stores profile Information;Finally, when JIT compiler is configured to execute controller, JIT compiler is based on profile information and executes compiling bytecode Function.This method improves the efficiency of code building by generating profile information, but there is no be based on certain types of word Section code does targetedly code building optimization.
Invention content
The invention aims to solve the problems in background technology, provide a kind of based on platform red fox browser of soaring The multiplication of integers optimization method of JIT engines, the categorical data collected according to JS engines do type inference and data analysis, are optimizing Floating-point multiply instruction before is replaced with into other equivalent instructions in JIT code generation processes, is realized complete in an instruction cycle It is operated at multiplication, to achieve the purpose that optimize multiplication of integers efficiency.
In order to solve the above technical problems, the technical solution adopted by the present invention is:Based on soaring, platform red fox browser JIT draws The multiplication of integers optimization method held up, in turn includes the following steps:
S110:Start to optimize jit compiling process;
S120:MIR is generated;
S130:Execute optimization time;
S140:MIR degrades;
S150:Code building, including:
A. multiplication of integers code building;
B. right operand in LMulI objects is read, corresponding operation is executed according to the type of right operand;
S160:Terminate.
Preferably, right operand in the reading LMulI objects executes corresponding operation according to the type of right operand, Including judging whether right operand is constant,
If constant, S151 is thened follow the steps;
If it is not, thening follow the steps S152;
S151:Execute the code building subprocess that right operand is constant;
S152:Execute the code building subprocess that right operand is register.
Preferably, described to execute the code building subprocess that right operand is constant, include the following steps:
S1511:Generate left operand and 0 instruction compared;
S1512:Judge whether right operand is 0;
Preferably, described to generate left operand and 0 instruction compared, including:
Judge whether canBeNegativeZero marks are set in MulI;
If canBeNegativeZero marks are set in MulI, instruction checking multiplication of integers operation result is generated Whether it is -0,
Preferably, described to judge whether right operand is 0, including:
If right operand is 0, the instruction that Bailout entrances are jumped to when LessThan marks are set is generated;
Otherwise the instruction that Bailout entrances are jumped to when Equal marks are set is generated;
Preferably, including judge r value, corresponding operation executed according to r value type,
When r value is constant 0, then generates instruction and constant 0 is moved to output register;
When r value is constant 1, then generates instruction and the content of left operand device register is moved to output register;
When r value is constant 2, then generates instruction and result is saved in output register by left operand phase adduction;
When r value is 2 n times power, then generates left shift instruction and result is saved in output register;
When r value is other constants, then move is generated by right operand load to rough draft register, and generate and multiply Method instructs and result is saved in output register, judges the canOverflow flag bits of MulI, if if true, generated Overflow marks jump to the instruction of Bailout entrances when being set;
Preferably, described to execute the code building subprocess that right operand is register, include the following steps:
S1521:It generates multiplying order and result is saved in output register, judge the canOverflow marks of MulI Position;
S1522:Judge the canBeNegativeZero marks of MulI;
Preferably, the canOverflow flag bits for judging MulI, including, if if true, generating Overflow marks The instruction of Bailout entrances is jumped to when will is set.
Preferably, judge the canBeNegativeZero marks of MulI, including:
If it is true, result register and 0 instruction compared are generated, because multiplication of integers result is only deposited here when being -0 An operand is 0 and another operand is less than 0 the case where, it is possible to generate two behaviour of CMN instruction testing Whether addition of counting is less than zero, and Bailout entrances are jumped to when Signed flag bits are set.
The invention has the advantages and positive effects that:
1. the present invention proposes the multiplication of integers code building optimization method based on platform red fox browser JIT engines of soaring, The categorical data collected according to JS engines does type inference and data analysis, will before in optimize JIT code generation processes Floating-point multiply instruction replaces with other equivalent instructions, realizes and completes multiplication operation in an instruction cycle, whole to reach optimization The purpose of number multiplication efficiency.
2. providing a kind of multiplication of integers instruction generation optimization side specifically for platform red fox browser JIT engines of soaring Case, to achieve the purpose that optimize multiplication of integers efficiency.
Description of the drawings
Fig. 1 is the flow chart for the platform red fox browser optimization JIT engines of soaring being not optimised;
Fig. 2 is the flow chart of the platform red fox browser optimization JIT engines of soaring after optimization;
Fig. 3 is the multiplication of integers code generation process for optimizing JIT in the present invention based on platform red fox browser of soaring;
Fig. 4 is that optimize right operand based on platform red fox browser JIT engine multiplications of integers of soaring in the present invention be constant Subprocess flow chart;
Fig. 5 is that optimize right operand based on platform red fox browser JIT engine multiplications of integers of soaring in the present invention be deposit The subprocess flow chart of device;
Specific implementation mode
The present embodiment provides the multiplication of integers optimization methods based on platform red fox browser JIT engines of soaring, such as Fig. 3 institutes Show, is one embodiment of optimization JIT multiplication of integers code building optimization process according to an embodiment of the invention, it is main Include the code building subprocess that operand r value is constant and the code building subprocess that right operand is register, simultaneously A kind of data structure is also used:LMulI objects.The content and type of object record multiplication of integers operation lvalue, r value And the range information of destination register information and result of calculation.Specific implementation step is as follows:
Step S301:The isConstant marks for reading right operand in LMulI objects judge whether right operand is normal Amount, S302 is thened follow the steps if constant, no to then follow the steps S303;
Step S302:Execute the code building subprocess that right operand is constant;
Step S303:Execute the code building subprocess that right operand is register;
Next, describing multiplication of integers code building that right operand according to the present invention is constant below with reference to Fig. 4 One embodiment of process.
Step S401:If canBeNegativeZero marks are set in MulI, instruction checking multiplication of integers is generated Whether operation result is -0.Left operand and 0 instruction (CMP) compared are generated, if right operand is 0, is generated LessThan marks jump to the instruction of Bailout entrances when being set, otherwise generate when Equal marks are set and jump to The instruction of Bailout entrances.
Step S402:When r value be constant 0, then generate instruction by constant 0 move (MOV) arrive output register;
Step S403:When r value is constant 1, then generates instruction and arrive the content of left operand device register movement (MOV) Output register;
Step S404:When r value is constant 2, then generates instruction and left operand is added (ADD) and is saved in result defeated Go out register;
Step S405:When r value is 2 n times power, then generates left shift instruction and result is saved in output register;
Step S406:When r value is other constants, then generates move (MOV) and post right operand load to rough draft Storage, and generate multiplying order and result is saved in output register, judge the canOverflow flag bits of MulI, if If true, generating the instruction for jumping to Bailout entrances when Overflow marks are set;
Next, describing the multiplication of integers code building that right operand according to the present invention is register below with reference to Fig. 5 One embodiment of subprocess.
Step S501:It generates multiplying order and result is saved in output register, judge the canOverflow marks of MulI Will position, if if true, generating the instruction for jumping to Bailout entrances when Overflow marks are set;
Step S502:Judge that the canBeNegativeZero marks of MulI generate result register and 0 if it is true Compare the instruction of (CBNZ), because it is 0 and another operand to only exist an operand when multiplication of integers result is -0 here Be less than 0 the case where, it is possible to generate two operands of CMN instruction testing and be added whether be less than zero, and in Signed Bailout entrances are jumped to when flag bit is set.
The invention has the advantages that compared with prior art:
1. the present invention proposes the multiplication of integers code building optimization method based on platform red fox browser JIT engines of soaring, The categorical data collected according to JS engines does type inference and data analysis, will before in optimize JIT code generation processes Floating-point multiply instruction replaces with other equivalent instructions, realizes and completes multiplication operation in an instruction cycle, whole to reach optimization The purpose of number multiplication efficiency.
2. providing a kind of multiplication of integers instruction generation optimization side specifically for platform red fox browser JIT engines of soaring Case, to achieve the purpose that optimize multiplication of integers efficiency.
One embodiment of the present invention has been described in detail above, but the content be only the present invention preferable implementation Example should not be construed as limiting the practical range of the present invention.It is all according to all the changes and improvements made by the present patent application range Deng should all still fall within the scope of the patent of the present invention.

Claims (9)

1. the multiplication of integers optimization method based on platform red fox browser JIT engines of soaring, it is characterised in that:Include as follows successively Step:
S110:Start to optimize jit compiling process;
S120:MIR is generated;
S130:Execute optimization time;
S140:MIR degrades;
S150:Code building, including:
A. multiplication of integers code building;
B. right operand in LMulI objects is read, corresponding operation is executed according to the type of right operand;
S160:Terminate.
2. the multiplication of integers optimization method according to claim 1 based on platform red fox browser JIT engines of soaring, special Sign is:Right operand in the reading LMulI objects executes corresponding operation according to the type of right operand, including judges Whether right operand is constant,
If constant, S151 is thened follow the steps;
If it is not, thening follow the steps S152;
S151:Execute the code building subprocess that right operand is constant;
S152:Execute the code building subprocess that right operand is register.
3. the multiplication of integers optimization method according to claim 2 based on platform red fox browser JIT engines of soaring, special Sign is:It is described to execute the code building subprocess that right operand is constant, include the following steps:
S1511:Generate left operand and 0 instruction compared;
S1512:Judge whether right operand is 0.
4. the multiplication of integers optimization method according to claim 3 based on platform red fox browser JIT engines of soaring, special Sign is:It is described to generate left operand and 0 instruction compared, including:
Judge whether canBeNegativeZero marks are set in MulI;
If canBeNegativeZero marks are set in MulI, whether instruction checking multiplication of integers operation result is generated It is -0.
5. the multiplication of integers optimization method according to claim 3 based on platform red fox browser JIT engines of soaring, special Sign is:It is described to judge whether right operand is 0, including:
If right operand is 0, the instruction that Bailout entrances are jumped to when LessThan marks are set is generated;
Otherwise the instruction that Bailout entrances are jumped to when Equal marks are set is generated.
6. the multiplication of integers optimization method according to claim 5 based on platform red fox browser JIT engines of soaring, special Sign is:Including judging r value, corresponding operation is executed according to r value type,
When r value is constant 0, then generates instruction and constant 0 is moved to output register;
When r value is constant 1, then generates instruction and the content of left operand device register is moved to output register;
When r value is constant 2, then generates instruction and result is saved in output register by left operand phase adduction;
When r value is 2 n times power, then generates left shift instruction and result is saved in output register;
When r value is other constants, then move is generated by right operand load to rough draft register, and generate multiplication and refer to It enables and result is saved in output register, judge the canOverflow flag bits of MulI, if if true, generating Overflow The instruction of Bailout entrances is jumped to when mark is set.
7. the multiplication of integers optimization method according to claim 2 based on platform red fox browser JIT engines of soaring, special Sign is:It is described to execute the code building subprocess that right operand is register, include the following steps:
S1521:It generates multiplying order and result is saved in output register, judge the canOverflow flag bits of MulI;
S1522:Judge the canBeNegativeZero marks of MulI.
8. the multiplication of integers optimization method according to claim 5 based on platform red fox browser JIT engines of soaring, special Sign is:The canOverflow flag bits for judging MulI, including, if be set if true, generating Overflow marks When jump to the instructions of Bailout entrances.
9. the multiplication of integers optimization method according to claim 1 based on platform red fox browser JIT engines of soaring, special Sign is:Judge the canBeNegativeZero marks of MulI, including:
If it is true, result register and 0 instruction compared are generated, because multiplication of integers result only exists one here when being -0 A operand be 0 and another operand be less than 0 the case where, it is possible to generate two operands of a CMN instruction testing It is added and whether is less than zero, and jump to Bailout entrances when Signed flag bits are set.
CN201810279057.8A 2018-03-30 2018-03-30 Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring Pending CN108509202A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810279057.8A CN108509202A (en) 2018-03-30 2018-03-30 Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810279057.8A CN108509202A (en) 2018-03-30 2018-03-30 Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring

Publications (1)

Publication Number Publication Date
CN108509202A true CN108509202A (en) 2018-09-07

Family

ID=63379580

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810279057.8A Pending CN108509202A (en) 2018-03-30 2018-03-30 Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring

Country Status (1)

Country Link
CN (1) CN108509202A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130346463A1 (en) * 2012-06-21 2013-12-26 Advanced Micro Devices, Inc. Method and apparatus for multiply instructions in data processors
CN104049945A (en) * 2013-03-15 2014-09-17 英特尔公司 Methods and apparatus for fusing instructions to provide or-test and and-test functionality on multiple test sources

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130346463A1 (en) * 2012-06-21 2013-12-26 Advanced Micro Devices, Inc. Method and apparatus for multiply instructions in data processors
CN104049945A (en) * 2013-03-15 2014-09-17 英特尔公司 Methods and apparatus for fusing instructions to provide or-test and and-test functionality on multiple test sources

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
NESTI FRONIKA SIANIPAR等: "Induction, Multiplication, and Acclimatization of", 《2015 INTERNATIONAL CONFERENCE ON TECHNOLOGY, INFORMATICS, MANAGEMENT, ENGINEERING & ENVIRONMENT (TIME-E)》 *
朱凯佳等: "基于GCC的VLIW编译系统研究", 《计算机工程与应用》 *

Similar Documents

Publication Publication Date Title
Oskin et al. HLS: Combining statistical and symbolic simulation to guide microprocessor designs
US9569342B2 (en) Test strategy for profile-guided code execution optimizers
CN109863473A (en) Profile with accurate relevant sample driving guides to optimize
CN107608880A (en) A kind of automated testing method for being used for virtual platform based on data-driven
WO2013036703A2 (en) Profile guided jit code generation
CN108228187B (en) Global optimization method of numerical program
CN110399133A (en) A kind of JavaScript code optimization method based on front end bytecode technology
CN104267654A (en) Method and system for converting ladder diagram program into instruction list program and compiling instruction list program
CN113722218A (en) Software defect prediction model construction method based on compiler intermediate representation
CN101271398B (en) Recognition method of multi-path branch structure
CN106843993A (en) A kind of method and system of resolving inversely GPU instructions
Li et al. A hybrid sample generation approach in speculative multithreading
CN108509202A (en) Multiplication of integers optimization method based on platform red fox browser JIT engines of soaring
CN112527304B (en) Self-adaptive node fusion compiling optimization method based on heterogeneous platform
CN105653344A (en) Graphical programming system compiler method
CN100583042C (en) Compiling method, apparatus for loop in program
WO2019136014A1 (en) Reduced instructions to generate global variable addresses
CN102446112A (en) Instruction processing device and processor, and instruction translating device and method
CN102023870B (en) Detection method and device for software modification as well as electronic equipment
RU2206119C2 (en) Method for producing object code
CN114217805A (en) Compiling self-optimization method
Nakatani et al. Making compaction-based parallelization affordable
CN102360306A (en) Method for extracting and optimizing information of cyclic data flow charts in high-level language codes
CN1175348C (en) Sub pipeline and pipeline executed in a superlong instruction character
Cheng et al. Efficient multiple-isa embedded processor core design based on risc-v

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
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Sun Ke

Inventor after: Zhang Duo

Inventor after: He Mingwu

Inventor after: Tang Xiaodong

Inventor after: Wei Lifeng

Inventor after: Kong Jinzhu

Inventor before: Sun Ke

Inventor before: Zhang Duo

Inventor before: He Mingwu

Inventor before: Tang Xiaodong

Inventor before: Wei Lifeng

Inventor before: Kong Jinzhu

Inventor before: Wu Qingbo

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180907