Java Code Examples for com.android.dx.rop.code.RegisterSpec#makeLocalOptional()
The following examples show how to use
com.android.dx.rop.code.RegisterSpec#makeLocalOptional() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SsaInsn.java From Box with Apache License 2.0 | 5 votes |
/** * Sets the local association for the result of this insn. This is * sometimes updated during the SsaRenamer process. * * @param local {@code null-ok;} new debug/local variable info */ public final void setResultLocal(LocalItem local) { LocalItem oldItem = result.getLocalItem(); if (local != oldItem && (local == null || !local.equals(result.getLocalItem()))) { result = RegisterSpec.makeLocalOptional( result.getReg(), result.getType(), local); } }
Example 2
Source File: SsaInsn.java From Box with Apache License 2.0 | 5 votes |
/** * Sets the local association for the result of this insn. This is * sometimes updated during the SsaRenamer process. * * @param local {@code null-ok;} new debug/local variable info */ public final void setResultLocal(LocalItem local) { LocalItem oldItem = result.getLocalItem(); if (local != oldItem && (local == null || !local.equals(result.getLocalItem()))) { result = RegisterSpec.makeLocalOptional( result.getReg(), result.getType(), local); } }
Example 3
Source File: SsaInsn.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Sets the local association for the result of this insn. This is * sometimes updated during the SsaRenamer process. * * @param local {@code null-ok;} new debug/local variable info */ public final void setResultLocal(LocalItem local) { LocalItem oldItem = result.getLocalItem(); if (local != oldItem && (local == null || !local.equals(result.getLocalItem()))) { result = RegisterSpec.makeLocalOptional( result.getReg(), result.getType(), local); } }
Example 4
Source File: SsaInsn.java From buck with Apache License 2.0 | 5 votes |
/** * Sets the local association for the result of this insn. This is * sometimes updated during the SsaRenamer process. * * @param local {@code null-ok;} new debug/local variable info */ public final void setResultLocal(LocalItem local) { LocalItem oldItem = result.getLocalItem(); if (local != oldItem && (local == null || !local.equals(result.getLocalItem()))) { result = RegisterSpec.makeLocalOptional( result.getReg(), result.getType(), local); } }
Example 5
Source File: BaseMachine.java From Box with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public final void localTarget(int idx, Type type, LocalItem local) { localTarget = RegisterSpec.makeLocalOptional(idx, type, local); }
Example 6
Source File: SsaRenamer.java From Box with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * Move insns are treated as a simple mapping operation, and * will later be removed unless they represent a local variable * assignment. If they represent a local variable assignement, they * are preserved. */ @Override public void visitMoveInsn(NormalSsaInsn insn) { /* * For moves: copy propogate the move if we can, but don't * if we need to preserve local variable info and the * result has a different name than the source. */ RegisterSpec ropResult = insn.getResult(); int ropResultReg = ropResult.getReg(); int ropSourceReg = insn.getSources().get(0).getReg(); insn.mapSourceRegisters(mapper); int ssaSourceReg = insn.getSources().get(0).getReg(); LocalItem sourceLocal = currentMapping[ropSourceReg].getLocalItem(); LocalItem resultLocal = ropResult.getLocalItem(); /* * A move from a register that's currently associated with a local * to one that will not be associated with a local does not need * to be preserved, but the local association should remain. * Hence, we inherit the sourceLocal where the resultLocal is null. */ LocalItem newLocal = (resultLocal == null) ? sourceLocal : resultLocal; LocalItem associatedLocal = getLocalForNewReg(ssaSourceReg); /* * If we take the new local, will only one local have ever * been associated with this SSA reg? */ boolean onlyOneAssociatedLocal = associatedLocal == null || newLocal == null || newLocal.equals(associatedLocal); /* * If we're going to copy-propogate, then the ssa register * spec that's going to go into the mapping is made up of * the source register number mapped from above, the type * of the result, and the name either from the result (if * specified) or inherited from the existing mapping. * * The move source has incomplete type information in null * object cases, so the result type is used. */ RegisterSpec ssaReg = RegisterSpec.makeLocalOptional( ssaSourceReg, ropResult.getType(), newLocal); if (!Optimizer.getPreserveLocals() || (onlyOneAssociatedLocal && equalsHandlesNulls(newLocal, sourceLocal)) && threshold == 0) { /* * We don't have to keep this move to preserve local * information. Either the name is the same, or the result * register spec is unnamed. */ addMapping(ropResultReg, ssaReg); } else if (onlyOneAssociatedLocal && sourceLocal == null && threshold == 0) { /* * The register was previously unnamed. This means that a * local starts after it's first assignment in SSA form */ RegisterSpecList ssaSources = RegisterSpecList.make( RegisterSpec.make(ssaReg.getReg(), ssaReg.getType(), newLocal)); SsaInsn newInsn = SsaInsn.makeFromRop( new PlainInsn(Rops.opMarkLocal(ssaReg), SourcePosition.NO_INFO, null, ssaSources),block); insnsToReplace.put(insn, newInsn); // Just map as above. addMapping(ropResultReg, ssaReg); } else { /* * Do not copy-propogate, since the two registers have * two different local-variable names. */ processResultReg(insn); movesToKeep.add(insn); } }
Example 7
Source File: BaseMachine.java From Box with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public final void localTarget(int idx, Type type, LocalItem local) { localTarget = RegisterSpec.makeLocalOptional(idx, type, local); }
Example 8
Source File: SsaRenamer.java From Box with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * Move insns are treated as a simple mapping operation, and * will later be removed unless they represent a local variable * assignment. If they represent a local variable assignement, they * are preserved. */ @Override public void visitMoveInsn(NormalSsaInsn insn) { /* * For moves: copy propogate the move if we can, but don't * if we need to preserve local variable info and the * result has a different name than the source. */ RegisterSpec ropResult = insn.getResult(); int ropResultReg = ropResult.getReg(); int ropSourceReg = insn.getSources().get(0).getReg(); insn.mapSourceRegisters(mapper); int ssaSourceReg = insn.getSources().get(0).getReg(); LocalItem sourceLocal = currentMapping[ropSourceReg].getLocalItem(); LocalItem resultLocal = ropResult.getLocalItem(); /* * A move from a register that's currently associated with a local * to one that will not be associated with a local does not need * to be preserved, but the local association should remain. * Hence, we inherit the sourceLocal where the resultLocal is null. */ LocalItem newLocal = (resultLocal == null) ? sourceLocal : resultLocal; LocalItem associatedLocal = getLocalForNewReg(ssaSourceReg); /* * If we take the new local, will only one local have ever * been associated with this SSA reg? */ boolean onlyOneAssociatedLocal = associatedLocal == null || newLocal == null || newLocal.equals(associatedLocal); /* * If we're going to copy-propogate, then the ssa register * spec that's going to go into the mapping is made up of * the source register number mapped from above, the type * of the result, and the name either from the result (if * specified) or inherited from the existing mapping. * * The move source has incomplete type information in null * object cases, so the result type is used. */ RegisterSpec ssaReg = RegisterSpec.makeLocalOptional( ssaSourceReg, ropResult.getType(), newLocal); if (!Optimizer.getPreserveLocals() || (onlyOneAssociatedLocal && equalsHandlesNulls(newLocal, sourceLocal)) && threshold == 0) { /* * We don't have to keep this move to preserve local * information. Either the name is the same, or the result * register spec is unnamed. */ addMapping(ropResultReg, ssaReg); } else if (onlyOneAssociatedLocal && sourceLocal == null && threshold == 0) { /* * The register was previously unnamed. This means that a * local starts after it's first assignment in SSA form */ RegisterSpecList ssaSources = RegisterSpecList.make( RegisterSpec.make(ssaReg.getReg(), ssaReg.getType(), newLocal)); SsaInsn newInsn = SsaInsn.makeFromRop( new PlainInsn(Rops.opMarkLocal(ssaReg), SourcePosition.NO_INFO, null, ssaSources),block); insnsToReplace.put(insn, newInsn); // Just map as above. addMapping(ropResultReg, ssaReg); } else { /* * Do not copy-propogate, since the two registers have * two different local-variable names. */ processResultReg(insn); movesToKeep.add(insn); } }
Example 9
Source File: BaseMachine.java From J2ME-Loader with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public final void localTarget(int idx, Type type, LocalItem local) { localTarget = RegisterSpec.makeLocalOptional(idx, type, local); }
Example 10
Source File: SsaRenamer.java From J2ME-Loader with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * Move insns are treated as a simple mapping operation, and * will later be removed unless they represent a local variable * assignment. If they represent a local variable assignement, they * are preserved. */ @Override public void visitMoveInsn(NormalSsaInsn insn) { /* * For moves: copy propogate the move if we can, but don't * if we need to preserve local variable info and the * result has a different name than the source. */ RegisterSpec ropResult = insn.getResult(); int ropResultReg = ropResult.getReg(); int ropSourceReg = insn.getSources().get(0).getReg(); insn.mapSourceRegisters(mapper); int ssaSourceReg = insn.getSources().get(0).getReg(); LocalItem sourceLocal = currentMapping[ropSourceReg].getLocalItem(); LocalItem resultLocal = ropResult.getLocalItem(); /* * A move from a register that's currently associated with a local * to one that will not be associated with a local does not need * to be preserved, but the local association should remain. * Hence, we inherit the sourceLocal where the resultLocal is null. */ LocalItem newLocal = (resultLocal == null) ? sourceLocal : resultLocal; LocalItem associatedLocal = getLocalForNewReg(ssaSourceReg); /* * If we take the new local, will only one local have ever * been associated with this SSA reg? */ boolean onlyOneAssociatedLocal = associatedLocal == null || newLocal == null || newLocal.equals(associatedLocal); /* * If we're going to copy-propogate, then the ssa register * spec that's going to go into the mapping is made up of * the source register number mapped from above, the type * of the result, and the name either from the result (if * specified) or inherited from the existing mapping. * * The move source has incomplete type information in null * object cases, so the result type is used. */ RegisterSpec ssaReg = RegisterSpec.makeLocalOptional( ssaSourceReg, ropResult.getType(), newLocal); if (!Optimizer.getPreserveLocals() || (onlyOneAssociatedLocal && equalsHandlesNulls(newLocal, sourceLocal)) && threshold == 0) { /* * We don't have to keep this move to preserve local * information. Either the name is the same, or the result * register spec is unnamed. */ addMapping(ropResultReg, ssaReg); } else if (onlyOneAssociatedLocal && sourceLocal == null && threshold == 0) { /* * The register was previously unnamed. This means that a * local starts after it's first assignment in SSA form */ RegisterSpecList ssaSources = RegisterSpecList.make( RegisterSpec.make(ssaReg.getReg(), ssaReg.getType(), newLocal)); SsaInsn newInsn = SsaInsn.makeFromRop( new PlainInsn(Rops.opMarkLocal(ssaReg), SourcePosition.NO_INFO, null, ssaSources),block); insnsToReplace.put(insn, newInsn); // Just map as above. addMapping(ropResultReg, ssaReg); } else { /* * Do not copy-propogate, since the two registers have * two different local-variable names. */ processResultReg(insn); movesToKeep.add(insn); } }
Example 11
Source File: BaseMachine.java From buck with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ public final void localTarget(int idx, Type type, LocalItem local) { localTarget = RegisterSpec.makeLocalOptional(idx, type, local); }
Example 12
Source File: SsaRenamer.java From buck with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * Move insns are treated as a simple mapping operation, and * will later be removed unless they represent a local variable * assignment. If they represent a local variable assignement, they * are preserved. */ public void visitMoveInsn(NormalSsaInsn insn) { /* * For moves: copy propogate the move if we can, but don't * if we need to preserve local variable info and the * result has a different name than the source. */ RegisterSpec ropResult = insn.getResult(); int ropResultReg = ropResult.getReg(); int ropSourceReg = insn.getSources().get(0).getReg(); insn.mapSourceRegisters(mapper); int ssaSourceReg = insn.getSources().get(0).getReg(); LocalItem sourceLocal = currentMapping[ropSourceReg].getLocalItem(); LocalItem resultLocal = ropResult.getLocalItem(); /* * A move from a register that's currently associated with a local * to one that will not be associated with a local does not need * to be preserved, but the local association should remain. * Hence, we inherit the sourceLocal where the resultLocal is null. */ LocalItem newLocal = (resultLocal == null) ? sourceLocal : resultLocal; LocalItem associatedLocal = getLocalForNewReg(ssaSourceReg); /* * If we take the new local, will only one local have ever * been associated with this SSA reg? */ boolean onlyOneAssociatedLocal = associatedLocal == null || newLocal == null || newLocal.equals(associatedLocal); /* * If we're going to copy-propogate, then the ssa register * spec that's going to go into the mapping is made up of * the source register number mapped from above, the type * of the result, and the name either from the result (if * specified) or inherited from the existing mapping. * * The move source has incomplete type information in null * object cases, so the result type is used. */ RegisterSpec ssaReg = RegisterSpec.makeLocalOptional( ssaSourceReg, ropResult.getType(), newLocal); if (!Optimizer.getPreserveLocals() || (onlyOneAssociatedLocal && equalsHandlesNulls(newLocal, sourceLocal)) && threshold == 0) { /* * We don't have to keep this move to preserve local * information. Either the name is the same, or the result * register spec is unnamed. */ addMapping(ropResultReg, ssaReg); } else if (onlyOneAssociatedLocal && sourceLocal == null && threshold == 0) { /* * The register was previously unnamed. This means that a * local starts after it's first assignment in SSA form */ RegisterSpecList ssaSources = RegisterSpecList.make( RegisterSpec.make(ssaReg.getReg(), ssaReg.getType(), newLocal)); SsaInsn newInsn = SsaInsn.makeFromRop( new PlainInsn(Rops.opMarkLocal(ssaReg), SourcePosition.NO_INFO, null, ssaSources),block); insnsToReplace.put(insn, newInsn); // Just map as above. addMapping(ropResultReg, ssaReg); } else { /* * Do not copy-propogate, since the two registers have * two different local-variable names. */ processResultReg(insn); movesToKeep.add(insn); } }