资源描述
,按一下以編輯母片標題樣式,按一下以編輯母片,第二層,第三層,第四層,第五層,*,小型,JIT,編譯器之最佳化技術評估,指導教授:單智君老師,指導學長:喬偉豪學長,組員:,鍾懿軒,蔣季融,李國丞,1,Outline,觀察-鍾懿軒,動機-鍾懿軒,目標-鍾懿軒,初步設計-李國丞,修改過的設計-蔣季融,未來進度-蔣季融,2,觀察,Java,是用,stack,運算。,因為底層機器是,register-based,非,stack-based,,用,interpreter,執行,,performance,不佳。,加入,JIT,將,bytecode,轉換為,register-based,的指令,可以增進,performance,。,若於,JIT,中加入一些機制,增進其效能,則可進一步增進,java performance,。,3,動機,加入的機制若能產生,IR,,使,JIT compiler,後端處理更方便。就有可能增進,JIT,的速度。,folding,機制,:,讀入,bytecode,產生,register-based,的,IR,,簡便後段處理。,因此決定於,JIT,中加入,folding,機制。,4,目標,將folding機制加入JIT中,以最少的overhead,fold最多的pattern,達到增加performance的目的。,5,初步設計,架構圖,Bytecode分類,Pattern 統計,遇到的問題,6,舊架構圖,7,舊folding架構圖,8,Bytecode分類,1.定義:,參考,kims paper,(Advanced POC Model-Based Java Instruction Folding Mechanism),P:,非,operation,含有,push。,Op:operation,含有,push,不含,pop。,Oc:operation,含有,pop,不含,push。,C:,非,operation,含有,pop。,On:,不含,push pop,無法分類者。,9,Bytecode,分類,(續),參考學長的,paper(stack operations folding in java processors),P: transfering data from Constant Register or Local Variable to the operand stack。,O: gets data from the operand stack and then performs different tasks,Oe: ALU type operator that writes the result back to the operand stack。,Ob: Branch type operator。,Oc: Complex type operator including array access, constant pool access 。,Ot: unable or hard to join the folding operation。,C: consumes data from the operand stack, and stores data back into the local variable。,10,Bytecode,分類,(續),2.統計,bytecode push/pop,數:,檢視,kvm source code,(bytecodes.c),:,查看每道,bytecode,的執行碼中有多少,push, pop,的動作。,檢視,jvm spec,(chapter 6),每道,bytecode,都已規定好,stack,情況,可直接紀錄。,11,Analyze patterns possibility in Java class file,Get information from Java class file,Do it our self (in C+),BCEL library for Java,(),12,Possibility of patterns,(1),KIM,所統計出的,Patterns,及出現百分比,(2),自行統計,”,Embedded CaffeineMark”,的結果,13,Problems,Classification can save time of string matching,Using “Hashing” is better than string matching !,Benefit of classification no longer exists when using “Hashing” !,使用,string matching sequential search:,Too much finding overhead。,14,修改過的設計,新架構圖,Folding方法,15,Structure of “JVM with JIT”,Java code source,JAVA compiler,Java bytecode,Class loader,Bytecode verifier,Hardware,Operating System,Java class libraries,Hotsp,ot,Interpret,Native code,JVM,Interpreter,JIT,Y,N,16,Interaction between Interpreter & JIT,Time,One method,Hotspot Detect,Interpret,Time,Complicated code,JIT,End of method,(,Start of method),Code block,Code block,17,Struture of our JIT,JIT,IR generator,Folding,Code generator,IR1,IR2,Native code,Method,18,方法(4-1)-Overview,O-oriented.Search bytecodes for O-type bytecode then find folding pattern for this O-type bytecode.,Data structure: array.,Table:Used for storing information of bytecodes.,19,方法(4-2)-Data Structure,Table: use bytecode ID number as index.,Buffer: length=4;,Bytecode information:,Type,P_num: Push number,Postive, s,tack grow,C_num: Pop number,Negative, stack fall,20,方法(4-3)-Algorithm,經由,bytecode,定義可得,:,P-type: C_num=0, P_num=1.,C-type: P_num=0, C_num=1.,O-type:,不一定,視其功能而定。,以,O-type,的,attribute,為尋找,pattern,的依據。,P_num:,向後尋找,P_num,個,bytecodes,C_num:,向前尋找,C_num,個,bytecodes,21,方法(4-4),Match:,向前找,C_num,個,bytecodes,的,P_num,剛好和,O-type,的,C_num,相抵銷。,向後找,P_num,個,bytecodes,的,C_num,剛好和,O-type,的,P_num,相抵銷。,整個,pattern,的,attribute,和要為零。,無法,match,放棄此,O-type bytecode,,繼續找下一個。,針對,continuous pattern,設計。,22,未來進度,Tracing code,Modifying code,Simulation,Performance,23,Tracing code,Environment configuration,Trace code,Concentrate on “How to add Folding into JIT?”,24,Modifying code,Adding Folding to JIT,Modulizing Folding and adding it into JIT between “IR generator” and “Code generator”,IR Generator,Code Generator,Bytecode,Native code,Folding,25,Simulation,Run benchmark on ARM simulator on Linux workstation,Benchmark : ”Embedded CaffeineMark”,26,Performance,Find out “Performance Speedup” after using folding,Speedup=,(time_with_folding),/,(time_without_folding),27,Performance(cont.),Equation,Positive,:Make “Code Generator” work easier and faster,Negative(Overhead),:Time to search “Folding Group” in Hotspots,28,
展开阅读全文