Class JvstCodeGen

    • Field Detail

      • paramArrayName

        java.lang.String paramArrayName
      • paramListName

        java.lang.String paramListName
      • paramTypeList

        CtClass[] paramTypeList
      • paramVarBase

        private int paramVarBase
      • useParam0

        private boolean useParam0
      • param0Type

        private java.lang.String param0Type
      • dollarType

        private CtClass dollarType
      • returnCastName

        java.lang.String returnCastName
      • returnVarName

        private java.lang.String returnVarName
      • proceedName

        java.lang.String proceedName
    • Method Detail

      • indexOfParam1

        private int indexOfParam1()
      • setProceedHandler

        public void setProceedHandler​(ProceedHandler h,
                                      java.lang.String name)
      • addNullIfVoid

        public void addNullIfVoid()
      • callGetType

        private void callGetType​(java.lang.String method)
      • atCastToRtype

        protected void atCastToRtype​(CastExpr expr)
                              throws CompileError
        Inserts a cast operator to the return type. If the return type is void, this does nothing.
        Throws:
        CompileError
      • isParamListName

        public boolean isParamListName​(ASTList args)
      • recordReturnType

        public int recordReturnType​(CtClass type,
                                    java.lang.String castName,
                                    java.lang.String resultName,
                                    SymbolTable tbl)
                             throws CompileError
        Makes a cast to the return type ($r) available. It also enables $_.

        If the return type is void, ($r) does nothing. The type of $_ is java.lang.Object.

        Parameters:
        resultName - null if $_ is not used.
        Returns:
        -1 or the variable index assigned to $_.
        Throws:
        CompileError
      • recordType

        public void recordType​(CtClass t)
        Makes $type available.
      • recordParams

        public int recordParams​(CtClass[] params,
                                boolean isStatic,
                                java.lang.String prefix,
                                java.lang.String paramVarName,
                                java.lang.String paramsName,
                                SymbolTable tbl)
                         throws CompileError
        Makes method parameters $0, $1, ..., $args, $$, and $class available. $0 is equivalent to THIS if the method is not static. Otherwise, if the method is static, then $0 is not available.
        Throws:
        CompileError
      • recordParams

        public int recordParams​(CtClass[] params,
                                boolean isStatic,
                                java.lang.String prefix,
                                java.lang.String paramVarName,
                                java.lang.String paramsName,
                                boolean use0,
                                int paramBase,
                                java.lang.String target,
                                SymbolTable tbl)
                         throws CompileError
        Makes method parameters $0, $1, ..., $args, $$, and $class available. $0 is available only if use0 is true. It might not be equivalent to THIS.
        Parameters:
        params - the parameter types (the types of $1, $2, ..)
        prefix - it must be "$" (the first letter of $0, $1, ...)
        paramVarName - it must be "$args"
        paramsName - it must be "$$"
        use0 - true if $0 is used.
        paramBase - the register number of $0 (use0 is true) or $1 (otherwise).
        target - the class of $0. If use0 is false, target can be null. The value of "target" is also used as the name of the type represented by $class.
        isStatic - true if the method in which the compiled bytecode is embedded is static.
        Throws:
        CompileError
      • recordVariable

        public int recordVariable​(CtClass type,
                                  java.lang.String varName,
                                  SymbolTable tbl)
                           throws CompileError
        Makes the given variable name available.
        Parameters:
        type - variable type
        varName - variable name
        Throws:
        CompileError
      • recordVariable

        public void recordVariable​(java.lang.String typeDesc,
                                   java.lang.String varName,
                                   int varNo,
                                   SymbolTable tbl)
                            throws CompileError
        Makes the given variable name available.
        Parameters:
        typeDesc - the type descriptor of the variable
        varName - variable name
        varNo - an index into the local variable array
        Throws:
        CompileError
      • compileParameterList

        public static int compileParameterList​(Bytecode code,
                                               CtClass[] params,
                                               int regno)