当前位置: 首页>>代码示例>>Java>>正文


Java PartialEvaluator类代码示例

本文整理汇总了Java中proguard.optimize.evaluation.PartialEvaluator的典型用法代码示例。如果您正苦于以下问题:Java PartialEvaluator类的具体用法?Java PartialEvaluator怎么用?Java PartialEvaluator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PartialEvaluator类属于proguard.optimize.evaluation包,在下文中一共展示了PartialEvaluator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitVariableInstruction

import proguard.optimize.evaluation.PartialEvaluator; //导入依赖的package包/类
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
{
    if (partialEvaluator.isTraced(offset) &&
        variableInstruction.isLoad())
    {
        int parameterIndex = variableInstruction.variableIndex;
        if (parameterIndex < codeAttribute.u2maxLocals)
        {
            Value producer =
                partialEvaluator.getVariablesBefore(offset).getProducerValue(parameterIndex);
            if (producer != null &&
                producer.instructionOffsetValue().contains(PartialEvaluator.AT_METHOD_ENTRY))
            {
                // Mark the variable.
                markParameterUsed(method, parameterIndex);

                // Account for Category 2 instructions, which take up two entries.
                if (variableInstruction.isCategory2())
                {
                    markParameterUsed(method, parameterIndex + 1);
                }
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:26,代码来源:ParameterUsageMarker.java

示例2: correspondingVerificationType

import proguard.optimize.evaluation.PartialEvaluator; //导入依赖的package包/类
/**
 * Creates and returns the verification type corresponding to the given
 * value. If necessary, a class constant is added to the constant pool of
 * the given class.
 */
private VerificationType correspondingVerificationType(ProgramClass  programClass,
                                                       ProgramMethod programMethod,
                                                       CodeAttribute codeAttribute,
                                                       int           offset,
                                                       boolean       isVariable0,
                                                       Value value,
                                                       Value producerValue)
{
    if (value == null)
    {
        return VerificationTypeFactory.createTopType();
    }

    int type = value.computationalType();

    switch (type)
    {
        case Value.TYPE_INSTRUCTION_OFFSET:
        case Value.TYPE_INTEGER:   return VerificationTypeFactory.createIntegerType();
        case Value.TYPE_LONG:      return VerificationTypeFactory.createLongType();
        case Value.TYPE_FLOAT:     return VerificationTypeFactory.createFloatType();
        case Value.TYPE_DOUBLE:    return VerificationTypeFactory.createDoubleType();
        case Value.TYPE_TOP:       return VerificationTypeFactory.createTopType();
        case Value.TYPE_REFERENCE:
            // Is it a Null type?
            ReferenceValue referenceValue = value.referenceValue();
            if (referenceValue.isNull() == Value.ALWAYS)
            {
                return VerificationTypeFactory.createNullType();
            }

            // Does the reference type have a single producer?
            if (offset != PartialEvaluator.AT_METHOD_ENTRY)
            {
                InstructionOffsetValue producers = producerValue.instructionOffsetValue();
                if (producers.instructionOffsetCount() == 1)
                {
                    int producerOffset = producers.instructionOffset(0);

                    // Follow any dup or swap instructions.
                    while (producerOffset != PartialEvaluator.AT_METHOD_ENTRY &&
                           isDupOrSwap(codeAttribute.code[producerOffset]))
                    {
                        producers      = partialEvaluator.getStackBefore(producerOffset).getTopProducerValue(0).instructionOffsetValue();
                        producerOffset = producers.instructionOffset(0);
                    }

                    // Are we in an instance initialization method,
                    // before the super initialization, loading "this"?
                    if (partialEvaluator.isInitializer()                       &&
                        offset <= partialEvaluator.superInitializationOffset() &&
                        (isVariable0 ||
                         producerOffset > PartialEvaluator.AT_METHOD_ENTRY &&
                         codeAttribute.code[producerOffset] == InstructionConstants.OP_ALOAD_0))
                    {
                        // It's an UninitializedThis type.
                        return VerificationTypeFactory.createUninitializedThisType();
                    }

                    // Is the reference type newly created and still
                    // uninitialized?
                    if (producerOffset > PartialEvaluator.AT_METHOD_ENTRY &&
                        offset <= partialEvaluator.initializationOffset(producerOffset))
                    {
                        // It's an Uninitialized type.
                        return VerificationTypeFactory.createUninitializedType(producerOffset);
                    }
                }
            }

            // It's an ordinary Object type.
            return VerificationTypeFactory.createObjectType(createClassConstant(programClass, referenceValue));
    }

    throw new IllegalArgumentException("Unknown computational type ["+type+"]");
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:82,代码来源:CodePreverifier.java


注:本文中的proguard.optimize.evaluation.PartialEvaluator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。