diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-17 12:38:40 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-17 12:38:40 +0100 |
commit | 927eb99e75325164a541c2638e1e607294019381 (patch) | |
tree | 5b5476456f0f957fc7492465ff08ace54e1a9e48 /cpp.cpp | |
parent | c9cb051fae190acfc36813e4a23759fb9b9c3df3 (diff) |
Complete hierarchical evaluation (unittest and systemtest fixed)
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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<FlowGraph::DataNode>(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<uint8_t>{ - 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<uint8_t>{ // # leave exit code in edi - 0x0f, 0x05, // syscall - } - ; + mCode = mSegment.getCode(); } // phases of translation, according to standard |