Skip to content

Commit

Permalink
exclude throw in may_throw
Browse files Browse the repository at this point in the history
Summary: There are is_throw and can_throw method

Reviewed By: NTillmann

Differential Revision: D62260532

fbshipit-source-id: 28649dfa0cdaff8169585aacf3e19c4a29aeb30a
  • Loading branch information
ssj933 authored and facebook-github-bot committed Sep 5, 2024
1 parent 1f2e35d commit 6bcd361
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion libredex/IROpcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,6 @@ bool may_throw(IROpcode op) {
case OPCODE_NEW_ARRAY:
case OPCODE_FILLED_NEW_ARRAY:
case OPCODE_FILL_ARRAY_DATA:
case OPCODE_THROW:
case OPCODE_AGET:
case OPCODE_AGET_WIDE:
case OPCODE_AGET_OBJECT:
Expand Down
5 changes: 5 additions & 0 deletions libredex/IROpcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ bool is_binop64(IROpcode op);
/**
* Update according to
* https://cs.android.com/android/platform/superproject/main/+/main:art/libdexfile/dex/dex_instruction_list.h
* except OPCODE_THROW, this get covered in can_throw
*/
bool may_throw(IROpcode);

Expand All @@ -113,6 +114,10 @@ bool may_throw(IROpcode);
inline bool is_##LC(IROpcode op) { return op == IOPCODE_##UC; }
#include "IROpcodes.def"

/**
* Should represent value in
* https://cs.android.com/android/platform/superproject/main/+/main:art/libdexfile/dex/dex_instruction_list.h
*/
inline bool can_throw(IROpcode op) { return may_throw(op) || is_throw(op); }

inline bool writes_result_register(IROpcode op) {
Expand Down

0 comments on commit 6bcd361

Please sign in to comment.