Repository navigation
defk-rt2.10: priv/defk_runtime.h lists the interface the compiler emits, checked by one test - #66
Merged
Merged
Conversation
…ts, checked by one test A comment block beside the header's Responsibilities index lists the runtime names the generated C uses (interface:start/end) and the names the generated C defines itself (kernel:start/end). test/runtime_interface_test.exs reads the names from the strings of compiler.ex, raise.ex and strip.ex (an interpolation as a wildcard) and checks the lists both ways, and that the interface names are the header's. The compiler map's line count is fixed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
priv/defk_runtime.hnow says which of its names the generated C uses. Before, the interface could only be learned from the emit strings incompiler.ex.interface:start/interface:end: the runtime names the generated C uses, in groups. A family uses the header's own notation (defk_get_<T>,DEFK_NF_<op>). Every other name in the header is internal.kernel:start/kernel:end: the names the generated C defines itself (DEFK_SP,DEFK_SAVE<n>,defk_rs, the labelsdefk_l<n>,defk_lit_<hash>, ...).test/runtime_interface_test.exsreads the names from the string literals ofcompiler.ex,raise.exandstrip.exthrough the parsed code. It skips atoms, sigils and comments, and each#{...}in a name becomes a wildcard (defk_get_#{e}givesdefk_get_*). Its three tests check that:defk_get_##Tcounts), and no name in the kernel list is a header name.Differences from the settled shape:
raise.ex(theDEFK_E_*kinds) andstrip.ex(a strip's rewritten C) also write runtime names, so the test reads them as well ascompiler.ex.defk_#{f}_#{s}, which givesdefk_clz_i. Such an entry passes when each of its pieces is an atom or a string piece of the sources (:clz,"i";lib/defk/builtins.exis read for the word lists). This direction is weaker for those names, and the test comment says so. The wildcard approach was the owner's choice over writing the names out in the compiler.Results
DEFK_HEADER_HASH, so every kernel's C changes in that one line. The scoreboard stamps hash the whole C, somix defk.examples --stalenow lists every stored row although no kernel code changed. Earlier header changes had the same effect.defk_mulhireplaced in the list by a made-updefk_bogus_x, all three tests failed, each with a message that names the problem. The list was then restored.How it was checked
mix cion the laptop (macOS) passed: 2300 tests, Credo found no issues, Dialyzer reported 0 errors.The mutation run above.
Touches a promised surface? No: the header changes only in a comment. No
CHANGELOG.mdentry.Touches
test/stability/? No.