Java Code Examples for com.android.dx.rop.type.Type#BT_VOID

The following examples show how to use com.android.dx.rop.type.Type#BT_VOID . 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: SsaRenamer.java    From Box with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
    if (registerSpec == null) return null;

    int reg = registerSpec.getReg();

    // For debugging: assert that the mapped types are compatible.
    if (DEBUG) {
        RegisterSpec newVersion = currentMapping[reg];
        if (newVersion.getBasicType() != Type.BT_VOID
                && registerSpec.getBasicFrameType()
                    != newVersion.getBasicFrameType()) {

            throw new RuntimeException(
                    "mapping registers of incompatible types! "
                    + registerSpec
                    + " " + currentMapping[reg]);
        }
    }

    return registerSpec.withReg(currentMapping[reg].getReg());
}
 
Example 2
Source File: CstType.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance of this class that represents the wrapper
 * class corresponding to a given primitive type. For example, if
 * given {@link Type#INT}, this method returns the class reference
 * {@code java.lang.Integer}.
 *
 * @param primitiveType {@code non-null;} the primitive type
 * @return {@code non-null;} the corresponding wrapper class
 */
public static CstType forBoxedPrimitiveType(Type primitiveType) {
    switch (primitiveType.getBasicType()) {
        case Type.BT_BOOLEAN: return BOOLEAN;
        case Type.BT_BYTE:    return BYTE;
        case Type.BT_CHAR:    return CHARACTER;
        case Type.BT_DOUBLE:  return DOUBLE;
        case Type.BT_FLOAT:   return FLOAT;
        case Type.BT_INT:     return INTEGER;
        case Type.BT_LONG:    return LONG;
        case Type.BT_SHORT:   return SHORT;
        case Type.BT_VOID:    return VOID;
    }

    throw new IllegalArgumentException("not primitive: " + primitiveType);
}
 
Example 3
Source File: SsaRenamer.java    From Box with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
    if (registerSpec == null) return null;

    int reg = registerSpec.getReg();

    // For debugging: assert that the mapped types are compatible.
    if (DEBUG) {
        RegisterSpec newVersion = currentMapping[reg];
        if (newVersion.getBasicType() != Type.BT_VOID
                && registerSpec.getBasicFrameType()
                    != newVersion.getBasicFrameType()) {

            throw new RuntimeException(
                    "mapping registers of incompatible types! "
                    + registerSpec
                    + " " + currentMapping[reg]);
        }
    }

    return registerSpec.withReg(currentMapping[reg].getReg());
}
 
Example 4
Source File: CstType.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance of this class that represents the wrapper
 * class corresponding to a given primitive type. For example, if
 * given {@link Type#INT}, this method returns the class reference
 * {@code java.lang.Integer}.
 *
 * @param primitiveType {@code non-null;} the primitive type
 * @return {@code non-null;} the corresponding wrapper class
 */
public static CstType forBoxedPrimitiveType(Type primitiveType) {
    switch (primitiveType.getBasicType()) {
        case Type.BT_BOOLEAN: return BOOLEAN;
        case Type.BT_BYTE:    return BYTE;
        case Type.BT_CHAR:    return CHARACTER;
        case Type.BT_DOUBLE:  return DOUBLE;
        case Type.BT_FLOAT:   return FLOAT;
        case Type.BT_INT:     return INTEGER;
        case Type.BT_LONG:    return LONG;
        case Type.BT_SHORT:   return SHORT;
        case Type.BT_VOID:    return VOID;
    }

    throw new IllegalArgumentException("not primitive: " + primitiveType);
}
 
Example 5
Source File: SsaRenamer.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
    if (registerSpec == null) return null;

    int reg = registerSpec.getReg();

    // For debugging: assert that the mapped types are compatible.
    if (DEBUG) {
        RegisterSpec newVersion = currentMapping[reg];
        if (newVersion.getBasicType() != Type.BT_VOID
                && registerSpec.getBasicFrameType()
                    != newVersion.getBasicFrameType()) {

            throw new RuntimeException(
                    "mapping registers of incompatible types! "
                    + registerSpec
                    + " " + currentMapping[reg]);
        }
    }

    return registerSpec.withReg(currentMapping[reg].getReg());
}
 
Example 6
Source File: CstType.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance of this class that represents the wrapper
 * class corresponding to a given primitive type. For example, if
 * given {@link Type#INT}, this method returns the class reference
 * {@code java.lang.Integer}.
 *
 * @param primitiveType {@code non-null;} the primitive type
 * @return {@code non-null;} the corresponding wrapper class
 */
public static CstType forBoxedPrimitiveType(Type primitiveType) {
    switch (primitiveType.getBasicType()) {
        case Type.BT_BOOLEAN: return BOOLEAN;
        case Type.BT_BYTE:    return BYTE;
        case Type.BT_CHAR:    return CHARACTER;
        case Type.BT_DOUBLE:  return DOUBLE;
        case Type.BT_FLOAT:   return FLOAT;
        case Type.BT_INT:     return INTEGER;
        case Type.BT_LONG:    return LONG;
        case Type.BT_SHORT:   return SHORT;
        case Type.BT_VOID:    return VOID;
    }

    throw new IllegalArgumentException("not primitive: " + primitiveType);
}
 
Example 7
Source File: SsaRenamer.java    From buck with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
    if (registerSpec == null) return null;

    int reg = registerSpec.getReg();

    // For debugging: assert that the mapped types are compatible.
    if (DEBUG) {
        RegisterSpec newVersion = currentMapping[reg];
        if (newVersion.getBasicType() != Type.BT_VOID
                && registerSpec.getBasicFrameType()
                    != newVersion.getBasicFrameType()) {

            throw new RuntimeException(
                    "mapping registers of incompatible types! "
                    + registerSpec
                    + " " + currentMapping[reg]);
        }
    }

    return registerSpec.withReg(currentMapping[reg].getReg());
}
 
Example 8
Source File: CstType.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance of this class that represents the wrapper
 * class corresponding to a given primitive type. For example, if
 * given {@link Type#INT}, this method returns the class reference
 * {@code java.lang.Integer}.
 *
 * @param primitiveType {@code non-null;} the primitive type
 * @return {@code non-null;} the corresponding wrapper class
 */
public static CstType forBoxedPrimitiveType(Type primitiveType) {
    switch (primitiveType.getBasicType()) {
        case Type.BT_BOOLEAN: return BOOLEAN;
        case Type.BT_BYTE:    return BYTE;
        case Type.BT_CHAR:    return CHARACTER;
        case Type.BT_DOUBLE:  return DOUBLE;
        case Type.BT_FLOAT:   return FLOAT;
        case Type.BT_INT:     return INTEGER;
        case Type.BT_LONG:    return LONG;
        case Type.BT_SHORT:   return SHORT;
        case Type.BT_VOID:    return VOID;
    }

    throw new IllegalArgumentException("not primitive: " + primitiveType);
}
 
Example 9
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 10
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 11
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 12
Source File: Rops.java    From buck 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);
}