Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Do not emit blatantly illformed apply expressions in core_inline #272

Closed
wants to merge 1 commit into from

3 participants

@nox
nox commented

Code such as apply 'f'/1 () should not be emitted by the Core Erlang inliner.

This fixes the last remaining problem related to #256.

@nox nox Do not emit blatantly illformed apply expressions in core_inline
Code such as apply 'f'/1 () should not be emitted by the Core Erlang inliner.
1ef9591
@bjorng
Collaborator

Now included in our daily builds. I have amended the commit message to reference the commit that added the test case and correction in v3_core.

@OTP-Maintainer

Patch has passed first testings and has been assigned to be reviewed

@bjorng
Collaborator

Merged.

@bjorng bjorng closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2014
  1. @nox

    Do not emit blatantly illformed apply expressions in core_inline

    nox authored
    Code such as apply 'f'/1 () should not be emitted by the Core Erlang inliner.
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/compiler/src/cerl_inline.erl
View
14 lib/compiler/src/cerl_inline.erl
@@ -51,7 +51,7 @@
catch_body/1, clause_body/1, clause_guard/1,
clause_pats/1, clause_vars/1, concrete/1, cons_hd/1,
cons_tl/1, data_arity/1, data_es/1, data_type/1,
- fun_body/1, fun_vars/1, get_ann/1, int_val/1,
+ fname_arity/1, fun_body/1, fun_vars/1, get_ann/1, int_val/1,
is_c_atom/1, is_c_cons/1, is_c_fname/1, is_c_int/1,
is_c_list/1, is_c_seq/1, is_c_tuple/1, is_c_var/1,
is_data/1, is_literal/1, is_literal_term/1, let_arg/1,
@@ -1030,8 +1030,16 @@ i_apply(E, Ctxt, Ren, Env, S) ->
visit_and_count_size(Opnd, S)
end,
S3, Opnds),
- N = apply_size(length(Es)),
- {update_c_apply(E, E1, Es), count_size(N, S4)}
+ Arity = length(Es),
+ E2 = case is_c_fname(E1) andalso length(Es) =/= fname_arity(E1) of
+ true ->
+ V = new_var(Env),
+ update_c_let(E, [V], E1, update_c_apply(E, V, Es));
+ false ->
+ update_c_apply(E, E1, Es)
+ end,
+ N = apply_size(Arity),
+ {E2, count_size(N, S4)}
end.
apply_size(A) ->
Something went wrong with that request. Please try again.