Package macromedia.asc.util

Examples of macromedia.asc.util.IntList


    {
        String metaDataKey = id;

        int metaNameIndex = id == null ? 0 : ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(id));
        int metaValuesCount = values == null ? 0 : values.length;
        IntList metaKeys = new IntList(metaValuesCount);
        IntList metaValues = new IntList(metaValuesCount);
        for( int z = 0; z < metaValuesCount; ++z )
        {
            Value val = values[z];
            String key = null;
            String value = null;
            if( val instanceof MetaDataEvaluator.KeylessValue )
            {
                key = null;
                value = ((MetaDataEvaluator.KeylessValue)val).obj;
            }
            else if( val instanceof MetaDataEvaluator.KeyValuePair )
            {
                MetaDataEvaluator.KeyValuePair pair = (MetaDataEvaluator.KeyValuePair)val;
                key = pair.key;
                value = pair.obj;
            }
            else
            {
                value = val.toString();
            }
            if( key != null )
            {
                metaKeys.add(ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(key)));
                metaDataKey += key;
            }
            else
            {
                metaKeys.add(0);
            }
            metaDataKey += value;
            metaValues.add(ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(value)));
        }
        int metaDataIndex = GetMetadataInfo(metaDataKey);
        if ( ab.metadata.at(metaDataIndex).size() == 0 )
        {
            // Only add the bytes if they weren't added by a previous trait.  Multiple traits can refer to the
View Full Code Here


        if( "$construct".equals(name) )
        {
            return// ISSUE: experiment. don't define traits for constructors
        }
       
        IntList namespaces = new IntList(quals.size())// will be (*it)->namespaces

        Iterator<ObjectValue> i = quals.keySet().iterator();       

        boolean isInterface = (obj.type != null && obj.type.isInterface());
    
        while (i.hasNext())
        {
            ObjectValue ns = i.next();

            int slot_kind = kind==TRAIT_Setter?SET_TOKEN:GET_TOKEN;

            int slot_index = obj.getSlotIndex(cx,slot_kind,name,ns);
            Slot slot  = obj.getSlot(cx,slot_index);
         
            if( kind == TRAIT_Method )
            {
                int implicit_index = obj.getImplicitIndex(cx,slot_index,EMPTY_TOKEN);
                slot = obj.getSlot(cx,implicit_index);
            }

            if( slot == null || slot.declaredBy != obj || slot.getMethodName().length() == 0 ) // this happens with internal accessors, that are not traits
            {
                continue;
           
           
            ObjectValue slot_value = slot != null? (slot.getValue() instanceof ObjectValue ? (ObjectValue) slot.getValue() : null) : null;
            ArrayList<MetaData> metaData = slot.getMetadata();
           
            // If a name is interface-qualified, emit the trait only if the traits
            // are for an interface definition.  In a class, the VM will automatically
            // add the interface-qualified traits when it sees the public method definition.
            if (!isInterface && ns.isInterface())
            {
                continue;
            }

            boolean is_override = slot.isOverride();
                   
            int flags = 0; // final/virtual & 1, override/new & 2
            flags |= slot.isFinal() ?TRAIT_FLAG_final:0/*virtual*/;
            flags |= is_override?TRAIT_FLAG_override:0/*new*/;

            if( ns != null )
            {
                int ns_index;
        if (doingAPIVersioning) {
          TreeSet<Integer> versions = apiVersionsOfSlot(slot, name, ns);
          ns_index = makeVersionedNamespaceSet(ns, versions);
        }
        else {
          ns_index = addNamespace(ns);
        }
        namespaces.add(ns_index);
            }
            else
            {
                cx.internalError(pos, "internal error: non object value for namespace");
            }

            int method_info = -1;
            int method_id = slot.getMethodID();
            if( method_id >= 0 )
            {       // method
                method_info = GetMethodInfo(slot.getMethodName());
            }
            else
            if( slot_value != null && slot_value.method_info >= 0 )
            {       // function
                method_info = slot_value.method_info;
            }
            else
            {
                cx.internalError("internal error");
                continue;
            }

            int name_index  = ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(name));

      int qname_index;
      if (doingAPIVersioning) {
        qname_index = ab.addMultiNameConstant(bytecodeFactory.ConstantMultiname(name_index,namespaces.back(),false));
      }
      else {
        qname_index = ab.addMultiNameConstant(bytecodeFactory.ConstantQualifiedName(name_index,namespaces.back(),false));
      }

            IntList  metaDataIndices = addMetadata(metaData);

            if( method_info >= 0 )
            {
                traits.push_back(allocBytes());
                method_id = method_id<0?0:method_id; // ISSUE: normalize -1 to 0. refactor to make rest of compiler use 0
View Full Code Here

        flushDebugInfo();       

        last_in = IKIND_other;

        IntList fixups = exceptionBlocks.last().finallyAddrs;
        if (fixups.size() > 0)
        {
            int start = getIP();
            Lookupswitch(ab.code)// rework to fit avm+ semantics
   
            // This will be fixed up with end of switch
            Int24(ab.code, 0);
           
              Int(ab.code, fixups.size() - 1);
             
            for (int i = 0, n=fixups.size(); i < n; ++i)
            {
                Int24(ab.code, fixups.get(i) - start);
            }
           
            // Fixup default to jump to here
            int offset = getIP() - start;
            ab.code.set(start+1, (byte) offset);
View Full Code Here

     *
     */

    protected void LabelStatementBegin()
    {
        break_addrs.add(new IntList());
        break_scope_depth.add(cx.getScopeDepth());
        break_temp_count.add(cur_locals);

        // These will never be used, but add because the loop_index for continues
        // as well as breaks were calculated with the LabelStatement incrementing the loop_index
        // so if we don't add these, we get badness later.
        continue_addrs.add(new IntList());
        continue_scope_depth.add(cx.getScopeDepth());
    }
View Full Code Here

            code_out.print("LoopBegin");
        }

        //flushDebugInfo();  Don't flush the debug info - let the first statement in the loop take care of that so the debugging info will be hit on each interation of the loop.
       
        break_addrs.add(new IntList());
        break_scope_depth.add(cx.getScopeDepth());
        break_temp_count.add(cur_locals);
       
        continue_addrs.add(new IntList());
        continue_scope_depth.add(cx.getScopeDepth());
       
        Jump(ab.code);
        loopbegin_addrs.add(getIP() - 3);
View Full Code Here

        flushDebugInfo();       

        // ASSERT(loop_index==break_addrs.size()-1);

        int target = getIP();
        IntList break_addr = break_addrs.removeLast();
        while (break_addr.size() != 0)
        {
            int break_index = break_addr.removeLast();
            int offset = target - break_index + 1 - 4;

            if (bytecodeFactory.show_bytecode)
            {
                code_out.println();
View Full Code Here

        flushDebugInfo();       

        // ASSERT(loop_index==continue_addrs.size()-1);

        int target = getIP();
        IntList continue_addr = continue_addrs.removeLast();
        while (continue_addr.size() != 0)
        {
            int continue_index = continue_addr.removeLast();
            int offset = target - continue_index + 1 - 4;

            if (bytecodeFactory.show_bytecode)
            {
                code_out.println();
View Full Code Here

            code_out.println();
            code_out.print("SwitchBegin");
        }

        seen_default_case.add(0);
        case_addrs.add(new IntList());
        break_addrs.add(new IntList());
        break_scope_depth.add(cx.getScopeDepth());
        break_temp_count.add(cur_locals);
        continue_addrs.add(new IntList());
        continue_scope_depth.add(cx.getScopeDepth());
        // Even though switches do not have continues, this is
        // to keep the loop index of nested loops synchronized
        // with this vector.
View Full Code Here

        Lookupswitch(ab.code)// rework to fit avm+ semantics

        int default_addr = default_addrs.removeLast();
        Int24(ab.code, default_addr - start);

        IntList case_addr = case_addrs.removeLast();
          Int(ab.code, case_addr.size() - 1);
         
        for (int case_index = 0, n=case_addr.size(); case_index < n; ++case_index)
        {
            Int24(ab.code, case_addr.get(case_index) - start);
        }
       
        if (show_instructions)
        {
            code_out.write(" [" + cur_stack + "]");
        }
       
        // We push a continue_addrs to keep the loop index stacks synchronized.
        // But switch doesn't support continue, so copy any continues up to the
        // surrounding loop.
        IntList switch_continues = continue_addrs.removeLast();
        if (continue_addrs.size() != 0)
        {
          IntList outer_continues = continue_addrs.last();
          outer_continues.addAll(switch_continues);
        }
        continue_scope_depth.removeLast();      
    }
View Full Code Here

          int lo_id = slots.at(0).id;
          int hi_id = slots.at(slots.size()-1).id;
          if( slots.size() -1 == hi_id - lo_id)
          {
            // Contiguous slot ids
            slot_id_boundaries = new IntList(2);
            slot_id_boundaries.add(lo_id);
            slot_id_boundaries.add(hi_id);
          }
          else
          {
            // Some non contiguous slot ids.  Should be just a few blocks of contiguous id's though
            slot_id_boundaries = new IntList(6);
            int last_id = lo_id;
            int start_id = lo_id;
            for( int i = 1, size = slots.size(); i < size; ++i )
            {
              int id = slots.at(i).id;
View Full Code Here

TOP

Related Classes of macromedia.asc.util.IntList

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.