Package org.apache.flex.abc.instructionlist

Examples of org.apache.flex.abc.instructionlist.InstructionList


         @return the instruction sequence that
         *    fetches the next key or value.
         */
        InstructionList generateKeyOrValue(int opcode)
        {
            InstructionList result = new InstructionList();
            result.addInstruction(hasnext.stem_temp.getlocal());
            result.addInstruction(hasnext.index_temp.getlocal());
            result.addInstruction(opcode);
            return result;
        }
View Full Code Here


         *  Generate the loop epilogue code.
         *  @return loop epilogue code.
         */
        InstructionList generateEpilogue()
        {
            InstructionList result = new InstructionList();
            result.addInstruction(hasnext.instruction);
            result.labelCurrent(test);
            currentScope.getFlowManager().resolveContinueLabel(result);
            result.addInstruction(OP_iftrue, loop);
            hasnext.release();
            return result;
        }
View Full Code Here

        byte[] generatedBytes = IABCBytesRequestResult.ZEROBYTES;
       
        if ( !fatal_error_encountered )
        {
            //  Initialize the init script.
            InstructionList script_init_insns = new InstructionList();

            script_init_insns.addInstruction(OP_getlocal0);
            script_init_insns.addInstruction(OP_pushscope);

            script_init_insns.addAll(global_scope.getInitInstructions());
            script_init_insns.addAll(top_level_processor.directiveInsns);

            if ( script_init_insns.canFallThrough() || script_init_insns.hasPendingLabels() )
                script_init_insns.addInstruction(OP_returnvoid);

            //  Allocate temps beginning with register 1,
            //  register 0 is reserved for "this" global.
            global_scope.initializeTempRegisters(1);
View Full Code Here

      burm.burm(subtree, goal_state);
      return ((InstructionList)burm.getResult());
    }
    catch ( Exception cant_reduce) {
      handleBurmError(burm, subtree, cant_reduce, scope);
      return new InstructionList();
    }
  }
View Full Code Here

        function_scope.setMethodInfo(mi);
       
        if ( is_constructor )
            function_scope.getMethodBodySemanticChecker().enterConstructor();
       
        InstructionList insns = null;
        
        if (node instanceof IFunctionNode)
            function_scope.setInitialControlFlowRegionNode(((IFunctionNode)node).getScopedNode());
        else
            function_scope.setInitialControlFlowRegionNode((IASNode)node);
View Full Code Here

        function_scope.methodBodyVisitor = methodBodyVisitor;
        function_scope.traitsVisitor = methodBodyVisitor.visitTraits();
        function_scope.setMethodInfo(mi);
       

        InstructionList functionBody;
        if (setterExpression instanceof InstructionListNode)
            functionBody = ((InstructionListNode)setterExpression).getInstructions();
        else
            functionBody = generateInstructions(setterExpression, CmcEmitter.__mxml_data_binding_setter_expression_NT, function_scope, null);
       
        functionBody.addInstruction(OP_returnvoid);
       
        methodBodyVisitor.visitInstructionList(functionBody);
        methodBodyVisitor.visitEnd();
        methodVisitor.visitEnd();
    }
