Java Code Examples for com.android.dx.rop.type.TypeBearer#getBasicFrameType()

The following examples show how to use com.android.dx.rop.type.TypeBearer#getBasicFrameType() . 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: Rops.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the appropriate {@code const} rop for the given
 * type. The result is a shared instance.
 *
 * @param type {@code non-null;} type of the constant
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opConst(TypeBearer type) {
    if (type.getType() == Type.KNOWN_NULL) {
        return CONST_OBJECT_NOTHROW;
    }

    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return CONST_INT;
        case Type.BT_LONG:   return CONST_LONG;
        case Type.BT_FLOAT:  return CONST_FLOAT;
        case Type.BT_DOUBLE: return CONST_DOUBLE;
        case Type.BT_OBJECT: return CONST_OBJECT;
    }

    return throwBadType(type);
}
 
Example 2
Source File: Rops.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the appropriate {@code const} rop for the given
 * type. The result is a shared instance.
 *
 * @param type {@code non-null;} type of the constant
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opConst(TypeBearer type) {
    if (type.getType() == Type.KNOWN_NULL) {
        return CONST_OBJECT_NOTHROW;
    }

    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return CONST_INT;
        case Type.BT_LONG:   return CONST_LONG;
        case Type.BT_FLOAT:  return CONST_FLOAT;
        case Type.BT_DOUBLE: return CONST_DOUBLE;
        case Type.BT_OBJECT: return CONST_OBJECT;
    }

    return throwBadType(type);
}
 
Example 3
Source File: Rops.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the appropriate {@code const} rop for the given
 * type. The result is a shared instance.
 *
 * @param type {@code non-null;} type of the constant
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opConst(TypeBearer type) {
    if (type.getType() == Type.KNOWN_NULL) {
        return CONST_OBJECT_NOTHROW;
    }

    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return CONST_INT;
        case Type.BT_LONG:   return CONST_LONG;
        case Type.BT_FLOAT:  return CONST_FLOAT;
        case Type.BT_DOUBLE: return CONST_DOUBLE;
        case Type.BT_OBJECT: return CONST_OBJECT;
    }

    return throwBadType(type);
}
 
Example 4
Source File: Rops.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code neg} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being operated on
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opNeg(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return NEG_INT;
        case Type.BT_LONG:   return NEG_LONG;
        case Type.BT_FLOAT:  return NEG_FLOAT;
        case Type.BT_DOUBLE: return NEG_DOUBLE;
    }

    return throwBadType(type);
}
 
Example 5
Source File: Rops.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code move-param} rop for the
 * given type. The result is a shared instance.
 *
 * @param type {@code non-null;} type of value being moved
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMoveParam(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MOVE_PARAM_INT;
        case Type.BT_LONG:   return MOVE_PARAM_LONG;
        case Type.BT_FLOAT:  return MOVE_PARAM_FLOAT;
        case Type.BT_DOUBLE: return MOVE_PARAM_DOUBLE;
        case Type.BT_OBJECT: return MOVE_PARAM_OBJECT;
    }

    return throwBadType(type);
}
 
Example 6
Source File: Rops.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code move} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being moved
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMove(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MOVE_INT;
        case Type.BT_LONG:   return MOVE_LONG;
        case Type.BT_FLOAT:  return MOVE_FLOAT;
        case Type.BT_DOUBLE: return MOVE_DOUBLE;
        case Type.BT_OBJECT: return MOVE_OBJECT;
        case Type.BT_ADDR:   return MOVE_RETURN_ADDRESS;
    }

    return throwBadType(type);
}
 
Example 7
Source File: Rops.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code mark-local} rop for the given type.
 * The result is a shared instance.
 *
 * @param type {@code non-null;} type of value being marked
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMarkLocal(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MARK_LOCAL_INT;
        case Type.BT_LONG:   return MARK_LOCAL_LONG;
        case Type.BT_FLOAT:  return MARK_LOCAL_FLOAT;
        case Type.BT_DOUBLE: return MARK_LOCAL_DOUBLE;
        case Type.BT_OBJECT: return MARK_LOCAL_OBJECT;
    }

    return throwBadType(type);
}
 
Example 8
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code return} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being returned
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opReturn(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return RETURN_INT;
        case Type.BT_LONG:   return RETURN_LONG;
        case Type.BT_FLOAT:  return RETURN_FLOAT;
        case Type.BT_DOUBLE: return RETURN_DOUBLE;
        case Type.BT_OBJECT: return RETURN_OBJECT;
        case Type.BT_VOID:   return RETURN_VOID;
    }

    return throwBadType(type);
}
 
