diff options
author | Rickard Green <[email protected]> | 2017-02-06 20:17:28 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-02-06 20:17:28 +0100 |
commit | 12eb5089147513d1bc0797617bb6e95bc6e0c332 (patch) | |
tree | 2e9297dc7cb7b2839c9774307044d138bce46fa2 /erts/preloaded/src/erlang.erl | |
parent | 888c889714569a142525505c914f577135a46ec9 (diff) | |
parent | 8a72a253e2eda59e510d953f0b6eb21b50e06d0e (diff) | |
download | otp-12eb5089147513d1bc0797617bb6e95bc6e0c332.tar.gz otp-12eb5089147513d1bc0797617bb6e95bc6e0c332.tar.bz2 otp-12eb5089147513d1bc0797617bb6e95bc6e0c332.zip |
Merge branch 'rickard/magic-references'
OTP-14205
* rickard/magic-references:
Add binary overhead for magic ref/binaries
Adjust the only usage of exposed magic binaries
Use magic refs for maps merge trap context
Use magic refs binary_to_term/term_to_binary trap context
Use magic refs for distributed send trap context
Use magic refs for unicode static NIFs traps
Use magic refs for binary compile patterns
Use magic refs for list_to_binary/binary_to_list traps
Use magic refs for compiled match specs
Use magic refs for re:run() static NIFs trap
Use magic refs for code loading state
Use magic refs in trapping processes()/ports() BIFs
Use magic refs for NIF resources
Implement magic references
Implement erts_refc_inc_unless()
Diffstat (limited to 'erts/preloaded/src/erlang.erl')
-rw-r--r-- | erts/preloaded/src/erlang.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index be7ceb928b..ca181343e3 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -83,6 +83,10 @@ | 'micro_seconds' | 'nano_seconds'. +-opaque prepared_code() :: reference(). + +-export_type([prepared_code/0]). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Native code BIF stubs and their types %% (BIF's actually implemented in this module goes last in the file) @@ -791,9 +795,9 @@ external_size(_Term, _Options) -> erlang:nif_error(undefined). %% finish_loading/2 --spec erlang:finish_loading(PreparedCodeBinaries) -> ok | Error when - PreparedCodeBinaries :: [PreparedCodeBinary], - PreparedCodeBinary :: binary(), +-spec erlang:finish_loading(PreparedCodeList) -> ok | Error when + PreparedCodeList :: [PreparedCode], + PreparedCode :: prepared_code(), ModuleList :: [module()], Error :: {not_purged,ModuleList} | {on_load,ModuleList}. finish_loading(_List) -> @@ -1030,7 +1034,7 @@ halt(_Status, _Options) -> %% has_prepared_code_on_load/1 -spec erlang:has_prepared_code_on_load(PreparedCode) -> boolean() when - PreparedCode :: binary(). + PreparedCode :: prepared_code(). has_prepared_code_on_load(_PreparedCode) -> erlang:nif_error(undefined). @@ -1447,7 +1451,7 @@ timestamp() -> -spec erlang:prepare_loading(Module, Code) -> PreparedCode | {error, Reason} when Module :: module(), Code :: binary(), - PreparedCode :: binary(), + PreparedCode :: prepared_code(), Reason :: bad_file. prepare_loading(_Module, _Code) -> erlang:nif_error(undefined). @@ -2007,8 +2011,8 @@ load_module(Mod, Code) -> case erlang:prepare_loading(Mod, Code) of {error,_}=Error -> Error; - Bin when erlang:is_binary(Bin) -> - case erlang:finish_loading([Bin]) of + Prep when erlang:is_reference(Prep) -> + case erlang:finish_loading([Prep]) of ok -> {module,Mod}; {Error,[Mod]} -> |