From de7e01c958ff7c9e6da4034a53567a30a4ae5792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 2 Aug 2012 11:26:48 +0200 Subject: Remove support for tuple funs Tuple funs were deprecated in R15B (in commit a4029940e309518f5500). --- erts/emulator/beam/beam_emu.c | 64 ------------------------------------- erts/emulator/hipe/hipe_bif0.c | 8 ----- erts/emulator/test/nofrag_SUITE.erl | 26 +-------------- 3 files changed, 1 insertion(+), 97 deletions(-) (limited to 'erts') diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 5dc5aa1e03..7b1ae624ce 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -230,11 +230,6 @@ BeamInstr beam_exception_trace[1]; /* UGLY also OpCode(i_return_trace) */ BeamInstr beam_return_time_trace[1]; /* OpCode(i_return_time_trace) */ -/* - * We should warn only once for tuple funs. - */ -static erts_smp_atomic_t warned_for_tuple_funs; - /* * All Beam instructions in numerical order. */ @@ -963,7 +958,6 @@ static Eterm make_arglist(Process* c_p, Eterm* reg, int a); void init_emulator(void) { - erts_smp_atomic_init_nob(&warned_for_tuple_funs, (erts_aint_t) 0); process_main(); } @@ -5990,7 +5984,6 @@ call_fun(Process* p, /* Current process. */ Eterm fun = reg[arity]; Eterm hdr; int i; - Eterm function; Eterm* hp; if (!is_boxed(fun)) { @@ -6128,63 +6121,6 @@ call_fun(Process* p, /* Current process. */ p->fvalue = TUPLE2(hp, fun, args); return NULL; } - } else if (hdr == make_arityval(2)) { - Eterm* tp; - Export* ep; - Eterm module; - - tp = tuple_val(fun); - module = tp[1]; - function = tp[2]; - if (!is_atom(module) || !is_atom(function)) { - goto badfun; - } - - /* - * If this is the first time a tuple fun is used, - * send a warning to the logger. - */ - if (erts_smp_atomic_xchg_nob(&warned_for_tuple_funs, - (erts_aint_t) 1) == 0) { - erts_dsprintf_buf_t* dsbufp; - - dsbufp = erts_create_logger_dsbuf(); - erts_dsprintf(dsbufp, "Call to tuple fun {%T,%T}.\n\n" - "Tuple funs are deprecated and will be removed " - "in R16. Use \"fun M:F/A\" instead, for example " - "\"fun %T:%T/%d\".\n\n" - "(This warning will only be shown the first time " - "a tuple fun is called.)\n", - module, function, module, function, arity); - erts_send_warning_to_logger(p->group_leader, dsbufp); - } - - if ((ep = erts_active_export_entry(module, function, arity)) == NULL) { - ep = erts_active_export_entry(erts_proc_get_error_handler(p), - am_undefined_function, 3); - if (ep == NULL) { - p->freason = EXC_UNDEF; - return 0; - } - if (is_non_value(args)) { - Uint sz = 2 * arity; - if (HeapWordsLeft(p) < sz) { - erts_garbage_collect(p, sz, reg, arity); - } - hp = HEAP_TOP(p); - HEAP_TOP(p) += sz; - args = NIL; - while (arity-- > 0) { - args = CONS(hp, reg[arity], args); - hp += 2; - } - } - reg[0] = module; - reg[1] = function; - reg[2] = args; - } - DTRACE_GLOBAL_CALL(p, module, function, arity); - return ep->addressv[erts_active_code_ix()]; } else { badfun: p->current = NULL; diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c index 74868b868c..ab62eeeb96 100644 --- a/erts/emulator/hipe/hipe_bif0.c +++ b/erts/emulator/hipe/hipe_bif0.c @@ -1583,14 +1583,6 @@ BIF_RETTYPE hipe_nonclosure_address(BIF_ALIST_2) goto badfun; m = ep->code[0]; f = ep->code[1]; - } else if (hdr == make_arityval(2)) { - Eterm *tp = tuple_val(BIF_ARG_1); - m = tp[1]; - f = tp[2]; - if (is_not_atom(m) || is_not_atom(f)) - goto badfun; - if (!erts_active_export_entry(m, f, BIF_ARG_2)) - goto badfun; } else goto badfun; address = hipe_get_na_nofail(m, f, BIF_ARG_2, 1); diff --git a/erts/emulator/test/nofrag_SUITE.erl b/erts/emulator/test/nofrag_SUITE.erl index 6b6ac28e2e..71567ed0cb 100644 --- a/erts/emulator/test/nofrag_SUITE.erl +++ b/erts/emulator/test/nofrag_SUITE.erl @@ -26,7 +26,6 @@ init_per_testcase/2,end_per_testcase/2, error_handler/1,error_handler_apply/1, error_handler_fixed_apply/1,error_handler_fun/1, - error_handler_tuple_fun/1, debug_breakpoint/1]). %% Exported functions for an error_handler module. @@ -37,7 +36,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [error_handler, error_handler_apply, error_handler_fixed_apply, error_handler_fun, - error_handler_tuple_fun, debug_breakpoint]. + debug_breakpoint]. groups() -> []. @@ -178,29 +177,6 @@ collect_fun(N, Fun) -> undefined_lambda(foobarblurf, Fun, Args) when is_function(Fun) -> Args. -error_handler_tuple_fun(Config) when is_list(Config) -> - ?line process_flag(error_handler, ?MODULE), - ?line Term = collect_tuple_fun(1024, {?MODULE,very_undefined_function}), - ?line Term = binary_to_term(term_to_binary(Term)), - ?line 1024 = length(Term), - ?line [[{foo,bar},42.0,[e,f,g]]] = lists:usort(Term), - ok. - -collect_tuple_fun(0, _) -> - []; -collect_tuple_fun(N, Fun) -> - %% The next line calls the error handle function, which is - %% ?MODULE:undefined_function/3 (it simply returns the list - %% of args). - C = Fun({foo,id(bar)}, 42.0, [e,f,id(g)]), - - %% The variable C will be saved onto the stack frame; if C - %% points into a heap fragment the garbage collector will reach - %% it and the emulator will crash sooner or later (sooner if - %% the emulator is debug-compiled). - Res = collect_tuple_fun(N-1, Fun), - [C|Res]. - debug_breakpoint(Config) when is_list(Config) -> ?line process_flag(error_handler, ?MODULE), ?line erts_debug:breakpoint({?MODULE,foobar,5}, true), -- cgit v1.2.3