[Decomp] Decompile gstring (#267)

* decompile gstring

* update

* Update code_status.md

* Update code_status.md

* decompile gstate

* add test for states, hope it passes

* also test throw and catch xmms

* update doc
This commit is contained in:
water111
2021-02-16 20:37:48 -05:00
committed by GitHub
parent aa9bcd07f4
commit f1a93886e7
29 changed files with 2505 additions and 396 deletions
+7 -1
View File
@@ -277,7 +277,13 @@ TP_Type DecompilerTypeSystem::tp_lca(const TP_Type& existing,
*changed = true;
return TP_Type::make_from_ts("int");
case TP_Type::Kind::METHOD:
case TP_Type::Kind::VIRTUAL_METHOD:
// never allow this to remain method
*changed = true;
return TP_Type::make_from_ts(
ts.lowest_common_ancestor(existing.typespec(), add.typespec()));
case TP_Type::Kind::NON_VIRTUAL_METHOD:
// never allow this to remain method
*changed = true;
return TP_Type::make_from_ts(
+9 -3
View File
@@ -55,7 +55,9 @@ std::string TP_Type::print() const {
return fmt::format("<integer {} + ({} x {})>", m_int, m_extra_multiplier, m_ts.print());
case Kind::DYNAMIC_METHOD_ACCESS:
return fmt::format("<dynamic-method-access>");
case Kind::METHOD:
case Kind::VIRTUAL_METHOD:
return fmt::format("<vmethod {}>", m_ts.print());
case Kind::NON_VIRTUAL_METHOD:
return fmt::format("<method {}>", m_ts.print());
case Kind::INVALID:
default:
@@ -75,7 +77,9 @@ bool TP_Type::operator==(const TP_Type& other) const {
return m_ts == other.m_ts;
case Kind::TYPE_OF_TYPE_NO_VIRTUAL:
return m_ts == other.m_ts;
case Kind::METHOD:
case Kind::VIRTUAL_METHOD:
return m_ts == other.m_ts;
case Kind::NON_VIRTUAL_METHOD:
return m_ts == other.m_ts;
case Kind::FALSE_AS_NULL:
return true;
@@ -144,7 +148,9 @@ TypeSpec TP_Type::typespec() const {
return TypeSpec("object");
case Kind::FORMAT_STRING:
return TypeSpec("string");
case Kind::METHOD:
case Kind::VIRTUAL_METHOD:
return m_ts;
case Kind::NON_VIRTUAL_METHOD:
return m_ts;
case Kind::INVALID:
default:
+11 -3
View File
@@ -29,7 +29,8 @@ class TP_Type {
INTEGER_CONSTANT_PLUS_VAR, // constant + variable. for dynamic addr of
INTEGER_CONSTANT_PLUS_VAR_MULT, // like var + 100 + 12 * var2
DYNAMIC_METHOD_ACCESS, // partial access into a
METHOD,
VIRTUAL_METHOD,
NON_VIRTUAL_METHOD,
INVALID
} kind = Kind::UNINITIALIZED;
TP_Type() = default;
@@ -75,9 +76,16 @@ class TP_Type {
static TP_Type make_from_ts(const std::string& ts) { return make_from_ts(TypeSpec(ts)); }
static TP_Type make_method(const TypeSpec& method_type) {
static TP_Type make_virtual_method(const TypeSpec& method_type) {
TP_Type result;
result.kind = Kind::METHOD;
result.kind = Kind::VIRTUAL_METHOD;
result.m_ts = method_type;
return result;
}
static TP_Type make_non_virtual_method(const TypeSpec& method_type) {
TP_Type result;
result.kind = Kind::NON_VIRTUAL_METHOD;
result.m_ts = method_type;
return result;
}