aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_dict.erl
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-01-18 10:37:04 +0100
committerFredrik Gustafsson <[email protected]>2013-01-18 10:37:04 +0100
commit750ecdea08fa5fa7e32b7f3019eed96c1699427e (patch)
treef2aa96ecfc71ba2af67f1636db7d77a3692f6b08 /lib/compiler/src/beam_dict.erl
parent2cfa0466c3b3c7bd5e3621aff0f3e2ca30addb68 (diff)
parented8afbbde6e8a90f415f8bd2d8d0a19d759fb7e3 (diff)
downloadotp-750ecdea08fa5fa7e32b7f3019eed96c1699427e.tar.gz
otp-750ecdea08fa5fa7e32b7f3019eed96c1699427e.tar.bz2
otp-750ecdea08fa5fa7e32b7f3019eed96c1699427e.zip
Merge branch 'nox/rm-reverse-eta-conversion/OTP-10682'
* nox/rm-reverse-eta-conversion/OTP-10682: Don't use fun references in cprof_SUITE Make trace_local_SUITE work without the reverse eta conversion Remove the reverse eta-conversion from v3_kernel
Diffstat (limited to 'lib/compiler/src/beam_dict.erl')
-rw-r--r--lib/compiler/src/beam_dict.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/compiler/src/beam_dict.erl b/lib/compiler/src/beam_dict.erl
index 531968b3c8..ff6c7c11dc 100644
--- a/lib/compiler/src/beam_dict.erl
+++ b/lib/compiler/src/beam_dict.erl
@@ -138,7 +138,17 @@ string(Str, Dict) when is_list(Str) ->
-spec lambda(label(), non_neg_integer(), bdict()) ->
{non_neg_integer(), bdict()}.
-lambda(Lbl, NumFree, #asm{lambdas=Lambdas0}=Dict) ->
+lambda(Lbl, 0, #asm{lambdas=Lambdas0}=Dict) ->
+ case lists:keyfind(Lbl, 1, Lambdas0) of
+ {Lbl,{OldIndex,_,_,_,_}} ->
+ {OldIndex,Dict};
+ false ->
+ new_lambda(Lbl, 0, Dict)
+ end;
+lambda(Lbl, NumFree, Dict) ->
+ new_lambda(Lbl, NumFree, Dict).
+
+new_lambda(Lbl, NumFree, #asm{lambdas=Lambdas0}=Dict) ->
OldIndex = length(Lambdas0),
%% Set Index the same as OldIndex.
Index = OldIndex,
@@ -235,10 +245,12 @@ string_table(#asm{strings=Strings,string_offset=Size}) ->
-spec lambda_table(bdict()) -> {non_neg_integer(), [<<_:192>>]}.
-lambda_table(#asm{locals=Loc0,lambdas=Lambdas0}) ->
+lambda_table(#asm{exports=Ext0,locals=Loc0,lambdas=Lambdas0}) ->
Lambdas1 = sofs:relation(Lambdas0),
Loc = sofs:relation([{Lbl,{F,A}} || {F,A,Lbl} <- Loc0]),
- Lambdas2 = sofs:relative_product1(Lambdas1, Loc),
+ Ext = sofs:relation([{Lbl,{F,A}} || {F,A,Lbl} <- Ext0]),
+ All = sofs:union(Loc, Ext),
+ Lambdas2 = sofs:relative_product1(Lambdas1, All),
Lambdas = [<<F:32,A:32,Lbl:32,Index:32,NumFree:32,OldUniq:32>> ||
{{_,Lbl,Index,NumFree,OldUniq},{F,A}} <- sofs:to_external(Lambdas2)],
{length(Lambdas),Lambdas}.