View Full Code Here

         *    this routine because there may be name-specific
         *    instructions before and after the value.
         */
        InstructionList generateGetOrSet(IASNode iNode, int opcode, InstructionList rhs)
        {
            InstructionList result = createInstructionList(iNode);

            //  Note: numerous microoptimization opportunities here
            //  to avoid storing values in temps by creative use of
            //  OP_dup and OP_swap, especially in getproperty gen.

            if ( this.compileTimeQualifier != null && this.runtimeName != null )
            {
                //  Generate MultinameL type code.
                Binding name_temp = currentScope.allocateTemp();

                result.addAll(this.runtimeName);
                result.addInstruction(OP_dup);
                result.addInstruction(name_temp.setlocal());
                //  findprop(MultinameL) consumes a name from the value stack.
                result.addInstruction(OP_findpropstrict, this.compileTimeQualifier);
                result.addInstruction(name_temp.getlocal());
                if ( rhs != null )
                    result.addAll(rhs);

                //  get/setprop(MultinameL) consumes a name from the value stack.
                result.addInstruction(opcode, this.compileTimeQualifier);
            }
            else if ( this.runtimeQualifier != null && this.runtimeName != null )
            {
                //  Generate RTQnameL type code.
                Binding name_temp = currentScope.allocateTemp();
                Binding qual_temp = currentScope.allocateTemp();

                Name rtqnl = new Name(CONSTANT_RTQnameL, null, null);

                result.addAll(getRuntimeName(iNode));
                result.addInstruction(name_temp.setlocal());

                result.addAll(getRuntimeQualifier(iNode));
                result.addInstruction(OP_dup);
                result.addInstruction(qual_temp.setlocal());

                result.addInstruction(name_temp.getlocal());
                //  findprop(RTQNameL) consumes namespace and name from the value stack.
                result.addInstruction(OP_findpropstrict, rtqnl);
                result.addInstruction(qual_temp.getlocal());
                result.addInstruction(name_temp.getlocal());
                if ( rhs != null )
                    result.addAll(rhs);

                //  get/setprop(RTQNameL) consumes namespace and name from the value stack.
                result.addInstruction(opcode, rtqnl);

                currentScope.releaseTemp(name_temp);
                currentScope.releaseTemp(qual_temp);
            }
            else
            {
                //  Last valid combination generates a RTQname.
                assert(this.runtimeQualifier != null && this.compileTimeName != null) : "Unknown runtime name configuration: " + this.toString();

                Name rtqn = new Name(CONSTANT_RTQname, null, this.compileTimeName.getBaseName());

                result.addAll(getRuntimeQualifier(iNode));
                result.addInstruction(OP_dup);
                //  findprop(RTQName) consumes a namespace from the value stack.
                result.addInstruction(OP_findpropstrict, rtqn);
                result.addInstruction(OP_swap);
                if ( rhs != null )
                    result.addAll(rhs);

                //  get/setprop(RTQName) consumes a namespace from the value stack.
                result.addInstruction(opcode, rtqn);
            }

            return result;
        }
View Full Code Here

         @return the runtime qualifier setup instructions.
         */
        public InstructionList getRuntimeQualifier(IASNode iNode)
        {
            assert(hasRuntimeQualifier());
            InstructionList result = createInstructionList(iNode);

            result.addAll(replicate(this.runtimeQualifier));

            //  Ensure the last instruction is an OP_coerce to Namespace.
            Instruction last = result.lastElement();

            if  (
                    last.getOpcode() != OP_coerce ||
                    last.getOperandCount() == 0 ||
                    ! namespaceType.equals(last.getOperand(0))
                )
            {
                result.addInstruction(OP_coerce, namespaceType);
            }

            return result;
        }
View Full Code Here

         */
        public InstructionList getRuntimeName(IASNode iNode)
        {
            assert(hasRuntimeName());

            InstructionList result = createInstructionList(iNode);

            result.addAll(replicate(this.runtimeName));
            if ( result.lastElement().getOpcode() != OP_coerce_s)
                result.addInstruction(OP_coerce_s);
            return result;
        }
View Full Code Here

        //----------------------------------------------------------------------
        // First property: set itemsFactory to the deferredInstanceFunction we created earlier
        Integer index = nodeToIndexMap.get(instanceNode);
        assert index != null;
       
        InstructionList addItemsIL = new InstructionList();
        int addItemsCounter = 0;
        if (getProject().getTargetSettings().getMxmlChildrenAsData())
        {
           
            addItemsIL.addInstruction(OP_pushstring, "itemsDescriptor");
            addItemsIL.addInstruction(OP_pushtrue)// the value is an array of descriptor data that will be parsed later
            InstructionList il = nodeToInstanceDescriptorMap.get(instanceNode);
            InstructionList ilCopy = (InstructionList)il.clone();
            addItemsIL.addAll(ilCopy);
            addItemsCounter++;
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.apache.flex.abc.instructionlist.InstructionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.