From 927eb99e75325164a541c2638e1e607294019381 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 17 Nov 2020 12:38:40 +0100 Subject: Complete hierarchical evaluation (unittest and systemtest fixed) --- cpp.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cpp.cpp') diff --git a/cpp.cpp b/cpp.cpp index 9690289..837eae9 100644 --- a/cpp.cpp +++ b/cpp.cpp @@ -562,7 +562,7 @@ void CPP::getValueOfNode(index_t index) size_t num_childs {m_nodes[index].child_ids.size()}; if (mValues.size() < num_childs) - throw std::runtime_error("ICE: Expected num_childs elements on Values stack at "s + locationOfNode(index)); + throw std::runtime_error("ICE: Expected num_childs elements on values stack at "s + locationOfNode(index)); auto function_it{node_eval_map.find(m_nodes[index].type)}; std::any result; @@ -587,6 +587,7 @@ void CPP::getValueOfToken(index_t index) FlowGraph::Graph graph{{std::make_shared(data)}}; mValues.push_back(graph); } else { + //throw std::runtime_error("ICE: Unsupported token: "s + m_tokens[index].type); mValues.push_back(std::any{}); } } @@ -629,13 +630,7 @@ void CPP::link() // mSegment -> elf - mCode = std::vector{ - 0x48, 0xc7, 0xc0, 0x3c, 0x00, 0x00, 0x00, // mov $0x3c,%rax # syscall 60 - 0x48, 0x31, 0xff, // xor %rdi,%rdi # exit code 0 - } + mSegment.getCode() + std::vector{ // # leave exit code in edi - 0x0f, 0x05, // syscall - } - ; + mCode = mSegment.getCode(); } // phases of translation, according to standard -- cgit v1.2.3