Skip to content

Commit 4b1bf33

Browse files
committed
Document the fact that in IR codegen only explicitly referenced functions are added to internal dispatch
1 parent 3357ca7 commit 4b1bf33

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

docs/ir-breaking-changes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ The ID ``0`` is reserved for uninitialized function pointers which then cause a
278278
In the old code generator, internal function pointers are initialized with a special function that always causes a panic.
279279
This causes a storage write at construction time for internal function pointers in storage.
280280

281+
.. note::
282+
The compiler is free to omit internal functions that are never explicitly referenced by name.
283+
As a consequence, assigning to a function type variable in inline assembly does not guarantee
284+
that the assigned value will be included in the internal dispatch.
285+
The function must also be explicitly referenced elsewhere in the code.
286+
281287
Cleanup
282288
-------
283289

docs/types/value-types.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,13 @@ the contract code is never going to be updated.
894894
It is also always possible to side-step any safeguards by using inline assembly.
895895
Such use always needs careful consideration.
896896

897+
.. note::
898+
The removal of unused internal functions only takes into account explicit references to
899+
such functions by name.
900+
Implicit references, such as assigning a new value to a function type variable in inline assembly
901+
may still lead to the removal of the function if it is not also referenced explicitly elsewhere
902+
in the source.
903+
897904
Examples
898905
^^^^^^^^
899906

0 commit comments

Comments
 (0)