3.2.3. Direct Compilers
Adirect compilertranslates either Java source code or bytecodes into machine instructions that are directly executable on the designated target processor (refer to Figure 2). The main difference between a direct compiler and a JIT compiler is that the compiled code generated by a direct compiler is available for future executions of the Java program. In JIT compilation, since the translation is done at run-time, compilation speed requirements limit the type and range of code optimizations that can be applied. Direct compilation is done statically, however, and so can apply traditional time-consuming optimization techniques, such as data-flow analysis, interprocedural analysis, and so on [Aho et al. 1986], to improve the performance of the compiled code. However, because they provide static compilation, direct compilers cannot support dynamic class loading. Direct compilation also results in a loss of portability since the generated code can be executed only on the specific target processor. It should be noted that the portability is not completely lost if the original bytecodes or source code are still available, however.
Caffeine[Hsieh et al. 1996] is a Java bytecode-to-native code compiler that generates optimized machine code for the X86 architecture. The compilation process involves several translation steps. First, it translates the bytecodes into an internal language representation, called Java IR, that is organized into functions and basic blocks. The Java IR is then converted to a machine-independent IR, calledLcode, using stack analysis, stackto-register mapping, and class hierarchy analysis. The IMPACT compiler [Chang et al. 1991] is then used to generate an optimized machine-independent IR by applying optimizations such as inlining, data-dependence and interclass analysis to improve instruction-level parallelism (ILP). Further, machine-specific optimizations, including peephole optimization, instruction scheduling, speculation, and register allocation, are applied to generate the optimized machine-specific IR. Finally, optimized machine code is generated from this machine-specific IR. Caffeine uses an enhanced memory model to reduce the overhead due to additional indirections specified in the standard Java memory model. It combines the Java class instance data block and the method table into one object block and thus requires only one level of indirection. Caffeine supports exception handling only through array bounds checking. It does not support garbage collection, threads, and the use of graphics libraries.
The Native Executable Translation (NET) compiler [Hsieh et al. 1997] extends the Caffeine prototype by supporting garbage collection. It uses a mark-andsweep garbage collector which is invoked only when memory is full or reaches a predefined limit. Thus, NET eliminates the overhead due to garbage collection in smaller application programs that have low memory requirements. NET also supports threads and graphic libraries.
The IBM High Performance Compiler for Java (HPCJ) [Seshadri 1997] is another optimizing native code compiler targeted for the AIX, OS/2, Windows95, and WindowsNT platforms. HPCJ takes both Java source code and bytecodes as its input. If the Java source code is used as an input, it invokes the AIX JDK’s Java source-to-bytecode compiler (javac) to produce the bytecodes. Java bytecodes are translated to an internal compiler intermediate language (IL) representation. The common back-end from IBM’s XL family of compilers for the RS/6000 is used to translate the IL code into an object module (.o file). The object module is then linked to other object modules from the Java application program and libraries to produce the executable machine code. The libraries in HPCJ implement garbage collection, Java APIs, and various runtime system routines to support object creation, threads, and exception handling.
A common back-end for the native code generation allows HPCJ to apply various language-independent optimizations, such as instruction scheduling, common subexpression elimination, intramodular inlining, constant propagation, global register allocation, and so on. The bytecodeto-IL translator reduces the overhead for Java run-time checking by performing a simple bytecode simulation during basic block compilation to determine whether such checks can be eliminated. HPCJ reduces the overhead due to method indirection by emitting direct calls for instance methods that are known to be final or that are known to belong to a final class. It uses a conservative garbage collector since the common back-end does not provide any special support for garbage collection.
3.2.3 . โดยตรงคอมไพเลอร์
adirect compilertranslates ทั้ง Java ซอร์สโค้ดหรือ bytecodes เข้าไปในเครื่องคำแนะนำที่ได้รับโดยตรงที่ปฏิบัติการได้ในที่ที่กำหนดเป้าหมายโปรเซสเซอร์(ดูรูปที่ 2 ) ข้อแตกต่างที่สำคัญระหว่างคอมไพเลอร์โดยตรงและคอมไพเลอร์ด่านอีป้องเป็นรหัสที่รวบรวมที่สร้างขึ้นโดยคอมไพเลอร์โดยตรงที่มีอยู่สำหรับเรื่องอนาคตของโปรแกรม Java ในรวบรวมด่านอีป้องนับตั้งแต่การแปลที่ได้ทำเวลาใช้ความเร็วความต้องการรวบรวมการจำกัดความหลากหลายและ ประเภท ของการปรับแต่งซอร์สโค้ดที่สามารถนำมาใช้ รวบรวมโดยตรงเป็นการกระทำรูปแบบสแตติกอย่างไรก็ตามและดังนั้นจึงสามารถใช้เทคนิคการปรับแต่งต้องใช้เวลานานแบบดั้งเดิมเช่นการวิเคราะห์ข้อมูลและการวิเคราะห์การไหลของ interprocedural ดังนั้นในวันที่[ aho et al . 1986 ]เพื่อปรับปรุง ประสิทธิภาพ การทำงานของรหัสคอมไพล์ได้.อย่างไรก็ตามเนื่องจากพวกเขาให้รวบรวมแบบสแตติกคอมไพเลอร์โดยตรงไม่สามารถรองรับการโหลด Class แบบไดนามิก รวบรวมโดยตรงนอกจากนี้ยังได้ผลในการสูญเสียที่พกพาสะดวกเนื่องจากรหัสของเกิดขึ้นที่สามารถดำเนินการเฉพาะในโปรเซสเซอร์เป้าหมายเฉพาะ ควรบันทึกไว้ด้วยว่าไม่ได้พกพาที่สูญหายหาก bytecodes แบบดั้งเดิมหรือซอร์สโค้ดจะยังคงจัดให้บริการแต่ถึงอย่างไรก็ตาม.
คาเฟอีน[ hsieh et al .อย่างสมบรูณ์แบบ1996 ]เป็นคอมไพเลอร์ bytecode - - พื้นเมืองรหัส Java ที่จะสร้างรหัสเครื่องที่ปรับแต่งสำหรับสถาปัตยกรรม X 86 ที่ การรวบรวมสิ่งที่เกี่ยวข้องกับขั้นตอนการแปลหลายแห่ง เป็นครั้งแรกที่จะแปลง bytecodes เข้าไปในการเป็นตัวแทน ภายใน ที่เรียกว่า ภาษา Java อินฟราเรดที่มีการจัดในช่วงตึกแบบเรียบง่ายและมีฟังก์ชันการใช้งาน Java อินฟราเรดจะถูกแปลงเป็นอินฟราเรดเครื่อง - อิสระที่ calledlcode แล้วโดยใช้การวิเคราะห์ Stack stackto - การลงทะเบียนและการทำแผนที่การวิเคราะห์โครงสร้างแบบลำดับชั้น ส่งผลกระทบต่อคอมไพเลอร์[ช้าง et al .ได้ 1991 ]ถูกใช้เพื่อสร้างอินฟราเรดเครื่อง - อิสระที่ได้รับการปรับแต่งโดยการนำข้อมูลเช่น inlining - การพึ่งพาและการวิเคราะห์ interclass เพื่อปรับปรุงการทำงานแบบขนานการเรียนการสอน - ระดับ( ilp )แล้ว การปรับแต่งเครื่องแบบเฉพาะเพิ่มเติมรวมทั้งการปรับแต่งรูที่เจาะไว้สำหรับดูการจัดตารางเวลาการเรียนการสอนการเก็งกำไรและการจัดสรรลงทะเบียนจะถูกนำไปใช้ในการสร้างอินฟราเรดเครื่อง - เฉพาะซึ่งได้รับการปรับแต่งด้าน สุดท้ายคือรหัสเครื่องที่ปรับแต่งจะถูกสร้างขึ้นจากอินฟราเรดแบบเครื่องรุ่นนี้ คาเฟอีนจะใช้รุ่นของหน่วยความจำที่เพิ่มขึ้นเพื่อลดค่าใช้จ่ายที่เกิดจากการ indirections เพิ่มเติมที่ระบุในรุ่นหน่วยความจำ Java มาตรฐานได้เป็นอาคารก่ออิฐที่ประกอบด้วยตารางข้อมูลตัวอย่างเช่น Class และวิธีการ Java ที่เข้าสู่หนึ่งในอาคารก่ออิฐและวัตถุทำให้มีระดับหนึ่งของอ้อม คาเฟอีนสนับสนุนยกเว้นการจัดการกับเฉพาะผ่านทางเขตความหลากหลายการตรวจสอบ แต่จะไม่รองรับการเก็บขยะเธรดและใช้งานของไลบรารีกราฟิก
พื้นเมืองที่ปฏิบัติการได้การแปล(ราคาสุทธิ)ที่คอมไพเลอร์[ hsieh et al .1997 ]ขยายต้นแบบคาเฟอีนโดยสนับสนุนการเก็บขยะ มีการใช้เครื่องหมายตัวเก็บขยะ - andsweep ซึ่งมีการปลุกเร้าขึ้นเท่านั้นเมื่อหน่วยความจำเต็มหรือเกินขีดจำกัดที่กำหนดไว้ล่วงหน้า ทำให้กำไรสุทธิจะช่วยขจัดปัญหาเรื่องค่าใช้จ่ายที่เนื่องจากการเก็บขยะในโปรแกรมแอปพลิเคชันที่มีขนาดเล็กลงมีความต้องการหน่วยความจำต่ำ สุทธิยังสนับสนุนเธรดและไลบรารี ภาพ กราฟิก
IBM , ประสิทธิภาพ ในการทำงานสูงคอมไพเลอร์ของ Java ( hpcj )[ seshadri 1997 ]เป็นคอมไพเลอร์รหัสพื้นเมืองการปรับแต่งอีกเป้าหมายใน Aix OS / 2 , Windows 95 และแพลตฟอร์มเช่น WindowsNT hpcj ใช้เวลาซอร์สโค้ดจาวาและ bytecodes ทั้งสองเป็นอินพุตของตน หากมีโค้ดจาวาแหล่งที่มาที่จะใช้เป็นอินพุตเซอร์วิสนี้ Java คอมไพเลอร์แหล่งที่มาที่ไปของ Aix bytecode jdk ( javac )เพื่อผลิต bytecodes ได้bytecodes Java เป็นการ ภายใน คอมไพเลอร์กลาง ภาษา ( IL )เป็นผู้แทนที่ ทั่วไป Back - end ออกจากช่องใส่ขนาด XL สำหรับครอบครัวของ IBM ของคอมไพเลอร์ของ RS / 6000 มีการใช้รหัสในการแปล, IL ที่เข้าไปในวัตถุโมดูล(. O ไฟล์) โมดูลวัตถุที่มีความเชื่อมโยงกับโมดูลออบเจกต์โค้ดโปรแกรมอื่นๆได้จากแอปพลิเคชันและไลบรารีในการผลิตเครื่องที่ปฏิบัติการได้ Java แล้วที่ไลบรารีใน hpcj ใช้ถังขยะคอลเลคชั่น, Java API ,และแอพพลิเคชันระบบรูทีนในการสนับสนุนการสร้างวัตถุ,เธรด,และข้อยกเว้นการจัดการ.
ที่ทั่วไป Back - end สำหรับคนพื้นเมือง hpcj รหัสรุ่นช่วยให้การใช้ ภาษา ต่างๆโดยแยกเป็นอิสระได้รับการปรับแต่ง,เช่นการเรียนการสอนการจัดตารางเวลา,ทั่วไป subexpression กำจัด intramodular inlining ,คงที่แพร่,การจัดสรรลงทะเบียนระดับโลกและที่จะเป็นไปได้ แปล bytecodeto - IL ช่วยลดค่าใช้จ่ายสำหรับการตรวจสอบเวลาใช้งาน Java โดยการทำการจำลอง bytecode แบบเรียบง่ายในระหว่างรวบรวมเป็นอาคารก่ออิฐแบบเรียบง่ายในการตรวจสอบว่าเช็คดังกล่าวสามารถกำจัดhpcj ช่วยลดค่าใช้จ่ายที่เกิดจากการใช้งานโดยอ้อมวิธีการโทรโดยตรงสำหรับวิธีการยกตัวอย่างเช่นที่เป็นที่รู้จักกันดีในเรื่องจะเป็นครั้งสุดท้ายหรือที่มีชื่อเสียงเป็น Class สุดท้ายที่ มีการใช้ที่รองกากอนุรักษ์นิยมที่นับตั้งแต่ทั่วไป Back - end ที่ไม่ให้การสนับสนุนแบบพิเศษใดๆสำหรับการเก็บขยะ.
การแปล กรุณารอสักครู่..
![](//thimg.ilovetranslation.com/pic/loading_3.gif?v=b9814dd30c1d7c59_8619)