diff options
author | Björn Gustavsson <[email protected]> | 2011-06-13 14:38:52 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-10-11 10:08:46 +0200 |
commit | 3b3bb767433a333750b090908fa370d957bbbfa2 (patch) | |
tree | 494ee27fd0814b45fbcefc2918945d441e99123a /erts/emulator/utils/beam_makeops | |
parent | 8f52f4b5d92197de19dd5df29513a9dcb5437280 (diff) | |
download | otp-3b3bb767433a333750b090908fa370d957bbbfa2.tar.gz otp-3b3bb767433a333750b090908fa370d957bbbfa2.tar.bz2 otp-3b3bb767433a333750b090908fa370d957bbbfa2.zip |
Generalize and rename is_set_var_instr() to is_instr()
It is more useful to have a helper function that can test for
any instruction.
Diffstat (limited to 'erts/emulator/utils/beam_makeops')
-rwxr-xr-x | erts/emulator/utils/beam_makeops | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops index ebf7db3277..75047f22bd 100755 --- a/erts/emulator/utils/beam_makeops +++ b/erts/emulator/utils/beam_makeops @@ -1437,7 +1437,7 @@ sub tr_gen_from { push(@code, &make_op($var, 'set_var', $var{$var})); } } - if (is_set_var_instr($code[$#code])) { + if (is_instr($code[$#code], 'set_var')) { my $ref = pop @code; my $comment = $ref->[2]; my $var = $ref->[1][1]; @@ -1560,7 +1560,7 @@ sub tr_gen_to { } push(@code, &make_op('', 'next_arg')); } - pop(@code) if $code[$#code]->[1][0] eq 'next_arg'; + pop(@code) if is_instr($code[$#code], 'next_arg'); } push(@code, &make_op('', 'end')); @@ -1597,10 +1597,10 @@ sub make_op { [scalar(@op), [@op], $comment]; } -sub is_set_var_instr { - my($ref) = @_; +sub is_instr { + my($ref,$op) = @_; return 0 unless ref($ref) eq 'ARRAY'; - $ref->[1][0] eq 'set_var'; + $ref->[1][0] eq $op; } sub tr_gen_call { |