Module erts_internal

An implementation of a subset of the Erlang/OTP erts_internal interface.

Description

These functions are not meant to be called directly. They are helpers, called from code generated by the compiler. In particular mc_iterator/1 and mc_refill/1 implement map comprehensions (#{K => V || K := V <- M}), introduced in OTP 26. The generated bytecode is identical from OTP 26 to at least OTP 29.

Function Index

cmp_term/2 Compare two terms using the standard exact term ordering.
mc_iterator/1 Start iterating over a map comprehension generator.
mc_refill/1 Advance a map comprehension iterator.

Function Details

cmp_term/2


cmp_term(A::term(), B::term()) -> -1 | 0 | 1

A: first term to compare
B: second term to compare

returns: -1 if A is less than B, 1 if A is greater than B, or 0 if they are exactly equal

Compare two terms using the standard exact term ordering.

Returns a negative, zero or positive indicator rather than a boolean. Comparison is exact, so numbers of different types are never equal (as with =:=). This is an internal helper and is not meant to be called directly.

mc_iterator/1


mc_iterator(MapOrIter) -> Iter

MapOrIter: a map or a map iterator to iterate over

returns: the first association as {Key, Value, NextIterator}, none if the map or iterator is empty, or [] if the argument is not a valid generator

Start iterating over a map comprehension generator.

This function is a helper called from compiler generated code for map comprehensions. It must be kept compatible as long as code calling this helper can still be loaded.

mc_refill/1


mc_refill(IterMap) -> Iter
  • IterMap = nonempty_improper_list(non_neg_integer() | list(), map())
  • Iter = {term(), term(), maps:iterator()} | none

IterMap: a map iterator to refill

returns: the next association as {Key, Value, NextIterator} or none

Advance a map comprehension iterator.

This function is a helper called from compiler generated code for map comprehensions. It must be kept compatible as long as code calling this helper can still be loaded.