-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FunC v0.5.0: syntax, refactoring, bugfixes, and a testing framework #1026
base: testnet
Are you sure you want to change the base?
Commits on Jun 14, 2024
-
[FunC] Change some fields to enums instead of integers
It makes it easier to understand/debug Also, drop some unused enum values from that cases
Configuration menu - View commit details
-
Copy full SHA for 0bc6305 - Browse repository at this point
Copy the full SHA 0bc6305View commit details -
[FunC] Enrich and refactor testing framework, add negative tests
* fully refactor run_tests.py, make it extensible for the future * an ability to write @compilation_should_fail tests * an ability to launch run_tests.py for a single .fc file * keep run_tests.js in sync with run_tests.py * extract legacy_tests names/hashes to a separate file shared between legacy_tester.py and legacy_tester.js
Configuration menu - View commit details
-
Copy full SHA for a5d2a10 - Browse repository at this point
Copy the full SHA a5d2a10View commit details -
[FunC] CMake option -DFUNC_DEBUG for development purposes
Seeing function name in debugger makes it much easier to delve into FunC sources
Configuration menu - View commit details
-
Copy full SHA for cbd7896 - Browse repository at this point
Copy the full SHA cbd7896View commit details -
[FunC] Enrich testing framework, add fif output patterns
* @fif_codegen to match compiled.fif against an expected pattern * @fif_codegen_avoid to ensure compiled.fif doesn't contain a substring * both in Python and JS run_tests * consider tests/codegen_check_demo.fc for examples
Configuration menu - View commit details
-
Copy full SHA for bac4e3d - Browse repository at this point
Copy the full SHA bac4e3dView commit details -
[FunC] Auto-inline functions-wrappers `T f(...args) { return anotherF…
…(...args); }` This will allow to easily implement camelCase wrappers aside stdlib, even without changing hashes of existing contracts. Also, stdlib renamings could be easily performed in the same manner, even with arguments reordered.
Configuration menu - View commit details
-
Copy full SHA for 18050a7 - Browse repository at this point
Copy the full SHA 18050a7View commit details -
[FunC] Enrich testing framework, add code hash checking
@code_hash to match (boc) hash of compiled.fif against expected. While being much less flexible than @fif_codegen, it nevertheless gives a guarantee of bytecode stability on compiler modifications.
Configuration menu - View commit details
-
Copy full SHA for c74e49d - Browse repository at this point
Copy the full SHA c74e49dView commit details -
[FunC] Apply camelCase to some tests to ensure code_hash remains unch…
…anged In auto-tests, @code_hash controls bytecode stability. In legacy tests, expected hashes are specified in a separate file.
Configuration menu - View commit details
-
Copy full SHA for a174f85 - Browse repository at this point
Copy the full SHA a174f85View commit details -
[FunC] Support traditional // and /**/ comments
They work alongside Lisp-style ;; and {--}, without any #pragma. Conceptually, a new syntax should be disabled by default and activated using a special compiler option. But now, we don't have an easy way to provide compiler options in func-js, blueprint, etc. Note, that introducing per-file #pragma is a wrong approach here, since if we want to fire human-readable error on using '//' without pragma, lexer should nevertheless work differently. (this could be controlled by a launch option, but see above)
Configuration menu - View commit details
-
Copy full SHA for 30572c7 - Browse repository at this point
Copy the full SHA 30572c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4994ae8 - Browse repository at this point
Copy the full SHA 4994ae8View commit details -
Configuration menu - View commit details
-
Copy full SHA for f217a7d - Browse repository at this point
Copy the full SHA f217a7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for a3e9e03 - Browse repository at this point
Copy the full SHA a3e9e03View commit details -
Configuration menu - View commit details
-
Copy full SHA for 85c60d1 - Browse repository at this point
Copy the full SHA 85c60d1View commit details -
[FunC] Forbid impure operations inside pure functions
In stdlib, all existing pure functions are asm-implemented. But since we introduced a `pure` keyword applicable to user-defined functions, we need to check that they won't have any side effects (exceptions, globals modification, etc.)
Configuration menu - View commit details
-
Copy full SHA for ef5719d - Browse repository at this point
Copy the full SHA ef5719dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0628e17 - Browse repository at this point
Copy the full SHA 0628e17View commit details -
Configuration menu - View commit details
-
Copy full SHA for acf0043 - Browse repository at this point
Copy the full SHA acf0043View commit details -
Configuration menu - View commit details
-
Copy full SHA for cdef830 - Browse repository at this point
Copy the full SHA cdef830View commit details -
[FunC] Add builtin functions to stdlib.fc
Note, that I have not added all builtin functions. I filtered out strange and actually unused in practice, like "int_at()" and similar, or "run_method0()" and similar. (Probably, they should be dropped off even from builtins) Also, I've modified some stdlib.fc legacy tests just to ensure that a resulting hash doesn't change.
Configuration menu - View commit details
-
Copy full SHA for de57087 - Browse repository at this point
Copy the full SHA de57087View commit details -
Configuration menu - View commit details
-
Copy full SHA for bb86dc0 - Browse repository at this point
Copy the full SHA bb86dc0View commit details -
[FunC] Deprecate pragma allow-post-modification
All tests pass: it does not affect hashes (since modifying variables in a single expression was an error)
Configuration menu - View commit details
-
Copy full SHA for aaf3ca3 - Browse repository at this point
Copy the full SHA aaf3ca3View commit details -
[FunC] Deprecate pragma compute-asm-ltr
It changes all hashes, since the compiler needs to manipulate the stack in a different way now.
Configuration menu - View commit details
-
Copy full SHA for 1e4b20a - Browse repository at this point
Copy the full SHA 1e4b20aView commit details -
[FunC] Refactor allow-post-modification, stop producing disabled Op::…
…_Let Before, #pragma allow-post-modification produced Op::_Let for every tensor entity (which became non-disabled if modification really happened). Although they are stripped off by the compiler and don't affect fif output, they pollute intermediate "AST" representation (ops). Now, Op::_Let is added only if var modification actually happens (which is very uncommon for real-wise code)
Configuration menu - View commit details
-
Copy full SHA for aee5173 - Browse repository at this point
Copy the full SHA aee5173View commit details -
[FunC] Change priority of
& | ^
operators to a more intuitive oneBefore, such code `if (slices_equal() & status == 1)` was parsed as `if( (slices_equal()&status) == 1 )`. Note, that this change leads to hash changes of some verified contracts, but a new priority is more expected from the user experience.
Configuration menu - View commit details
-
Copy full SHA for 7afa929 - Browse repository at this point
Copy the full SHA 7afa929View commit details -
[FunC] Deprecate
method_id
specifier, introduceget
keyword`get` keyword behaves exactly like `method_id` (auto-calc hash), but it's placed on the left, similar to Tact: `get T name()`. `method_id(n)` is still valid, considering it can't be invoked by name, since a client will compute another hash. It's supposed it will be still used in tests and in low-level code (not to be called externally, but to be called after replacing c3). `get(hash)` is invalid, this keyword does not accept anything.
Configuration menu - View commit details
-
Copy full SHA for 7b8268d - Browse repository at this point
Copy the full SHA 7b8268dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8932c51 - Browse repository at this point
Copy the full SHA 8932c51View commit details -
[FunC] Fix an issue of funcfiftlib.wasm which truncated long fif output
As it turned out, PSTRING() created a buffer of 128K. If asm_code exceeded this buffer, it was truncated. I've just dropped PSTRING() from there in favor of std::string.
Configuration menu - View commit details
-
Copy full SHA for 2da85a6 - Browse repository at this point
Copy the full SHA 2da85a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 49a0d32 - Browse repository at this point
Copy the full SHA 49a0d32View commit details
Commits on Jun 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3520184 - Browse repository at this point
Copy the full SHA 3520184View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5867d52 - Browse repository at this point
Copy the full SHA 5867d52View commit details -
[FunC] Require parenthesis in tricky bitwise precedence cases
Example: "flags & 0xFF != 0" is equivalent to "flags & 1", most likely it's unexpected. Example: "a << 2 + 1" (equal to "a << 3", probably unexpected). The only way to suppress this error for the programmer is to use parenthesis.
Configuration menu - View commit details
-
Copy full SHA for 79721d2 - Browse repository at this point
Copy the full SHA 79721d2View commit details
Commits on Jun 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e2467b8 - Browse repository at this point
Copy the full SHA e2467b8View commit details