sometsome 1.0.2 → 3.10.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (732) hide show
  1. checksums.yaml +4 -4
  2. data/lib/proguard4.7/README +33 -0
  3. data/lib/proguard4.7/bin/proguard.bat +14 -0
  4. data/lib/proguard4.7/bin/proguard.sh +11 -0
  5. data/lib/proguard4.7/bin/proguardgui.bat +14 -0
  6. data/lib/proguard4.7/bin/proguardgui.sh +15 -0
  7. data/lib/proguard4.7/bin/retrace.bat +14 -0
  8. data/lib/proguard4.7/bin/retrace.sh +12 -0
  9. data/lib/proguard4.7/build/build.sh +94 -0
  10. data/lib/proguard4.7/build/build.xml +171 -0
  11. data/lib/proguard4.7/build/makefile +94 -0
  12. data/lib/proguard4.7/docs/FAQ.html +253 -0
  13. data/lib/proguard4.7/docs/GPL.html +406 -0
  14. data/lib/proguard4.7/docs/GPL_exception.html +56 -0
  15. data/lib/proguard4.7/docs/acknowledgements.html +76 -0
  16. data/lib/proguard4.7/docs/alternatives.html +699 -0
  17. data/lib/proguard4.7/docs/checkmark.gif +0 -0
  18. data/lib/proguard4.7/docs/downloads.html +623 -0
  19. data/lib/proguard4.7/docs/drop1.gif +0 -0
  20. data/lib/proguard4.7/docs/drop2.gif +0 -0
  21. data/lib/proguard4.7/docs/drop3.gif +0 -0
  22. data/lib/proguard4.7/docs/favicon.ico +0 -0
  23. data/lib/proguard4.7/docs/feedback.html +120 -0
  24. data/lib/proguard4.7/docs/index.html +92 -0
  25. data/lib/proguard4.7/docs/license.html +60 -0
  26. data/lib/proguard4.7/docs/main.html +102 -0
  27. data/lib/proguard4.7/docs/manual/ant.html +634 -0
  28. data/lib/proguard4.7/docs/manual/attention.gif +0 -0
  29. data/lib/proguard4.7/docs/manual/examples.html +1504 -0
  30. data/lib/proguard4.7/docs/manual/gui.html +479 -0
  31. data/lib/proguard4.7/docs/manual/index.html +51 -0
  32. data/lib/proguard4.7/docs/manual/introduction.html +173 -0
  33. data/lib/proguard4.7/docs/manual/limitations.html +69 -0
  34. data/lib/proguard4.7/docs/manual/optimizations.html +172 -0
  35. data/lib/proguard4.7/docs/manual/refcard.html +486 -0
  36. data/lib/proguard4.7/docs/manual/retrace/examples.html +345 -0
  37. data/lib/proguard4.7/docs/manual/retrace/index.html +37 -0
  38. data/lib/proguard4.7/docs/manual/retrace/introduction.html +79 -0
  39. data/lib/proguard4.7/docs/manual/retrace/usage.html +127 -0
  40. data/lib/proguard4.7/docs/manual/sections.html +60 -0
  41. data/lib/proguard4.7/docs/manual/style.css +105 -0
  42. data/lib/proguard4.7/docs/manual/troubleshooting.html +729 -0
  43. data/lib/proguard4.7/docs/manual/usage.html +1243 -0
  44. data/lib/proguard4.7/docs/manual/wtk.html +70 -0
  45. data/lib/proguard4.7/docs/quality.html +56 -0
  46. data/lib/proguard4.7/docs/results.html +170 -0
  47. data/lib/proguard4.7/docs/saikoalogo.png +0 -0
  48. data/lib/proguard4.7/docs/screenshot_console.gif +0 -0
  49. data/lib/proguard4.7/docs/screenshot_console_small.gif +0 -0
  50. data/lib/proguard4.7/docs/screenshot_gui1.gif +0 -0
  51. data/lib/proguard4.7/docs/screenshot_gui2.gif +0 -0
  52. data/lib/proguard4.7/docs/screenshot_gui3.gif +0 -0
  53. data/lib/proguard4.7/docs/screenshot_gui4.gif +0 -0
  54. data/lib/proguard4.7/docs/screenshot_gui5.gif +0 -0
  55. data/lib/proguard4.7/docs/screenshot_gui6.gif +0 -0
  56. data/lib/proguard4.7/docs/screenshot_gui7.gif +0 -0
  57. data/lib/proguard4.7/docs/screenshot_gui8.gif +0 -0
  58. data/lib/proguard4.7/docs/screenshots.html +67 -0
  59. data/lib/proguard4.7/docs/screenshots_gui_small.gif +0 -0
  60. data/lib/proguard4.7/docs/sections.html +64 -0
  61. data/lib/proguard4.7/docs/sflogo.png +0 -0
  62. data/lib/proguard4.7/docs/steel.gif +0 -0
  63. data/lib/proguard4.7/docs/style.css +223 -0
  64. data/lib/proguard4.7/docs/testimonials.html +133 -0
  65. data/lib/proguard4.7/docs/title.gif +0 -0
  66. data/lib/proguard4.7/docs/title.html +17 -0
  67. data/lib/proguard4.7/examples/android.pro +149 -0
  68. data/lib/proguard4.7/examples/annotations/examples.pro +60 -0
  69. data/lib/proguard4.7/examples/annotations/examples/Applet.java +22 -0
  70. data/lib/proguard4.7/examples/annotations/examples/Application.java +20 -0
  71. data/lib/proguard4.7/examples/annotations/examples/Bean.java +56 -0
  72. data/lib/proguard4.7/examples/annotations/examples/NativeCallBack.java +44 -0
  73. data/lib/proguard4.7/examples/annotations/lib/annotations.jar +0 -0
  74. data/lib/proguard4.7/examples/annotations/lib/annotations.pro +118 -0
  75. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/Keep.java +18 -0
  76. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepApplication.java +18 -0
  77. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepClassMemberNames.java +18 -0
  78. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepClassMembers.java +18 -0
  79. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepGettersSetters.java +18 -0
  80. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepImplementations.java +18 -0
  81. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepName.java +18 -0
  82. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java +18 -0
  83. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java +18 -0
  84. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java +18 -0
  85. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicImplementations.java +18 -0
  86. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java +18 -0
  87. data/lib/proguard4.7/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java +19 -0
  88. data/lib/proguard4.7/examples/ant/android-8.xml +177 -0
  89. data/lib/proguard4.7/examples/ant/applets.xml +88 -0
  90. data/lib/proguard4.7/examples/ant/applications1.xml +15 -0
  91. data/lib/proguard4.7/examples/ant/applications2.xml +74 -0
  92. data/lib/proguard4.7/examples/ant/applications3.xml +98 -0
  93. data/lib/proguard4.7/examples/ant/library.xml +102 -0
  94. data/lib/proguard4.7/examples/ant/midlets.xml +52 -0
  95. data/lib/proguard4.7/examples/ant/proguard.xml +78 -0
  96. data/lib/proguard4.7/examples/ant/servlets.xml +88 -0
  97. data/lib/proguard4.7/examples/applets.pro +69 -0
  98. data/lib/proguard4.7/examples/applications.pro +75 -0
  99. data/lib/proguard4.7/examples/dictionaries/compact.txt +18 -0
  100. data/lib/proguard4.7/examples/dictionaries/keywords.txt +58 -0
  101. data/lib/proguard4.7/examples/dictionaries/shakespeare.txt +23 -0
  102. data/lib/proguard4.7/examples/dictionaries/windows.txt +209 -0
  103. data/lib/proguard4.7/examples/library.pro +79 -0
  104. data/lib/proguard4.7/examples/midlets.pro +67 -0
  105. data/lib/proguard4.7/examples/proguard.pro +57 -0
  106. data/lib/proguard4.7/examples/proguardall.pro +62 -0
  107. data/lib/proguard4.7/examples/proguardgui.pro +50 -0
  108. data/lib/proguard4.7/examples/retrace.pro +43 -0
  109. data/lib/proguard4.7/examples/scala.pro +132 -0
  110. data/lib/proguard4.7/examples/servlets.pro +70 -0
  111. data/lib/proguard4.7/lib/proguard.jar +0 -0
  112. data/lib/proguard4.7/lib/proguardgui.jar +0 -0
  113. data/lib/proguard4.7/lib/retrace.jar +0 -0
  114. data/lib/proguard4.7/src/proguard/ArgumentWordReader.java +111 -0
  115. data/lib/proguard4.7/src/proguard/ClassPath.java +94 -0
  116. data/lib/proguard4.7/src/proguard/ClassPathEntry.java +282 -0
  117. data/lib/proguard4.7/src/proguard/ClassSpecification.java +259 -0
  118. data/lib/proguard4.7/src/proguard/ClassSpecificationVisitorFactory.java +503 -0
  119. data/lib/proguard4.7/src/proguard/Configuration.java +328 -0
  120. data/lib/proguard4.7/src/proguard/ConfigurationConstants.java +123 -0
  121. data/lib/proguard4.7/src/proguard/ConfigurationParser.java +1285 -0
  122. data/lib/proguard4.7/src/proguard/ConfigurationWriter.java +651 -0
  123. data/lib/proguard4.7/src/proguard/DataEntryReaderFactory.java +141 -0
  124. data/lib/proguard4.7/src/proguard/DataEntryWriterFactory.java +150 -0
  125. data/lib/proguard4.7/src/proguard/DescriptorKeepChecker.java +169 -0
  126. data/lib/proguard4.7/src/proguard/DuplicateClassPrinter.java +63 -0
  127. data/lib/proguard4.7/src/proguard/FileWordReader.java +55 -0
  128. data/lib/proguard4.7/src/proguard/FullyQualifiedClassNameChecker.java +191 -0
  129. data/lib/proguard4.7/src/proguard/GPL.java +197 -0
  130. data/lib/proguard4.7/src/proguard/Initializer.java +424 -0
  131. data/lib/proguard4.7/src/proguard/InputReader.java +233 -0
  132. data/lib/proguard4.7/src/proguard/KeepClassMemberChecker.java +87 -0
  133. data/lib/proguard4.7/src/proguard/KeepClassSpecification.java +137 -0
  134. data/lib/proguard4.7/src/proguard/LineWordReader.java +74 -0
  135. data/lib/proguard4.7/src/proguard/MANIFEST.MF +2 -0
  136. data/lib/proguard4.7/src/proguard/MemberSpecification.java +114 -0
  137. data/lib/proguard4.7/src/proguard/OutputWriter.java +296 -0
  138. data/lib/proguard4.7/src/proguard/ParseException.java +51 -0
  139. data/lib/proguard4.7/src/proguard/ProGuard.java +512 -0
  140. data/lib/proguard4.7/src/proguard/SeedPrinter.java +97 -0
  141. data/lib/proguard4.7/src/proguard/SubclassedClassFilter.java +62 -0
  142. data/lib/proguard4.7/src/proguard/Targeter.java +88 -0
  143. data/lib/proguard4.7/src/proguard/UpToDateChecker.java +232 -0
  144. data/lib/proguard4.7/src/proguard/WordReader.java +387 -0
  145. data/lib/proguard4.7/src/proguard/ant/ClassPathElement.java +191 -0
  146. data/lib/proguard4.7/src/proguard/ant/ClassSpecificationElement.java +258 -0
  147. data/lib/proguard4.7/src/proguard/ant/ConfigurationElement.java +53 -0
  148. data/lib/proguard4.7/src/proguard/ant/ConfigurationTask.java +441 -0
  149. data/lib/proguard4.7/src/proguard/ant/FilterElement.java +85 -0
  150. data/lib/proguard4.7/src/proguard/ant/KeepSpecificationElement.java +87 -0
  151. data/lib/proguard4.7/src/proguard/ant/MemberSpecificationElement.java +218 -0
  152. data/lib/proguard4.7/src/proguard/ant/ProGuardTask.java +352 -0
  153. data/lib/proguard4.7/src/proguard/ant/package.html +3 -0
  154. data/lib/proguard4.7/src/proguard/ant/task.properties +2 -0
  155. data/lib/proguard4.7/src/proguard/classfile/ClassConstants.java +316 -0
  156. data/lib/proguard4.7/src/proguard/classfile/ClassPool.java +152 -0
  157. data/lib/proguard4.7/src/proguard/classfile/Clazz.java +261 -0
  158. data/lib/proguard4.7/src/proguard/classfile/Field.java +32 -0
  159. data/lib/proguard4.7/src/proguard/classfile/LibraryClass.java +548 -0
  160. data/lib/proguard4.7/src/proguard/classfile/LibraryField.java +77 -0
  161. data/lib/proguard4.7/src/proguard/classfile/LibraryMember.java +108 -0
  162. data/lib/proguard4.7/src/proguard/classfile/LibraryMethod.java +83 -0
  163. data/lib/proguard4.7/src/proguard/classfile/Member.java +57 -0
  164. data/lib/proguard4.7/src/proguard/classfile/Method.java +32 -0
  165. data/lib/proguard4.7/src/proguard/classfile/ProgramClass.java +572 -0
  166. data/lib/proguard4.7/src/proguard/classfile/ProgramField.java +93 -0
  167. data/lib/proguard4.7/src/proguard/classfile/ProgramMember.java +168 -0
  168. data/lib/proguard4.7/src/proguard/classfile/ProgramMethod.java +99 -0
  169. data/lib/proguard4.7/src/proguard/classfile/VisitorAccepter.java +47 -0
  170. data/lib/proguard4.7/src/proguard/classfile/attribute/Attribute.java +142 -0
  171. data/lib/proguard4.7/src/proguard/classfile/attribute/BootstrapMethodInfo.java +89 -0
  172. data/lib/proguard4.7/src/proguard/classfile/attribute/BootstrapMethodsAttribute.java +95 -0
  173. data/lib/proguard4.7/src/proguard/classfile/attribute/CodeAttribute.java +202 -0
  174. data/lib/proguard4.7/src/proguard/classfile/attribute/ConstantValueAttribute.java +62 -0
  175. data/lib/proguard4.7/src/proguard/classfile/attribute/DeprecatedAttribute.java +66 -0
  176. data/lib/proguard4.7/src/proguard/classfile/attribute/EnclosingMethodAttribute.java +132 -0
  177. data/lib/proguard4.7/src/proguard/classfile/attribute/ExceptionInfo.java +100 -0
  178. data/lib/proguard4.7/src/proguard/classfile/attribute/ExceptionsAttribute.java +80 -0
  179. data/lib/proguard4.7/src/proguard/classfile/attribute/InnerClassesAttribute.java +80 -0
  180. data/lib/proguard4.7/src/proguard/classfile/attribute/InnerClassesInfo.java +119 -0
  181. data/lib/proguard4.7/src/proguard/classfile/attribute/LineNumberInfo.java +50 -0
  182. data/lib/proguard4.7/src/proguard/classfile/attribute/LineNumberTableAttribute.java +100 -0
  183. data/lib/proguard4.7/src/proguard/classfile/attribute/LocalVariableInfo.java +99 -0
  184. data/lib/proguard4.7/src/proguard/classfile/attribute/LocalVariableTableAttribute.java +79 -0
  185. data/lib/proguard4.7/src/proguard/classfile/attribute/LocalVariableTypeInfo.java +107 -0
  186. data/lib/proguard4.7/src/proguard/classfile/attribute/LocalVariableTypeTableAttribute.java +79 -0
  187. data/lib/proguard4.7/src/proguard/classfile/attribute/SignatureAttribute.java +100 -0
  188. data/lib/proguard4.7/src/proguard/classfile/attribute/SourceDirAttribute.java +62 -0
  189. data/lib/proguard4.7/src/proguard/classfile/attribute/SourceFileAttribute.java +62 -0
  190. data/lib/proguard4.7/src/proguard/classfile/attribute/SyntheticAttribute.java +66 -0
  191. data/lib/proguard4.7/src/proguard/classfile/attribute/UnknownAttribute.java +82 -0
  192. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/Annotation.java +143 -0
  193. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/AnnotationDefaultAttribute.java +73 -0
  194. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/AnnotationElementValue.java +76 -0
  195. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/AnnotationsAttribute.java +100 -0
  196. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/ArrayElementValue.java +82 -0
  197. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/ClassElementValue.java +95 -0
  198. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/ConstantElementValue.java +71 -0
  199. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/ElementValue.java +126 -0
  200. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/EnumConstantElementValue.java +99 -0
  201. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/ParameterAnnotationsAttribute.java +83 -0
  202. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/RuntimeInvisibleAnnotationsAttribute.java +70 -0
  203. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/RuntimeInvisibleParameterAnnotationsAttribute.java +62 -0
  204. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/RuntimeVisibleAnnotationsAttribute.java +70 -0
  205. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/RuntimeVisibleParameterAnnotationsAttribute.java +62 -0
  206. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/package.html +4 -0
  207. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/AllAnnotationVisitor.java +100 -0
  208. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/AnnotatedClassVisitor.java +62 -0
  209. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/AnnotationToMemberVisitor.java +62 -0
  210. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/AnnotationTypeFilter.java +102 -0
  211. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/AnnotationVisitor.java +40 -0
  212. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/ElementValueVisitor.java +51 -0
  213. data/lib/proguard4.7/src/proguard/classfile/attribute/annotation/visitor/package.html +3 -0
  214. data/lib/proguard4.7/src/proguard/classfile/attribute/package.html +3 -0
  215. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/DoubleType.java +66 -0
  216. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/FloatType.java +66 -0
  217. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/FullFrame.java +202 -0
  218. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/IntegerType.java +66 -0
  219. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/LessZeroFrame.java +103 -0
  220. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/LongType.java +66 -0
  221. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/MoreZeroFrame.java +161 -0
  222. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/NullType.java +66 -0
  223. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/ObjectType.java +107 -0
  224. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/SameOneFrame.java +115 -0
  225. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/SameZeroFrame.java +74 -0
  226. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/StackMapAttribute.java +91 -0
  227. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/StackMapFrame.java +117 -0
  228. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/StackMapTableAttribute.java +93 -0
  229. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/TopType.java +66 -0
  230. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/UninitializedThisType.java +66 -0
  231. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/UninitializedType.java +106 -0
  232. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/VerificationType.java +103 -0
  233. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/VerificationTypeFactory.java +112 -0
  234. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/visitor/StackMapFrameVisitor.java +40 -0
  235. data/lib/proguard4.7/src/proguard/classfile/attribute/preverification/visitor/VerificationTypeVisitor.java +65 -0
  236. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AllAttributeVisitor.java +117 -0
  237. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AllBootstrapMethodInfoVisitor.java +55 -0
  238. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AllExceptionInfoVisitor.java +55 -0
  239. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AllInnerClassesInfoVisitor.java +55 -0
  240. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AttributeNameFilter.java +368 -0
  241. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/AttributeVisitor.java +90 -0
  242. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java +40 -0
  243. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java +37 -0
  244. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java +38 -0
  245. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java +38 -0
  246. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java +38 -0
  247. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java +38 -0
  248. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/MultiAttributeVisitor.java +365 -0
  249. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/NonEmptyAttributeFilter.java +293 -0
  250. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/RequiredAttributeFilter.java +360 -0
  251. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/StackSizeComputer.java +378 -0
  252. data/lib/proguard4.7/src/proguard/classfile/attribute/visitor/package.html +3 -0
  253. data/lib/proguard4.7/src/proguard/classfile/constant/ClassConstant.java +105 -0
  254. data/lib/proguard4.7/src/proguard/classfile/constant/Constant.java +68 -0
  255. data/lib/proguard4.7/src/proguard/classfile/constant/DoubleConstant.java +82 -0
  256. data/lib/proguard4.7/src/proguard/classfile/constant/FieldrefConstant.java +71 -0
  257. data/lib/proguard4.7/src/proguard/classfile/constant/FloatConstant.java +82 -0
  258. data/lib/proguard4.7/src/proguard/classfile/constant/IntegerConstant.java +82 -0
  259. data/lib/proguard4.7/src/proguard/classfile/constant/InterfaceMethodrefConstant.java +71 -0
  260. data/lib/proguard4.7/src/proguard/classfile/constant/InvokeDynamicConstant.java +148 -0
  261. data/lib/proguard4.7/src/proguard/classfile/constant/LongConstant.java +82 -0
  262. data/lib/proguard4.7/src/proguard/classfile/constant/MethodHandleConstant.java +124 -0
  263. data/lib/proguard4.7/src/proguard/classfile/constant/MethodTypeConstant.java +93 -0
  264. data/lib/proguard4.7/src/proguard/classfile/constant/MethodrefConstant.java +71 -0
  265. data/lib/proguard4.7/src/proguard/classfile/constant/NameAndTypeConstant.java +119 -0
  266. data/lib/proguard4.7/src/proguard/classfile/constant/RefConstant.java +130 -0
  267. data/lib/proguard4.7/src/proguard/classfile/constant/StringConstant.java +135 -0
  268. data/lib/proguard4.7/src/proguard/classfile/constant/Utf8Constant.java +285 -0
  269. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/AllConstantVisitor.java +53 -0
  270. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/BootstrapMethodHandleTraveler.java +100 -0
  271. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/ConstantTagFilter.java +86 -0
  272. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/ConstantVisitor.java +49 -0
  273. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/ExceptClassConstantFilter.java +69 -0
  274. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/MethodrefTraveler.java +60 -0
  275. data/lib/proguard4.7/src/proguard/classfile/constant/visitor/package.html +3 -0
  276. data/lib/proguard4.7/src/proguard/classfile/editor/AccessFixer.java +180 -0
  277. data/lib/proguard4.7/src/proguard/classfile/editor/AnnotationAdder.java +153 -0
  278. data/lib/proguard4.7/src/proguard/classfile/editor/AnnotationsAttributeEditor.java +67 -0
  279. data/lib/proguard4.7/src/proguard/classfile/editor/AttributeAdder.java +457 -0
  280. data/lib/proguard4.7/src/proguard/classfile/editor/AttributeSorter.java +89 -0
  281. data/lib/proguard4.7/src/proguard/classfile/editor/AttributesEditor.java +269 -0
  282. data/lib/proguard4.7/src/proguard/classfile/editor/BridgeMethodFixer.java +117 -0
  283. data/lib/proguard4.7/src/proguard/classfile/editor/ClassEditor.java +255 -0
  284. data/lib/proguard4.7/src/proguard/classfile/editor/ClassElementSorter.java +52 -0
  285. data/lib/proguard4.7/src/proguard/classfile/editor/ClassMemberSorter.java +69 -0
  286. data/lib/proguard4.7/src/proguard/classfile/editor/ClassReferenceFixer.java +546 -0
  287. data/lib/proguard4.7/src/proguard/classfile/editor/CodeAttributeComposer.java +843 -0
  288. data/lib/proguard4.7/src/proguard/classfile/editor/CodeAttributeEditor.java +1104 -0
  289. data/lib/proguard4.7/src/proguard/classfile/editor/CodeAttributeEditorResetter.java +60 -0
  290. data/lib/proguard4.7/src/proguard/classfile/editor/ComparableConstant.java +249 -0
  291. data/lib/proguard4.7/src/proguard/classfile/editor/ConstantAdder.java +239 -0
  292. data/lib/proguard4.7/src/proguard/classfile/editor/ConstantPoolEditor.java +782 -0
  293. data/lib/proguard4.7/src/proguard/classfile/editor/ConstantPoolRemapper.java +662 -0
  294. data/lib/proguard4.7/src/proguard/classfile/editor/ConstantPoolShrinker.java +578 -0
  295. data/lib/proguard4.7/src/proguard/classfile/editor/ConstantPoolSorter.java +123 -0
  296. data/lib/proguard4.7/src/proguard/classfile/editor/ElementValueAdder.java +217 -0
  297. data/lib/proguard4.7/src/proguard/classfile/editor/ElementValuesEditor.java +238 -0
  298. data/lib/proguard4.7/src/proguard/classfile/editor/ExceptionAdder.java +65 -0
  299. data/lib/proguard4.7/src/proguard/classfile/editor/ExceptionInfoAdder.java +67 -0
  300. data/lib/proguard4.7/src/proguard/classfile/editor/ExceptionsAttributeEditor.java +68 -0
  301. data/lib/proguard4.7/src/proguard/classfile/editor/InnerClassesAccessFixer.java +83 -0
  302. data/lib/proguard4.7/src/proguard/classfile/editor/InstructionAdder.java +76 -0
  303. data/lib/proguard4.7/src/proguard/classfile/editor/InstructionWriter.java +278 -0
  304. data/lib/proguard4.7/src/proguard/classfile/editor/InterfaceAdder.java +62 -0
  305. data/lib/proguard4.7/src/proguard/classfile/editor/InterfaceSorter.java +152 -0
  306. data/lib/proguard4.7/src/proguard/classfile/editor/InterfacesEditor.java +122 -0
  307. data/lib/proguard4.7/src/proguard/classfile/editor/LineNumberInfoAdder.java +59 -0
  308. data/lib/proguard4.7/src/proguard/classfile/editor/LineNumberTableAttributeEditor.java +67 -0
  309. data/lib/proguard4.7/src/proguard/classfile/editor/LocalVariableInfoAdder.java +67 -0
  310. data/lib/proguard4.7/src/proguard/classfile/editor/LocalVariableTableAttributeEditor.java +67 -0
  311. data/lib/proguard4.7/src/proguard/classfile/editor/LocalVariableTypeInfoAdder.java +68 -0
  312. data/lib/proguard4.7/src/proguard/classfile/editor/LocalVariableTypeTableAttributeEditor.java +68 -0
  313. data/lib/proguard4.7/src/proguard/classfile/editor/MemberAdder.java +288 -0
  314. data/lib/proguard4.7/src/proguard/classfile/editor/MemberReferenceFixer.java +447 -0
  315. data/lib/proguard4.7/src/proguard/classfile/editor/MethodInvocationFixer.java +243 -0
  316. data/lib/proguard4.7/src/proguard/classfile/editor/NameAndTypeShrinker.java +188 -0
  317. data/lib/proguard4.7/src/proguard/classfile/editor/NamedAttributeDeleter.java +54 -0
  318. data/lib/proguard4.7/src/proguard/classfile/editor/ParameterAnnotationsAttributeEditor.java +71 -0
  319. data/lib/proguard4.7/src/proguard/classfile/editor/StackSizeUpdater.java +54 -0
  320. data/lib/proguard4.7/src/proguard/classfile/editor/SubclassAdder.java +59 -0
  321. data/lib/proguard4.7/src/proguard/classfile/editor/SubclassToAdder.java +60 -0
  322. data/lib/proguard4.7/src/proguard/classfile/editor/Utf8Shrinker.java +455 -0
  323. data/lib/proguard4.7/src/proguard/classfile/editor/VariableCleaner.java +267 -0
  324. data/lib/proguard4.7/src/proguard/classfile/editor/VariableEditor.java +130 -0
  325. data/lib/proguard4.7/src/proguard/classfile/editor/VariableRemapper.java +156 -0
  326. data/lib/proguard4.7/src/proguard/classfile/editor/VariableSizeUpdater.java +105 -0
  327. data/lib/proguard4.7/src/proguard/classfile/editor/package.html +3 -0
  328. data/lib/proguard4.7/src/proguard/classfile/instruction/BranchInstruction.java +180 -0
  329. data/lib/proguard4.7/src/proguard/classfile/instruction/ConstantInstruction.java +309 -0
  330. data/lib/proguard4.7/src/proguard/classfile/instruction/Instruction.java +920 -0
  331. data/lib/proguard4.7/src/proguard/classfile/instruction/InstructionConstants.java +449 -0
  332. data/lib/proguard4.7/src/proguard/classfile/instruction/InstructionFactory.java +300 -0
  333. data/lib/proguard4.7/src/proguard/classfile/instruction/InstructionUtil.java +67 -0
  334. data/lib/proguard4.7/src/proguard/classfile/instruction/LookUpSwitchInstruction.java +135 -0
  335. data/lib/proguard4.7/src/proguard/classfile/instruction/SimpleInstruction.java +255 -0
  336. data/lib/proguard4.7/src/proguard/classfile/instruction/SwitchInstruction.java +83 -0
  337. data/lib/proguard4.7/src/proguard/classfile/instruction/TableSwitchInstruction.java +139 -0
  338. data/lib/proguard4.7/src/proguard/classfile/instruction/VariableInstruction.java +372 -0
  339. data/lib/proguard4.7/src/proguard/classfile/instruction/package.html +9 -0
  340. data/lib/proguard4.7/src/proguard/classfile/instruction/visitor/AllInstructionVisitor.java +56 -0
  341. data/lib/proguard4.7/src/proguard/classfile/instruction/visitor/InstructionCounter.java +59 -0
  342. data/lib/proguard4.7/src/proguard/classfile/instruction/visitor/InstructionVisitor.java +42 -0
  343. data/lib/proguard4.7/src/proguard/classfile/instruction/visitor/MultiInstructionVisitor.java +131 -0
  344. data/lib/proguard4.7/src/proguard/classfile/instruction/visitor/package.html +3 -0
  345. data/lib/proguard4.7/src/proguard/classfile/io/LibraryClassReader.java +383 -0
  346. data/lib/proguard4.7/src/proguard/classfile/io/ProgramClassReader.java +919 -0
  347. data/lib/proguard4.7/src/proguard/classfile/io/ProgramClassWriter.java +735 -0
  348. data/lib/proguard4.7/src/proguard/classfile/io/RuntimeDataInput.java +223 -0
  349. data/lib/proguard4.7/src/proguard/classfile/io/RuntimeDataOutput.java +224 -0
  350. data/lib/proguard4.7/src/proguard/classfile/io/package.html +3 -0
  351. data/lib/proguard4.7/src/proguard/classfile/package.html +15 -0
  352. data/lib/proguard4.7/src/proguard/classfile/util/AccessUtil.java +105 -0
  353. data/lib/proguard4.7/src/proguard/classfile/util/ClassReferenceInitializer.java +559 -0
  354. data/lib/proguard4.7/src/proguard/classfile/util/ClassSubHierarchyInitializer.java +77 -0
  355. data/lib/proguard4.7/src/proguard/classfile/util/ClassSuperHierarchyInitializer.java +163 -0
  356. data/lib/proguard4.7/src/proguard/classfile/util/ClassUtil.java +1227 -0
  357. data/lib/proguard4.7/src/proguard/classfile/util/DescriptorClassEnumeration.java +236 -0
  358. data/lib/proguard4.7/src/proguard/classfile/util/DynamicClassReferenceInitializer.java +485 -0
  359. data/lib/proguard4.7/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java +944 -0
  360. data/lib/proguard4.7/src/proguard/classfile/util/ExternalTypeEnumeration.java +106 -0
  361. data/lib/proguard4.7/src/proguard/classfile/util/InstructionSequenceMatcher.java +754 -0
  362. data/lib/proguard4.7/src/proguard/classfile/util/InternalTypeEnumeration.java +204 -0
  363. data/lib/proguard4.7/src/proguard/classfile/util/MemberFinder.java +197 -0
  364. data/lib/proguard4.7/src/proguard/classfile/util/MethodLinker.java +160 -0
  365. data/lib/proguard4.7/src/proguard/classfile/util/SimplifiedVisitor.java +834 -0
  366. data/lib/proguard4.7/src/proguard/classfile/util/StringReferenceInitializer.java +90 -0
  367. data/lib/proguard4.7/src/proguard/classfile/util/StringSharer.java +172 -0
  368. data/lib/proguard4.7/src/proguard/classfile/util/WarningPrinter.java +136 -0
  369. data/lib/proguard4.7/src/proguard/classfile/util/package.html +3 -0
  370. data/lib/proguard4.7/src/proguard/classfile/visitor/AllClassVisitor.java +47 -0
  371. data/lib/proguard4.7/src/proguard/classfile/visitor/AllFieldVisitor.java +55 -0
  372. data/lib/proguard4.7/src/proguard/classfile/visitor/AllMemberVisitor.java +57 -0
  373. data/lib/proguard4.7/src/proguard/classfile/visitor/AllMethodVisitor.java +55 -0
  374. data/lib/proguard4.7/src/proguard/classfile/visitor/BottomClassFilter.java +69 -0
  375. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassAccessFilter.java +88 -0
  376. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassCleaner.java +275 -0
  377. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassCollector.java +58 -0
  378. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassCounter.java +56 -0
  379. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassHierarchyTraveler.java +91 -0
  380. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassNameFilter.java +112 -0
  381. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassPoolFiller.java +55 -0
  382. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassPoolVisitor.java +37 -0
  383. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassPresenceFilter.java +93 -0
  384. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassPrinter.java +1011 -0
  385. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassVersionFilter.java +85 -0
  386. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassVersionSetter.java +83 -0
  387. data/lib/proguard4.7/src/proguard/classfile/visitor/ClassVisitor.java +36 -0
  388. data/lib/proguard4.7/src/proguard/classfile/visitor/ConcreteClassDownTraveler.java +100 -0
  389. data/lib/proguard4.7/src/proguard/classfile/visitor/DotClassClassVisitor.java +89 -0
  390. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptClassFilter.java +69 -0
  391. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptClassesFilter.java +90 -0
  392. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionCounter.java +52 -0
  393. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionExcludedOffsetFilter.java +64 -0
  394. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionHandlerConstantVisitor.java +62 -0
  395. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionHandlerFilter.java +70 -0
  396. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionOffsetFilter.java +64 -0
  397. data/lib/proguard4.7/src/proguard/classfile/visitor/ExceptionRangeFilter.java +68 -0
  398. data/lib/proguard4.7/src/proguard/classfile/visitor/ImplementedClassConstantFilter.java +69 -0
  399. data/lib/proguard4.7/src/proguard/classfile/visitor/ImplementedClassFilter.java +71 -0
  400. data/lib/proguard4.7/src/proguard/classfile/visitor/ImplementingClassConstantFilter.java +70 -0
  401. data/lib/proguard4.7/src/proguard/classfile/visitor/LibraryClassFilter.java +60 -0
  402. data/lib/proguard4.7/src/proguard/classfile/visitor/LibraryMemberFilter.java +73 -0
  403. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberAccessFilter.java +122 -0
  404. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberClassAccessFilter.java +106 -0
  405. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberCollector.java +59 -0
  406. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberCounter.java +72 -0
  407. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberDescriptorFilter.java +113 -0
  408. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberNameFilter.java +113 -0
  409. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberToClassVisitor.java +90 -0
  410. data/lib/proguard4.7/src/proguard/classfile/visitor/MemberVisitor.java +40 -0
  411. data/lib/proguard4.7/src/proguard/classfile/visitor/MethodImplementationFilter.java +70 -0
  412. data/lib/proguard4.7/src/proguard/classfile/visitor/MethodImplementationTraveler.java +128 -0
  413. data/lib/proguard4.7/src/proguard/classfile/visitor/MultiClassPoolVisitor.java +88 -0
  414. data/lib/proguard4.7/src/proguard/classfile/visitor/MultiClassVisitor.java +97 -0
  415. data/lib/proguard4.7/src/proguard/classfile/visitor/MultiMemberVisitor.java +113 -0
  416. data/lib/proguard4.7/src/proguard/classfile/visitor/NamedClassVisitor.java +49 -0
  417. data/lib/proguard4.7/src/proguard/classfile/visitor/NamedFieldVisitor.java +61 -0
  418. data/lib/proguard4.7/src/proguard/classfile/visitor/NamedMethodVisitor.java +61 -0
  419. data/lib/proguard4.7/src/proguard/classfile/visitor/ProgramClassFilter.java +60 -0
  420. data/lib/proguard4.7/src/proguard/classfile/visitor/ProgramMemberFilter.java +73 -0
  421. data/lib/proguard4.7/src/proguard/classfile/visitor/ReferencedClassVisitor.java +255 -0
  422. data/lib/proguard4.7/src/proguard/classfile/visitor/ReferencedMemberVisitor.java +73 -0
  423. data/lib/proguard4.7/src/proguard/classfile/visitor/SimilarMemberVisitor.java +125 -0
  424. data/lib/proguard4.7/src/proguard/classfile/visitor/SimpleClassPrinter.java +167 -0
  425. data/lib/proguard4.7/src/proguard/classfile/visitor/SubclassFilter.java +91 -0
  426. data/lib/proguard4.7/src/proguard/classfile/visitor/SubclassTraveler.java +60 -0
  427. data/lib/proguard4.7/src/proguard/classfile/visitor/VariableClassVisitor.java +78 -0
  428. data/lib/proguard4.7/src/proguard/classfile/visitor/VariableMemberVisitor.java +96 -0
  429. data/lib/proguard4.7/src/proguard/classfile/visitor/package.html +40 -0
  430. data/lib/proguard4.7/src/proguard/evaluation/BasicBranchUnit.java +126 -0
  431. data/lib/proguard4.7/src/proguard/evaluation/BasicInvocationUnit.java +425 -0
  432. data/lib/proguard4.7/src/proguard/evaluation/BranchUnit.java +63 -0
  433. data/lib/proguard4.7/src/proguard/evaluation/ClassConstantValueFactory.java +53 -0
  434. data/lib/proguard4.7/src/proguard/evaluation/ConstantValueFactory.java +113 -0
  435. data/lib/proguard4.7/src/proguard/evaluation/InvocationUnit.java +62 -0
  436. data/lib/proguard4.7/src/proguard/evaluation/Processor.java +908 -0
  437. data/lib/proguard4.7/src/proguard/evaluation/Stack.java +560 -0
  438. data/lib/proguard4.7/src/proguard/evaluation/TracedStack.java +342 -0
  439. data/lib/proguard4.7/src/proguard/evaluation/TracedVariables.java +199 -0
  440. data/lib/proguard4.7/src/proguard/evaluation/Variables.java +347 -0
  441. data/lib/proguard4.7/src/proguard/evaluation/value/Category1Value.java +41 -0
  442. data/lib/proguard4.7/src/proguard/evaluation/value/Category2Value.java +41 -0
  443. data/lib/proguard4.7/src/proguard/evaluation/value/ComparisonValue.java +69 -0
  444. data/lib/proguard4.7/src/proguard/evaluation/value/CompositeDoubleValue.java +81 -0
  445. data/lib/proguard4.7/src/proguard/evaluation/value/CompositeFloatValue.java +81 -0
  446. data/lib/proguard4.7/src/proguard/evaluation/value/CompositeIntegerValue.java +87 -0
  447. data/lib/proguard4.7/src/proguard/evaluation/value/CompositeLongValue.java +87 -0
  448. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedByteValue.java +64 -0
  449. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedCharacterValue.java +64 -0
  450. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedDoubleValue.java +64 -0
  451. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedFloatValue.java +64 -0
  452. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedIntegerValue.java +64 -0
  453. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedLongValue.java +64 -0
  454. data/lib/proguard4.7/src/proguard/evaluation/value/ConvertedShortValue.java +64 -0
  455. data/lib/proguard4.7/src/proguard/evaluation/value/DoubleValue.java +359 -0
  456. data/lib/proguard4.7/src/proguard/evaluation/value/FloatValue.java +359 -0
  457. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedDoubleValue.java +67 -0
  458. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedFloatValue.java +67 -0
  459. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedIntegerValue.java +67 -0
  460. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedLongValue.java +67 -0
  461. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedReferenceValue.java +102 -0
  462. data/lib/proguard4.7/src/proguard/evaluation/value/IdentifiedValueFactory.java +75 -0
  463. data/lib/proguard4.7/src/proguard/evaluation/value/InstructionOffsetValue.java +307 -0
  464. data/lib/proguard4.7/src/proguard/evaluation/value/IntegerValue.java +1002 -0
  465. data/lib/proguard4.7/src/proguard/evaluation/value/LongValue.java +554 -0
  466. data/lib/proguard4.7/src/proguard/evaluation/value/NegatedDoubleValue.java +71 -0
  467. data/lib/proguard4.7/src/proguard/evaluation/value/NegatedFloatValue.java +71 -0
  468. data/lib/proguard4.7/src/proguard/evaluation/value/NegatedIntegerValue.java +71 -0
  469. data/lib/proguard4.7/src/proguard/evaluation/value/NegatedLongValue.java +71 -0
  470. data/lib/proguard4.7/src/proguard/evaluation/value/ParticularDoubleValue.java +216 -0
  471. data/lib/proguard4.7/src/proguard/evaluation/value/ParticularFloatValue.java +216 -0
  472. data/lib/proguard4.7/src/proguard/evaluation/value/ParticularIntegerValue.java +383 -0
  473. data/lib/proguard4.7/src/proguard/evaluation/value/ParticularLongValue.java +271 -0
  474. data/lib/proguard4.7/src/proguard/evaluation/value/ReferenceValue.java +540 -0
  475. data/lib/proguard4.7/src/proguard/evaluation/value/SpecificDoubleValue.java +186 -0
  476. data/lib/proguard4.7/src/proguard/evaluation/value/SpecificFloatValue.java +186 -0
  477. data/lib/proguard4.7/src/proguard/evaluation/value/SpecificIntegerValue.java +354 -0
  478. data/lib/proguard4.7/src/proguard/evaluation/value/SpecificLongValue.java +259 -0
  479. data/lib/proguard4.7/src/proguard/evaluation/value/SpecificValueFactory.java +97 -0
  480. data/lib/proguard4.7/src/proguard/evaluation/value/TopValue.java +79 -0
  481. data/lib/proguard4.7/src/proguard/evaluation/value/UnknownDoubleValue.java +125 -0
  482. data/lib/proguard4.7/src/proguard/evaluation/value/UnknownFloatValue.java +125 -0
  483. data/lib/proguard4.7/src/proguard/evaluation/value/UnknownIntegerValue.java +216 -0
  484. data/lib/proguard4.7/src/proguard/evaluation/value/UnknownLongValue.java +160 -0
  485. data/lib/proguard4.7/src/proguard/evaluation/value/Value.java +169 -0
  486. data/lib/proguard4.7/src/proguard/evaluation/value/ValueFactory.java +193 -0
  487. data/lib/proguard4.7/src/proguard/evaluation/value/package.html +3 -0
  488. data/lib/proguard4.7/src/proguard/gui/ClassPathPanel.java +441 -0
  489. data/lib/proguard4.7/src/proguard/gui/ClassSpecificationDialog.java +546 -0
  490. data/lib/proguard4.7/src/proguard/gui/ClassSpecificationsPanel.java +231 -0
  491. data/lib/proguard4.7/src/proguard/gui/ExtensionFileFilter.java +78 -0
  492. data/lib/proguard4.7/src/proguard/gui/FilterBuilder.java +208 -0
  493. data/lib/proguard4.7/src/proguard/gui/FilterDialog.java +320 -0
  494. data/lib/proguard4.7/src/proguard/gui/GUIResources.java +56 -0
  495. data/lib/proguard4.7/src/proguard/gui/GUIResources.properties +643 -0
  496. data/lib/proguard4.7/src/proguard/gui/KeepSpecificationsPanel.java +81 -0
  497. data/lib/proguard4.7/src/proguard/gui/ListPanel.java +341 -0
  498. data/lib/proguard4.7/src/proguard/gui/MANIFEST.MF +3 -0
  499. data/lib/proguard4.7/src/proguard/gui/MemberSpecificationDialog.java +509 -0
  500. data/lib/proguard4.7/src/proguard/gui/MemberSpecificationsPanel.java +304 -0
  501. data/lib/proguard4.7/src/proguard/gui/MessageDialogRunnable.java +90 -0
  502. data/lib/proguard4.7/src/proguard/gui/OptimizationsDialog.java +251 -0
  503. data/lib/proguard4.7/src/proguard/gui/ProGuardGUI.java +1777 -0
  504. data/lib/proguard4.7/src/proguard/gui/ProGuardRunnable.java +154 -0
  505. data/lib/proguard4.7/src/proguard/gui/ReTraceRunnable.java +149 -0
  506. data/lib/proguard4.7/src/proguard/gui/SwingUtil.java +82 -0
  507. data/lib/proguard4.7/src/proguard/gui/TabbedPane.java +229 -0
  508. data/lib/proguard4.7/src/proguard/gui/TextAreaOutputStream.java +81 -0
  509. data/lib/proguard4.7/src/proguard/gui/arrow.gif +0 -0
  510. data/lib/proguard4.7/src/proguard/gui/boilerplate.pro +410 -0
  511. data/lib/proguard4.7/src/proguard/gui/default.pro +318 -0
  512. data/lib/proguard4.7/src/proguard/gui/package.html +3 -0
  513. data/lib/proguard4.7/src/proguard/gui/splash/BufferedSprite.java +145 -0
  514. data/lib/proguard4.7/src/proguard/gui/splash/CircleSprite.java +74 -0
  515. data/lib/proguard4.7/src/proguard/gui/splash/ClipSprite.java +85 -0
  516. data/lib/proguard4.7/src/proguard/gui/splash/ColorSprite.java +65 -0
  517. data/lib/proguard4.7/src/proguard/gui/splash/CompositeSprite.java +56 -0
  518. data/lib/proguard4.7/src/proguard/gui/splash/ConstantColor.java +51 -0
  519. data/lib/proguard4.7/src/proguard/gui/splash/ConstantDouble.java +49 -0
  520. data/lib/proguard4.7/src/proguard/gui/splash/ConstantFont.java +46 -0
  521. data/lib/proguard4.7/src/proguard/gui/splash/ConstantInt.java +49 -0
  522. data/lib/proguard4.7/src/proguard/gui/splash/ConstantString.java +49 -0
  523. data/lib/proguard4.7/src/proguard/gui/splash/ConstantTiming.java +57 -0
  524. data/lib/proguard4.7/src/proguard/gui/splash/FontSprite.java +65 -0
  525. data/lib/proguard4.7/src/proguard/gui/splash/ImageSprite.java +76 -0
  526. data/lib/proguard4.7/src/proguard/gui/splash/LinearColor.java +72 -0
  527. data/lib/proguard4.7/src/proguard/gui/splash/LinearDouble.java +55 -0
  528. data/lib/proguard4.7/src/proguard/gui/splash/LinearInt.java +55 -0
  529. data/lib/proguard4.7/src/proguard/gui/splash/LinearTiming.java +55 -0
  530. data/lib/proguard4.7/src/proguard/gui/splash/OverrideGraphics2D.java +598 -0
  531. data/lib/proguard4.7/src/proguard/gui/splash/RectangleSprite.java +114 -0
  532. data/lib/proguard4.7/src/proguard/gui/splash/SawToothTiming.java +53 -0
  533. data/lib/proguard4.7/src/proguard/gui/splash/ShadowedSprite.java +109 -0
  534. data/lib/proguard4.7/src/proguard/gui/splash/SineTiming.java +53 -0
  535. data/lib/proguard4.7/src/proguard/gui/splash/SmoothTiming.java +66 -0
  536. data/lib/proguard4.7/src/proguard/gui/splash/SplashPanel.java +235 -0
  537. data/lib/proguard4.7/src/proguard/gui/splash/Sprite.java +41 -0
  538. data/lib/proguard4.7/src/proguard/gui/splash/TextSprite.java +89 -0
  539. data/lib/proguard4.7/src/proguard/gui/splash/TimeSwitchSprite.java +75 -0
  540. data/lib/proguard4.7/src/proguard/gui/splash/Timing.java +34 -0
  541. data/lib/proguard4.7/src/proguard/gui/splash/TypeWriterString.java +71 -0
  542. data/lib/proguard4.7/src/proguard/gui/splash/VariableColor.java +36 -0
  543. data/lib/proguard4.7/src/proguard/gui/splash/VariableDouble.java +34 -0
  544. data/lib/proguard4.7/src/proguard/gui/splash/VariableFont.java +36 -0
  545. data/lib/proguard4.7/src/proguard/gui/splash/VariableInt.java +34 -0
  546. data/lib/proguard4.7/src/proguard/gui/splash/VariableSizeFont.java +65 -0
  547. data/lib/proguard4.7/src/proguard/gui/splash/VariableString.java +34 -0
  548. data/lib/proguard4.7/src/proguard/gui/splash/package.html +4 -0
  549. data/lib/proguard4.7/src/proguard/gui/vtitle.png +0 -0
  550. data/lib/proguard4.7/src/proguard/io/CascadingDataEntryWriter.java +94 -0
  551. data/lib/proguard4.7/src/proguard/io/ClassFilter.java +59 -0
  552. data/lib/proguard4.7/src/proguard/io/ClassReader.java +115 -0
  553. data/lib/proguard4.7/src/proguard/io/ClassRewriter.java +80 -0
  554. data/lib/proguard4.7/src/proguard/io/DataEntry.java +62 -0
  555. data/lib/proguard4.7/src/proguard/io/DataEntryClassWriter.java +85 -0
  556. data/lib/proguard4.7/src/proguard/io/DataEntryCopier.java +247 -0
  557. data/lib/proguard4.7/src/proguard/io/DataEntryDirectoryFilter.java +40 -0
  558. data/lib/proguard4.7/src/proguard/io/DataEntryFilter.java +38 -0
  559. data/lib/proguard4.7/src/proguard/io/DataEntryNameFilter.java +54 -0
  560. data/lib/proguard4.7/src/proguard/io/DataEntryObfuscator.java +150 -0
  561. data/lib/proguard4.7/src/proguard/io/DataEntryParentFilter.java +51 -0
  562. data/lib/proguard4.7/src/proguard/io/DataEntryPump.java +43 -0
  563. data/lib/proguard4.7/src/proguard/io/DataEntryReader.java +38 -0
  564. data/lib/proguard4.7/src/proguard/io/DataEntryRenamer.java +104 -0
  565. data/lib/proguard4.7/src/proguard/io/DataEntryRewriter.java +148 -0
  566. data/lib/proguard4.7/src/proguard/io/DataEntryWriter.java +73 -0
  567. data/lib/proguard4.7/src/proguard/io/DirectoryFilter.java +58 -0
  568. data/lib/proguard4.7/src/proguard/io/DirectoryPump.java +78 -0
  569. data/lib/proguard4.7/src/proguard/io/DirectoryWriter.java +165 -0
  570. data/lib/proguard4.7/src/proguard/io/FileDataEntry.java +96 -0
  571. data/lib/proguard4.7/src/proguard/io/FilteredDataEntryReader.java +90 -0
  572. data/lib/proguard4.7/src/proguard/io/FilteredDataEntryWriter.java +125 -0
  573. data/lib/proguard4.7/src/proguard/io/Finisher.java +37 -0
  574. data/lib/proguard4.7/src/proguard/io/JarReader.java +75 -0
  575. data/lib/proguard4.7/src/proguard/io/JarWriter.java +235 -0
  576. data/lib/proguard4.7/src/proguard/io/ManifestRewriter.java +216 -0
  577. data/lib/proguard4.7/src/proguard/io/NameFilter.java +83 -0
  578. data/lib/proguard4.7/src/proguard/io/ParentDataEntryWriter.java +75 -0
  579. data/lib/proguard4.7/src/proguard/io/RenamedDataEntry.java +83 -0
  580. data/lib/proguard4.7/src/proguard/io/ZipDataEntry.java +98 -0
  581. data/lib/proguard4.7/src/proguard/io/package.html +4 -0
  582. data/lib/proguard4.7/src/proguard/obfuscate/AttributeShrinker.java +120 -0
  583. data/lib/proguard4.7/src/proguard/obfuscate/AttributeUsageMarker.java +71 -0
  584. data/lib/proguard4.7/src/proguard/obfuscate/ClassObfuscator.java +533 -0
  585. data/lib/proguard4.7/src/proguard/obfuscate/ClassRenamer.java +109 -0
  586. data/lib/proguard4.7/src/proguard/obfuscate/DictionaryNameFactory.java +189 -0
  587. data/lib/proguard4.7/src/proguard/obfuscate/MapCleaner.java +57 -0
  588. data/lib/proguard4.7/src/proguard/obfuscate/MappingKeeper.java +177 -0
  589. data/lib/proguard4.7/src/proguard/obfuscate/MappingPrinter.java +147 -0
  590. data/lib/proguard4.7/src/proguard/obfuscate/MappingProcessor.java +79 -0
  591. data/lib/proguard4.7/src/proguard/obfuscate/MappingReader.java +199 -0
  592. data/lib/proguard4.7/src/proguard/obfuscate/MemberNameCleaner.java +60 -0
  593. data/lib/proguard4.7/src/proguard/obfuscate/MemberNameCollector.java +106 -0
  594. data/lib/proguard4.7/src/proguard/obfuscate/MemberNameConflictFixer.java +159 -0
  595. data/lib/proguard4.7/src/proguard/obfuscate/MemberNameFilter.java +120 -0
  596. data/lib/proguard4.7/src/proguard/obfuscate/MemberObfuscator.java +230 -0
  597. data/lib/proguard4.7/src/proguard/obfuscate/MemberSpecialNameFilter.java +101 -0
  598. data/lib/proguard4.7/src/proguard/obfuscate/MultiMappingProcessor.java +96 -0
  599. data/lib/proguard4.7/src/proguard/obfuscate/NameFactory.java +34 -0
  600. data/lib/proguard4.7/src/proguard/obfuscate/NameFactoryResetter.java +59 -0
  601. data/lib/proguard4.7/src/proguard/obfuscate/NameMarker.java +166 -0
  602. data/lib/proguard4.7/src/proguard/obfuscate/NumericNameFactory.java +49 -0
  603. data/lib/proguard4.7/src/proguard/obfuscate/Obfuscator.java +445 -0
  604. data/lib/proguard4.7/src/proguard/obfuscate/ParameterNameMarker.java +128 -0
  605. data/lib/proguard4.7/src/proguard/obfuscate/SimpleNameFactory.java +156 -0
  606. data/lib/proguard4.7/src/proguard/obfuscate/SourceFileRenamer.java +84 -0
  607. data/lib/proguard4.7/src/proguard/obfuscate/SpecialNameFactory.java +83 -0
  608. data/lib/proguard4.7/src/proguard/obfuscate/package.html +3 -0
  609. data/lib/proguard4.7/src/proguard/optimize/BootstrapMethodArgumentShrinker.java +103 -0
  610. data/lib/proguard4.7/src/proguard/optimize/ChangedCodePrinter.java +297 -0
  611. data/lib/proguard4.7/src/proguard/optimize/ConstantMemberFilter.java +77 -0
  612. data/lib/proguard4.7/src/proguard/optimize/ConstantParameterFilter.java +79 -0
  613. data/lib/proguard4.7/src/proguard/optimize/DuplicateInitializerFixer.java +215 -0
  614. data/lib/proguard4.7/src/proguard/optimize/DuplicateInitializerInvocationFixer.java +161 -0
  615. data/lib/proguard4.7/src/proguard/optimize/KeepMarker.java +95 -0
  616. data/lib/proguard4.7/src/proguard/optimize/KeptClassFilter.java +69 -0
  617. data/lib/proguard4.7/src/proguard/optimize/KeptMemberFilter.java +88 -0
  618. data/lib/proguard4.7/src/proguard/optimize/MemberDescriptorSpecializer.java +138 -0
  619. data/lib/proguard4.7/src/proguard/optimize/MethodDescriptorShrinker.java +317 -0
  620. data/lib/proguard4.7/src/proguard/optimize/MethodStaticizer.java +87 -0
  621. data/lib/proguard4.7/src/proguard/optimize/OptimizationInfoMemberFilter.java +94 -0
  622. data/lib/proguard4.7/src/proguard/optimize/Optimizer.java +963 -0
  623. data/lib/proguard4.7/src/proguard/optimize/ParameterShrinker.java +146 -0
  624. data/lib/proguard4.7/src/proguard/optimize/TailRecursionSimplifier.java +356 -0
  625. data/lib/proguard4.7/src/proguard/optimize/WriteOnlyFieldFilter.java +65 -0
  626. data/lib/proguard4.7/src/proguard/optimize/evaluation/EvaluationShrinker.java +2082 -0
  627. data/lib/proguard4.7/src/proguard/optimize/evaluation/EvaluationSimplifier.java +973 -0
  628. data/lib/proguard4.7/src/proguard/optimize/evaluation/LivenessAnalyzer.java +526 -0
  629. data/lib/proguard4.7/src/proguard/optimize/evaluation/LoadingInvocationUnit.java +195 -0
  630. data/lib/proguard4.7/src/proguard/optimize/evaluation/PartialEvaluator.java +1282 -0
  631. data/lib/proguard4.7/src/proguard/optimize/evaluation/StoringInvocationUnit.java +207 -0
  632. data/lib/proguard4.7/src/proguard/optimize/evaluation/TracedBranchUnit.java +59 -0
  633. data/lib/proguard4.7/src/proguard/optimize/evaluation/VariableOptimizer.java +345 -0
  634. data/lib/proguard4.7/src/proguard/optimize/evaluation/package.html +4 -0
  635. data/lib/proguard4.7/src/proguard/optimize/info/AccessMethodMarker.java +202 -0
  636. data/lib/proguard4.7/src/proguard/optimize/info/BackwardBranchMarker.java +90 -0
  637. data/lib/proguard4.7/src/proguard/optimize/info/CatchExceptionMarker.java +69 -0
  638. data/lib/proguard4.7/src/proguard/optimize/info/CaughtClassFilter.java +63 -0
  639. data/lib/proguard4.7/src/proguard/optimize/info/CaughtClassMarker.java +64 -0
  640. data/lib/proguard4.7/src/proguard/optimize/info/ClassOptimizationInfo.java +165 -0
  641. data/lib/proguard4.7/src/proguard/optimize/info/ClassOptimizationInfoSetter.java +47 -0
  642. data/lib/proguard4.7/src/proguard/optimize/info/DotClassFilter.java +63 -0
  643. data/lib/proguard4.7/src/proguard/optimize/info/DotClassMarker.java +96 -0
  644. data/lib/proguard4.7/src/proguard/optimize/info/ExceptionInstructionChecker.java +193 -0
  645. data/lib/proguard4.7/src/proguard/optimize/info/FieldOptimizationInfo.java +204 -0
  646. data/lib/proguard4.7/src/proguard/optimize/info/InstanceofClassFilter.java +63 -0
  647. data/lib/proguard4.7/src/proguard/optimize/info/InstanceofClassMarker.java +93 -0
  648. data/lib/proguard4.7/src/proguard/optimize/info/InstantiationClassFilter.java +62 -0
  649. data/lib/proguard4.7/src/proguard/optimize/info/InstantiationClassMarker.java +93 -0
  650. data/lib/proguard4.7/src/proguard/optimize/info/MemberOptimizationInfoSetter.java +59 -0
  651. data/lib/proguard4.7/src/proguard/optimize/info/MethodInvocationMarker.java +107 -0
  652. data/lib/proguard4.7/src/proguard/optimize/info/MethodOptimizationInfo.java +302 -0
  653. data/lib/proguard4.7/src/proguard/optimize/info/NoSideEffectMethodMarker.java +91 -0
  654. data/lib/proguard4.7/src/proguard/optimize/info/NonPrivateMemberMarker.java +171 -0
  655. data/lib/proguard4.7/src/proguard/optimize/info/PackageVisibleMemberContainingClassMarker.java +85 -0
  656. data/lib/proguard4.7/src/proguard/optimize/info/PackageVisibleMemberInvokingClassMarker.java +129 -0
  657. data/lib/proguard4.7/src/proguard/optimize/info/ParameterUsageMarker.java +285 -0
  658. data/lib/proguard4.7/src/proguard/optimize/info/ReadWriteFieldMarker.java +163 -0
  659. data/lib/proguard4.7/src/proguard/optimize/info/SideEffectInstructionChecker.java +245 -0
  660. data/lib/proguard4.7/src/proguard/optimize/info/SideEffectMethodMarker.java +175 -0
  661. data/lib/proguard4.7/src/proguard/optimize/info/StaticInitializerContainingClassFilter.java +62 -0
  662. data/lib/proguard4.7/src/proguard/optimize/info/StaticInitializerContainingClassMarker.java +65 -0
  663. data/lib/proguard4.7/src/proguard/optimize/info/SuperInvocationMarker.java +93 -0
  664. data/lib/proguard4.7/src/proguard/optimize/info/VariableUsageMarker.java +96 -0
  665. data/lib/proguard4.7/src/proguard/optimize/info/package.html +4 -0
  666. data/lib/proguard4.7/src/proguard/optimize/package.html +4 -0
  667. data/lib/proguard4.7/src/proguard/optimize/peephole/BranchTargetFinder.java +687 -0
  668. data/lib/proguard4.7/src/proguard/optimize/peephole/ClassFinalizer.java +84 -0
  669. data/lib/proguard4.7/src/proguard/optimize/peephole/ClassMerger.java +576 -0
  670. data/lib/proguard4.7/src/proguard/optimize/peephole/GotoCommonCodeReplacer.java +266 -0
  671. data/lib/proguard4.7/src/proguard/optimize/peephole/GotoGotoReplacer.java +115 -0
  672. data/lib/proguard4.7/src/proguard/optimize/peephole/GotoReturnReplacer.java +115 -0
  673. data/lib/proguard4.7/src/proguard/optimize/peephole/HorizontalClassMerger.java +90 -0
  674. data/lib/proguard4.7/src/proguard/optimize/peephole/InstructionSequenceConstants.java +4424 -0
  675. data/lib/proguard4.7/src/proguard/optimize/peephole/InstructionSequenceReplacer.java +420 -0
  676. data/lib/proguard4.7/src/proguard/optimize/peephole/InstructionSequencesReplacer.java +138 -0
  677. data/lib/proguard4.7/src/proguard/optimize/peephole/MemberPrivatizer.java +103 -0
  678. data/lib/proguard4.7/src/proguard/optimize/peephole/MethodFinalizer.java +93 -0
  679. data/lib/proguard4.7/src/proguard/optimize/peephole/MethodInliner.java +597 -0
  680. data/lib/proguard4.7/src/proguard/optimize/peephole/NopRemover.java +89 -0
  681. data/lib/proguard4.7/src/proguard/optimize/peephole/PeepholeOptimizer.java +103 -0
  682. data/lib/proguard4.7/src/proguard/optimize/peephole/ReachableCodeMarker.java +262 -0
  683. data/lib/proguard4.7/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java +170 -0
  684. data/lib/proguard4.7/src/proguard/optimize/peephole/TargetClassChanger.java +455 -0
  685. data/lib/proguard4.7/src/proguard/optimize/peephole/UnreachableCodeRemover.java +143 -0
  686. data/lib/proguard4.7/src/proguard/optimize/peephole/UnreachableExceptionRemover.java +163 -0
  687. data/lib/proguard4.7/src/proguard/optimize/peephole/VariableShrinker.java +129 -0
  688. data/lib/proguard4.7/src/proguard/optimize/peephole/VerticalClassMerger.java +88 -0
  689. data/lib/proguard4.7/src/proguard/optimize/peephole/package.html +3 -0
  690. data/lib/proguard4.7/src/proguard/package.html +5 -0
  691. data/lib/proguard4.7/src/proguard/preverify/CodePreverifier.java +611 -0
  692. data/lib/proguard4.7/src/proguard/preverify/CodeSubroutineInliner.java +406 -0
  693. data/lib/proguard4.7/src/proguard/preverify/Preverifier.java +73 -0
  694. data/lib/proguard4.7/src/proguard/preverify/SubroutineInliner.java +73 -0
  695. data/lib/proguard4.7/src/proguard/retrace/MANIFEST.MF +3 -0
  696. data/lib/proguard4.7/src/proguard/retrace/ReTrace.java +749 -0
  697. data/lib/proguard4.7/src/proguard/retrace/package.html +4 -0
  698. data/lib/proguard4.7/src/proguard/shrink/AnnotationUsageMarker.java +333 -0
  699. data/lib/proguard4.7/src/proguard/shrink/ClassShrinker.java +458 -0
  700. data/lib/proguard4.7/src/proguard/shrink/InnerUsageMarker.java +174 -0
  701. data/lib/proguard4.7/src/proguard/shrink/InterfaceUsageMarker.java +152 -0
  702. data/lib/proguard4.7/src/proguard/shrink/ShortestUsageMark.java +183 -0
  703. data/lib/proguard4.7/src/proguard/shrink/ShortestUsageMarker.java +277 -0
  704. data/lib/proguard4.7/src/proguard/shrink/ShortestUsagePrinter.java +210 -0
  705. data/lib/proguard4.7/src/proguard/shrink/Shrinker.java +181 -0
  706. data/lib/proguard4.7/src/proguard/shrink/UsageMarker.java +1036 -0
  707. data/lib/proguard4.7/src/proguard/shrink/UsagePrinter.java +177 -0
  708. data/lib/proguard4.7/src/proguard/shrink/UsedClassFilter.java +74 -0
  709. data/lib/proguard4.7/src/proguard/shrink/UsedMemberFilter.java +93 -0
  710. data/lib/proguard4.7/src/proguard/shrink/package.html +3 -0
  711. data/lib/proguard4.7/src/proguard/util/AndMatcher.java +49 -0
  712. data/lib/proguard4.7/src/proguard/util/ClassNameParser.java +216 -0
  713. data/lib/proguard4.7/src/proguard/util/ConstantMatcher.java +48 -0
  714. data/lib/proguard4.7/src/proguard/util/EmptyStringMatcher.java +36 -0
  715. data/lib/proguard4.7/src/proguard/util/ExtensionMatcher.java +63 -0
  716. data/lib/proguard4.7/src/proguard/util/FileNameParser.java +121 -0
  717. data/lib/proguard4.7/src/proguard/util/FixedStringMatcher.java +56 -0
  718. data/lib/proguard4.7/src/proguard/util/ListMatcher.java +69 -0
  719. data/lib/proguard4.7/src/proguard/util/ListParser.java +137 -0
  720. data/lib/proguard4.7/src/proguard/util/ListUtil.java +180 -0
  721. data/lib/proguard4.7/src/proguard/util/NameParser.java +106 -0
  722. data/lib/proguard4.7/src/proguard/util/NotMatcher.java +46 -0
  723. data/lib/proguard4.7/src/proguard/util/OrMatcher.java +49 -0
  724. data/lib/proguard4.7/src/proguard/util/SettableMatcher.java +46 -0
  725. data/lib/proguard4.7/src/proguard/util/StringMatcher.java +38 -0
  726. data/lib/proguard4.7/src/proguard/util/StringParser.java +35 -0
  727. data/lib/proguard4.7/src/proguard/util/VariableStringMatcher.java +126 -0
  728. data/lib/proguard4.7/src/proguard/util/package.html +3 -0
  729. data/lib/proguard4.7/src/proguard/wtk/ProGuardObfuscator.java +141 -0
  730. data/lib/proguard4.7/src/proguard/wtk/default.pro +114 -0
  731. data/lib/proguard4.7/src/proguard/wtk/package.html +3 -0
  732. metadata +960 -10