Example 9
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code not} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being operated on
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opNot(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:  return NOT_INT;
        case Type.BT_LONG: return NOT_LONG;
    }

    return throwBadType(type);
}
 
Example 10
Source File: Rops.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code neg} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being operated on
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opNeg(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return NEG_INT;
        case Type.BT_LONG:   return NEG_LONG;
        case Type.BT_FLOAT:  return NEG_FLOAT;
        case Type.BT_DOUBLE: return NEG_DOUBLE;
    }

    return throwBadType(type);
}
 
Example 11
Source File: Rops.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code mark-local} rop for the given type.
 * The result is a shared instance.
 *
 * @param type {@code non-null;} type of value being marked
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMarkLocal(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MARK_LOCAL_INT;
        case Type.BT_LONG:   return MARK_LOCAL_LONG;
        case Type.BT_FLOAT:  return MARK_LOCAL_FLOAT;
        case Type.BT_DOUBLE: return MARK_LOCAL_DOUBLE;
        case Type.BT_OBJECT: return MARK_LOCAL_OBJECT;
    }

    return throwBadType(type);
}
 
Example 12
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code move} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being moved
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMove(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MOVE_INT;
        case Type.BT_LONG:   return MOVE_LONG;
        case Type.BT_FLOAT:  return MOVE_FLOAT;
        case Type.BT_DOUBLE: return MOVE_DOUBLE;
        case Type.BT_OBJECT: return MOVE_OBJECT;
        case Type.BT_ADDR:   return MOVE_RETURN_ADDRESS;
    }

    return throwBadType(type);
}
 
Example 13
Source File: Rops.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code return} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being returned
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opReturn(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return RETURN_INT;
        case Type.BT_LONG:   return RETURN_LONG;
        case Type.BT_FLOAT:  return RETURN_FLOAT;
        case Type.BT_DOUBLE: return RETURN_DOUBLE;
        case Type.BT_OBJECT: return RETURN_OBJECT;
        case Type.BT_VOID:   return RETURN_VOID;
    }

    return throwBadType(type);
}
 
Example 14
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code return} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being returned
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opReturn(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return RETURN_INT;
        case Type.BT_LONG:   return RETURN_LONG;
        case Type.BT_FLOAT:  return RETURN_FLOAT;
        case Type.BT_DOUBLE: return RETURN_DOUBLE;
        case Type.BT_OBJECT: return RETURN_OBJECT;
        case Type.BT_VOID:   return RETURN_VOID;
    }

    return throwBadType(type);
}
 
Example 15
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code not} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being operated on
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opNot(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:  return NOT_INT;
        case Type.BT_LONG: return NOT_LONG;
    }

    return throwBadType(type);
}
 
Example 16
Source File: Rops.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code move} rop for the given type. The
 * result is a shared instance.
 *
 * @param type {@code non-null;} type of value being moved
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMove(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MOVE_INT;
        case Type.BT_LONG:   return MOVE_LONG;
        case Type.BT_FLOAT:  return MOVE_FLOAT;
        case Type.BT_DOUBLE: return MOVE_DOUBLE;
        case Type.BT_OBJECT: return MOVE_OBJECT;
        case Type.BT_ADDR:   return MOVE_RETURN_ADDRESS;
    }

    return throwBadType(type);
}
 
Example 17
Source File: Rops.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the appropriate {@code move-param} rop for the
 * given type. The result is a shared instance.
 *
 * @param type {@code non-null;} type of value being moved
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMoveParam(TypeBearer type) {
    switch (type.getBasicFrameType()) {
        case Type.BT_INT:    return MOVE_PARAM_INT;
        case Type.BT_LONG:   return MOVE_PARAM_LONG;
        case Type.BT_FLOAT:  return MOVE_PARAM_FLOAT;
        case Type.BT_DOUBLE: return MOVE_PARAM_DOUBLE;
        case Type.BT_OBJECT: return MOVE_PARAM_OBJECT;
    }

    return throwBadType(type);
}
 
