本文整理汇总了Java中com.android.dx.rop.type.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于com.android.dx.rop.type包,在下文中一共展示了Type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
if (cst == null) {
throw new NullPointerException("cst == null");
}
throwIfNotPrepared();
Type type = ((CstType) cst).getClassType();
IndexedItem result = typeIds.get(type);
if (result == null) {
throw new IllegalArgumentException("not found: " + cst);
}
return result;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:TypeIdsSection.java
示例2: forBoxedPrimitiveType
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* 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);
}
开发者ID:johnlee175,项目名称:dex,代码行数:25,代码来源:CstType.java
示例3: getCatchTypes
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/** {@inheritDoc} */
public HashSet<Type> getCatchTypes() {
HashSet<Type> result = new HashSet<Type>(20);
BasicBlockList blocks = method.getBlocks();
int size = blocks.size();
for (int i = 0; i < size; i++) {
BasicBlock block = blocks.get(i);
TypeList catches = block.getLastInsn().getCatches();
int catchSize = catches.size();
for (int j = 0; j < catchSize; j++) {
result.add(catches.getType(j));
}
}
return result;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:StdCatchBuilder.java
示例4: add
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Adds an element to this instance. It is illegal to attempt to add more
* than one class with the same name.
*
* @param clazz {@code non-null;} the class def to add
*/
public void add(ClassDefItem clazz) {
Type type;
try {
type = clazz.getThisClass().getClassType();
} catch (NullPointerException ex) {
// Elucidate the exception.
throw new NullPointerException("clazz == null");
}
throwIfPrepared();
if (classDefs.get(type) != null) {
throw new IllegalArgumentException("already added: " + type);
}
classDefs.put(type, clazz);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:25,代码来源:ClassDefsSection.java
示例5: get
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
if (cst == null) {
throw new NullPointerException("cst == null");
}
throwIfNotPrepared();
Type type = ((CstType) cst).getClassType();
IndexedItem result = classDefs.get(type);
if (result == null) {
throw new IllegalArgumentException("not found");
}
return result;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:ClassDefsSection.java
示例6: checkReturnType
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Checks whether the prototype is compatible with returning the
* given type, and throws if not.
*
* @param encountered {@code non-null;} the encountered return type
*/
private void checkReturnType(Type encountered) {
Type returnType = machine.getPrototype().getReturnType();
/*
* Check to see if the prototype's return type is
* possibly assignable from the type we encountered. This
* takes care of all the salient cases (types are the same,
* they're compatible primitive types, etc.).
*/
if (!Merger.isPossiblyAssignableFrom(returnType, encountered)) {
throw new SimException("return type mismatch: prototype " +
"indicates " + returnType.toHuman() +
", but encountered type " + encountered.toHuman());
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:Simulator.java
示例7: opPutStatic
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns the appropriate {@code put-static} rop for the given
* type. The result is a shared instance.
*
* @param type {@code non-null;} type of the field in question
* @return {@code non-null;} an appropriate instance
*/
public static Rop opPutStatic(TypeBearer type) {
switch (type.getBasicType()) {
case Type.BT_INT: return PUT_STATIC_INT;
case Type.BT_LONG: return PUT_STATIC_LONG;
case Type.BT_FLOAT: return PUT_STATIC_FLOAT;
case Type.BT_DOUBLE: return PUT_STATIC_DOUBLE;
case Type.BT_OBJECT: return PUT_STATIC_OBJECT;
case Type.BT_BOOLEAN: return PUT_STATIC_BOOLEAN;
case Type.BT_BYTE: return PUT_STATIC_BYTE;
case Type.BT_CHAR: return PUT_STATIC_CHAR;
case Type.BT_SHORT: return PUT_STATIC_SHORT;
}
return throwBadType(type);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:Rops.java
示例8: makeInitialized
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Replaces all the occurrences of the given uninitialized type in
* this stack with its initialized equivalent.
*
* @param type {@code non-null;} type to replace
*/
public void makeInitialized(Type type) {
if (stackPtr == 0) {
// We have to check for this before checking for immutability.
return;
}
throwIfImmutable();
Type initializedType = type.getInitializedType();
for (int i = 0; i < stackPtr; i++) {
if (stack[i] == type) {
stack[i] = initializedType;
}
}
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:ExecutionStack.java
示例9: orderItems
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void orderItems() {
int sz = classDefs.size();
int idx = 0;
orderedDefs = new ArrayList<ClassDefItem>(sz);
/*
* Iterate over all the classes, recursively assigning an
* index to each, implicitly skipping the ones that have
* already been assigned by the time this (top-level)
* iteration reaches them.
*/
for (Type type : classDefs.keySet()) {
idx = orderItems0(type, idx, sz - idx);
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:ClassDefsSection.java
示例10: opAget
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns the appropriate {@code aget} rop for the given type. The
* result is a shared instance.
*
* @param type {@code non-null;} element type of array being accessed
* @return {@code non-null;} an appropriate instance
*/
public static Rop opAget(TypeBearer type) {
switch (type.getBasicType()) {
case Type.BT_INT: return AGET_INT;
case Type.BT_LONG: return AGET_LONG;
case Type.BT_FLOAT: return AGET_FLOAT;
case Type.BT_DOUBLE: return AGET_DOUBLE;
case Type.BT_OBJECT: return AGET_OBJECT;
case Type.BT_BOOLEAN: return AGET_BOOLEAN;
case Type.BT_BYTE: return AGET_BYTE;
case Type.BT_CHAR: return AGET_CHAR;
case Type.BT_SHORT: return AGET_SHORT;
}
return throwBadType(type);
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:Rops.java
示例11: intern
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Interns an element into this instance.
*
* @param type {@code non-null;} the type to intern
* @return {@code non-null;} the interned reference
*/
public TypeIdItem intern(CstType type) {
if (type == null) {
throw new NullPointerException("type == null");
}
throwIfPrepared();
Type typePerSe = type.getClassType();
TypeIdItem result = typeIds.get(typePerSe);
if (result == null) {
result = new TypeIdItem(type);
typeIds.put(typePerSe, result);
}
return result;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:TypeIdsSection.java
示例12: processInsn
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Process a single instruction, looking for new objects resulting from
* move result or move param.
*
* @param insn {@code non-null;} instruction to process
*/
private void processInsn(SsaInsn insn) {
int op = insn.getOpcode().getOpcode();
RegisterSpec result = insn.getResult();
EscapeSet escSet;
// Identify new objects
if (op == RegOps.MOVE_RESULT_PSEUDO &&
result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
// Handle objects generated through move_result_pseudo
escSet = processMoveResultPseudoInsn(insn);
processRegister(result, escSet);
} else if (op == RegOps.MOVE_PARAM &&
result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
// Track method arguments that are objects
escSet = new EscapeSet(result.getReg(), regCount, EscapeState.NONE);
latticeValues.add(escSet);
processRegister(result, escSet);
} else if (op == RegOps.MOVE_RESULT &&
result.getTypeBearer().getBasicType() == Type.BT_OBJECT) {
// Track method return values that are objects
escSet = new EscapeSet(result.getReg(), regCount, EscapeState.NONE);
latticeValues.add(escSet);
processRegister(result, escSet);
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:32,代码来源:EscapeAnalysis.java
示例13: opFilledNewArray
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns the appropriate {@code filled-new-array} rop for the given
* type. The result may be a shared instance.
*
* @param arrayType {@code non-null;} type of array being created
* @param count {@code >= 0;} number of elements that the array should have
* @return {@code non-null;} an appropriate instance
*/
public static Rop opFilledNewArray(TypeBearer arrayType, int count) {
Type type = arrayType.getType();
Type elementType = type.getComponentType();
if (elementType.isCategory2()) {
return throwBadType(arrayType);
}
if (count < 0) {
throw new IllegalArgumentException("count < 0");
}
StdTypeList sourceTypes = new StdTypeList(count);
for (int i = 0; i < count; i++) {
sourceTypes.set(i, elementType);
}
// Note: The resulting rop is considered call-like.
return new Rop(RegOps.FILLED_NEW_ARRAY,
sourceTypes,
Exceptions.LIST_Error);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:32,代码来源:Rops.java
示例14: opAput
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns the appropriate {@code aput} rop for the given type. The
* result is a shared instance.
*
* @param type {@code non-null;} element type of array being accessed
* @return {@code non-null;} an appropriate instance
*/
public static Rop opAput(TypeBearer type) {
switch (type.getBasicType()) {
case Type.BT_INT: return APUT_INT;
case Type.BT_LONG: return APUT_LONG;
case Type.BT_FLOAT: return APUT_FLOAT;
case Type.BT_DOUBLE: return APUT_DOUBLE;
case Type.BT_OBJECT: return APUT_OBJECT;
case Type.BT_BOOLEAN: return APUT_BOOLEAN;
case Type.BT_BYTE: return APUT_BYTE;
case Type.BT_CHAR: return APUT_CHAR;
case Type.BT_SHORT: return APUT_SHORT;
}
return throwBadType(type);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:Rops.java
示例15: opGetField
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns the appropriate {@code get-field} rop for the given
* type. The result is a shared instance.
*
* @param type {@code non-null;} type of the field in question
* @return {@code non-null;} an appropriate instance
*/
public static Rop opGetField(TypeBearer type) {
switch (type.getBasicType()) {
case Type.BT_INT: return GET_FIELD_INT;
case Type.BT_LONG: return GET_FIELD_LONG;
case Type.BT_FLOAT: return GET_FIELD_FLOAT;
case Type.BT_DOUBLE: return GET_FIELD_DOUBLE;
case Type.BT_OBJECT: return GET_FIELD_OBJECT;
case Type.BT_BOOLEAN: return GET_FIELD_BOOLEAN;
case Type.BT_BYTE: return GET_FIELD_BYTE;
case Type.BT_CHAR: return GET_FIELD_CHAR;
case Type.BT_SHORT: return GET_FIELD_SHORT;
}
return throwBadType(type);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:Rops.java
示例16: intern
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Returns an interned instance of this class for the given type.
*
* @param type {@code non-null;} the underlying type
* @return {@code non-null;} an appropriately-constructed instance
*/
public static CstType intern(Type type) {
synchronized (interns) {
CstType cst = interns.get(type);
if (cst == null) {
cst = new CstType(type);
interns.put(type, cst);
}
return cst;
}
}
开发者ID:johnlee175,项目名称:dex,代码行数:19,代码来源:CstType.java
示例17: tryReplacingWithConstant
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Tries to replace an instruction with a const instruction. The given
* instruction must have a constant result for it to be replaced.
*
* @param insn {@code non-null;} instruction to try to replace
* @return true if the instruction was replaced
*/
private boolean tryReplacingWithConstant(NormalSsaInsn insn) {
Insn originalRopInsn = insn.getOriginalRopInsn();
Rop opcode = originalRopInsn.getOpcode();
RegisterSpec result = insn.getResult();
if (result != null && !ssaMeth.isRegALocal(result) &&
opcode.getOpcode() != RegOps.CONST) {
TypeBearer type = insn.getResult().getTypeBearer();
if (type.isConstant() && type.getBasicType() == Type.BT_INT) {
// Replace the instruction with a constant
replacePlainInsn(insn, RegisterSpecList.EMPTY,
RegOps.CONST, (Constant) type);
// Remove the source as well if this is a move-result-pseudo
if (opcode.getOpcode() == RegOps.MOVE_RESULT_PSEUDO) {
int pred = insn.getBlock().getPredecessors().nextSetBit(0);
ArrayList<SsaInsn> predInsns =
ssaMeth.getBlocks().get(pred).getInsns();
NormalSsaInsn sourceInsn =
(NormalSsaInsn) predInsns.get(predInsns.size()-1);
replacePlainInsn(sourceInsn, RegisterSpecList.EMPTY,
RegOps.GOTO, null);
}
return true;
}
}
return false;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:36,代码来源:LiteralOpUpgrader.java
示例18: ClassDefsSection
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* Constructs an instance. The file offset is initially unknown.
*
* @param file {@code non-null;} file that this instance is part of
*/
public ClassDefsSection(DexFile file) {
super("class_defs", file, 4);
classDefs = new TreeMap<Type, ClassDefItem>();
orderedDefs = null;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:12,代码来源:ClassDefsSection.java
示例19: opMove
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* 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);
}
开发者ID:johnlee175,项目名称:dex,代码行数:20,代码来源:Rops.java
示例20: opNeg
import com.android.dx.rop.type.Type; //导入依赖的package包/类
/**
* 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);
}
开发者ID:johnlee175,项目名称:dex,代码行数:18,代码来源:Rops.java
注:本文中的com.android.dx.rop.type.Type类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论