@@ -0,0 +1,65 @@
1
+ /*
2
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
3
+ * of Java bytecode.
4
+ *
5
+ * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify it
8
+ * under the terms of the GNU General Public License as published by the Free
9
+ * Software Foundation; either version 2 of the License, or (at your option)
10
+ * any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but WITHOUT
13
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
+ * more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License along
18
+ * with this program; if not, write to the Free Software Foundation, Inc.,
19
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ */
21
+ package proguard.optimize;
22
+
23
+ import proguard.classfile.*;
24
+ import proguard.classfile.util.SimplifiedVisitor;
25
+ import proguard.classfile.visitor.MemberVisitor;
26
+ import proguard.optimize.info.ReadWriteFieldMarker;
27
+
28
+ /**
29
+ * This <code>MemberVisitor</code> delegates its visits to program fields to
30
+ * other given <code>MemberVisitor</code> instances, but only when the visited
31
+ * field has been marked as write-only.
32
+ *
33
+ * @see ReadWriteFieldMarker
34
+ * @author Eric Lafortune
35
+ */
36
+ public class WriteOnlyFieldFilter
37
+ extends SimplifiedVisitor
38
+ implements MemberVisitor
39
+ {
40
+ private final MemberVisitor writeOnlyFieldVisitor;
41
+
42
+
43
+ /**
44
+ * Creates a new WriteOnlyFieldFilter.
45
+ * @param writeOnlyFieldVisitor the <code>MemberVisitor</code> to which
46
+ * visits to write-only fields will be delegated.
47
+ */
48
+ public WriteOnlyFieldFilter(MemberVisitor writeOnlyFieldVisitor)
49
+ {
50
+ this.writeOnlyFieldVisitor = writeOnlyFieldVisitor;
51
+ }
52
+
53
+
54
+ // Implementations for MemberVisitor.
55
+
56
+ public void visitProgramField(ProgramClass programClass, ProgramField programField)
57
+ {
58
+
59
+ if (ReadWriteFieldMarker.isWritten(programField) &&
60
+ !ReadWriteFieldMarker.isRead(programField))
61
+ {
62
+ writeOnlyFieldVisitor.visitProgramField(programClass, programField);
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,2082 @@
1
+ /*
2
+ * ProGuard -- shrinking, optimization, obfuscation, and preverification
3
+ * of Java bytecode.
4
+ *
5
+ * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify it
8
+ * under the terms of the GNU General Public License as published by the Free
9
+ * Software Foundation; either version 2 of the License, or (at your option)
10
+ * any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but WITHOUT
13
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
+ * more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License along
18
+ * with this program; if not, write to the Free Software Foundation, Inc.,
19
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ */
21
+ package proguard.optimize.evaluation;
22
+
23
+ import proguard.classfile.*;
24
+ import proguard.classfile.attribute.*;
25
+ import proguard.classfile.attribute.visitor.AttributeVisitor;
26
+ import proguard.classfile.constant.RefConstant;
27
+ import proguard.classfile.constant.visitor.ConstantVisitor;
28
+ import proguard.classfile.editor.CodeAttributeEditor;
29
+ import proguard.classfile.instruction.*;
30
+ import proguard.classfile.instruction.visitor.InstructionVisitor;
31
+ import proguard.classfile.util.*;
32
+ import proguard.classfile.visitor.*;
33
+ import proguard.evaluation.*;
34
+ import proguard.evaluation.value.*;
35
+ import proguard.optimize.info.*;
36
+
37
+ import java.util.Arrays;
38
+
39
+ /**
40
+ * This AttributeVisitor simplifies the code attributes that it visits, based
41
+ * on partial evaluation.
42
+ *
43
+ * @author Eric Lafortune
44
+ */
45
+ public class EvaluationShrinker
46
+ extends SimplifiedVisitor
47
+ implements AttributeVisitor
48
+ {
49
+ //*
50
+ private static final boolean DEBUG_RESULTS = false;
51
+ private static final boolean DEBUG = false;
52
+ /*/
53
+ private static boolean DEBUG_RESULTS = true;
54
+ private static boolean DEBUG = true;
55
+ //*/
56
+
57
+ private final InstructionVisitor extraDeletedInstructionVisitor;
58
+ private final InstructionVisitor extraAddedInstructionVisitor;
59
+
60
+ private final PartialEvaluator partialEvaluator;
61
+ private final PartialEvaluator simplePartialEvaluator = new PartialEvaluator();
62
+ private final SideEffectInstructionChecker sideEffectInstructionChecker = new SideEffectInstructionChecker(true);
63
+ private final MyUnusedParameterSimplifier unusedParameterSimplifier = new MyUnusedParameterSimplifier();
64
+ private final MyProducerMarker producerMarker = new MyProducerMarker();
65
+ private final MyVariableInitializationMarker variableInitializationMarker = new MyVariableInitializationMarker();
66
+ private final MyStackConsistencyFixer stackConsistencyFixer = new MyStackConsistencyFixer();
67
+ private final CodeAttributeEditor codeAttributeEditor = new CodeAttributeEditor(false);
68
+
69
+ private boolean[][] variablesNecessaryAfter = new boolean[ClassConstants.TYPICAL_CODE_LENGTH][ClassConstants.TYPICAL_VARIABLES_SIZE];
70
+ private boolean[][] stacksNecessaryAfter = new boolean[ClassConstants.TYPICAL_CODE_LENGTH][ClassConstants.TYPICAL_STACK_SIZE];
71
+ private boolean[][] stacksSimplifiedBefore = new boolean[ClassConstants.TYPICAL_CODE_LENGTH][ClassConstants.TYPICAL_STACK_SIZE];
72
+ private boolean[] instructionsNecessary = new boolean[ClassConstants.TYPICAL_CODE_LENGTH];
73
+
74
+ private int maxMarkedOffset;
75
+
76
+
77
+ /**
78
+ * Creates a new EvaluationShrinker.
79
+ */
80
+ public EvaluationShrinker()
81
+ {
82
+ this(new PartialEvaluator(), null, null);
83
+ }
84
+
85
+
86
+ /**
87
+ * Creates a new EvaluationShrinker.
88
+ * @param partialEvaluator the partial evaluator that will
89
+ * execute the code and provide
90
+ * information about the results.
91
+ * @param extraDeletedInstructionVisitor an optional extra visitor for all
92
+ * deleted instructions.
93
+ * @param extraAddedInstructionVisitor an optional extra visitor for all
94
+ * added instructions.
95
+ */
96
+ public EvaluationShrinker(PartialEvaluator partialEvaluator,
97
+ InstructionVisitor extraDeletedInstructionVisitor,
98
+ InstructionVisitor extraAddedInstructionVisitor)
99
+ {
100
+ this.partialEvaluator = partialEvaluator;
101
+ this.extraDeletedInstructionVisitor = extraDeletedInstructionVisitor;
102
+ this.extraAddedInstructionVisitor = extraAddedInstructionVisitor;
103
+ }
104
+
105
+
106
+ // Implementations for AttributeVisitor.
107
+
108
+ public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
109
+
110
+
111
+ public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
112
+ {
113
+ // DEBUG = DEBUG_RESULTS =
114
+ // clazz.getName().equals("abc/Def") &&
115
+ // method.getName(clazz).equals("abc");
116
+
117
+ // TODO: Remove this when the evaluation shrinker has stabilized.
118
+ // Catch any unexpected exceptions from the actual visiting method.
119
+ try
120
+ {
121
+ // Process the code.
122
+ visitCodeAttribute0(clazz, method, codeAttribute);
123
+ }
124
+ catch (RuntimeException ex)
125
+ {
126
+ System.err.println("Unexpected error while shrinking instructions after partial evaluation:");
127
+ System.err.println(" Class = ["+clazz.getName()+"]");
128
+ System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
129
+ System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
130
+ System.err.println("Not optimizing this method");
131
+
132
+ if (DEBUG)
133
+ {
134
+ method.accept(clazz, new ClassPrinter());
135
+
136
+ throw ex;
137
+ }
138
+ }
139
+ }
140
+
141
+
142
+ public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)
143
+ {
144
+ if (DEBUG_RESULTS)
145
+ {
146
+ System.out.println();
147
+ System.out.println("Class "+ClassUtil.externalClassName(clazz.getName()));
148
+ System.out.println("Method "+ClassUtil.externalFullMethodDescription(clazz.getName(),
149
+ 0,
150
+ method.getName(clazz),
151
+ method.getDescriptor(clazz)));
152
+ }
153
+
154
+ // Initialize the necessary array.
155
+ initializeNecessary(codeAttribute);
156
+
157
+ // Evaluate the method.
158
+ partialEvaluator.visitCodeAttribute(clazz, method, codeAttribute);
159
+
160
+ int codeLength = codeAttribute.u4codeLength;
161
+
162
+ // Reset the code changes.
163
+ codeAttributeEditor.reset(codeLength);
164
+
165
+ // Mark any unused method parameters on the stack.
166
+ if (DEBUG) System.out.println("Invocation simplification:");
167
+
168
+ for (int offset = 0; offset < codeLength; offset++)
169
+ {
170
+ if (partialEvaluator.isTraced(offset))
171
+ {
172
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
173
+ offset);
174
+
175
+ instruction.accept(clazz, method, codeAttribute, offset, unusedParameterSimplifier);
176
+ }
177
+ }
178
+
179
+ // Mark all essential instructions that have been encountered as used.
180
+ if (DEBUG) System.out.println("Usage initialization: ");
181
+
182
+ maxMarkedOffset = -1;
183
+
184
+ // The invocation of the "super" or "this" <init> method inside a
185
+ // constructor is always necessary.
186
+ int superInitializationOffset = partialEvaluator.superInitializationOffset();
187
+ if (superInitializationOffset != PartialEvaluator.NONE)
188
+ {
189
+ if (DEBUG) System.out.print("(super.<init>)");
190
+
191
+ markInstruction(superInitializationOffset);
192
+ }
193
+
194
+ // Also mark infinite loops and instructions that cause side effects.
195
+ for (int offset = 0; offset < codeLength; offset++)
196
+ {
197
+ if (partialEvaluator.isTraced(offset))
198
+ {
199
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
200
+ offset);
201
+
202
+ // Mark that the instruction is necessary if it is an infinite loop.
203
+ if (instruction.opcode == InstructionConstants.OP_GOTO &&
204
+ ((BranchInstruction)instruction).branchOffset == 0)
205
+ {
206
+ if (DEBUG) System.out.print("(infinite loop)");
207
+ markInstruction(offset);
208
+ }
209
+
210
+ // Mark that the instruction is necessary if it has side effects.
211
+ else if (sideEffectInstructionChecker.hasSideEffects(clazz,
212
+ method,
213
+ codeAttribute,
214
+ offset,
215
+ instruction))
216
+ {
217
+ markInstruction(offset);
218
+ }
219
+ }
220
+ }
221
+ if (DEBUG) System.out.println();
222
+
223
+
224
+ // Globally mark instructions and their produced variables and stack
225
+ // entries on which necessary instructions depend.
226
+ // Instead of doing this recursively, we loop across all instructions,
227
+ // starting at the highest previously unmarked instruction that has
228
+ // been been marked.
229
+ if (DEBUG) System.out.println("Usage marking:");
230
+
231
+ while (maxMarkedOffset >= 0)
232
+ {
233
+ int offset = maxMarkedOffset;
234
+
235
+ maxMarkedOffset = offset - 1;
236
+
237
+ if (partialEvaluator.isTraced(offset))
238
+ {
239
+ if (isInstructionNecessary(offset))
240
+ {
241
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
242
+ offset);
243
+
244
+ instruction.accept(clazz, method, codeAttribute, offset, producerMarker);
245
+ }
246
+
247
+ // Check if this instruction is a branch origin from a branch
248
+ // that straddles some marked code.
249
+ markStraddlingBranches(offset,
250
+ partialEvaluator.branchTargets(offset),
251
+ true);
252
+
253
+ // Check if this instruction is a branch target from a branch
254
+ // that straddles some marked code.
255
+ markStraddlingBranches(offset,
256
+ partialEvaluator.branchOrigins(offset),
257
+ false);
258
+ }
259
+
260
+ if (DEBUG)
261
+ {
262
+ if (maxMarkedOffset > offset)
263
+ {
264
+ System.out.println(" -> "+maxMarkedOffset);
265
+ }
266
+ }
267
+ }
268
+ if (DEBUG) System.out.println();
269
+
270
+
271
+ // Mark variable initializations, even if they aren't strictly necessary.
272
+ // The virtual machine's verification step is not smart enough to see
273
+ // this, and may complain otherwise.
274
+ if (DEBUG) System.out.println("Initialization marking: ");
275
+
276
+ for (int offset = 0; offset < codeLength; offset++)
277
+ {
278
+ // Is it a variable initialization that hasn't been marked yet?
279
+ if (partialEvaluator.isTraced(offset) &&
280
+ !isInstructionNecessary(offset))
281
+ {
282
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
283
+ offset);
284
+
285
+ instruction.accept(clazz, method, codeAttribute, offset, variableInitializationMarker);
286
+ }
287
+ }
288
+ if (DEBUG) System.out.println();
289
+
290
+
291
+ // Locally fix instructions, in order to keep the stack consistent.
292
+ if (DEBUG) System.out.println("Stack consistency fixing:");
293
+
294
+ maxMarkedOffset = codeLength - 1;
295
+
296
+ while (maxMarkedOffset >= 0)
297
+ {
298
+ int offset = maxMarkedOffset;
299
+
300
+ maxMarkedOffset = offset - 1;
301
+
302
+ if (partialEvaluator.isTraced(offset))
303
+ {
304
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
305
+ offset);
306
+
307
+ instruction.accept(clazz, method, codeAttribute, offset, stackConsistencyFixer);
308
+
309
+ // Check if this instruction is a branch origin from a branch
310
+ // that straddles some marked code.
311
+ markStraddlingBranches(offset,
312
+ partialEvaluator.branchTargets(offset),
313
+ true);
314
+
315
+ // Check if this instruction is a branch target from a branch
316
+ // that straddles some marked code.
317
+ markStraddlingBranches(offset,
318
+ partialEvaluator.branchOrigins(offset),
319
+ false);
320
+ }
321
+ }
322
+ if (DEBUG) System.out.println();
323
+
324
+
325
+ // Replace traced but unmarked backward branches by infinite loops.
326
+ // The virtual machine's verification step is not smart enough to see
327
+ // the code isn't reachable, and may complain otherwise.
328
+ // Any clearly unreachable code will still be removed elsewhere.
329
+ if (DEBUG) System.out.println("Infinite loop fixing:");
330
+
331
+ for (int offset = 0; offset < codeLength; offset++)
332
+ {
333
+ // Is it a traced but unmarked backward branch, without an unmarked
334
+ // straddling forward branch? Note that this is still a heuristic.
335
+ if (partialEvaluator.isTraced(offset) &&
336
+ !isInstructionNecessary(offset) &&
337
+ isAllSmallerThanOrEqual(partialEvaluator.branchTargets(offset),
338
+ offset) &&
339
+ !isAnyUnnecessaryInstructionBranchingOver(lastNecessaryInstructionOffset(offset),
340
+ offset))
341
+ {
342
+ replaceByInfiniteLoop(clazz, offset);
343
+ }
344
+ }
345
+ if (DEBUG) System.out.println();
346
+
347
+
348
+ // Insert infinite loops after jumps to subroutines that don't return.
349
+ // The virtual machine's verification step is not smart enough to see
350
+ // the code isn't reachable, and may complain otherwise.
351
+ if (DEBUG) System.out.println("Non-returning subroutine fixing:");
352
+
353
+ for (int offset = 0; offset < codeLength; offset++)
354
+ {
355
+ // Is it a traced but unmarked backward branch, without an unmarked
356
+ // straddling forward branch? Note that this is still a heuristic.
357
+ if (isInstructionNecessary(offset) &&
358
+ partialEvaluator.isSubroutineInvocation(offset))
359
+ {
360
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
361
+ offset);
362
+
363
+ int nextOffset = offset + instruction.length(offset);
364
+ if (!isInstructionNecessary(nextOffset))
365
+ {
366
+ replaceByInfiniteLoop(clazz, nextOffset);
367
+ }
368
+ }
369
+ }
370
+ if (DEBUG) System.out.println();
371
+
372
+
373
+ // Delete all instructions that are not used.
374
+ int offset = 0;
375
+ do
376
+ {
377
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
378
+ offset);
379
+ if (!isInstructionNecessary(offset))
380
+ {
381
+ codeAttributeEditor.deleteInstruction(offset);
382
+
383
+ codeAttributeEditor.insertBeforeInstruction(offset, (Instruction)null);
384
+ codeAttributeEditor.replaceInstruction(offset, (Instruction)null);
385
+ codeAttributeEditor.insertAfterInstruction(offset, (Instruction)null);
386
+
387
+ // Visit the instruction, if required.
388
+ if (extraDeletedInstructionVisitor != null)
389
+ {
390
+ instruction.accept(clazz, method, codeAttribute, offset, extraDeletedInstructionVisitor);
391
+ }
392
+ }
393
+
394
+ offset += instruction.length(offset);
395
+ }
396
+ while (offset < codeLength);
397
+
398
+
399
+ if (DEBUG_RESULTS)
400
+ {
401
+ System.out.println("Simplification results:");
402
+
403
+ offset = 0;
404
+ do
405
+ {
406
+ Instruction instruction = InstructionFactory.create(codeAttribute.code,
407
+ offset);
408
+ System.out.println((isInstructionNecessary(offset) ? " + " : " - ")+instruction.toString(offset));
409
+
410
+ if (partialEvaluator.isTraced(offset))
411
+ {
412
+ int initializationOffset = partialEvaluator.initializationOffset(offset);
413
+ if (initializationOffset != PartialEvaluator.NONE)
414
+ {
415
+ System.out.println(" is to be initialized at ["+initializationOffset+"]");
416
+ }
417
+
418
+ InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset);
419
+ if (branchTargets != null)
420
+ {
421
+ System.out.println(" has overall been branching to "+branchTargets);
422
+ }
423
+
424
+ boolean deleted = codeAttributeEditor.deleted[offset];
425
+ if (isInstructionNecessary(offset) && deleted)
426
+ {
427
+ System.out.println(" is deleted");
428
+ }
429
+
430
+ Instruction preInsertion = codeAttributeEditor.preInsertions[offset];
431
+ if (preInsertion != null)
432
+ {
433
+ System.out.println(" is preceded by: "+preInsertion);
434
+ }
435
+
436
+ Instruction replacement = codeAttributeEditor.replacements[offset];
437
+ if (replacement != null)
438
+ {
439
+ System.out.println(" is replaced by: "+replacement);
440
+ }
441
+
442
+ Instruction postInsertion = codeAttributeEditor.postInsertions[offset];
443
+ if (postInsertion != null)
444
+ {
445
+ System.out.println(" is followed by: "+postInsertion);
446
+ }
447
+ }
448
+
449
+ offset += instruction.length(offset);
450
+ }
451
+ while (offset < codeLength);
452
+ }
453
+
454
+ // Apply all accumulated changes to the code.
455
+ codeAttributeEditor.visitCodeAttribute(clazz, method, codeAttribute);
456
+ }
457
+
458
+
459
+ /**
460
+ * This MemberVisitor marks stack entries that aren't necessary because
461
+ * parameters aren't used in the methods that are visited.
462
+ */
463
+ private class MyUnusedParameterSimplifier
464
+ extends SimplifiedVisitor
465
+ implements InstructionVisitor,
466
+ ConstantVisitor,
467
+ MemberVisitor
468
+ {
469
+ private int invocationOffset;
470
+ private ConstantInstruction invocationInstruction;
471
+
472
+
473
+ // Implementations for InstructionVisitor.
474
+
475
+ public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) {}
476
+
477
+
478
+ public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
479
+ {
480
+ switch (constantInstruction.opcode)
481
+ {
482
+ case InstructionConstants.OP_INVOKEVIRTUAL:
483
+ case InstructionConstants.OP_INVOKESPECIAL:
484
+ case InstructionConstants.OP_INVOKESTATIC:
485
+ case InstructionConstants.OP_INVOKEINTERFACE:
486
+ this.invocationOffset = offset;
487
+ this.invocationInstruction = constantInstruction;
488
+ clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
489
+ break;
490
+ }
491
+ }
492
+
493
+
494
+ // Implementations for ConstantVisitor.
495
+
496
+ public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
497
+ {
498
+ refConstant.referencedMemberAccept(this);
499
+ }
500
+
501
+
502
+ // Implementations for MemberVisitor.
503
+
504
+ public void visitAnyMember(Clazz clazz, Member member) {}
505
+
506
+
507
+ public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
508
+ {
509
+ // Get the total size of the parameters.
510
+ int parameterSize = ParameterUsageMarker.getParameterSize(programMethod);
511
+
512
+ // Make the method invocation static, if possible.
513
+ if ((programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) == 0 &&
514
+ !ParameterUsageMarker.isParameterUsed(programMethod, 0))
515
+ {
516
+ replaceByStaticInvocation(programClass,
517
+ invocationOffset,
518
+ invocationInstruction);
519
+ }
520
+
521
+ // Remove unused parameters.
522
+ for (int index = 0; index < parameterSize; index++)
523
+ {
524
+ if (!ParameterUsageMarker.isParameterUsed(programMethod, index))
525
+ {
526
+ TracedStack stack =
527
+ partialEvaluator.getStackBefore(invocationOffset);
528
+
529
+ int stackIndex = stack.size() - parameterSize + index;
530
+
531
+ if (DEBUG)
532
+ {
533
+ System.out.println(" ["+invocationOffset+"] Ignoring parameter #"+index+" of "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass)+"] (stack entry #"+stackIndex+" ["+stack.getBottom(stackIndex)+"])");
534
+ System.out.println(" Full stack: "+stack);
535
+ }
536
+
537
+ markStackSimplificationBefore(invocationOffset, stackIndex);
538
+ }
539
+ }
540
+ }
541
+ }
542
+
543
+
544
+ /**
545
+ * This InstructionVisitor marks the producing instructions and produced
546
+ * variables and stack entries of the instructions that it visits.
547
+ * Simplified method arguments are ignored.
548
+ */
549
+ private class MyProducerMarker
550
+ extends SimplifiedVisitor
551
+ implements InstructionVisitor
552
+ {
553
+ // Implementations for InstructionVisitor.
554
+
555
+ public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
556
+ {
557
+ markStackProducers(clazz, offset, instruction);
558
+ }
559
+
560
+
561
+ public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
562
+ {
563
+ switch (simpleInstruction.opcode)
564
+ {
565
+ case InstructionConstants.OP_DUP:
566
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
567
+ conditionallyMarkStackEntryProducers(offset, 1, 0);
568
+ break;
569
+ case InstructionConstants.OP_DUP_X1:
570
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
571
+ conditionallyMarkStackEntryProducers(offset, 1, 1);
572
+ conditionallyMarkStackEntryProducers(offset, 2, 0);
573
+ break;
574
+ case InstructionConstants.OP_DUP_X2:
575
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
576
+ conditionallyMarkStackEntryProducers(offset, 1, 1);
577
+ conditionallyMarkStackEntryProducers(offset, 2, 2);
578
+ conditionallyMarkStackEntryProducers(offset, 3, 0);
579
+ break;
580
+ case InstructionConstants.OP_DUP2:
581
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
582
+ conditionallyMarkStackEntryProducers(offset, 1, 1);
583
+ conditionallyMarkStackEntryProducers(offset, 2, 0);
584
+ conditionallyMarkStackEntryProducers(offset, 3, 1);
585
+ break;
586
+ case InstructionConstants.OP_DUP2_X1:
587
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
588
+ conditionallyMarkStackEntryProducers(offset, 1, 1);
589
+ conditionallyMarkStackEntryProducers(offset, 2, 2);
590
+ conditionallyMarkStackEntryProducers(offset, 3, 0);
591
+ conditionallyMarkStackEntryProducers(offset, 4, 1);
592
+ break;
593
+ case InstructionConstants.OP_DUP2_X2:
594
+ conditionallyMarkStackEntryProducers(offset, 0, 0);
595
+ conditionallyMarkStackEntryProducers(offset, 1, 1);
596
+ conditionallyMarkStackEntryProducers(offset, 2, 2);
597
+ conditionallyMarkStackEntryProducers(offset, 3, 3);
598
+ conditionallyMarkStackEntryProducers(offset, 4, 0);
599
+ conditionallyMarkStackEntryProducers(offset, 5, 1);
600
+ break;
601
+ case InstructionConstants.OP_SWAP:
602
+ conditionallyMarkStackEntryProducers(offset, 0, 1);
603
+ conditionallyMarkStackEntryProducers(offset, 1, 0);
604
+ break;
605
+ default:
606
+ markStackProducers(clazz, offset, simpleInstruction);
607
+ break;
608
+ }
609
+ }
610
+
611
+
612
+ public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
613
+ {
614
+ // Is the variable being loaded (or incremented)?
615
+ if (variableInstruction.opcode < InstructionConstants.OP_ISTORE)
616
+ {
617
+ markVariableProducers(offset, variableInstruction.variableIndex);
618
+ }
619
+ else
620
+ {
621
+ markStackProducers(clazz, offset, variableInstruction);
622
+ }
623
+ }
624
+
625
+
626
+ public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
627
+ {
628
+ // Mark the initializer invocation, if this is a 'new' instruction.
629
+ if (constantInstruction.opcode == InstructionConstants.OP_NEW)
630
+ {
631
+ markInitialization(offset);
632
+ }
633
+
634
+ markStackProducers(clazz, offset, constantInstruction);
635
+ }
636
+
637
+
638
+ public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
639
+ {
640
+ // Explicitly mark the produced stack entry of a 'jsr' instruction,
641
+ // because the consuming 'astore' instruction of the subroutine is
642
+ // cleared every time it is traced.
643
+ if (branchInstruction.opcode == InstructionConstants.OP_JSR ||
644
+ branchInstruction.opcode == InstructionConstants.OP_JSR_W)
645
+ {
646
+ markStackEntryAfter(offset, 0);
647
+ }
648
+ else
649
+ {
650
+ markStackProducers(clazz, offset, branchInstruction);
651
+ }
652
+ }
653
+ }
654
+
655
+
656
+ /**
657
+ * This InstructionVisitor marks variable initializations that are
658
+ * necessary to appease the JVM.
659
+ */
660
+ private class MyVariableInitializationMarker
661
+ extends SimplifiedVisitor
662
+ implements InstructionVisitor
663
+ {
664
+ // Implementations for InstructionVisitor.
665
+
666
+ public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) {}
667
+
668
+
669
+ public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
670
+ {
671
+ if (!variableInstruction.isLoad())
672
+ {
673
+ int variableIndex = variableInstruction.variableIndex;
674
+
675
+ if (isVariableInitialization(offset,
676
+ variableIndex) &&
677
+ isVariableInitializationNecessary(clazz,
678
+ method,
679
+ codeAttribute,
680
+ offset,
681
+ variableIndex))
682
+ {
683
+ markInstruction(offset);
684
+ }
685
+ }
686
+ }
687
+ }
688
+
689
+
690
+ /**
691
+ * This InstructionVisitor fixes instructions locally, popping any unused
692
+ * produced stack entries after marked instructions, and popping produced
693
+ * stack entries and pushing missing stack entries instead of unmarked
694
+ * instructions.
695
+ */
696
+ private class MyStackConsistencyFixer
697
+ extends SimplifiedVisitor
698
+ implements InstructionVisitor
699
+ {
700
+ // Implementations for InstructionVisitor.
701
+
702
+ public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
703
+ {
704
+ // Has the instruction been marked?
705
+ if (isInstructionNecessary(offset))
706
+ {
707
+ // Check all stack entries that are popped.
708
+ // Typical case: a freshly marked variable initialization that
709
+ // requires some value on the stack.
710
+ int popCount = instruction.stackPopCount(clazz);
711
+ if (popCount > 0)
712
+ {
713
+ TracedStack tracedStack =
714
+ partialEvaluator.getStackBefore(offset);
715
+
716
+ int top = tracedStack.size() - 1;
717
+
718
+ int requiredPushCount = 0;
719
+ for (int stackIndex = 0; stackIndex < popCount; stackIndex++)
720
+ {
721
+ InstructionOffsetValue producerOffsets =
722
+ tracedStack.getTopProducerValue(stackIndex).instructionOffsetValue();
723
+
724
+ if (!isStackSimplifiedBefore(offset, top - stackIndex))
725
+ {
726
+ // Is the stack entry pushed by any producer,
727
+ // because it is required by other consumers?
728
+ if (isAnyStackEntryNecessaryAfter(producerOffsets, top - stackIndex))
729
+ {
730
+ // Make sure it is pushed after all producers.
731
+ markStackEntriesAfter(producerOffsets, top - stackIndex);
732
+ }
733
+ else
734
+ {
735
+ // Remember to push it.
736
+ requiredPushCount++;
737
+ }
738
+ }
739
+ }
740
+
741
+ // Push some necessary stack entries.
742
+ if (requiredPushCount > 0)
743
+ {
744
+ if (DEBUG) System.out.println(" Inserting before marked consumer "+instruction.toString(offset));
745
+
746
+ if (requiredPushCount > (instruction.isCategory2() ? 2 : 1))
747
+ {
748
+ throw new IllegalArgumentException("Unsupported stack size increment ["+requiredPushCount+"]");
749
+ }
750
+
751
+ insertPushInstructions(offset, false, tracedStack.getTop(0).computationalType());
752
+ }
753
+ }
754
+
755
+ // Check all stack entries that are pushed.
756
+ // Typical case: a return value that wasn't really required and
757
+ // that should be popped.
758
+ int pushCount = instruction.stackPushCount(clazz);
759
+ if (pushCount > 0)
760
+ {
761
+ TracedStack tracedStack =
762
+ partialEvaluator.getStackAfter(offset);
763
+
764
+ int top = tracedStack.size() - 1;
765
+
766
+ int requiredPopCount = 0;
767
+ for (int stackIndex = 0; stackIndex < pushCount; stackIndex++)
768
+ {
769
+ // Is the stack entry required by consumers?
770
+ if (!isStackEntryNecessaryAfter(offset, top - stackIndex))
771
+ {
772
+ // Remember to pop it.
773
+ requiredPopCount++;
774
+ }
775
+ }
776
+
777
+ // Pop the unnecessary stack entries.
778
+ if (requiredPopCount > 0)
779
+ {
780
+ if (DEBUG) System.out.println(" Inserting after marked producer "+instruction.toString(offset));
781
+
782
+ insertPopInstructions(offset, false, requiredPopCount);
783
+ }
784
+ }
785
+ }
786
+ else
787
+ {
788
+ // Check all stack entries that would be popped.
789
+ // Typical case: a stack value that is required elsewhere and
790
+ // that still has to be popped.
791
+ int popCount = instruction.stackPopCount(clazz);
792
+ if (popCount > 0)
793
+ {
794
+ TracedStack tracedStack =
795
+ partialEvaluator.getStackBefore(offset);
796
+
797
+ int top = tracedStack.size() - 1;
798
+
799
+ int expectedPopCount = 0;
800
+ for (int stackIndex = 0; stackIndex < popCount; stackIndex++)
801
+ {
802
+ InstructionOffsetValue producerOffsets =
803
+ tracedStack.getTopProducerValue(stackIndex).instructionOffsetValue();
804
+
805
+ // Is the stack entry pushed by any producer,
806
+ // because it is required by other consumers?
807
+ if (isAnyStackEntryNecessaryAfter(producerOffsets, top - stackIndex))
808
+ {
809
+ // Make sure it is pushed after all producers.
810
+ markStackEntriesAfter(producerOffsets, top - stackIndex);
811
+
812
+ // Remember to pop it.
813
+ expectedPopCount++;
814
+ }
815
+ }
816
+
817
+ // Pop the unnecessary stack entries.
818
+ if (expectedPopCount > 0)
819
+ {
820
+ if (DEBUG) System.out.println(" Replacing unmarked consumer "+instruction.toString(offset));
821
+
822
+ insertPopInstructions(offset, true, expectedPopCount);
823
+ }
824
+ }
825
+
826
+ // Check all stack entries that would be pushed.
827
+ // Typical case: never.
828
+ int pushCount = instruction.stackPushCount(clazz);
829
+ if (pushCount > 0)
830
+ {
831
+ TracedStack tracedStack =
832
+ partialEvaluator.getStackAfter(offset);
833
+
834
+ int top = tracedStack.size() - 1;
835
+
836
+ int expectedPushCount = 0;
837
+ for (int stackIndex = 0; stackIndex < pushCount; stackIndex++)
838
+ {
839
+ // Is the stack entry required by consumers?
840
+ if (isStackEntryNecessaryAfter(offset, top - stackIndex))
841
+ {
842
+ // Remember to push it.
843
+ expectedPushCount++;
844
+ }
845
+ }
846
+
847
+ // Push some necessary stack entries.
848
+ if (expectedPushCount > 0)
849
+ {
850
+ if (DEBUG) System.out.println(" Replacing unmarked producer "+instruction.toString(offset));
851
+
852
+ insertPushInstructions(offset, true, tracedStack.getTop(0).computationalType());
853
+ }
854
+ }
855
+ }
856
+ }
857
+
858
+
859
+ public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
860
+ {
861
+ if (isInstructionNecessary(offset) &&
862
+ isDupOrSwap(simpleInstruction))
863
+ {
864
+ fixDupInstruction(clazz, codeAttribute, offset, simpleInstruction);
865
+ }
866
+ else
867
+ {
868
+ visitAnyInstruction(clazz, method, codeAttribute, offset, simpleInstruction);
869
+ }
870
+ }
871
+ }
872
+
873
+
874
+ // Small utility methods.
875
+
876
+ /**
877
+ * Marks the variable and the corresponding producing instructions
878
+ * of the consumer at the given offset.
879
+ * @param consumerOffset the offset of the consumer.
880
+ * @param variableIndex the index of the variable to be marked.
881
+ */
882
+ private void markVariableProducers(int consumerOffset,
883
+ int variableIndex)
884
+ {
885
+ TracedVariables tracedVariables =
886
+ partialEvaluator.getVariablesBefore(consumerOffset);
887
+
888
+ // Mark the producer of the loaded value.
889
+ markVariableProducers(tracedVariables.getProducerValue(variableIndex).instructionOffsetValue(),
890
+ variableIndex);
891
+ }
892
+
893
+
894
+ /**
895
+ * Marks the variable and its producing instructions at the given offsets.
896
+ * @param producerOffsets the offsets of the producers to be marked.
897
+ * @param variableIndex the index of the variable to be marked.
898
+ */
899
+ private void markVariableProducers(InstructionOffsetValue producerOffsets,
900
+ int variableIndex)
901
+ {
902
+ if (producerOffsets != null)
903
+ {
904
+ int offsetCount = producerOffsets.instructionOffsetCount();
905
+ for (int offsetIndex = 0; offsetIndex < offsetCount; offsetIndex++)
906
+ {
907
+ // Make sure the variable and the instruction are marked
908
+ // at the producing offset.
909
+ int offset = producerOffsets.instructionOffset(offsetIndex);
910
+
911
+ markVariableAfter(offset, variableIndex);
912
+ markInstruction(offset);
913
+ }
914
+ }
915
+ }
916
+
917
+
918
+ /**
919
+ * Marks the stack entries and their producing instructions of the
920
+ * consumer at the given offset.
921
+ * @param clazz the containing class.
922
+ * @param consumerOffset the offset of the consumer.
923
+ * @param consumer the consumer of the stack entries.
924
+ */
925
+ private void markStackProducers(Clazz clazz,
926
+ int consumerOffset,
927
+ Instruction consumer)
928
+ {
929
+ // Mark the producers of the popped values.
930
+ int popCount = consumer.stackPopCount(clazz);
931
+ for (int stackIndex = 0; stackIndex < popCount; stackIndex++)
932
+ {
933
+ markStackEntryProducers(consumerOffset, stackIndex);
934
+ }
935
+ }
936
+
937
+
938
+ /**
939
+ * Marks the stack entry and the corresponding producing instructions
940
+ * of the consumer at the given offset, if the stack entry of the
941
+ * consumer is marked.
942
+ * @param consumerOffset the offset of the consumer.
943
+ * @param consumerStackIndex the index of the stack entry to be checked
944
+ * (counting from the top).
945
+ * @param producerStackIndex the index of the stack entry to be marked
946
+ * (counting from the top).
947
+ */
948
+ private void conditionallyMarkStackEntryProducers(int consumerOffset,
949
+ int consumerStackIndex,
950
+ int producerStackIndex)
951
+ {
952
+ int top = partialEvaluator.getStackAfter(consumerOffset).size() - 1;
953
+
954
+ if (isStackEntryNecessaryAfter(consumerOffset, top - consumerStackIndex))
955
+ {
956
+ markStackEntryProducers(consumerOffset, producerStackIndex);
957
+ }
958
+ }
959
+
960
+
961
+ /**
962
+ * Marks the stack entry and the corresponding producing instructions
963
+ * of the consumer at the given offset.
964
+ * @param consumerOffset the offset of the consumer.
965
+ * @param stackIndex the index of the stack entry to be marked
966
+ * (counting from the top).
967
+ */
968
+ private void markStackEntryProducers(int consumerOffset,
969
+ int stackIndex)
970
+ {
971
+ TracedStack tracedStack =
972
+ partialEvaluator.getStackBefore(consumerOffset);
973
+
974
+ int stackBottomIndex = tracedStack.size() - 1 - stackIndex;
975
+
976
+ if (!isStackSimplifiedBefore(consumerOffset, stackBottomIndex))
977
+ {
978
+ markStackEntryProducers(tracedStack.getTopProducerValue(stackIndex).instructionOffsetValue(),
979
+ stackBottomIndex);
980
+ }
981
+ }
982
+
983
+
984
+ /**
985
+ * Marks the stack entry and its producing instructions at the given
986
+ * offsets.
987
+ * @param producerOffsets the offsets of the producers to be marked.
988
+ * @param stackIndex the index of the stack entry to be marked
989
+ * (counting from the bottom).
990
+ */
991
+ private void markStackEntryProducers(InstructionOffsetValue producerOffsets,
992
+ int stackIndex)
993
+ {
994
+ if (producerOffsets != null)
995
+ {
996
+ int offsetCount = producerOffsets.instructionOffsetCount();
997
+ for (int offsetIndex = 0; offsetIndex < offsetCount; offsetIndex++)
998
+ {
999
+ // Make sure the stack entry and the instruction are marked
1000
+ // at the producing offset.
1001
+ int offset = producerOffsets.instructionOffset(offsetIndex);
1002
+
1003
+ markStackEntryAfter(offset, stackIndex);
1004
+ markInstruction(offset);
1005
+ }
1006
+ }
1007
+ }
1008
+
1009
+
1010
+ /**
1011
+ * Marks the stack entry and its initializing instruction
1012
+ * ('invokespecial *.<init>') for the given 'new' instruction offset.
1013
+ * @param newInstructionOffset the offset of the 'new' instruction.
1014
+ */
1015
+ private void markInitialization(int newInstructionOffset)
1016
+ {
1017
+ int initializationOffset =
1018
+ partialEvaluator.initializationOffset(newInstructionOffset);
1019
+
1020
+ TracedStack tracedStack =
1021
+ partialEvaluator.getStackAfter(newInstructionOffset);
1022
+
1023
+ markStackEntryAfter(initializationOffset, tracedStack.size() - 1);
1024
+ markInstruction(initializationOffset);
1025
+ }
1026
+
1027
+
1028
+ /**
1029
+ * Marks the branch instructions of straddling branches, if they straddle
1030
+ * some code that has been marked.
1031
+ * @param instructionOffset the offset of the branch origin or branch target.
1032
+ * @param branchOffsets the offsets of the straddling branch targets
1033
+ * or branch origins.
1034
+ * @param isPointingToTargets <code>true</code> if the above offsets are
1035
+ * branch targets, <code>false</code> if they
1036
+ * are branch origins.
1037
+ */
1038
+ private void markStraddlingBranches(int instructionOffset,
1039
+ InstructionOffsetValue branchOffsets,
1040
+ boolean isPointingToTargets)
1041
+ {
1042
+ if (branchOffsets != null)
1043
+ {
1044
+ // Loop over all branch offsets.
1045
+ int branchCount = branchOffsets.instructionOffsetCount();
1046
+ for (int branchIndex = 0; branchIndex < branchCount; branchIndex++)
1047
+ {
1048
+ // Is the branch straddling forward any necessary instructions?
1049
+ int branchOffset = branchOffsets.instructionOffset(branchIndex);
1050
+
1051
+ // Is the offset pointing to a branch origin or to a branch target?
1052
+ if (isPointingToTargets)
1053
+ {
1054
+ markStraddlingBranch(instructionOffset,
1055
+ branchOffset,
1056
+ instructionOffset,
1057
+ branchOffset);
1058
+ }
1059
+ else
1060
+ {
1061
+ markStraddlingBranch(instructionOffset,
1062
+ branchOffset,
1063
+ branchOffset,
1064
+ instructionOffset);
1065
+ }
1066
+ }
1067
+ }
1068
+ }
1069
+
1070
+
1071
+ private void markStraddlingBranch(int instructionOffsetStart,
1072
+ int instructionOffsetEnd,
1073
+ int branchOrigin,
1074
+ int branchTarget)
1075
+ {
1076
+ if (!isInstructionNecessary(branchOrigin) &&
1077
+ isAnyInstructionNecessary(instructionOffsetStart, instructionOffsetEnd))
1078
+ {
1079
+ if (DEBUG) System.out.print("["+branchOrigin+"->"+branchTarget+"]");
1080
+
1081
+ // Mark the branch instruction.
1082
+ markInstruction(branchOrigin);
1083
+ }
1084
+ }
1085
+
1086
+
1087
+ /**
1088
+ * Marks the specified instruction if it is a required dup/swap instruction,
1089
+ * replacing it by an appropriate variant if necessary.
1090
+ * @param clazz the class that is being checked.
1091
+ * @param codeAttribute the code that is being checked.
1092
+ * @param dupOffset the offset of the dup/swap instruction.
1093
+ * @param instruction the dup/swap instruction.
1094
+ */
1095
+ private void fixDupInstruction(Clazz clazz,
1096
+ CodeAttribute codeAttribute,
1097
+ int dupOffset,
1098
+ Instruction instruction)
1099
+ {
1100
+ int top = partialEvaluator.getStackAfter(dupOffset).size() - 1;
1101
+
1102
+ byte oldOpcode = instruction.opcode;
1103
+ byte newOpcode = 0;
1104
+ byte addOpcode = 0;
1105
+
1106
+ // Simplify the popping instruction if possible.
1107
+ switch (oldOpcode)
1108
+ {
1109
+ case InstructionConstants.OP_DUP:
1110
+ {
1111
+ boolean stackEntryPresent0 = isStackEntryNecessaryAfter(dupOffset, top - 0);
1112
+ boolean stackEntryPresent1 = isStackEntryNecessaryAfter(dupOffset, top - 1);
1113
+
1114
+ // Should either the original element or the copy be present?
1115
+ if (stackEntryPresent0 ||
1116
+ stackEntryPresent1)
1117
+ {
1118
+ // Should both the original element and the copy be present?
1119
+ if (stackEntryPresent0 &&
1120
+ stackEntryPresent1)
1121
+ {
1122
+ newOpcode = InstructionConstants.OP_DUP;
1123
+ }
1124
+ }
1125
+ break;
1126
+ }
1127
+ case InstructionConstants.OP_DUP_X1:
1128
+ {
1129
+ boolean stackEntryPresent0 = isStackEntryNecessaryAfter(dupOffset, top - 0);
1130
+ boolean stackEntryPresent1 = isStackEntryNecessaryAfter(dupOffset, top - 1);
1131
+ boolean stackEntryPresent2 = isStackEntryNecessaryAfter(dupOffset, top - 2);
1132
+
1133
+ // Should either the original element or the copy be present?
1134
+ if (stackEntryPresent0 ||
1135
+ stackEntryPresent2)
1136
+ {
1137
+ // Should the copy be present?
1138
+ if (stackEntryPresent2)
1139
+ {
1140
+ // Compute the number of elements to be skipped.
1141
+ int skipCount = stackEntryPresent1 ? 1 : 0;
1142
+
1143
+ // Should the original element be present?
1144
+ if (stackEntryPresent0)
1145
+ {
1146
+ // Copy the original element.
1147
+ newOpcode = (byte)(InstructionConstants.OP_DUP + skipCount);
1148
+ }
1149
+ else if (skipCount == 1)
1150
+ {
1151
+ // Move the original element.
1152
+ newOpcode = InstructionConstants.OP_SWAP;
1153
+ }
1154
+ }
1155
+ }
1156
+ break;
1157
+ }
1158
+ case InstructionConstants.OP_DUP_X2:
1159
+ {
1160
+ boolean stackEntryPresent0 = isStackEntryNecessaryAfter(dupOffset, top - 0);
1161
+ boolean stackEntryPresent1 = isStackEntryNecessaryAfter(dupOffset, top - 1);
1162
+ boolean stackEntryPresent2 = isStackEntryNecessaryAfter(dupOffset, top - 2);
1163
+ boolean stackEntryPresent3 = isStackEntryNecessaryAfter(dupOffset, top - 3);
1164
+
1165
+ // Should either the original element or the copy be present?
1166
+ if (stackEntryPresent0 ||
1167
+ stackEntryPresent3)
1168
+ {
1169
+ // Should the copy be present?
1170
+ if (stackEntryPresent3)
1171
+ {
1172
+ int skipCount = (stackEntryPresent1 ? 1 : 0) +
1173
+ (stackEntryPresent2 ? 1 : 0);
1174
+
1175
+ // Should the original element be present?
1176
+ if (stackEntryPresent0)
1177
+ {
1178
+ // Copy the original element.
1179
+ newOpcode = (byte)(InstructionConstants.OP_DUP + skipCount);
1180
+ }
1181
+ else if (skipCount == 1)
1182
+ {
1183
+ // Move the original element.
1184
+ newOpcode = InstructionConstants.OP_SWAP;
1185
+ }
1186
+ else if (skipCount == 2)
1187
+ {
1188
+ // We can't easily move the original element.
1189
+ throw new UnsupportedOperationException("Can't handle dup_x2 instruction moving original element across two elements at ["+dupOffset +"]");
1190
+ }
1191
+ }
1192
+ }
1193
+ break;
1194
+ }
1195
+ case InstructionConstants.OP_DUP2:
1196
+ {
1197
+ boolean stackEntriesPresent01 = isStackEntriesNecessaryAfter(dupOffset, top - 0, top - 1);
1198
+ boolean stackEntriesPresent23 = isStackEntriesNecessaryAfter(dupOffset, top - 2, top - 3);
1199
+
1200
+ // Should either the original element or the copy be present?
1201
+ if (stackEntriesPresent01 ||
1202
+ stackEntriesPresent23)
1203
+ {
1204
+ // Should both the original element and the copy be present?
1205
+ if (stackEntriesPresent01 &&
1206
+ stackEntriesPresent23)
1207
+ {
1208
+ newOpcode = InstructionConstants.OP_DUP2;
1209
+ }
1210
+ }
1211
+ break;
1212
+ }
1213
+ case InstructionConstants.OP_DUP2_X1:
1214
+ {
1215
+ boolean stackEntriesPresent01 = isStackEntriesNecessaryAfter(dupOffset, top - 0, top - 1);
1216
+ boolean stackEntryPresent2 = isStackEntryNecessaryAfter(dupOffset, top - 2);
1217
+ boolean stackEntriesPresent34 = isStackEntriesNecessaryAfter(dupOffset, top - 3, top - 4);
1218
+
1219
+ // Should either the original element or the copy be present?
1220
+ if (stackEntriesPresent01 ||
1221
+ stackEntriesPresent34)
1222
+ {
1223
+ // Should the copy be present?
1224
+ if (stackEntriesPresent34)
1225
+ {
1226
+ int skipCount = stackEntryPresent2 ? 1 : 0;
1227
+
1228
+ // Should the original element be present?
1229
+ if (stackEntriesPresent01)
1230
+ {
1231
+ // Copy the original element.
1232
+ newOpcode = (byte)(InstructionConstants.OP_DUP2 + skipCount);
1233
+ }
1234
+ else if (skipCount > 0)
1235
+ {
1236
+ // We can't easily move the original element.
1237
+ throw new UnsupportedOperationException("Can't handle dup2_x1 instruction moving original element across "+skipCount+" elements at ["+dupOffset +"]");
1238
+ }
1239
+ }
1240
+ }
1241
+ break;
1242
+ }
1243
+ case InstructionConstants.OP_DUP2_X2:
1244
+ {
1245
+ boolean stackEntriesPresent01 = isStackEntriesNecessaryAfter(dupOffset, top - 0, top - 1);
1246
+ boolean stackEntryPresent2 = isStackEntryNecessaryAfter(dupOffset, top - 2);
1247
+ boolean stackEntryPresent3 = isStackEntryNecessaryAfter(dupOffset, top - 3);
1248
+ boolean stackEntriesPresent45 = isStackEntriesNecessaryAfter(dupOffset, top - 4, top - 5);
1249
+
1250
+ // Should either the original element or the copy be present?
1251
+ if (stackEntriesPresent01 ||
1252
+ stackEntriesPresent45)
1253
+ {
1254
+ // Should the copy be present?
1255
+ if (stackEntriesPresent45)
1256
+ {
1257
+ int skipCount = (stackEntryPresent2 ? 1 : 0) +
1258
+ (stackEntryPresent3 ? 1 : 0);
1259
+
1260
+ // Should the original element be present?
1261
+ if (stackEntriesPresent01)
1262
+ {
1263
+ // Copy the original element.
1264
+ newOpcode = (byte)(InstructionConstants.OP_DUP2 + skipCount);
1265
+ }
1266
+ else if (skipCount > 0)
1267
+ {
1268
+ // We can't easily move the original element.
1269
+ throw new UnsupportedOperationException("Can't handle dup2_x2 instruction moving original element across "+skipCount+" elements at ["+dupOffset +"]");
1270
+ }
1271
+ }
1272
+ }
1273
+ break;
1274
+ }
1275
+ case InstructionConstants.OP_SWAP:
1276
+ {
1277
+ boolean stackEntryPresent0 = isStackEntryNecessaryAfter(dupOffset, top - 0);
1278
+ boolean stackEntryPresent1 = isStackEntryNecessaryAfter(dupOffset, top - 1);
1279
+
1280
+ // Will either element be present?
1281
+ if (stackEntryPresent0 ||
1282
+ stackEntryPresent1)
1283
+ {
1284
+ // Will both elements be present?
1285
+ if (!stackEntryPresent1)
1286
+ {
1287
+ // Pop the original top element (later bottom element).
1288
+ newOpcode = InstructionConstants.OP_POP;
1289
+ }
1290
+ else if (!stackEntryPresent0)
1291
+ {
1292
+ // Swap both elements and pop the top one.
1293
+ newOpcode = InstructionConstants.OP_SWAP;
1294
+ addOpcode = InstructionConstants.OP_POP;
1295
+ }
1296
+ else
1297
+ {
1298
+ // Just swap both elements.
1299
+ newOpcode = InstructionConstants.OP_SWAP;
1300
+ }
1301
+ }
1302
+ break;
1303
+ }
1304
+ }
1305
+
1306
+ // Is there a replacement opcode?
1307
+ if (newOpcode == 0)
1308
+ {
1309
+ // Delete the instruction.
1310
+ codeAttributeEditor.deleteInstruction(dupOffset);
1311
+
1312
+ if (extraDeletedInstructionVisitor != null)
1313
+ {
1314
+ extraDeletedInstructionVisitor.visitSimpleInstruction(null, null, null, dupOffset, null);
1315
+ }
1316
+
1317
+ if (DEBUG) System.out.println(" Marking but deleting instruction "+instruction.toString(dupOffset));
1318
+ }
1319
+ else if (newOpcode == oldOpcode)
1320
+ {
1321
+ // Leave the instruction unchanged.
1322
+ codeAttributeEditor.undeleteInstruction(dupOffset);
1323
+
1324
+ if (DEBUG) System.out.println(" Marking unchanged instruction "+instruction.toString(dupOffset));
1325
+ }
1326
+ else
1327
+ {
1328
+ // Replace the instruction.
1329
+ Instruction replacementInstruction = new SimpleInstruction(newOpcode);
1330
+ codeAttributeEditor.replaceInstruction(dupOffset,
1331
+ replacementInstruction);
1332
+
1333
+ if (DEBUG) System.out.println(" Replacing instruction "+instruction.toString(dupOffset)+" by "+replacementInstruction.toString());
1334
+ }
1335
+
1336
+ // Is there an additional opcode?
1337
+ if (addOpcode != 0)
1338
+ {
1339
+ // Add the instruction.
1340
+ Instruction additionalInstruction = new SimpleInstruction(addOpcode);
1341
+ codeAttributeEditor.insertAfterInstruction(dupOffset, additionalInstruction);
1342
+
1343
+ if (extraAddedInstructionVisitor != null)
1344
+ {
1345
+ extraAddedInstructionVisitor.visitSimpleInstruction(null, null, null, dupOffset, null);
1346
+ }
1347
+
1348
+ if (DEBUG) System.out.println(" Adding instruction "+additionalInstruction.toString(dupOffset));
1349
+ }
1350
+ }
1351
+
1352
+
1353
+ /**
1354
+ * Pushes a specified type of stack entry before or at the given offset.
1355
+ * The instruction is marked as necessary.
1356
+ */
1357
+ private void insertPushInstructions(int offset,
1358
+ boolean replace,
1359
+ int computationalType)
1360
+ {
1361
+ // Mark this instruction.
1362
+ markInstruction(offset);
1363
+
1364
+ // Create a simple push instrucion.
1365
+ Instruction replacementInstruction =
1366
+ new SimpleInstruction(pushOpcode(computationalType));
1367
+
1368
+ if (DEBUG) System.out.println(": "+replacementInstruction.toString(offset));
1369
+
1370
+ // Replace or insert the push instruction.
1371
+ if (replace)
1372
+ {
1373
+ // Replace the push instruction.
1374
+ codeAttributeEditor.replaceInstruction(offset, replacementInstruction);
1375
+ }
1376
+ else
1377
+ {
1378
+ // Insert the push instruction.
1379
+ codeAttributeEditor.insertBeforeInstruction(offset, replacementInstruction);
1380
+
1381
+ if (extraAddedInstructionVisitor != null)
1382
+ {
1383
+ replacementInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor);
1384
+ }
1385
+ }
1386
+ }
1387
+
1388
+
1389
+ /**
1390
+ * Returns the opcode of a push instruction corresponding to the given
1391
+ * computational type.
1392
+ * @param computationalType the computational type to be pushed on the stack.
1393
+ */
1394
+ private byte pushOpcode(int computationalType)
1395
+ {
1396
+ switch (computationalType)
1397
+ {
1398
+ case Value.TYPE_INTEGER: return InstructionConstants.OP_ICONST_0;
1399
+ case Value.TYPE_LONG: return InstructionConstants.OP_LCONST_0;
1400
+ case Value.TYPE_FLOAT: return InstructionConstants.OP_FCONST_0;
1401
+ case Value.TYPE_DOUBLE: return InstructionConstants.OP_DCONST_0;
1402
+ case Value.TYPE_REFERENCE:
1403
+ case Value.TYPE_INSTRUCTION_OFFSET: return InstructionConstants.OP_ACONST_NULL;
1404
+ }
1405
+
1406
+ throw new IllegalArgumentException("No push opcode for computational type ["+computationalType+"]");
1407
+ }
1408
+
1409
+
1410
+ /**
1411
+ * Pops the given number of stack entries at or after the given offset.
1412
+ * The instructions are marked as necessary.
1413
+ */
1414
+ private void insertPopInstructions(int offset, boolean replace, int popCount)
1415
+ {
1416
+ // Mark this instruction.
1417
+ markInstruction(offset);
1418
+
1419
+ switch (popCount)
1420
+ {
1421
+ case 1:
1422
+ {
1423
+ // Replace or insert a single pop instruction.
1424
+ Instruction popInstruction =
1425
+ new SimpleInstruction(InstructionConstants.OP_POP);
1426
+
1427
+ if (replace)
1428
+ {
1429
+ codeAttributeEditor.replaceInstruction(offset, popInstruction);
1430
+ }
1431
+ else
1432
+ {
1433
+ codeAttributeEditor.insertAfterInstruction(offset, popInstruction);
1434
+
1435
+ if (extraAddedInstructionVisitor != null)
1436
+ {
1437
+ popInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor);
1438
+ }
1439
+ }
1440
+ break;
1441
+ }
1442
+ case 2:
1443
+ {
1444
+ // Replace or insert a single pop2 instruction.
1445
+ Instruction popInstruction =
1446
+ new SimpleInstruction(InstructionConstants.OP_POP2);
1447
+
1448
+ if (replace)
1449
+ {
1450
+ codeAttributeEditor.replaceInstruction(offset, popInstruction);
1451
+ }
1452
+ else
1453
+ {
1454
+ codeAttributeEditor.insertAfterInstruction(offset, popInstruction);
1455
+
1456
+ if (extraAddedInstructionVisitor != null)
1457
+ {
1458
+ popInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor);
1459
+ }
1460
+ }
1461
+ break;
1462
+ }
1463
+ default:
1464
+ {
1465
+ // Replace or insert the specified number of pop instructions.
1466
+ Instruction[] popInstructions =
1467
+ new Instruction[popCount / 2 + popCount % 2];
1468
+
1469
+ Instruction popInstruction =
1470
+ new SimpleInstruction(InstructionConstants.OP_POP2);
1471
+
1472
+ for (int index = 0; index < popCount / 2; index++)
1473
+ {
1474
+ popInstructions[index] = popInstruction;
1475
+ }
1476
+
1477
+ if (popCount % 2 == 1)
1478
+ {
1479
+ popInstruction =
1480
+ new SimpleInstruction(InstructionConstants.OP_POP);
1481
+
1482
+ popInstructions[popCount / 2] = popInstruction;
1483
+ }
1484
+
1485
+ if (replace)
1486
+ {
1487
+ codeAttributeEditor.replaceInstruction(offset, popInstructions);
1488
+
1489
+ for (int index = 1; index < popInstructions.length; index++)
1490
+ {
1491
+ if (extraAddedInstructionVisitor != null)
1492
+ {
1493
+ popInstructions[index].accept(null, null, null, offset, extraAddedInstructionVisitor);
1494
+ }
1495
+ }
1496
+ }
1497
+ else
1498
+ {
1499
+ codeAttributeEditor.insertAfterInstruction(offset, popInstructions);
1500
+
1501
+ for (int index = 0; index < popInstructions.length; index++)
1502
+ {
1503
+ if (extraAddedInstructionVisitor != null)
1504
+ {
1505
+ popInstructions[index].accept(null, null, null, offset, extraAddedInstructionVisitor);
1506
+ }
1507
+ }
1508
+ }
1509
+ break;
1510
+ }
1511
+ }
1512
+ }
1513
+
1514
+
1515
+ /**
1516
+ * Replaces the instruction at a given offset by a static invocation.
1517
+ */
1518
+ private void replaceByStaticInvocation(Clazz clazz,
1519
+ int offset,
1520
+ ConstantInstruction constantInstruction)
1521
+ {
1522
+ // Remember the replacement instruction.
1523
+ Instruction replacementInstruction =
1524
+ new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC,
1525
+ constantInstruction.constantIndex).shrink();
1526
+
1527
+ if (DEBUG) System.out.println(" Replacing by static invocation "+constantInstruction.toString(offset)+" -> "+replacementInstruction.toString());
1528
+
1529
+ codeAttributeEditor.replaceInstruction(offset, replacementInstruction);
1530
+ }
1531
+
1532
+
1533
+ /**
1534
+ * Replaces the given instruction by an infinite loop.
1535
+ */
1536
+ private void replaceByInfiniteLoop(Clazz clazz,
1537
+ int offset)
1538
+ {
1539
+ if (DEBUG) System.out.println(" Inserting infinite loop at ["+offset+"]");
1540
+
1541
+ // Mark the instruction.
1542
+ markInstruction(offset);
1543
+
1544
+ // Replace the instruction by an infinite loop.
1545
+ Instruction replacementInstruction =
1546
+ new BranchInstruction(InstructionConstants.OP_GOTO, 0);
1547
+
1548
+ codeAttributeEditor.replaceInstruction(offset, replacementInstruction);
1549
+ }
1550
+
1551
+
1552
+ // Small utility methods.
1553
+
1554
+ /**
1555
+ * Returns whether the given instruction is a dup or swap instruction
1556
+ * (dup, dup_x1, dup_x2, dup2, dup2_x1, dup2_x2, swap).
1557
+ */
1558
+ private boolean isDupOrSwap(Instruction instruction)
1559
+ {
1560
+ return instruction.opcode >= InstructionConstants.OP_DUP &&
1561
+ instruction.opcode <= InstructionConstants.OP_SWAP;
1562
+ }
1563
+
1564
+
1565
+ /**
1566
+ * Returns whether the given instruction is a pop instruction
1567
+ * (pop, pop2).
1568
+ */
1569
+ private boolean isPop(Instruction instruction)
1570
+ {
1571
+ return instruction.opcode == InstructionConstants.OP_POP ||
1572
+ instruction.opcode == InstructionConstants.OP_POP2;
1573
+ }
1574
+
1575
+
1576
+ /**
1577
+ * Returns whether any traced but unnecessary instruction between the two
1578
+ * given offsets is branching over the second given offset.
1579
+ */
1580
+ private boolean isAnyUnnecessaryInstructionBranchingOver(int instructionOffset1,
1581
+ int instructionOffset2)
1582
+ {
1583
+ for (int offset = instructionOffset1; offset < instructionOffset2; offset++)
1584
+ {
1585
+ // Is it a traced but unmarked straddling branch?
1586
+ if (partialEvaluator.isTraced(offset) &&
1587
+ !isInstructionNecessary(offset) &&
1588
+ isAnyLargerThan(partialEvaluator.branchTargets(offset),
1589
+ instructionOffset2))
1590
+ {
1591
+ return true;
1592
+ }
1593
+ }
1594
+
1595
+ return false;
1596
+ }
1597
+
1598
+
1599
+ /**
1600
+ * Returns whether all of the given instruction offsets (at least one)
1601
+ * are smaller than or equal to the given offset.
1602
+ */
1603
+ private boolean isAllSmallerThanOrEqual(InstructionOffsetValue instructionOffsets,
1604
+ int instructionOffset)
1605
+ {
1606
+ if (instructionOffsets != null)
1607
+ {
1608
+ // Loop over all instruction offsets.
1609
+ int branchCount = instructionOffsets.instructionOffsetCount();
1610
+ if (branchCount > 0)
1611
+ {
1612
+ for (int branchIndex = 0; branchIndex < branchCount; branchIndex++)
1613
+ {
1614
+ // Is the offset larger than the reference offset?
1615
+ if (instructionOffsets.instructionOffset(branchIndex) > instructionOffset)
1616
+ {
1617
+ return false;
1618
+ }
1619
+ }
1620
+
1621
+ return true;
1622
+ }
1623
+ }
1624
+
1625
+ return false;
1626
+ }
1627
+
1628
+
1629
+ /**
1630
+ * Returns whether any of the given instruction offsets (at least one)
1631
+ * is larger than the given offset.
1632
+ */
1633
+ private boolean isAnyLargerThan(InstructionOffsetValue instructionOffsets,
1634
+ int instructionOffset)
1635
+ {
1636
+ if (instructionOffsets != null)
1637
+ {
1638
+ // Loop over all instruction offsets.
1639
+ int branchCount = instructionOffsets.instructionOffsetCount();
1640
+ if (branchCount > 0)
1641
+ {
1642
+ for (int branchIndex = 0; branchIndex < branchCount; branchIndex++)
1643
+ {
1644
+ // Is the offset larger than the reference offset?
1645
+ if (instructionOffsets.instructionOffset(branchIndex) > instructionOffset)
1646
+ {
1647
+ return true;
1648
+ }
1649
+ }
1650
+ }
1651
+ }
1652
+
1653
+ return false;
1654
+ }
1655
+
1656
+
1657
+ /**
1658
+ * Initializes the necessary data structure.
1659
+ */
1660
+ private void initializeNecessary(CodeAttribute codeAttribute)
1661
+ {
1662
+ int codeLength = codeAttribute.u4codeLength;
1663
+ int maxLocals = codeAttribute.u2maxLocals;
1664
+ int maxStack = codeAttribute.u2maxStack;
1665
+
1666
+ // Create new arrays for storing information at each instruction offset.
1667
+ if (variablesNecessaryAfter.length < codeLength ||
1668
+ variablesNecessaryAfter[0].length < maxLocals)
1669
+ {
1670
+ variablesNecessaryAfter = new boolean[codeLength][maxLocals];
1671
+ }
1672
+ else
1673
+ {
1674
+ for (int offset = 0; offset < codeLength; offset++)
1675
+ {
1676
+ Arrays.fill(variablesNecessaryAfter[offset], 0, maxLocals, false);
1677
+ }
1678
+ }
1679
+
1680
+ if (stacksNecessaryAfter.length < codeLength ||
1681
+ stacksNecessaryAfter[0].length < maxStack)
1682
+ {
1683
+ stacksNecessaryAfter = new boolean[codeLength][maxStack];
1684
+ }
1685
+ else
1686
+ {
1687
+ for (int offset = 0; offset < codeLength; offset++)
1688
+ {
1689
+ Arrays.fill(stacksNecessaryAfter[offset], 0, maxStack, false);
1690
+ }
1691
+ }
1692
+
1693
+ if (stacksSimplifiedBefore.length < codeLength ||
1694
+ stacksSimplifiedBefore[0].length < maxStack)
1695
+ {
1696
+ stacksSimplifiedBefore = new boolean[codeLength][maxStack];
1697
+ }
1698
+ else
1699
+ {
1700
+ for (int offset = 0; offset < codeLength; offset++)
1701
+ {
1702
+ Arrays.fill(stacksSimplifiedBefore[offset], 0, maxStack, false);
1703
+ }
1704
+ }
1705
+
1706
+ if (instructionsNecessary.length < codeLength)
1707
+ {
1708
+ instructionsNecessary = new boolean[codeLength];
1709
+ }
1710
+ else
1711
+ {
1712
+ Arrays.fill(instructionsNecessary, 0, codeLength, false);
1713
+ }
1714
+ }
1715
+
1716
+
1717
+ /**
1718
+ * Returns whether the given stack entry is present after execution of the
1719
+ * instruction at the given offset.
1720
+ */
1721
+ private boolean isStackEntriesNecessaryAfter(int instructionOffset,
1722
+ int stackIndex1,
1723
+ int stackIndex2)
1724
+ {
1725
+ boolean present1 = isStackEntryNecessaryAfter(instructionOffset, stackIndex1);
1726
+ boolean present2 = isStackEntryNecessaryAfter(instructionOffset, stackIndex2);
1727
+
1728
+ // if (present1 ^ present2)
1729
+ // {
1730
+ // throw new UnsupportedOperationException("Can't handle partial use of dup2 instructions");
1731
+ // }
1732
+
1733
+ return present1 || present2;
1734
+ }
1735
+
1736
+
1737
+ /**
1738
+ * Returns whether the specified variable is initialized at the specified
1739
+ * offset.
1740
+ */
1741
+ private boolean isVariableInitialization(int instructionOffset,
1742
+ int variableIndex)
1743
+ {
1744
+ // Wasn't the variable set yet?
1745
+ Value valueBefore = partialEvaluator.getVariablesBefore(instructionOffset).getValue(variableIndex);
1746
+ if (valueBefore == null)
1747
+ {
1748
+ return true;
1749
+ }
1750
+
1751
+ // Is the computational type different now?
1752
+ Value valueAfter = partialEvaluator.getVariablesAfter(instructionOffset).getValue(variableIndex);
1753
+ if (valueAfter.computationalType() != valueBefore.computationalType())
1754
+ {
1755
+ return true;
1756
+ }
1757
+
1758
+ // Was the producer an argument (which may be removed)?
1759
+ Value producersBefore = partialEvaluator.getVariablesBefore(instructionOffset).getProducerValue(variableIndex);
1760
+ return producersBefore.instructionOffsetValue().instructionOffsetCount() == 1 &&
1761
+ producersBefore.instructionOffsetValue().instructionOffset(0) == PartialEvaluator.AT_METHOD_ENTRY;
1762
+ }
1763
+
1764
+
1765
+ /**
1766
+ * Returns whether the specified variable must be initialized at the
1767
+ * specified offset, according to the verifier of the JVM.
1768
+ */
1769
+ private boolean isVariableInitializationNecessary(Clazz clazz,
1770
+ Method method,
1771
+ CodeAttribute codeAttribute,
1772
+ int initializationOffset,
1773
+ int variableIndex)
1774
+ {
1775
+ int codeLength = codeAttribute.u4codeLength;
1776
+
1777
+ // Is the variable necessary anywhere at all?
1778
+ if (isVariableNecessaryAfterAny(0, codeLength, variableIndex))
1779
+ {
1780
+ if (DEBUG) System.out.println("Simple partial evaluation for initialization of variable v"+variableIndex+" at ["+initializationOffset+"]");
1781
+
1782
+ // Lazily perform simple partial evaluation, the way the JVM
1783
+ // verifier would do it.
1784
+ simplePartialEvaluator.visitCodeAttribute(clazz, method, codeAttribute);
1785
+
1786
+ if (DEBUG) System.out.println("End of simple partial evaluation for initialization of variable v"+variableIndex+" at ["+initializationOffset+"]");
1787
+
1788
+ // Check if the variable is necessary elsewhere.
1789
+ for (int offset = 0; offset < codeLength; offset++)
1790
+ {
1791
+ if (partialEvaluator.isTraced(offset))
1792
+ {
1793
+ Value producer = partialEvaluator.getVariablesBefore(offset).getProducerValue(variableIndex);
1794
+ if (producer != null)
1795
+ {
1796
+ Value simpleProducer = simplePartialEvaluator.getVariablesBefore(offset).getProducerValue(variableIndex);
1797
+ if (simpleProducer != null)
1798
+ {
1799
+ InstructionOffsetValue producerOffsets =
1800
+ producer.instructionOffsetValue();
1801
+ InstructionOffsetValue simpleProducerOffsets =
1802
+ simpleProducer.instructionOffsetValue();
1803
+
1804
+ if (DEBUG)
1805
+ {
1806
+ System.out.println(" ["+offset+"] producers ["+producerOffsets+"], simple producers ["+simpleProducerOffsets+"]");
1807
+ }
1808
+
1809
+ // Is the variable being used without all of its
1810
+ // immediate simple producers being marked?
1811
+ if (isVariableNecessaryAfterAny(producerOffsets, variableIndex) &&
1812
+ !isVariableNecessaryAfterAll(simpleProducerOffsets, variableIndex))
1813
+ {
1814
+ if (DEBUG)
1815
+ {
1816
+ System.out.println(" => initialization of variable v"+variableIndex+" at ["+initializationOffset+"] necessary");
1817
+ }
1818
+
1819
+ // Then the initialization may be necessary.
1820
+ return true;
1821
+ }
1822
+ }
1823
+ }
1824
+ }
1825
+ }
1826
+ }
1827
+
1828
+ if (DEBUG)
1829
+ {
1830
+ System.out.println(" => initialization of variable v"+variableIndex+" at ["+initializationOffset+"] not necessary");
1831
+ }
1832
+
1833
+ return false;
1834
+ }
1835
+
1836
+
1837
+ private void markVariableAfter(int instructionOffset,
1838
+ int variableIndex)
1839
+ {
1840
+ if (!isVariableNecessaryAfter(instructionOffset, variableIndex))
1841
+ {
1842
+ if (DEBUG) System.out.print("["+instructionOffset+".v"+variableIndex+"],");
1843
+
1844
+ variablesNecessaryAfter[instructionOffset][variableIndex] = true;
1845
+
1846
+ if (maxMarkedOffset < instructionOffset)
1847
+ {
1848
+ maxMarkedOffset = instructionOffset;
1849
+ }
1850
+ }
1851
+ }
1852
+
1853
+
1854
+ /**
1855
+ * Returns whether the specified variable is ever necessary after any
1856
+ * instructions in the specified block.
1857
+ */
1858
+ private boolean isVariableNecessaryAfterAny(int startOffset,
1859
+ int endOffset,
1860
+ int variableIndex)
1861
+ {
1862
+ for (int offset = startOffset; offset < endOffset; offset++)
1863
+ {
1864
+ if (isVariableNecessaryAfter(offset, variableIndex))
1865
+ {
1866
+ return true;
1867
+ }
1868
+ }
1869
+
1870
+ return false;
1871
+ }
1872
+
1873
+
1874
+ /**
1875
+ * Returns whether the specified variable is ever necessary after any
1876
+ * instructions in the specified set of instructions offsets.
1877
+ */
1878
+ private boolean isVariableNecessaryAfterAny(InstructionOffsetValue instructionOffsetValue,
1879
+ int variableIndex)
1880
+ {
1881
+ int count = instructionOffsetValue.instructionOffsetCount();
1882
+
1883
+ for (int index = 0; index < count; index++)
1884
+ {
1885
+ if (isVariableNecessaryAfter(instructionOffsetValue.instructionOffset(index),
1886
+ variableIndex))
1887
+ {
1888
+ return true;
1889
+ }
1890
+ }
1891
+
1892
+ return false;
1893
+ }
1894
+
1895
+
1896
+ /**
1897
+ * Returns whether the specified variable is ever necessary after all
1898
+ * instructions in the specified set of instructions offsets.
1899
+ */
1900
+ private boolean isVariableNecessaryAfterAll(InstructionOffsetValue instructionOffsetValue,
1901
+ int variableIndex)
1902
+ {
1903
+ int count = instructionOffsetValue.instructionOffsetCount();
1904
+
1905
+ for (int index = 0; index < count; index++)
1906
+ {
1907
+ if (!isVariableNecessaryAfter(instructionOffsetValue.instructionOffset(index),
1908
+ variableIndex))
1909
+ {
1910
+ return false;
1911
+ }
1912
+ }
1913
+
1914
+ return true;
1915
+ }
1916
+
1917
+
1918
+ private boolean isVariableNecessaryAfter(int instructionOffset,
1919
+ int variableIndex)
1920
+ {
1921
+ return instructionOffset == PartialEvaluator.AT_METHOD_ENTRY ||
1922
+ variablesNecessaryAfter[instructionOffset][variableIndex];
1923
+ }
1924
+
1925
+
1926
+ /**
1927
+ * Marks the stack entries after the given offsets.
1928
+ * @param instructionOffsets the offsets of the stack entries to be marked.
1929
+ * @param stackIndex the index of the stack entries to be marked
1930
+ * (counting from the bottom).
1931
+ */
1932
+ private void markStackEntriesAfter(InstructionOffsetValue instructionOffsets,
1933
+ int stackIndex)
1934
+ {
1935
+ if (instructionOffsets != null)
1936
+ {
1937
+ int offsetCount = instructionOffsets.instructionOffsetCount();
1938
+ for (int offsetIndex = 0; offsetIndex < offsetCount; offsetIndex++)
1939
+ {
1940
+ // Make sure the stack entry and the instruction are marked
1941
+ // at the producing offset.
1942
+ int offset = instructionOffsets.instructionOffset(offsetIndex);
1943
+
1944
+ markStackEntryAfter(offset, stackIndex);
1945
+ }
1946
+ }
1947
+ }
1948
+
1949
+
1950
+ /**
1951
+ * Marks the stack entry after the given offset.
1952
+ * @param instructionOffset the offset of the stack entry to be marked.
1953
+ * @param stackIndex the index of the stack entry to be marked
1954
+ * (counting from the bottom).
1955
+ */
1956
+ private void markStackEntryAfter(int instructionOffset,
1957
+ int stackIndex)
1958
+ {
1959
+ if (!isStackEntryNecessaryAfter(instructionOffset, stackIndex))
1960
+ {
1961
+ if (DEBUG) System.out.print("["+instructionOffset+".s"+stackIndex+"],");
1962
+
1963
+ stacksNecessaryAfter[instructionOffset][stackIndex] = true;
1964
+
1965
+ if (maxMarkedOffset < instructionOffset)
1966
+ {
1967
+ maxMarkedOffset = instructionOffset;
1968
+ }
1969
+ }
1970
+ }
1971
+
1972
+
1973
+ /**
1974
+ * Returns whether any of the stack entries after the given offsets are
1975
+ * necessary.
1976
+ * @param instructionOffsets the offsets of the stack entries to be checked.
1977
+ * @param stackIndex the index of the stack entries to be checked
1978
+ * (counting from the bottom).
1979
+ */
1980
+ private boolean isAnyStackEntryNecessaryAfter(InstructionOffsetValue instructionOffsets,
1981
+ int stackIndex)
1982
+ {
1983
+ int offsetCount = instructionOffsets.instructionOffsetCount();
1984
+
1985
+ for (int offsetIndex = 0; offsetIndex < offsetCount; offsetIndex++)
1986
+ {
1987
+ if (isStackEntryNecessaryAfter(instructionOffsets.instructionOffset(offsetIndex), stackIndex))
1988
+ {
1989
+ return true;
1990
+ }
1991
+ }
1992
+
1993
+ return false;
1994
+ }
1995
+
1996
+
1997
+ /**
1998
+ * Returns whether any of the stack entries after the given offset are
1999
+ * necessary.
2000
+ * @param instructionOffset the offset of the stack entry to be checked.
2001
+ * @param stackIndex the index of the stack entry to be checked
2002
+ * (counting from the bottom).
2003
+ */
2004
+ private boolean isStackEntryNecessaryAfter(int instructionOffset,
2005
+ int stackIndex)
2006
+ {
2007
+ return instructionOffset == PartialEvaluator.AT_CATCH_ENTRY ||
2008
+ stacksNecessaryAfter[instructionOffset][stackIndex];
2009
+ }
2010
+
2011
+
2012
+ private void markStackSimplificationBefore(int instructionOffset,
2013
+ int stackIndex)
2014
+ {
2015
+ stacksSimplifiedBefore[instructionOffset][stackIndex] = true;
2016
+ }
2017
+
2018
+
2019
+ private boolean isStackSimplifiedBefore(int instructionOffset,
2020
+ int stackIndex)
2021
+ {
2022
+ return stacksSimplifiedBefore[instructionOffset][stackIndex];
2023
+ }
2024
+
2025
+
2026
+ private void markInstruction(int instructionOffset)
2027
+ {
2028
+ if (!isInstructionNecessary(instructionOffset))
2029
+ {
2030
+ if (DEBUG) System.out.print(instructionOffset+",");
2031
+
2032
+ instructionsNecessary[instructionOffset] = true;
2033
+
2034
+ if (maxMarkedOffset < instructionOffset)
2035
+ {
2036
+ maxMarkedOffset = instructionOffset;
2037
+ }
2038
+ }
2039
+ }
2040
+
2041
+
2042
+ private boolean isAnyInstructionNecessary(int instructionOffset1,
2043
+ int instructionOffset2)
2044
+ {
2045
+ for (int instructionOffset = instructionOffset1;
2046
+ instructionOffset < instructionOffset2;
2047
+ instructionOffset++)
2048
+ {
2049
+ if (isInstructionNecessary(instructionOffset))
2050
+ {
2051
+ return true;
2052
+ }
2053
+ }
2054
+
2055
+ return false;
2056
+ }
2057
+
2058
+
2059
+ /**
2060
+ * Returns the highest offset of an instruction that has been marked as
2061
+ * necessary, before the given offset.
2062
+ */
2063
+ private int lastNecessaryInstructionOffset(int instructionOffset)
2064
+ {
2065
+ for (int offset = instructionOffset-1; offset >= 0; offset--)
2066
+ {
2067
+ if (isInstructionNecessary(instructionOffset))
2068
+ {
2069
+ return offset;
2070
+ }
2071
+ }
2072
+
2073
+ return 0;
2074
+ }
2075
+
2076
+
2077
+ private boolean isInstructionNecessary(int instructionOffset)
2078
+ {
2079
+ return instructionOffset == PartialEvaluator.AT_METHOD_ENTRY ||
2080
+ instructionsNecessary[instructionOffset];
2081
+ }
2082
+ }