Example 18
Source File: Rops.java    From Box with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the appropriate {@code conv} rop for the given types. The
 * result is a shared instance.
 *
 * @param dest {@code non-null;} target value type
 * @param source {@code non-null;} source value type
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opConv(TypeBearer dest, TypeBearer source) {
    int dbt = dest.getBasicFrameType();
    switch (source.getBasicFrameType()) {
        case Type.BT_INT: {
            switch (dbt) {
                case Type.BT_LONG:   return CONV_I2L;
                case Type.BT_FLOAT:  return CONV_I2F;
                case Type.BT_DOUBLE: return CONV_I2D;
                default:             break;
            }
        }
        case Type.BT_LONG: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_L2I;
                case Type.BT_FLOAT:  return CONV_L2F;
                case Type.BT_DOUBLE: return CONV_L2D;
                default:             break;
            }
        }
        case Type.BT_FLOAT: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_F2I;
                case Type.BT_LONG:   return CONV_F2L;
                case Type.BT_DOUBLE: return CONV_F2D;
                default:             break;
            }
        }
        case Type.BT_DOUBLE: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_D2I;
                case Type.BT_LONG:   return CONV_D2L;
                case Type.BT_FLOAT:  return CONV_D2F;
                default:             break;
            }
        }
    }

    return throwBadTypes(StdTypeList.make(dest.getType(),
                                          source.getType()));
}
 
Example 19
Source File: Rops.java    From Box with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the appropriate {@code conv} rop for the given types. The
 * result is a shared instance.
 *
 * @param dest {@code non-null;} target value type
 * @param source {@code non-null;} source value type
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opConv(TypeBearer dest, TypeBearer source) {
    int dbt = dest.getBasicFrameType();
    switch (source.getBasicFrameType()) {
        case Type.BT_INT: {
            switch (dbt) {
                case Type.BT_LONG:   return CONV_I2L;
                case Type.BT_FLOAT:  return CONV_I2F;
                case Type.BT_DOUBLE: return CONV_I2D;
                default:             break;
            }
        }
        case Type.BT_LONG: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_L2I;
                case Type.BT_FLOAT:  return CONV_L2F;
                case Type.BT_DOUBLE: return CONV_L2D;
                default:             break;
            }
        }
        case Type.BT_FLOAT: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_F2I;
                case Type.BT_LONG:   return CONV_F2L;
                case Type.BT_DOUBLE: return CONV_F2D;
                default:             break;
            }
        }
        case Type.BT_DOUBLE: {
            switch (dbt) {
                case Type.BT_INT:    return CONV_D2I;
                case Type.BT_LONG:   return CONV_D2L;
                case Type.BT_FLOAT:  return CONV_D2F;
                default:             break;
            }
        }
    }

    return throwBadTypes(StdTypeList.make(dest.getType(),
                                          source.getType()));
}
 
Example 20
Source File: Rops.java    From buck with Apache License 2.0 4 votes vote down vote up
/**
   * Returns the appropriate {@code conv} rop for the given types. The
   * result is a shared instance.
   *
   * @param dest {@code non-null;} target value type
   * @param source {@code non-null;} source value type
   * @return {@code non-null;} an appropriate instance
   */
  public static Rop opConv(TypeBearer dest, TypeBearer source) {
      int dbt = dest.getBasicFrameType();
      switch (source.getBasicFrameType()) {
          case Type.BT_INT: {
              switch (dbt) {
                  case Type.BT_LONG:   return CONV_I2L;
                  case Type.BT_FLOAT:  return CONV_I2F;
                  case Type.BT_DOUBLE: return CONV_I2D;
                  default:             break;
              }
break;
          }
          case Type.BT_LONG: {
              switch (dbt) {
                  case Type.BT_INT:    return CONV_L2I;
                  case Type.BT_FLOAT:  return CONV_L2F;
                  case Type.BT_DOUBLE: return CONV_L2D;
                  default:             break;
              }
break;
          }
          case Type.BT_FLOAT: {
              switch (dbt) {
                  case Type.BT_INT:    return CONV_F2I;
                  case Type.BT_LONG:   return CONV_F2L;
                  case Type.BT_DOUBLE: return CONV_F2D;
                  default:             break;
              }
break;
          }
          case Type.BT_DOUBLE: {
              switch (dbt) {
                  case Type.BT_INT:    return CONV_D2I;
                  case Type.BT_LONG:   return CONV_D2L;
                  case Type.BT_FLOAT:  return CONV_D2F;
                  default:             break;
              }
break;
          }
      }

      return throwBadTypes(StdTypeList.make(dest.getType(),
                                            source.getType()));
  }