diff options
author | Ying Wang <wangying@google.com> | 2013-09-20 16:17:43 -0700 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2013-09-20 16:32:42 -0700 |
commit | b9cc48a43ed984587c939d02fba5316bf5c0df6e (patch) | |
tree | 7d42e31a97264803b1147ef6001e8a5e6968a122 /src/proguard/evaluation/BasicInvocationUnit.java | |
parent | 54f59ac04f3e21d5aecdd46bb1e7f4577924ab92 (diff) | |
download | android_external_proguard-b9cc48a43ed984587c939d02fba5316bf5c0df6e.tar.gz android_external_proguard-b9cc48a43ed984587c939d02fba5316bf5c0df6e.tar.bz2 android_external_proguard-b9cc48a43ed984587c939d02fba5316bf5c0df6e.zip |
Upgrade Proguard to 4.10.
Downloaded from:
http://sourceforge.net/projects/proguard/files/proguard/4.10/
Bug: 8992787
Change-Id: Ia07cc5b3feed443982b7e8f2a1f361479e735b18
Diffstat (limited to 'src/proguard/evaluation/BasicInvocationUnit.java')
-rw-r--r-- | src/proguard/evaluation/BasicInvocationUnit.java | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/proguard/evaluation/BasicInvocationUnit.java b/src/proguard/evaluation/BasicInvocationUnit.java index bccd866..474556c 100644 --- a/src/proguard/evaluation/BasicInvocationUnit.java +++ b/src/proguard/evaluation/BasicInvocationUnit.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -162,6 +162,7 @@ implements InvocationUnit, break; case InstructionConstants.OP_INVOKESTATIC: + case InstructionConstants.OP_INVOKEDYNAMIC: isStatic = true; break; @@ -230,6 +231,31 @@ implements InvocationUnit, } } + public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant) + { + String type = invokeDynamicConstant.getType(clazz); + + // Count the number of parameters. + int parameterCount = ClassUtil.internalMethodParameterCount(type); + if (!isStatic) + { + parameterCount++; + } + + // Pop the parameters and the class reference, in reverse order. + for (int parameterIndex = parameterCount-1; parameterIndex >= 0; parameterIndex--) + { + stack.pop(); + } + + // Push the return value, if applicable. + String returnType = ClassUtil.internalMethodReturnType(type); + if (returnType.charAt(0) != ClassConstants.INTERNAL_TYPE_VOID) + { + stack.push(getMethodReturnValue(clazz, invokeDynamicConstant, returnType)); + } + } + /** * Sets the class through which the specified field is accessed. @@ -340,6 +366,25 @@ implements InvocationUnit, } + /** + * Returns the return value of the specified method. + */ + protected Value getMethodReturnValue(Clazz clazz, + InvokeDynamicConstant invokeDynamicConstant, + String type) + { + // Try to figure out the class of the return type. + Clazz[] referencedClasses = invokeDynamicConstant.referencedClasses; + + Clazz returnTypeClass = referencedClasses == null ? null : + referencedClasses[referencedClasses.length - 1]; + + return valueFactory.createValue(type, + returnTypeClass, + true); + } + + // Implementations for MemberVisitor. public void visitProgramField(ProgramClass programClass, ProgramField programField) |