[erlang-patches] Optimize handling of local fun variables in v3_kernel

Björn Gustavsson bgustavsson@REDACTED
Wed Jan 9 17:32:53 CET 2013


The code looks fine.

I have only one comment for this part of the patch:

@@ -1663,6 +1655,19 @@ uexpr(#ifun{anno=A,vars=Vs,body=B0}, {break,Rs},
St0) ->
    #k_int{val=Index},#k_int{val=Uniq}|Fvs],
      ret=Rs},
      Free,add_local_function(Fun, St)};
+uexpr(#k_local{anno=A,name=Name,arity=Arity}, {break,Rs}, St) ->
+    Fs = get_free(Name, Arity, St),
+    FsCount = length(Fs),
+    Free = lit_list_vars(Fs),
+    %% Set dummy values for Index and Uniq -- the real values will
+    %% be assigned by beam_asm.
+    Index = Uniq = 0,
+    Bif = #k_bif{anno=#k{us=Free,ns=lit_list_vars(Rs),a=A},
+                 op=#k_internal{name=make_fun,arity=FsCount+3},
+                 args=[#k_atom{val=Name},#k_int{val=FsCount+Arity},
+                       #k_int{val=Index},#k_int{val=Uniq}|Fs],
+                 ret=Rs},
+    {Bif,Free,St};
 uexpr(Lit, {break,Rs0}, St0) ->
     %% Transform literals to puts here.
     %%ok = io:fwrite("uexpr ~w:~p~n", [?LINE,Lit]),

The code handles free variables. As far as I can understand, there
can be no free variables in this case, so you should simplify the code.



On Wed, Jan 9, 2013 at 4:51 PM, Fredrik <fredrik@REDACTED> wrote:

> Hello Anthony,
> Your patch is failing the following suites and tests;
> trace_local_SUITE, exception_apply_function
> trace_local_SUITE, exception_function
> trace_local_SUITE, exception_meta_apply_function
> trace_local_SUITE, exception_meta_function
> trace_local_SUITE, exception_meta_nocatch_apply_**function
> trace_local_SUITE, exception_meta_nocatch_**function
> trace_local_SUITE, exception_nocatch_apply_**function
> trace_local_SUITE, exception_nocatch_function
>
> Could you please fix this and then give me a notice,
>
> BR Fredrik Gustafsson
> Erlang OTP Team
>
> On 12/03/2012 11:28 AM, Anthony Ramine wrote:
>
>> I've removed the second commit of this branch because I'm not happy with
>> it and because it makes the mnesia test suites fail. Enabling propagatation
>> of local function names should be another patch on its own, let's not put
>> that in this branch.
>>
>> Please refetch.
>>
>>
> ______________________________**_________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/**listinfo/erlang-patches<http://erlang.org/mailman/listinfo/erlang-patches>
>



-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130109/e408082e/attachment.htm>


More information about the erlang-patches mailing list