|
Authored by: Anonymous on Friday, May 18 2012 @ 11:25 PM EDT |
The parent and grandparent are both right. Any type of pattern matcher
will iterate through the input bytecodes in some way, bailing out as soon
as it runs into something unexpected. This pattern is simple and linear,
suitable for a DFA matcher (a regular expression), but even that seems
more complicated than necessary. No recursion is needed, although a
linear traversal like this could also be written recursively... But except in a
functional programming language, there is no reason to do it like that. I'm
too lazy to check what Dalvik actually does. But if I were given this
problem and asked to solve it in C++ or a similar language, I would just
use a for loop to linearly scan through the bytecodes and recognize (i.e.
pattern-match) each group of 4 instructions, and collect up the constants.[ Reply to This | Parent | # ]
|
|
|
|
|