小型JIT编译器之最佳化技术评估.pptx
- 文档编号:18906287
- 上传时间:2024-02-11
- 格式:PPTX
- 页数:28
- 大小:164.07KB
小型JIT编译器之最佳化技术评估.pptx
《小型JIT编译器之最佳化技术评估.pptx》由会员分享,可在线阅读,更多相关《小型JIT编译器之最佳化技术评估.pptx(28页珍藏版)》请在冰点文库上搜索。
小型小型JIT編譯器之最佳化技術編譯器之最佳化技術評估評估指導教授:
單智君老師指導學長:
喬偉豪學長組員:
鍾懿軒,蔣季融,李國丞Outlinen觀察-鍾懿軒n動機-鍾懿軒n目標-鍾懿軒n初步設計-李國丞n修改過的設計-蔣季融n未來進度-蔣季融觀察nJava是用stack運算。
n因為底層機器是register-based非stack-based,用interpreter執行,performance不佳。
n加入JIT將bytecode轉換為register-based的指令,可以增進performance。
n若於JIT中加入一些機制,增進其效能,則可進一步增進javaperformance。
動機n加入的機制若能產生IR,使JITcompiler後端處理更方便。
就有可能增進JIT的速度。
nfolding機制:
讀入bytecode產生register-based的IR,簡便後段處理。
n因此決定於JIT中加入folding機制。
目標n將folding機制加入JIT中,以最少的overhead,fold最多的pattern,達到增加performance的目的。
初步設計n架構圖nBytecode分類nPattern統計n遇到的問題舊架構圖舊folding架構圖Bytecode分類n1.定義:
n參考kimspaper(AdvancedPOCModel-BasedJavaInstructionFoldingMechanism)nP:
非operation含有push。
nOp:
operation含有push不含pop。
nOc:
operation含有pop不含push。
nC:
非operation含有pop。
nOn:
不含pushpop,無法分類者。
Bytecode分類(續)n參考學長的paper(stackoperationsfoldinginjavaprocessors)nP:
transferingdatafromConstantRegisterorLocalVariabletotheoperandstack。
nO:
getsdatafromtheoperandstackandthenperformsdifferenttasksnOe:
ALUtypeoperatorthatwritestheresultbacktotheoperandstack。
nOb:
Branchtypeoperator。
nOc:
Complextypeoperatorincludingarrayaccess,constantpoolaccess。
nOt:
unableorhardtojointhefoldingoperation。
nC:
consumesdatafromtheoperandstack,andstoresdatabackintothelocalvariable。
Bytecode分類(續)n2.統計bytecodepush/pop數:
n檢視kvmsourcecode(bytecodes.c):
n查看每道bytecode的執行碼中有多少push,pop的動作。
n檢視jvmspec(chapter6)n每道bytecode都已規定好stack情況,可直接紀錄。
AnalyzepatternspossibilityinJavaclassfilenGetinformationfromJavaclassfilenDoitourself(inC+)nBCELlibraryforJava(http:
/jakarta.apache.org/bcel)Possibilityofpatternsn
(1)KIM所統計出的Patterns及出現百分比n
(2)自行統計”EmbeddedCaffeineMark”的結果ProblemsnClassificationcansavetimeofstringmatchingnUsing“Hashing”isbetterthanstringmatching!
nBenefitofclassificationnolongerexistswhenusing“Hashing”!
n使用stringmatchingsequentialsearch:
Toomuchfindingoverhead。
修改過的設計n新架構圖nFolding方法Structureof“JVMwithJIT”JavacodesourceJAVAcompilerJavabytecodeClassloaderBytecodeverifierHardwareOperatingSystemJavaclasslibrariesHotspotInterpretNativecodeJVMInterpreterJITYNInteractionbetweenInterpreter&JITTimeOnemethodHotspotDetectInterpretTimeComplicatedcodeJITEndofmethod(Startofmethod)CodeblockCodeblockStrutureofourJITJITIRgeneratorFoldingCodegeneratorIR1IR2NativecodeMethod方法(4-1)-OverviewnO-oriented.SearchbytecodesforO-typebytecodethenfindfoldingpatternforthisO-typebytecode.nDatastructure:
array.nTable:
Usedforstoringinformationofbytecodes.方法(4-2)-DataStructurenTable:
usebytecodeIDnumberasindex.nBuffer:
length=4;nBytecodeinformation:
nTypenP_num:
PushnumbernPostive,stackgrownC_num:
PopnumbernNegative,stackfall方法(4-3)-Algorithmn經由bytecode定義可得:
nP-type:
C_num=0,P_num=1.nC-type:
P_num=0,C_num=1.nO-type:
不一定,視其功能而定。
n以O-type的attribute為尋找pattern的依據。
nP_num:
向後尋找P_num個bytecodesnC_num:
向前尋找C_num個bytecodes方法(4-4)nMatch:
n向前找C_num個bytecodes的P_num剛好和O-type的C_num相抵銷。
n向後找P_num個bytecodes的C_num剛好和O-type的P_num相抵銷。
n整個pattern的attribute和要為零。
n無法match放棄此O-typebytecode,繼續找下一個。
n針對continuouspattern設計。
未來進度nTracingcodenModifyingcodenSimulationnPerformanceTracingcodenEnvironmentconfigurationnTracecodenConcentrateon“HowtoaddFoldingintoJIT?
”ModifyingcodenAddingFoldingtoJITnModulizingFoldingandaddingitintoJITbetween“IRgenerator”and“Codegenerator”IRGeneratorCodeGeneratorBytecodeNativecodeFoldingSimulationnRunbenchmarkonARMsimulatoronLinuxworkstationnBenchmark:
”EmbeddedCaffeineMark”PerformancenFindout“PerformanceSpeedup”afterusingfoldingnSpeedup=(time_with_folding)/(time_without_folding)Performance(cont.)nEquationnPositive:
Make“CodeGenerator”workeasierandfasternNegative(Overhead):
Timetosearch“FoldingGroup”inHotspots
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 小型 JIT 编译器 最佳 技术 评估