Package com.android.dx.rop.code

Examples of com.android.dx.rop.code.RegisterSpec


            if (insn instanceof LocalSnapshot) {
                RegisterSpecSet snapshot =
                    ((LocalSnapshot) insn).getLocals();
                state.snapshot(insn.getAddress(), snapshot);
            } else if (insn instanceof LocalStart) {
                RegisterSpec local = ((LocalStart) insn).getLocal();
                state.startLocal(insn.getAddress(), local);
            } else if (insn instanceof LocalEnd) {
                RegisterSpec local = ((LocalEnd) insn).getLocal();
                state.endLocal(insn.getAddress(), local);
            }
        }

        LocalList result = state.finish();
View Full Code Here


            int sz = specs.getMaxSize();
            aboutToProcess(address, sz - 1);

            for (int i = 0; i < sz; i++) {
                RegisterSpec oldSpec = regs.get(i);
                RegisterSpec newSpec = filterSpec(specs.get(i));

                if (oldSpec == null) {
                    if (newSpec != null) {
                        startLocal(address, newSpec);
                    }
                } else if (newSpec == null) {
                    endLocal(address, oldSpec);
                } else if (! newSpec.equalsUsingSimpleType(oldSpec)) {
                    endLocal(address, oldSpec);
                    startLocal(address, newSpec);
                }
            }
View Full Code Here

            int regNum = startedLocal.getReg();

            startedLocal = filterSpec(startedLocal);
            aboutToProcess(address, regNum);

            RegisterSpec existingLocal = regs.get(regNum);

            if (startedLocal.equalsUsingSimpleType(existingLocal)) {
                // Silently ignore a redundant start.
                return;
            }

            RegisterSpec movedLocal = regs.findMatchingLocal(startedLocal);
            if (movedLocal != null) {
                /*
                 * The same variable was moved from one register to another.
                 * So add an end for its old location.
                 */
                addOrUpdateEnd(address, Disposition.END_MOVED, movedLocal);
            }

            int endAt = endIndices[regNum];

            if (existingLocal != null) {
                /*
                 * There is an existing (but non-matching) local.
                 * Add an explicit end for it.
                 */
                add(address, Disposition.END_REPLACED, existingLocal);
            } else if (endAt >= 0) {
                /*
                 * Look for an end local for the same register at the
                 * same address. If found, then update it or delete
                 * it, depending on whether or not it represents the
                 * same variable as the one being started.
                 */
                Entry endEntry = result.get(endAt);
                if (endEntry.getAddress() == address) {
                    if (endEntry.matches(startedLocal)) {
                        /*
                         * There was already an end local for the same
                         * variable at the same address. This turns
                         * out to be superfluous, as we are starting
                         * up the exact same local. This situation can
                         * happen when a single local variable got
                         * somehow "split up" during intermediate
                         * processing. In any case, rather than represent
                         * the end-then-start, just remove the old end.
                         */
                        result.set(endAt, null);
                        nullResultCount++;
                        regs.put(startedLocal);
                        endIndices[regNum] = -1;
                        return;
                    } else {
                        /*
                         * There was a different variable ended at the
                         * same address. Update it to indicate that
                         * it was ended due to a replacement (rather than
                         * ending for no particular reason).
                         */
                        endEntry = endEntry.withDisposition(
                                Disposition.END_REPLACED);
                        result.set(endAt, endEntry);
                    }
                }
            }

            /*
             * The code above didn't find and remove an unnecessary
             * local end, so we now have to add one or more entries to
             * the output to capture the transition.
             */

            /*
             * If the local just below (in the register set at reg-1)
             * is of category-2, then it is ended by this new start.
             */
            if (regNum > 0) {
                RegisterSpec justBelow = regs.get(regNum - 1);
                if ((justBelow != null) && justBelow.isCategory2()) {
                    addOrUpdateEnd(address,
                            Disposition.END_CLOBBERED_BY_NEXT,
                            justBelow);
                }
            }

            /*
             * Similarly, if this local is category-2, then the local
             * just above (if any) is ended by the start now being
             * emitted.
             */
            if (startedLocal.isCategory2()) {
                RegisterSpec justAbove = regs.get(regNum + 1);
                if (justAbove != null) {
                    addOrUpdateEnd(address,
                            Disposition.END_CLOBBERED_BY_PREV,
                            justAbove);
                }
View Full Code Here

    }
      }
  }
  else if (insn instanceof LocalStart)
  {
      RegisterSpec spec= ((LocalStart) insn).getLocal();
      if (hasLocalInfo(spec))
      {
    return true;
      }
  }
View Full Code Here

    addConstants(result, specs.get(i));
      }
  }
  else if (insn instanceof LocalStart)
  {
      RegisterSpec spec= ((LocalStart) insn).getLocal();
      addConstants(result, spec);
  }
    }
View Full Code Here

            case 1: {
                sb.append(regs.get(0).regString());
                break;
            }
            default: {
                RegisterSpec lastReg = regs.get(size - 1);
                if (lastReg.getCategory() == 2) {
                    /*
                     * Add one to properly represent a list-final
                     * category-2 register.
                     */
                    lastReg = lastReg.withOffset(1);
                }
               
                sb.append(regs.get(0).regString());
                sb.append("..");
                sb.append(lastReg.regString());
            }
        }

        sb.append("}, ");
        sb.append(cstString(insn));
View Full Code Here

    int sz = registers.size();

    insns = new SimpleInsn[sz];

    for (int i = 0, outAt = 0; i < sz; i++) {
      RegisterSpec src = registers.get(i);
      insns[i] = moveInsnFor(src, outAt);
      outAt += src.getCategory();
    }
  }
View Full Code Here

        if (!unsignedFitsInShort(first)) {
            return false;
        }

        for (int i = 0; i < sz; i++) {
            RegisterSpec one = regs.get(i);
            if (one.getReg() != next) {
                return false;
            }
            next += one.getCategory();
        }

        return unsignedFitsInByte(next - first);
    }
View Full Code Here

    RegisterSpecList registers = getRegisters();
    int sz = registers.size();
    SimpleInsn[] result = new SimpleInsn[sz];

    for (int i = 0, outAt = 0; i < sz; i++) {
      RegisterSpec src = registers.get(i);
      result[i] = moveInsnFor(src, outAt);
      outAt += src.getCategory();
    }

    return result;
  }
View Full Code Here

            case RegOps.INVOKE_INTERFACE: return Dops.INVOKE_INTERFACE;
            case RegOps.NEW_ARRAY:        return Dops.NEW_ARRAY;
            case RegOps.FILLED_NEW_ARRAY: return Dops.FILLED_NEW_ARRAY;
            case RegOps.FILL_ARRAY_DATA:  return Dops.FILL_ARRAY_DATA;
            case RegOps.MOVE_RESULT: {
                RegisterSpec resultReg = insn.getResult();

                if (resultReg == null) {
                    return Dops.NOP;
                } else {
                    switch (resultReg.getBasicType()) {
                        case Type.BT_INT:
                        case Type.BT_FLOAT:
                        case Type.BT_BOOLEAN:
                        case Type.BT_BYTE:
                        case Type.BT_CHAR:
View Full Code Here

TOP

Related Classes of com.android.dx.rop.code.RegisterSpec

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.