Class Assembler

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public final class Assembler
    extends java.lang.Object
    implements Constants
    This class is used to assemble the bytecode instructions for a method. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Detail

      • maxdepth

        int maxdepth
      • maxvar

        int maxvar
      • maxpc

        int maxpc
      • SourceClassList

        static java.util.Vector<java.lang.String> SourceClassList
      • TmpCovTable

        static java.util.Vector<java.lang.String> TmpCovTable
      • JcovClassCountArray

        static int[] JcovClassCountArray
      • JcovMagicLine

        static java.lang.String JcovMagicLine
      • JcovClassLine

        static java.lang.String JcovClassLine
      • JcovSrcfileLine

        static java.lang.String JcovSrcfileLine
      • JcovTimestampLine

        static java.lang.String JcovTimestampLine
      • JcovDataLine

        static java.lang.String JcovDataLine
      • JcovHeadingLine

        static java.lang.String JcovHeadingLine
      • arrayModifiers

        static int[] arrayModifiers
      • arrayModifiersOpc

        static int[] arrayModifiersOpc
    • Constructor Detail

      • Assembler

        public Assembler()
    • Method Detail

      • add

        public void add​(Instruction inst)
        Add an instruction
      • add

        public void add​(long where,
                        int opc)
      • add

        public void add​(long where,
                        int opc,
                        java.lang.Object obj)
      • add

        public void add​(long where,
                        int opc,
                        java.lang.Object obj,
                        boolean flagCondInverted)
      • add

        public void add​(boolean flagNoCovered,
                        long where,
                        int opc,
                        java.lang.Object obj)
      • add

        public void add​(long where,
                        int opc,
                        boolean flagNoCovered)
      • optimize

        void optimize​(Environment env,
                      Label lbl)
        Optimize instructions and mark those that can be reached
      • eliminate

        boolean eliminate()
        Eliminate instructions that are not reached
      • optimize

        public void optimize​(Environment env)
        Optimize the byte codes
      • balance

        void balance​(Label lbl,
                     int depth)
        Determine stack size, count local variables
      • writeExceptions

        void writeExceptions​(Environment env,
                             java.io.DataOutputStream out,
                             ConstantPool tab,
                             Instruction first,
                             Instruction last)
                      throws java.io.IOException
        Write the exceptions table
        Throws:
        java.io.IOException
      • writeCoverageTable

        public void writeCoverageTable​(Environment env,
                                       ClassDefinition c,
                                       java.io.DataOutputStream out,
                                       ConstantPool tab,
                                       long whereField)
                                throws java.io.IOException
        Write the coverage table
        Throws:
        java.io.IOException
      • writeLineNumberTable

        public void writeLineNumberTable​(Environment env,
                                         java.io.DataOutputStream out,
                                         ConstantPool tab)
                                  throws java.io.IOException
        Write the linenumber table
        Throws:
        java.io.IOException
      • flowFields

        void flowFields​(Environment env,
                        Label lbl,
                        MemberDefinition[] locals)
        Figure out when registers contain a legal value. This is done using a simple data flow algorithm. This information is later used to generate the local variable table.
      • writeLocalVariableTable

        public void writeLocalVariableTable​(Environment env,
                                            MemberDefinition field,
                                            java.io.DataOutputStream out,
                                            ConstantPool tab)
                                     throws java.io.IOException
        Write the local variable table. The necessary constants have already been added to the constant table by the collect() method. The flowFields method is used to determine which variables are alive at each pc.
        Throws:
        java.io.IOException
      • empty

        public boolean empty()
        Return true if empty
      • listing

        public void listing​(java.io.PrintStream out)
        Print the byte codes