From c79e1106853bcfdabe7325a7073ce911ef75afaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 9 Mar 2012 14:47:23 +0100 Subject: If VM probes are not enabled, short-circuit calls to probe BIFs --- erts/emulator/Makefile.in | 2 ++ erts/emulator/beam/ops.tab | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) (limited to 'erts') diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index d8fad98de2..2efbe2d57e 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -25,6 +25,7 @@ ENABLE_ALLOC_TYPE_VARS = @ENABLE_ALLOC_TYPE_VARS@ HIPE_ENABLED=@HIPE_ENABLED@ DTRACE_ENABLED=@DTRACE_ENABLED@ DTRACE_ENABLED_2STEP=@DTRACE_ENABLED_2STEP@ +USE_VM_PROBES=@USE_VM_PROBES@ LIBS = @LIBS@ Z_LIB=@Z_LIB@ NO_INLINE_FUNCTIONS=false @@ -508,6 +509,7 @@ $(TTF_DIR)/OPCODES-GENERATED: $(OPCODE_TABLES) utils/beam_makeops LANG=C $(PERL) utils/beam_makeops \ -wordsize @EXTERNAL_WORD_SIZE@ \ -outdir $(TTF_DIR) \ + -DUSE_VM_PROBES=$(if $(USE_VM_PROBES),1,0) \ -emulator $(OPCODE_TABLES) && echo $? >$(TTF_DIR)/OPCODES-GENERATED GENERATE += $(TTF_DIR)/OPCODES-GENERATED diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab index fc53a88a3a..edc935e1ff 100644 --- a/erts/emulator/beam/ops.tab +++ b/erts/emulator/beam/ops.tab @@ -882,6 +882,95 @@ call_ext u==3 u$func:erlang:hibernate/3 => i_hibernate call_ext_last u==3 u$func:erlang:hibernate/3 D => i_hibernate call_ext_only u==3 u$func:erlang:hibernate/3 => i_hibernate +# +# If VM probes are not enabled, we want to short-circult calls to +# the utag BIFs to make them as cheap as possible. +# + +%unless USE_VM_PROBES + +call_ext Arity u$func:erlang:get_utag/0 => \ + move a=am_undefined r +call_ext_last Arity u$func:erlang:get_utag/0 D => \ + move a=am_undefined r | deallocate D | return +call_ext_only Arity u$func:erlang:get_utag/0 => \ + move a=am_undefined r | return + +move Any r | call_ext Arity u$func:erlang:put_utag/1 => \ + move a=am_undefined r +move Any r | call_ext_last Arity u$func:erlang:put_utag/1 D => \ + move a=am_undefined r | deallocate D | return +move Any r | call_ext_only Arity u$func:erlang:put_utag/1 => \ + move a=am_undefined r | return +call_ext Arity u$func:erlang:put_utag/1 => \ + move a=am_undefined r +call_ext_last Arity u$func:erlang:put_utag/1 D => \ + move a=am_undefined r | deallocate D | return +call_ext_only Arity u$func:erlang:put_utag/1 => \ + move a=am_undefined r | return + +call_ext Arity u$func:erlang:get_utag_data/0 => \ + move a=am_undefined r +call_ext_last Arity u$func:erlang:get_utag_data/0 D => \ + move a=am_undefined r | deallocate D | return +call_ext_only Arity u$func:erlang:get_utag_data/0 => \ + move a=am_undefined r | return + +move Any r | call_ext Arity u$func:erlang:spread_utag/1 => \ + move a=am_true r +move Any r | call_ext_last Arity u$func:erlang:spread_utag/1 D => \ + move a=am_true r | deallocate D | return +move Any r | call_ext_only Arity u$func:erlang:spread_utag/1 => \ + move a=am_true r | return +call_ext Arity u$func:erlang:spread_utag/1 => \ + move a=am_true r +call_ext_last Arity u$func:erlang:spread_utag/1 D => \ + move a=am_true r | deallocate D | return +call_ext_only Arity u$func:erlang:spread_utag/1 => \ + move a=am_true r | return + +move Any r | call_ext Arity u$func:erlang:restore_utag/1 => \ + move a=am_true r +move Any r | call_ext_last Arity u$func:erlang:restore_utag/1 D => \ + move a=am_true r | deallocate D | return +move Any r | call_ext_only Arity u$func:erlang:restore_utag/1 => \ + move a=am_true r | return +call_ext Arity u$func:erlang:restore_utag/1 => \ + move a=am_true r +call_ext_last Arity u$func:erlang:restore_utag/1 D => \ + move a=am_true r | deallocate D | return +call_ext_only Arity u$func:erlang:restore_utag/1 => \ + move a=am_true r | return + +move Any r | call_ext Arity u$func:erlang:prepend_vm_utag_data/1 => \ + move Any r +move Any r | call_ext_last Arity u$func:erlang:prepend_vm_utag_data/1 D => \ + move Any r | deallocate D | return +move Any r | call_ext_only Arity u$func:erlang:prepend_vm_utag_data/1 => \ + move Any r | return +call_ext Arity u$func:erlang:prepend_vm_utag_data/1 => +call_ext_last Arity u$func:erlang:prepend_vm_utag_data/1 D => \ + deallocate D | return +call_ext_only Arity u$func:erlang:prepend_vm_utag_data/1 => \ + return + +move Any r | call_ext Arity u$func:erlang:append_vm_utag_data/1 => \ + move Any r +move Any r | call_ext_last Arity u$func:erlang:append_vm_utag_data/1 D => \ + move Any r | deallocate D | return +move Any r | call_ext_only Arity u$func:erlang:append_vm_utag_data/1 => \ + move Any r | return +call_ext Arity u$func:erlang:append_vm_utag_data/1 => +call_ext_last Arity u$func:erlang:append_vm_utag_data/1 D => \ + deallocate D | return +call_ext_only Arity u$func:erlang:append_vm_utag_data/1 => \ + return + +# Can happen after one of the transformations above. +move Discarded r | move Something r => move Something r + +%endif + # # The general case for BIFs that have no special instructions. # A BIF used in the tail must be followed by a return instruction. -- cgit v1.2.3