aboutsummaryrefslogtreecommitdiff
path: root/smali
diff options
context:
space:
mode:
authorBen Gruver <bgruv@google.com>2018-05-22 16:22:59 -0700
committerBen Gruver <bgruv@google.com>2018-05-23 13:34:16 -0700
commite2cffa23f71ec480e7b901f764a342b63b11cbd7 (patch)
tree6a442d7813d8566a4af06add73af19b4e5d761b5 /smali
parenta387fa8b48eb23749982677b9716e0155f213724 (diff)
downloadsmali-e2cffa23f71ec480e7b901f764a342b63b11cbd7.tar.gz
Add support for const-method-handle and const-method-type in the tree walker
Diffstat (limited to 'smali')
-rw-r--r--smali/src/main/antlr/smaliTreeWalker.g28
1 files changed, 28 insertions, 0 deletions
diff --git a/smali/src/main/antlr/smaliTreeWalker.g b/smali/src/main/antlr/smaliTreeWalker.g
index 7a77d8fb..5844bb45 100644
--- a/smali/src/main/antlr/smaliTreeWalker.g
+++ b/smali/src/main/antlr/smaliTreeWalker.g
@@ -769,6 +769,8 @@ instruction
| insn_format20bc
| insn_format20t
| insn_format21c_field
+ | insn_format21c_method_handle
+ | insn_format21c_method_type
| insn_format21c_string
| insn_format21c_type
| insn_format21ih
@@ -888,6 +890,32 @@ insn_format21c_field
dexBuilder.internFieldReference(fieldReference)));
};
+insn_format21c_method_handle
+ : //e.g. const-method-handle v0, static-invoke@Ljava/lang/Integer;->toString(I)Ljava/lang/String;
+ ^(I_STATEMENT_FORMAT21c_METHOD_HANDLE inst=(INSTRUCTION_FORMAT21c_METHOD_HANDLE) REGISTER method_handle_reference)
+ {
+ Opcode opcode = opcodes.getOpcodeByName($inst.text);
+ short regA = parseRegister_byte($REGISTER.text);
+
+ ImmutableMethodHandleReference methodHandleReference = $method_handle_reference.methodHandle;
+
+ $method::methodBuilder.addInstruction(new BuilderInstruction21c(opcode, regA,
+ dexBuilder.internMethodHandle(methodHandleReference)));
+ };
+
+insn_format21c_method_type
+ : //e.g. const-method-type v0, (ILjava/lang/String;)Ljava/lang/String;
+ ^(I_STATEMENT_FORMAT21c_METHOD_TYPE inst=(INSTRUCTION_FORMAT21c_METHOD_TYPE) REGISTER method_prototype)
+ {
+ Opcode opcode = opcodes.getOpcodeByName($inst.text);
+ short regA = parseRegister_byte($REGISTER.text);
+
+ ImmutableMethodProtoReference methodProtoReference = $method_prototype.proto;
+
+ $method::methodBuilder.addInstruction(new BuilderInstruction21c(opcode, regA,
+ dexBuilder.internMethodProtoReference(methodProtoReference)));
+ };
+
insn_format21c_string
: //e.g. const-string v1, "Hello World!"
^(I_STATEMENT_FORMAT21c_STRING INSTRUCTION_FORMAT21c_STRING REGISTER string_literal)