for (size_t i = 0; i != n; ++i) {
const Dwarf_Op *op = ops + i;
std::uint8_t atom = op->atom;
+ intptr_t first;
+ intptr_t second;
switch (atom) {
// and replace the top of the stack with the computed value
// (stack.top() += stack.before_top()).
- case DW_OP_plus: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_plus:
+ first = stack.pop();
+ second = stack.pop();
stack.push(first + second);
break;
- }
- case DW_OP_mul: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_mul:
+ first = stack.pop();
+ second = stack.pop();
stack.push(first * second);
break;
- }
case DW_OP_plus_uconst:
stack.top() += op->number;
stack.top() = - (intptr_t) stack.top();
break;
- case DW_OP_minus: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_minus:
+ first = stack.pop();
+ second = stack.pop();
stack.push(second - first);
break;
- }
- case DW_OP_and: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_and:
+ first = stack.pop();
+ second = stack.pop();
stack.push(first & second);
break;
- }
- case DW_OP_or: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_or:
+ first = stack.pop();
+ second = stack.pop();
stack.push(first | second);
break;
- }
- case DW_OP_xor: {
- intptr_t first = stack.pop();
- intptr_t second = stack.pop();
+ case DW_OP_xor:
+ first = stack.pop();
+ second = stack.pop();
stack.push(first ^ second);
break;
- }
case DW_OP_nop:
break;
xbt_die("Lua call failed. See Log");
}
lua_close(L);
+ return;
}
- else
#endif
- { // Use XML parser
- int parse_status;
+ // Use XML parser
- /* init the flex parser */
- after_config_done = 0;
- surf_parse_open(file);
+ int parse_status;
- /* Do the actual parsing */
- parse_status = surf_parse();
+ /* init the flex parser */
+ after_config_done = 0;
+ surf_parse_open(file);
- /* connect all traces relative to hosts */
- for (auto const& elm : trace_connect_list_host_avail) {
- xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
- tmgr_trace_t trace = traces_set_list.at(elm.first);
+ /* Do the actual parsing */
+ parse_status = surf_parse();
- simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
- xbt_assert(host, "Host %s undefined", elm.second.c_str());
- simgrid::surf::Cpu *cpu = host->pimpl_cpu;
+ /* connect all traces relative to hosts */
+ for (auto const& elm : trace_connect_list_host_avail) {
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
- cpu->setStateTrace(trace);
- }
-
- for (auto const& elm : trace_connect_list_host_speed) {
- xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
- tmgr_trace_t trace = traces_set_list.at(elm.first);
+ simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
+ xbt_assert(host, "Host %s undefined", elm.second.c_str());
+ simgrid::surf::Cpu* cpu = host->pimpl_cpu;
- simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
- xbt_assert(host, "Host %s undefined", elm.second.c_str());
- simgrid::surf::Cpu *cpu = host->pimpl_cpu;
+ cpu->setStateTrace(trace);
+ }
- cpu->setSpeedTrace(trace);
- }
+ for (auto const& elm : trace_connect_list_host_speed) {
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
- for (auto const& elm : trace_connect_list_link_avail) {
- xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
- tmgr_trace_t trace = traces_set_list.at(elm.first);
+ simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
+ xbt_assert(host, "Host %s undefined", elm.second.c_str());
+ simgrid::surf::Cpu* cpu = host->pimpl_cpu;
- sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
- xbt_assert(link, "Link %s undefined", elm.second.c_str());
- link->setStateTrace(trace);
- }
+ cpu->setSpeedTrace(trace);
+ }
- for (auto const& elm : trace_connect_list_link_bw) {
- xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
- tmgr_trace_t trace = traces_set_list.at(elm.first);
- sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
- xbt_assert(link, "Link %s undefined", elm.second.c_str());
- link->setBandwidthTrace(trace);
- }
+ for (auto const& elm : trace_connect_list_link_avail) {
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
- for (auto const& elm : trace_connect_list_link_lat) {
- xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
- tmgr_trace_t trace = traces_set_list.at(elm.first);
- sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
- xbt_assert(link, "Link %s undefined", elm.second.c_str());
- link->setLatencyTrace(trace);
- }
+ sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
+ xbt_assert(link, "Link %s undefined", elm.second.c_str());
+ link->setStateTrace(trace);
+ }
- surf_parse_close();
+ for (auto const& elm : trace_connect_list_link_bw) {
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
+ sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
+ xbt_assert(link, "Link %s undefined", elm.second.c_str());
+ link->setBandwidthTrace(trace);
+ }
- if (parse_status)
- surf_parse_error(std::string("Parse error in ") + file);
+ for (auto const& elm : trace_connect_list_link_lat) {
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
+ sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
+ xbt_assert(link, "Link %s undefined", elm.second.c_str());
+ link->setLatencyTrace(trace);
}
+
+ surf_parse_close();
+
+ if (parse_status)
+ surf_parse_error(std::string("Parse error in ") + file);
}
}