[Decompiler] Fix printing of lets (#314)

* fix let prints and windows warnings

* missing include for windows

* windows again
This commit is contained in:
water111
2021-03-07 12:01:59 -05:00
committed by GitHub
parent d8a82eeca1
commit 9074a35b9b
33 changed files with 158 additions and 86 deletions
+40 -7
View File
@@ -489,6 +489,15 @@ const std::unordered_set<std::string> control_flow_start_forms = {
};
}
PrettyPrinterNode* seek_to_next_non_whitespace(PrettyPrinterNode* in) {
in = in->next;
while (in && (in->is_line_separator ||
(in->tok && in->tok->kind == FormToken::TokenKind::WHITESPACE))) {
in = in->next;
}
return in;
}
void insertSpecialBreaks(NodePool& pool, PrettyPrinterNode* node) {
for (; node; node = node->next) {
if (!node->is_line_separator && node->tok->kind == FormToken::TokenKind::STRING) {
@@ -502,15 +511,39 @@ void insertSpecialBreaks(NodePool& pool, PrettyPrinterNode* node) {
if (name == "defun" || name == "defmethod" || name == "defun-debug" || name == "let" ||
name == "let*") {
auto* parent_type_dec = getNextListOnLine(node);
if (parent_type_dec) {
insertNewlineAfter(pool, parent_type_dec->paren, 0);
breakList(pool, node->paren, parent_type_dec);
auto* first_list = getNextListOnLine(node);
if (first_list) {
insertNewlineAfter(pool, first_list->paren, 0);
breakList(pool, node->paren, first_list);
}
if ((name == "let" || name == "let*") && parent_type_dec) {
if (parent_type_dec->tok->kind == FormToken::TokenKind::OPEN_PAREN) {
breakList(pool, parent_type_dec);
if ((name == "let" || name == "let*") && first_list) {
if (first_list->tok->kind == FormToken::TokenKind::OPEN_PAREN) {
// we only want to break the variable list if it has multiple.
bool single_var = false;
// auto var_close_paren = first_list->paren;
auto first_var_open = seek_to_next_non_whitespace(first_list);
if (first_var_open->tok &&
first_var_open->tok->kind == FormToken::TokenKind::OPEN_PAREN) {
auto var_close_paren = first_var_open->paren;
if (var_close_paren && var_close_paren->next) {
auto iter = var_close_paren->next;
while (iter &&
(iter->is_line_separator ||
(iter->tok && iter->tok->kind == FormToken::TokenKind::WHITESPACE))) {
iter = iter->next;
}
if (iter) {
if (iter->tok && iter->tok->kind == FormToken::TokenKind::CLOSE_PAREN) {
single_var = true;
}
}
}
}
if (!single_var) {
breakList(pool, first_list);
}
}
auto open_paren = node->prev;
if (open_paren && open_paren->tok->kind == FormToken::TokenKind::OPEN_PAREN) {
+1 -1
View File
@@ -73,7 +73,7 @@ std::pair<int, int> SourceText::get_containing_line(int offset) {
return std::make_pair(offset_by_line[line], offset_by_line[line + 1]);
}
}
return std::make_pair(0, text.size());
return std::make_pair(0, (int)text.size());
}
/*!
+1
View File
@@ -44,6 +44,7 @@ std::string FieldReverseLookupOutput::Token::print() const {
return "__VAR__";
default:
assert(false);
return {};
}
}
+1
View File
@@ -153,6 +153,7 @@ bool InstructionAtom::operator==(const InstructionAtom& other) const {
return true;
default:
assert(false);
return false;
}
}
+2
View File
@@ -92,6 +92,7 @@ std::string get_before_paren(std::string& instr) {
}
}
assert(false);
return {};
}
std::string get_in_paren(std::string& instr) {
@@ -110,6 +111,7 @@ std::string get_in_paren(std::string& instr) {
}
}
assert(false);
return {};
}
bool is_integer(const std::string& str) {
+1
View File
@@ -80,6 +80,7 @@ class DecompWarnings {
return fmt::format("INFO: {}\n", message);
default:
assert(false);
return {};
}
}
+1
View File
@@ -110,6 +110,7 @@ std::shared_ptr<IR> instr_atom_to_ir(const InstructionAtom& ia, int idx) {
return make_int(ia.get_imm());
default:
assert(false);
return nullptr;
}
}
+4
View File
@@ -614,6 +614,7 @@ goos::Object BranchDelay::to_form(const LinkedObjectFile& file) const {
return pretty_print::build_list("unknown-branch-delay");
default:
assert(false);
return {};
}
}
@@ -669,6 +670,7 @@ int Condition::num_args() const {
return 0;
default:
assert(false);
return -1;
}
}
@@ -867,6 +869,7 @@ goos::Object Condition::to_form(const LinkedObjectFile& file) const {
return pretty_print::to_symbol(condtion_operator);
} else {
assert(false);
return {};
}
}
@@ -992,6 +995,7 @@ goos::Object IR_AsmReg::to_form(const LinkedObjectFile& file) const {
return pretty_print::to_symbol("ACC");
default:
assert(false);
return {};
}
}
+8
View File
@@ -41,6 +41,7 @@ goos::Object RegisterAccess::to_form(const Env& env, Print mode) const {
}
default:
assert(false);
return {};
}
}
@@ -268,6 +269,7 @@ std::string get_simple_expression_op_name(SimpleExpression::Kind kind) {
return "max.ui";
default:
assert(false);
return {};
}
}
} // namespace
@@ -317,6 +319,7 @@ int get_simple_expression_arg_count(SimpleExpression::Kind kind) {
return 2;
default:
assert(false);
return -1;
}
}
@@ -718,6 +721,7 @@ std::string get_condition_kind_name(IR2_Condition::Kind kind) {
return ">=0.ui";
default:
assert(false);
return "";
}
}
@@ -760,6 +764,7 @@ int get_condition_num_args(IR2_Condition::Kind kind) {
return 0;
default:
assert(false);
return -1;
}
}
@@ -831,6 +836,7 @@ IR2_Condition::Kind get_condition_opposite(IR2_Condition::Kind kind) {
return IR2_Condition::Kind::LESS_THAN_ZERO_UNSIGNED;
default:
assert(false);
return IR2_Condition::Kind::INVALID;
}
}
@@ -1177,6 +1183,7 @@ goos::Object IR2_BranchDelay::to_form(const std::vector<DecompilerLabel>& labels
return pretty_print::build_list("unknown-branch-delay!");
default:
assert(false);
return {};
}
}
@@ -1375,6 +1382,7 @@ goos::Object SpecialOp::to_form(const std::vector<DecompilerLabel>& labels, cons
return pretty_print::build_list("suspend");
default:
assert(false);
return {};
}
}
+1
View File
@@ -15,6 +15,7 @@ RegClass get_reg_kind(const Register& r) {
return RegClass::FLOAT;
default:
assert(false);
return RegClass::INVALID;
}
}
} // namespace
+2
View File
@@ -27,6 +27,7 @@ RegClass get_reg_kind(const Register& r) {
return RegClass::FLOAT;
default:
assert(false);
return RegClass::INVALID;
}
}
@@ -758,6 +759,7 @@ TypeState SpecialOp::propagate_types_internal(const TypeState& input,
return input;
default:
assert(false);
return input;
}
}
+7
View File
@@ -212,6 +212,7 @@ goos::Object LoadSourceElement::to_form_internal(const Env& env) const {
return pretty_print::build_list("l.d", m_addr->to_form(env));
default:
assert(false);
return {};
}
break;
case LoadVarOp::Kind::SIGNED:
@@ -224,10 +225,12 @@ goos::Object LoadSourceElement::to_form_internal(const Env& env) const {
return pretty_print::build_list("l.w", m_addr->to_form(env));
default:
assert(false);
return {};
}
break;
default:
assert(false);
return {};
}
}
@@ -1327,6 +1330,7 @@ goos::Object GenericOperator::to_form(const Env& env) const {
return m_function->to_form(env);
default:
assert(false);
return {};
}
}
@@ -1369,6 +1373,7 @@ bool GenericOperator::operator==(const GenericOperator& other) const {
return false;
default:
assert(false);
return false;
}
}
@@ -1473,6 +1478,7 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
return "pair?";
default:
assert(false);
return "";
}
}
@@ -1650,6 +1656,7 @@ goos::Object DerefToken::to_form(const Env& env) const {
return pretty_print::to_symbol("PLACEHOLDER");
default:
assert(false);
return {};
}
}
+2
View File
@@ -500,6 +500,7 @@ bool DerefTokenMatcher::do_match(const DerefToken& input, MatchResult::Maps* map
return false;
default:
assert(false);
return false;
}
}
@@ -543,6 +544,7 @@ bool GenericOpMatcher::do_match(GenericOperator& input, MatchResult::Maps* maps_
return false;
default:
assert(false);
return false;
}
}
+1
View File
@@ -45,6 +45,7 @@ class LinkedWord {
return (data >> 24) & 0xff;
default:
assert(false);
return 0;
}
}
};
+2
View File
@@ -3,6 +3,7 @@
#include <cstring>
#include <vector>
#include <string>
#include <stdexcept>
#include "common/common_types.h"
#include "decompiler/ObjectFile/LinkedWord.h"
@@ -17,6 +18,7 @@ class LinkedWordReader {
return result;
} else {
assert(false);
throw std::runtime_error("LinkedWordReader::get_type_tag failed");
}
}
+1
View File
@@ -295,6 +295,7 @@ TP_Type DecompilerTypeSystem::tp_lca(const TP_Type& existing,
case TP_Type::Kind::INVALID:
default:
assert(false);
return {};
}
} else {
// trying to combine two of different types.
+3
View File
@@ -62,6 +62,7 @@ std::string TP_Type::print() const {
case Kind::INVALID:
default:
assert(false);
return {};
}
}
@@ -107,6 +108,7 @@ bool TP_Type::operator==(const TP_Type& other) const {
case Kind::INVALID:
default:
assert(false);
return false;
}
}
@@ -155,6 +157,7 @@ TypeSpec TP_Type::typespec() const {
case Kind::INVALID:
default:
assert(false);
return {};
}
}
} // namespace decompiler
+3
View File
@@ -1,6 +1,7 @@
#pragma once
#include <string>
#include <cassert>
#include <stdexcept>
#include "common/log/log.h"
#include "common/type_system/TypeSpec.h"
#include "common/common_types.h"
@@ -239,6 +240,7 @@ struct TypeState {
return fpr_types[r.get_fpr()];
default:
assert(false);
throw std::runtime_error("TP_Type::get failed");
}
}
@@ -251,6 +253,7 @@ struct TypeState {
default:
lg::die("Cannot use register {} with TypeState.", r.to_charp());
assert(false);
throw std::runtime_error("TP_Type::get failed");
}
}
};
+2
View File
@@ -165,6 +165,7 @@ u64 alloc_from_heap(u32 heapSymbol, u32 type, s32 size) {
return kmalloc(*Ptr<Ptr<kheapinfo>>(heapSymbol), size, KMALLOC_MEMSET, gstr->data()).offset;
} else if (heapOffset == FIX_SYM_PROCESS_TYPE) {
assert(false); // nyi
return 0;
// allocate on current process heap
// Ptr start = *ptr<Ptr>(getS6() + 0x4c + 8);
// Ptr heapEnd = *ptr<Ptr>(getS6() + 0x4c + 4);
@@ -181,6 +182,7 @@ u64 alloc_from_heap(u32 heapSymbol, u32 type, s32 size) {
// }
} else if (heapOffset == FIX_SYM_SCRATCH) {
assert(false); // nyi, I think unused.
return 0;
} else {
memset(Ptr<u8>(heapSymbol).c(), 0, (size_t)alignedSize); // treat it as a stack address
return heapSymbol;
+1
View File
@@ -173,6 +173,7 @@ s32 sceLseek(s32 fd, s32 offset, s32 where) {
return ftell(kv->second);
default:
assert(false);
return -1;
}
}
}
+1 -1
View File
@@ -154,7 +154,7 @@ RegVal* MemoryDerefVal::to_reg(Env* fe) {
if (base_as_co) {
s64 offset;
auto final_base = get_constant_offset_and_base(base_as_co, &offset);
fe->emit_ir<IR_LoadConstOffset>(re, offset, final_base->to_gpr(fe), info);
fe->emit_ir<IR_LoadConstOffset>(re, (int)offset, final_base->to_gpr(fe), info);
} else {
auto addr = base->to_gpr(fe);
fe->emit(std::make_unique<IR_LoadConstOffset>(re, 0, addr, info));
+2 -2
View File
@@ -181,14 +181,14 @@ class StackVarAddrVal : public Val {
class MemoryOffsetConstantVal : public Val {
public:
MemoryOffsetConstantVal(TypeSpec ts, Val* _base, int _offset)
MemoryOffsetConstantVal(TypeSpec ts, Val* _base, s64 _offset)
: Val(std::move(ts)), base(_base), offset(_offset) {}
std::string print() const override {
return "(" + base->print() + " + " + std::to_string(offset) + ")";
}
RegVal* to_reg(Env* fe) override;
Val* base = nullptr;
int offset = 0;
s64 offset = 0;
};
class MemoryOffsetVal : public Val {
@@ -83,7 +83,7 @@ Val* Compiler::compile_asm_file(const goos::Object& form, const goos::Object& re
bool no_code = false;
bool disassemble = false;
std::vector<std::pair<std::string, float>> timing;
std::vector<std::pair<std::string, double>> timing;
Timer total_timer;
// parse arguments
@@ -422,6 +422,7 @@ std::string Compiler::make_symbol_info_description(const SymbolInfo& info) {
m_goos.reader.db.get_info_for(info.src_form()));
default:
assert(false);
return {};
}
}
+2
View File
@@ -33,6 +33,7 @@ bool integer_fits(s64 in, int size, bool is_signed) {
return true;
default:
assert(false);
return false;
}
}
@@ -415,6 +416,7 @@ StaticResult Compiler::compile_static_no_eval_for_pairs(const goos::Object& form
return result;
} else {
assert(false); // not yet implemented
return {};
}
}
+12
View File
@@ -714,6 +714,7 @@ class IGen {
return storevf_gpr64_plus_gpr64_plus_s32(value, addr, off, offset);
}
assert(false);
return {0};
}
static Instruction store_goal_gpr(Register addr,
@@ -764,6 +765,7 @@ class IGen {
}
default:
assert(false);
return {0};
}
}
@@ -776,6 +778,7 @@ class IGen {
return loadvf_gpr64_plus_gpr64_plus_s32(dst, addr, off, offset);
} else {
assert(false);
return {0};
}
}
@@ -871,6 +874,7 @@ class IGen {
}
default:
assert(false);
return {0};
}
}
@@ -993,6 +997,7 @@ class IGen {
return lea_reg_plus_off32(dest, base, offset);
} else {
assert(false);
return {0};
}
}
@@ -1076,6 +1081,7 @@ class IGen {
return load32_xmm32_gpr64_plus_gpr64_plus_s32(xmm_dest, addr, off, offset);
} else {
assert(false);
return {0};
}
}
@@ -1088,6 +1094,7 @@ class IGen {
return store32_xmm32_gpr64_plus_gpr64_plus_s32(addr, off, xmm_value, offset);
} else {
assert(false);
return {0};
}
}
@@ -1100,6 +1107,7 @@ class IGen {
return store32_xmm32_gpr64_plus_s32(base, xmm_value, offset);
} else {
assert(false);
return {0};
}
}
@@ -1112,6 +1120,7 @@ class IGen {
return load32_xmm32_gpr64_plus_s32(xmm_dest, base, offset);
} else {
assert(false);
return {0};
}
}
@@ -1211,6 +1220,7 @@ class IGen {
return load128_xmm128_gpr64_s32(xmm_dest, base, offset);
} else {
assert(false);
return {0};
}
}
@@ -1223,6 +1233,7 @@ class IGen {
return store128_gpr64_xmm128_s32(base, xmm_val, offset);
} else {
assert(false);
return {0};
}
}
@@ -2266,6 +2277,7 @@ class IGen {
break;
default:
assert(false);
return {0};
}
}
+2
View File
@@ -85,6 +85,7 @@ struct VEX3 {
return result;
} else {
assert(false);
return -1;
}
}
@@ -124,6 +125,7 @@ struct VEX2 {
return result;
} else {
assert(false);
return -1;
}
}
+1
View File
@@ -91,6 +91,7 @@ HWRegKind reg_class_to_hw(RegClass reg_class) {
return HWRegKind::GPR;
default:
assert(false);
return HWRegKind::INVALID;
}
}
+5 -8
View File
@@ -1,8 +1,6 @@
/*!
* @file Listener.cpp
* The Listener can connect to a Deci2Server for debugging.
*
* TODO - msg ID?
*/
#ifdef __linux__
@@ -20,7 +18,6 @@
#undef max
#endif
// TODO - i think im not including the dependency right..?
#include "common/cross_sockets/xsocket.h"
#include <stdexcept>
@@ -224,8 +221,8 @@ void Listener::receive_func() {
if (hdr->msg_id == last_sent_id) {
printf("[Listener] Received ACK for most recent message late.\n");
if (last_recvd_id != hdr->msg_id - 1) {
printf(
"[Listener] WARNING: message ID jumped from %ld to %ld. Some messages may have "
fmt::print(
"[Listener] WARNING: message ID jumped from {} to {}. Some messages may have "
"been lost. You must wait for an ACK before sending the next message.\n",
last_recvd_id, hdr->msg_id);
}
@@ -251,9 +248,9 @@ void Listener::receive_func() {
got_ack = true;
last_recvd_id = hdr->msg_id;
if (last_recvd_id > last_sent_id) {
printf(
"[Listener] ERROR: Got an ack message with id of %ld, but the last message sent "
"had an ID of %ld.\n",
fmt::print(
"[Listener] ERROR: Got an ack message with id of {}, but the last message sent "
"had an ID of {}.\n",
last_recvd_id, last_sent_id);
}
} else {
+2
View File
@@ -1,5 +1,6 @@
#include <cassert>
#include <algorithm>
#include <stdexcept>
#include "MemoryMap.h"
#include "third-party/fmt/core.h"
#include "common/link_types.h"
@@ -114,6 +115,7 @@ const MemoryMapEntry& MemoryMap::lookup(u32 addr) {
}
}
assert(false);
throw std::runtime_error("MemoryMap::lookup failed");
}
bool MemoryMap::lookup(const std::string& obj_name, u8 seg_id, MemoryMapEntry* out) {
+1
View File
@@ -22,6 +22,7 @@ std::string IRegister::to_string() const {
return fmt::format("ivf-{}", id);
default:
assert(false);
return {};
}
}
+31 -62
View File
@@ -188,13 +188,11 @@
(a1-0 "#<vector ~F ~F ~F ~F @ #x~X>")
)
(.sllv a2-0 gp-0 r0-0)
(let ((a3-0 (sar gp-0 32))
)
(let ((a3-0 (sar gp-0 32)))
(.pcpyud v1-0 gp-0 r0-0)
(.sllv t0-0 v1-0 r0-0)
(.pcpyud v1-1 gp-0 r0-0)
(let ((t1-0 (sar v1-1 32))
)
(let ((t1-0 (sar v1-1 32)))
(.por t2-0 gp-0 r0-0)
(t9-0 a0-1 a1-0 a2-0 a3-0 t0-0 t1-0 t2-0)
)
@@ -248,8 +246,7 @@
;; definition for function type-type?
(defun type-type? ((child-type type) (parent-type type))
(let ((end-type object)
)
(let ((end-type object))
(until
(begin
(set! child-type (-> child-type parent))
@@ -266,8 +263,7 @@
;; definition for function find-parent-method
(defun find-parent-method ((child-type type) (method-id int))
(local-vars (current-method function))
(let ((original-method (-> child-type method-table method-id))
)
(let ((original-method (-> child-type method-table method-id)))
(until (!= current-method original-method)
(if (= child-type object)
(return nothing)
@@ -300,8 +296,7 @@
(set! result 0)
)
(else
(let ((iter (cdr obj))
)
(let ((iter (cdr obj)))
(set! result 1)
(while (and (not (null? iter)) (pair? iter))
(+! result 1)
@@ -321,8 +316,7 @@
;; definition for function last
(defun last ((lst object))
(let ((iter lst)
)
(let ((iter lst))
(while (not (null? (cdr iter)))
(nop!)
(nop!)
@@ -334,8 +328,7 @@
;; definition for function member
(defun member ((obj object) (lst object))
(let ((iter lst)
)
(let ((iter lst))
(while (not (or (null? iter) (= (car iter) obj)))
(set! iter (cdr iter))
)
@@ -357,8 +350,7 @@
;; definition for function assoc
(defun assoc ((item object) (alist object))
(let ((iter alist)
)
(let ((iter alist))
(while (not (or (null? iter) (= (car (car iter)) item)))
(set! iter (cdr iter))
)
@@ -370,8 +362,7 @@
;; definition for function assoce
(defun assoce ((item object) (alist object))
(let ((iter alist)
)
(let ((iter alist))
(while
(not (or (null? iter) (= (car (car iter)) item) (= (car (car iter)) 'else)))
(set! iter (cdr iter))
@@ -384,8 +375,7 @@
;; definition for function nassoc
(defun nassoc ((item-name string) (alist object))
(while (not (or (null? alist) (let ((key (car (car alist)))
)
(while (not (or (null? alist) (let ((key (car (car alist))))
(if (pair? key)
(nmember item-name key)
(name= (the-as basic key) item-name)
@@ -402,8 +392,7 @@
;; definition for function nassoce
(defun nassoce ((item-name string) (alist object))
(while (not (or (null? alist) (let ((key (car (car alist)))
)
(while (not (or (null? alist) (let ((key (car (car alist))))
(if (pair? key)
(nmember item-name key)
(or
@@ -428,8 +417,7 @@
back
)
(else
(let ((iter front)
)
(let ((iter front))
(while (not (null? (cdr iter)))
(nop!)
(nop!)
@@ -494,20 +482,17 @@
;; definition for function insert-cons!
(defun insert-cons! ((kv object) (alist object))
(let ((updated-list (delete-car! (car kv) alist))
)
(let ((updated-list (delete-car! (car kv) alist)))
(cons kv updated-list)
)
)
;; definition for function sort
(defun sort ((lst object) (compare-func (function object object object)))
(let ((unsorted-count -1)
)
(let ((unsorted-count -1))
(while (nonzero? unsorted-count)
(set! unsorted-count 0)
(let ((iter lst)
)
(let ((iter lst))
(while (not (or (null? (cdr iter)) (not (pair? (cdr iter)))))
(let* ((first-elt (car iter))
(seoncd-elt (car (cdr iter)))
@@ -640,8 +625,7 @@
(local-vars (a2-8 int))
(format #t "#(")
(if (type-type? (-> obj content-type) integer)
(let ((content-type-sym (-> obj content-type symbol))
)
(let ((content-type-sym (-> obj content-type symbol)))
(cond
((= content-type-sym 'int32)
(dotimes (s5-0 (-> obj length))
@@ -736,8 +720,7 @@
)
)
(let
((v1-42 (+ (shl s5-8 4) (the-as int (the-as (array uint128) obj))))
)
((v1-42 (+ (shl s5-8 4) (the-as int (the-as (array uint128) obj)))))
(TODO.LQ a2-8 v1-42 :offset 12)
)
(t9-10 a0-21 a1-11 a2-8)
@@ -791,8 +774,7 @@
(format #t "~Tcontent-type: ~A~%" (-> obj content-type))
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj allocated-length) (-> obj data))
(if (type-type? (-> obj content-type) integer)
(let ((content-type-sym (-> obj content-type symbol))
)
(let ((content-type-sym (-> obj content-type symbol)))
(cond
((= content-type-sym 'int32)
(dotimes (s5-0 (-> obj length))
@@ -843,8 +825,7 @@
(a1-15 "~T [~D] #x~X~%")
(a2-13 s5-8)
)
(let ((v1-42 (+ (shl s5-8 4) (the-as int obj)))
)
(let ((v1-42 (+ (shl s5-8 4) (the-as int obj))))
(TODO.LQ a3-10 v1-42 :offset 12)
)
(t9-14 a0-25 a1-15 a2-13 a3-10)
@@ -902,8 +883,7 @@
;; definition for function mem-copy!
(defun mem-copy! ((dst pointer) (src pointer) (size int))
(let ((result dst)
)
(let ((result dst))
(dotimes (i size)
(set! (-> (the-as (pointer uint8) dst)) (-> (the-as (pointer uint8) src)))
(&+! dst 1)
@@ -918,10 +898,8 @@
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
(defun qmem-copy<-! ((dst pointer) (src pointer) (size int))
(local-vars (value int))
(let ((result dst)
)
(let ((qwc (sar (+ size 15) 4))
)
(let ((result dst))
(let ((qwc (sar (+ size 15) 4)))
(while (nonzero? qwc)
(+! qwc -1)
(TODO.LQ value src)
@@ -939,10 +917,8 @@
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
(defun qmem-copy->! ((dst pointer) (src pointer) (size int))
(local-vars (src-ptr pointer) (dst-ptr pointer) (value int))
(let ((result dst)
)
(let ((qwc (sar (+ size 15) 4))
)
(let ((result dst))
(let ((qwc (sar (+ size 15) 4)))
(&+! dst (shl qwc 4))
(&+! src (shl qwc 4))
(while (nonzero? qwc)
@@ -959,8 +935,7 @@
;; definition for function mem-set32!
(defun mem-set32! ((dst pointer) (size int) (value int))
(let ((result dst)
)
(let ((result dst))
(dotimes (i size)
(set! (-> (the-as (pointer int32) dst)) value)
(&+! dst 4)
@@ -972,8 +947,7 @@
;; definition for function mem-or!
(defun mem-or! ((dst pointer) (src pointer) (size int))
(let ((result dst)
)
(let ((result dst))
(dotimes (i size)
(set!
(-> (the-as (pointer uint8) dst))
@@ -1010,8 +984,7 @@
;; definition for function printl
(defun printl ((arg0 object))
(let ((a0-1 arg0)
)
(let ((a0-1 arg0))
((method-of-type (rtype-of a0-1) print) a0-1)
)
(format #t "~%")
@@ -1138,8 +1111,7 @@
)
#f
)
((or (not in-goal-mem) (begin (let ((v1-10 #x8000)
)
((or (not in-goal-mem) (begin (let ((v1-10 #x8000))
(.daddu v1-11 v1-10 s7-0)
)
(< (the-as uint obj) (the-as uint v1-11))
@@ -1289,8 +1261,7 @@
#f
)
((= expected-type symbol)
(let ((v1-43 #x8000)
)
(let ((v1-43 #x8000))
(.daddu v1-44 v1-43 s7-0)
)
(cond
@@ -1312,8 +1283,7 @@
)
)
)
((begin (let ((v1-47 #x8000)
)
((begin (let ((v1-47 #x8000))
(.daddu v1-48 v1-47 s7-0)
)
(< (the-as uint obj) (the-as uint v1-48))
@@ -1342,6 +1312,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0)
)
(let ((v0-3 0))
)
@@ -0,0 +1,6 @@
;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(let ((v0-0 0))
)
+7 -4
View File
@@ -9,12 +9,15 @@
namespace {
// the object files to test
const std::unordered_set<std::string> g_object_files_to_decompile = {"gcommon"};
const std::unordered_set<std::string> g_object_files_to_decompile = {
"gcommon",
"gstring-h",
};
// the object files to check against a reference in test/decompiler/reference
const std::unordered_set<std::string> g_object_files_to_check_against_reference = {
"gcommon" // NOTE: this file needs work, but adding it for now just to test the framework.
};
const std::vector<std::string> g_object_files_to_check_against_reference = {
"gcommon", // NOTE: this file needs work, but adding it for now just to test the framework.
"gstring-h"};
// the functions we expect the decompiler to skip
const std::unordered_set<std::string> expected_skip_in_decompiler = {