當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。