1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Add constants and string literals to funC

* Add special string literals "..."? (s,a,u,h,)

* Add string literal H (256-bit hash)

* Add string literal c (crc32)

* Use td::hex_encode instead of homebrew function and add test

* Fix error codes and use more generic address

* Add support for int and slice constants

* Add support for strongly typed constants

* Add support for precompiled constant expressions (hard!)

Co-authored-by: starlightduck <starlightduck@gmail.com>
This commit is contained in:
EmelyanenkoK 2022-05-06 10:30:46 +03:00
parent 0e955793ed
commit 0c772185ef
14 changed files with 397 additions and 26 deletions

View file

@ -353,6 +353,7 @@ bool Op::compute_used_vars(const CodeBlob& code, bool edit) {
}
switch (cl) {
case _IntConst:
case _SliceConst:
case _GlobVar:
case _Call:
case _CallInd:
@ -540,6 +541,7 @@ bool prune_unreachable(std::unique_ptr<Op>& ops) {
bool reach;
switch (op.cl) {
case Op::_IntConst:
case Op::_SliceConst:
case Op::_GlobVar:
case Op::_SetGlob:
case Op::_Call:
@ -707,6 +709,10 @@ VarDescrList Op::fwd_analyze(VarDescrList values) {
values.add_newval(left[0]).set_const(int_const);
break;
}
case _SliceConst: {
values.add_newval(left[0]).set_const(str_const);
break;
}
case _Call: {
prepare_args(values);
auto func = dynamic_cast<const SymValAsmFunc*>(fun_ref->value);
@ -848,6 +854,7 @@ bool Op::mark_noreturn() {
// fallthrough
case _Import:
case _IntConst:
case _SliceConst:
case _Let:
case _Tuple:
case _UnTuple: