@@ -45,11 +45,11 @@ compile(Quoted, ArgsList, CompilerOpts, #{line := Line} = E) ->
45
45
{Expanded , SE , EE } = elixir_expand :expand (Block , elixir_env :env_to_ex (E ), E ),
46
46
elixir_env :check_unused_vars (SE , EE ),
47
47
48
- {Module , Fun } =
48
+ {Module , Fun , LabelledLocals } =
49
49
elixir_erl_compiler :spawn (fun () -> spawned_compile (Expanded , CompilerOpts , E ) end ),
50
50
51
51
Args = list_to_tuple (ArgsList ),
52
- {dispatch (Module , Fun , Args ), SE , EE }.
52
+ {dispatch (Module , Fun , Args , LabelledLocals ), SE , EE }.
53
53
54
54
spawned_compile (ExExprs , CompilerOpts , #{line := Line , file := File } = E ) ->
55
55
{Vars , S } = elixir_erl_var :from_env (E ),
@@ -61,12 +61,22 @@ spawned_compile(ExExprs, CompilerOpts, #{line := Line, file := File} = E) ->
61
61
62
62
{Module , Binary } = elixir_erl_compiler :noenv_forms (Forms , File , [nowarn_nomatch | CompilerOpts ]),
63
63
code :load_binary (Module , " " , Binary ),
64
- {Module , Fun }.
64
+ {Module , Fun , is_purgeable ( Binary ) }.
65
65
66
- dispatch (Module , Fun , Args ) ->
66
+ is_purgeable (<<" FOR1" , _Size :32 , " BEAM" , Rest /binary >>) ->
67
+ do_is_purgeable (Rest ).
68
+
69
+ do_is_purgeable (<<>>) -> true ;
70
+ do_is_purgeable (<<" LocT" , 4 :32 , 0 :32 , _ /binary >>) -> true ;
71
+ do_is_purgeable (<<" LocT" , _ :32 , _ /binary >>) -> false ;
72
+ do_is_purgeable (<<_ :4 /binary , Size :32 , Beam /binary >>) ->
73
+ <<_ :(4 * trunc ((Size + 3 ) / 4 ))/binary , Rest /binary >> = Beam ,
74
+ do_is_purgeable (Rest ).
75
+
76
+ dispatch (Module , Fun , Args , Purgeable ) ->
67
77
Res = Module :Fun (Args ),
68
78
code :delete (Module ),
69
- return_compiler_module (Module ),
79
+ Purgeable andalso return_compiler_module (Module ),
70
80
Res .
71
81
72
82
code_fun (nil ) -> '__FILE__' ;
0 commit comments