mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated fift/func
This commit is contained in:
parent
b6f6788532
commit
d41ce55305
31 changed files with 717 additions and 66 deletions
|
@ -37,6 +37,7 @@ struct ControlRegs {
|
|||
Ref<Continuation> c[creg_num]; // c0..c3
|
||||
Ref<Cell> d[dreg_num]; // c4..c5
|
||||
Ref<Tuple> c7; // c7
|
||||
bool clear();
|
||||
Ref<Continuation> get_c(unsigned idx) const {
|
||||
return idx < creg_num ? c[idx] : Ref<Continuation>{};
|
||||
}
|
||||
|
@ -136,6 +137,8 @@ struct ControlRegs {
|
|||
ControlRegs& operator^=(const ControlRegs& save); // sets c[i]=save.c[i] for all save.c[i] != 0
|
||||
ControlRegs& operator^=(ControlRegs&& save);
|
||||
bool serialize(CellBuilder& cb) const;
|
||||
bool deserialize(CellSlice& cs, int mode = 0);
|
||||
bool deserialize(Ref<Cell> root, int mode = 0);
|
||||
};
|
||||
|
||||
struct ControlData {
|
||||
|
@ -151,7 +154,9 @@ struct ControlData {
|
|||
}
|
||||
ControlData(int _cp, Ref<Stack> _stack, int _nargs = -1) : stack(std::move(_stack)), nargs(_nargs), cp(_cp) {
|
||||
}
|
||||
bool clear();
|
||||
bool serialize(CellBuilder& cb) const;
|
||||
bool deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class Continuation : public td::CntObject {
|
||||
|
@ -164,10 +169,6 @@ class Continuation : public td::CntObject {
|
|||
virtual const ControlData* get_cdata() const {
|
||||
return 0;
|
||||
}
|
||||
virtual bool serialize(CellBuilder& cb) const {
|
||||
return false;
|
||||
}
|
||||
bool serialize_ref(CellBuilder& cb) const;
|
||||
bool has_c0() const;
|
||||
Continuation() {
|
||||
}
|
||||
|
@ -181,6 +182,15 @@ class Continuation : public td::CntObject {
|
|||
return *this;
|
||||
}
|
||||
~Continuation() override = default;
|
||||
virtual bool serialize(CellBuilder& cb) const {
|
||||
return false;
|
||||
}
|
||||
bool serialize_ref(CellBuilder& cb) const;
|
||||
static Ref<Continuation> deserialize(CellSlice& cs, int mode = 0);
|
||||
static bool deserialize_to(CellSlice& cs, Ref<Continuation>& cont, int mode = 0) {
|
||||
return (cont = deserialize(cs, mode)).not_null();
|
||||
}
|
||||
static bool deserialize_to(Ref<Cell> cell, Ref<Continuation>& cont, int mode = 0);
|
||||
};
|
||||
|
||||
class QuitCont : public Continuation {
|
||||
|
@ -194,6 +204,7 @@ class QuitCont : public Continuation {
|
|||
return ~exit_code;
|
||||
}
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<QuitCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class ExcQuitCont : public Continuation {
|
||||
|
@ -202,6 +213,7 @@ class ExcQuitCont : public Continuation {
|
|||
~ExcQuitCont() override = default;
|
||||
int jump(VmState* st) const & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<ExcQuitCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class PushIntCont : public Continuation {
|
||||
|
@ -215,6 +227,7 @@ class PushIntCont : public Continuation {
|
|||
int jump(VmState* st) const & override;
|
||||
int jump_w(VmState* st) & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<PushIntCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class RepeatCont : public Continuation {
|
||||
|
@ -229,6 +242,7 @@ class RepeatCont : public Continuation {
|
|||
int jump(VmState* st) const & override;
|
||||
int jump_w(VmState* st) & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<RepeatCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class AgainCont : public Continuation {
|
||||
|
@ -241,6 +255,7 @@ class AgainCont : public Continuation {
|
|||
int jump(VmState* st) const & override;
|
||||
int jump_w(VmState* st) & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<AgainCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class UntilCont : public Continuation {
|
||||
|
@ -253,6 +268,7 @@ class UntilCont : public Continuation {
|
|||
int jump(VmState* st) const & override;
|
||||
int jump_w(VmState* st) & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<UntilCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class WhileCont : public Continuation {
|
||||
|
@ -267,6 +283,7 @@ class WhileCont : public Continuation {
|
|||
int jump(VmState* st) const & override;
|
||||
int jump_w(VmState* st) & override;
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<WhileCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class ArgContExt : public Continuation {
|
||||
|
@ -274,9 +291,13 @@ class ArgContExt : public Continuation {
|
|||
Ref<Continuation> ext;
|
||||
|
||||
public:
|
||||
ArgContExt(Ref<Continuation> _ext) : data(), ext(_ext) {
|
||||
ArgContExt(Ref<Continuation> _ext) : data(), ext(std::move(_ext)) {
|
||||
}
|
||||
ArgContExt(Ref<Continuation> _ext, Ref<Stack> _stack) : data(_stack), ext(_ext) {
|
||||
ArgContExt(Ref<Continuation> _ext, Ref<Stack> _stack) : data(std::move(_stack)), ext(std::move(_ext)) {
|
||||
}
|
||||
ArgContExt(Ref<Continuation> _ext, const ControlData& _cdata) : data(_cdata), ext(std::move(_ext)) {
|
||||
}
|
||||
ArgContExt(Ref<Continuation> _ext, ControlData&& _cdata) : data(std::move(_cdata)), ext(std::move(_ext)) {
|
||||
}
|
||||
ArgContExt(const ArgContExt&) = default;
|
||||
ArgContExt(ArgContExt&&) = default;
|
||||
|
@ -293,6 +314,7 @@ class ArgContExt : public Continuation {
|
|||
return new ArgContExt{*this};
|
||||
}
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<ArgContExt> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
class OrdCont : public Continuation {
|
||||
|
@ -310,6 +332,10 @@ class OrdCont : public Continuation {
|
|||
OrdCont(Ref<CellSlice> _code, int _cp, Ref<Stack> _stack, int nargs = -1)
|
||||
: data(_cp, std::move(_stack), nargs), code(std::move(_code)) {
|
||||
}
|
||||
OrdCont(Ref<CellSlice> _code, const ControlData& _cdata) : data(_cdata), code(std::move(_code)) {
|
||||
}
|
||||
OrdCont(Ref<CellSlice> _code, ControlData&& _cdata) : data(std::move(_cdata)), code(std::move(_code)) {
|
||||
}
|
||||
OrdCont(const OrdCont&) = default;
|
||||
OrdCont(OrdCont&&) = default;
|
||||
~OrdCont() override = default;
|
||||
|
@ -342,6 +368,7 @@ class OrdCont : public Continuation {
|
|||
return Ref<OrdCont>{true, *this};
|
||||
}
|
||||
bool serialize(CellBuilder& cb) const override;
|
||||
static Ref<OrdCont> deserialize(CellSlice& cs, int mode = 0);
|
||||
};
|
||||
|
||||
struct GasLimits {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue