From 5427ca0a9d8e727a4bdd4b2402d7c48437a3b800 Mon Sep 17 00:00:00 2001 From: slavek-kucera <53339291+slavek-kucera@users.noreply.github.com> Date: Tue, 2 Jul 2024 08:32:28 +0200 Subject: [PATCH] perf: Postponed statement handling --- parser_library/src/context/literal_pool.cpp | 7 +- .../symbol_dependency_tables.cpp | 248 ++++++++---------- .../symbol_dependency_tables.h | 70 ++--- .../instruction_sets/asm_processor.cpp | 86 +++--- .../instruction_sets/mach_processor.cpp | 5 +- parser_library/test/processing/org_test.cpp | 2 +- 6 files changed, 179 insertions(+), 239 deletions(-) diff --git a/parser_library/src/context/literal_pool.cpp b/parser_library/src/context/literal_pool.cpp index 66e47558a..069b2e448 100644 --- a/parser_library/src/context/literal_pool.cpp +++ b/parser_library/src/context/literal_pool.cpp @@ -210,7 +210,7 @@ void literal_pool::generate_pool(diagnosable_ctx& diags, index_tsecond.r)); else { - auto adder = ord_ctx.symbol_dependencies().add_dependencies( + ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(lit, lit_val), dependency_evaluation_context { lit_val.loctr, @@ -218,10 +218,7 @@ void literal_pool::generate_pool(diagnosable_ctx& diags, index_t& dependency_source_stmts; + std::unordered_map& dependencies; + postponed_statements_t& postponed_stmts; const dependency_evaluation_context& dep_ctx; const library_info& li; @@ -122,9 +123,10 @@ struct resolve_dependant_visitor if (sp->kind == space_kind::LOCTR_UNKNOWN) { // I don't think that the postponed statement has to always exist. - auto dep_it = dependency_source_stmts.find(sp); - const postponed_statement* stmt = - dep_it == dependency_source_stmts.end() ? nullptr : dep_it->second.stmt_ref->first.get(); + auto dep_it = dependencies.find(sp); + const postponed_statement* stmt = dep_it == dependencies.end() || !dep_it->second.related_statement_id + ? nullptr + : postponed_stmts[dep_it->second.related_statement_id.value()].first.get(); resolve_unknown_loctr_dependency(sp, val, stmt); } else @@ -230,10 +232,18 @@ void symbol_dependency_tables::resolve_dependant(dependant target, const library_info& li) { context::ordinary_assembly_dependency_solver dep_solver(m_sym_ctx, dep_ctx, li); - symbol_value val = dep_src->resolve(dep_solver); std::visit( - resolve_dependant_visitor { val, diag_consumer, m_sym_ctx, m_dependency_source_stmts, dep_ctx, li }, target); + resolve_dependant_visitor { + dep_src->resolve(dep_solver), + diag_consumer, + m_sym_ctx, + m_dependencies, + m_postponed_stmts, + dep_ctx, + li, + }, + target); } struct resolve_dependant_default_visitor @@ -435,7 +445,12 @@ void symbol_dependency_tables::resolve( const auto& [target, dep_value] = *dep_it; resolve_dependant(target, dep_value.m_resolvable, diag_consumer, dep_value.m_dec, li); // resolve target - try_erase_source_statement(target); + if (auto id = dep_it->second.related_statement_id) + { + auto& ref_count = m_postponed_stmts_references[id.value()]; + assert(ref_count >= 1); + --ref_count; + } accum.reset(std::visit(dependant_hash(), delete_dependency(dep_it))); } @@ -547,46 +562,43 @@ bool symbol_dependency_tables::update_dependencies(const dependency_value& d, co return m_dependencies_filters.any(d.m_last_dependencies); } -std::vector symbol_dependency_tables::extract_dependencies( - const std::vector& dependency_sources, - const dependency_evaluation_context& dep_ctx, - const library_info& li) +template +index_t symbol_dependency_tables::add_postponed( + post_stmt_ptr dependency_source_stmt, T&& dep_ctx) { - std::vector ret; - - for (auto dep : dependency_sources) + index_t id; + if (m_postponed_stmts_free.empty()) { - auto tmp = extract_dependencies(dep, dep_ctx, li); - ret.insert(ret.end(), std::make_move_iterator(tmp.begin()), std::make_move_iterator(tmp.end())); + id = index_t(m_postponed_stmts.size()); + m_postponed_stmts.emplace_back(std::move(dependency_source_stmt), std::forward(dep_ctx)); + m_postponed_stmts_references.emplace_back(); } - return ret; + else + { + id = m_postponed_stmts_free.back(); + m_postponed_stmts_free.pop_back(); + auto& [stmt, ctx] = m_postponed_stmts[id.value()]; + stmt = std::move(dependency_source_stmt); + ctx = std::forward(dep_ctx); + } + + return id; } -void symbol_dependency_tables::try_erase_source_statement(const dependant& index) +void symbol_dependency_tables::delete_postponed(index_t id) { - auto ait = m_dependency_source_addrs.find(index); - if (ait != m_dependency_source_addrs.end()) - m_dependency_source_addrs.erase(ait); - - auto it = m_dependency_source_stmts.find(index); - if (it == m_dependency_source_stmts.end()) - return; - - auto& [dep, ref] = *it; - - assert(ref.ref_count >= 1); - - if (--ref.ref_count == 0) - m_postponed_stmts.erase(ref.stmt_ref); - - m_dependency_source_stmts.erase(it); + m_postponed_stmts_free.push_back(id); + auto& [stmt, ctx] = m_postponed_stmts[id.value()]; + stmt.reset(); + ctx.loctr_address.reset(); + m_postponed_stmts_references[id.value()] = 0; } symbol_dependency_tables::symbol_dependency_tables(ordinary_assembly_context& sym_ctx) : m_sym_ctx(sym_ctx) {} -bool symbol_dependency_tables::add_dependency(dependant target, +symbol_dependency_tables::dependency_value* symbol_dependency_tables::add_dependency(dependant target, const resolvable* dependency_source, bool check_for_cycle, const dependency_evaluation_context& dep_ctx, @@ -598,16 +610,14 @@ bool symbol_dependency_tables::add_dependency(dependant target, if (!no_cycle) { resolve(std::visit(dependant_visitor(), target), nullptr, li); - return false; + return nullptr; } } - insert_depenency(std::move(target), dependency_source, dep_ctx); - - return true; + return insert_depenency(std::move(target), dependency_source, dep_ctx); } -void symbol_dependency_tables::insert_depenency( +symbol_dependency_tables::dependency_value* symbol_dependency_tables::insert_depenency( dependant target, const resolvable* dependency_source, const dependency_evaluation_context& dep_ctx) { const bool is_space_ptr = std::holds_alternative(target); @@ -619,6 +629,8 @@ void symbol_dependency_tables::insert_depenency( m_dependencies_space_ptr_type.emplace_back(is_space_ptr); assert(inserted); + + return &it->second; } dependant symbol_dependency_tables::delete_dependency(std::unordered_map::iterator it) @@ -643,11 +655,13 @@ bool symbol_dependency_tables::add_dependency(id_index target, const dependency_evaluation_context& dep_ctx, const library_info& li) { - dependency_adder adder(*this, std::move(dependency_source_stmt), dep_ctx, li); - bool added = adder.add_dependency(target, dependency_source); - adder.finish(); + auto* dep = add_dependency(dependant(target), dependency_source, true, dep_ctx, li); + if (!dep) + return false; + + establish_statement_dependency(*dep, add_postponed(std::move(dependency_source_stmt), dep_ctx)); - return added; + return true; } bool symbol_dependency_tables::add_dependency(id_index target, @@ -657,11 +671,13 @@ bool symbol_dependency_tables::add_dependency(id_index target, const dependency_evaluation_context& dep_ctx, const library_info& li) { - dependency_adder adder(*this, std::move(dependency_source_stmt), dep_ctx, li); - bool added = adder.add_dependency(target, attr, dependency_source); - adder.finish(); + auto* dep = add_dependency(dependant(attr_ref { attr, target }), dependency_source, true, dep_ctx, li); + if (!dep) + return false; - return added; + establish_statement_dependency(*dep, add_postponed(std::move(dependency_source_stmt), dep_ctx)); + + return true; } void symbol_dependency_tables::add_dependency(space_ptr space, @@ -670,9 +686,10 @@ void symbol_dependency_tables::add_dependency(space_ptr space, const dependency_evaluation_context& dep_ctx, const library_info& li) { - dependency_adder adder(*this, std::move(dependency_source_stmt), dep_ctx, li); - adder.add_dependency(std::move(space), dependency_source); - adder.finish(); + auto* dep = add_dependency(dependant(space), dependency_source, false, dep_ctx, li); + assert(dep); + + establish_statement_dependency(*dep, add_postponed(std::move(dependency_source_stmt), dep_ctx)); } void symbol_dependency_tables::add_dependency(space_ptr target, @@ -681,20 +698,19 @@ void symbol_dependency_tables::add_dependency(space_ptr target, const library_info& li, post_stmt_ptr dependency_source_stmt) { - auto [it, inserted] = m_dependency_source_addrs.emplace(target, std::move(dependency_source)); + auto* dep = add_dependency(dependant(target), std::to_address(dependency_source), false, dep_ctx, li); + assert(dep); - assert(inserted); - - add_dependency(dependant(target), std::to_address(it->second), false, dep_ctx, li); + dep->related_source_addr = std::move(dependency_source); if (dependency_source_stmt) - { - auto [sit, sinserted] = m_postponed_stmts.try_emplace(std::move(dependency_source_stmt), dep_ctx); - - assert(sinserted); + establish_statement_dependency(*dep, add_postponed(std::move(dependency_source_stmt), dep_ctx)); +} - m_dependency_source_stmts.emplace(dependant(std::move(target)), statement_ref(sit, 1)); - } +void symbol_dependency_tables::establish_statement_dependency(dependency_value& val, index_t id) +{ + val.related_statement_id = id; + ++m_postponed_stmts_references[id.value()]; } bool symbol_dependency_tables::check_cycle(space_ptr target, const library_info& li) @@ -711,18 +727,16 @@ bool symbol_dependency_tables::check_cycle(space_ptr target, const library_info& return no_cycle; } -void symbol_dependency_tables::add_dependency( - post_stmt_ptr target, const dependency_evaluation_context& dep_ctx, const library_info& li) +void symbol_dependency_tables::add_postponed_statement(post_stmt_ptr target, dependency_evaluation_context dep_ctx) { - dependency_adder adder(*this, std::move(target), dep_ctx, li); - adder.add_dependency(); - adder.finish(); + (void)add_postponed(std::move(target), std::move(dep_ctx)); } dependency_adder symbol_dependency_tables::add_dependencies( post_stmt_ptr dependency_source_stmt, const dependency_evaluation_context& dep_ctx, const library_info& li) { - return dependency_adder(*this, std::move(dependency_source_stmt), dep_ctx, li); + auto id = add_postponed(std::move(dependency_source_stmt), dep_ctx); + return dependency_adder(*this, id, li); } void symbol_dependency_tables::add_defined( @@ -800,108 +814,70 @@ bool symbol_dependency_tables::check_loctr_cycle(const library_info& li) for (const auto* target : cycles) { resolve_dependant_default(*target); - try_erase_source_statement(*target); if (auto it = m_dependencies.find(*target); it != m_dependencies.end()) + { + if (auto id = it->second.related_statement_id) + { + auto& ref_count = m_postponed_stmts_references[id.value()]; + assert(ref_count >= 1); + if (--ref_count == 0) + delete_postponed(id); + } delete_dependency(it); + } } return cycles.empty(); } -std::vector> symbol_dependency_tables::collect_postponed() +postponed_statements_t symbol_dependency_tables::collect_postponed() { - std::vector> res; - - res.reserve(m_postponed_stmts.size()); - for (auto it = m_postponed_stmts.begin(); it != m_postponed_stmts.end();) - { - auto node = m_postponed_stmts.extract(it++); - res.emplace_back(std::move(node.key()), std::move(node.mapped())); - } - - m_postponed_stmts.clear(); - m_dependency_source_stmts.clear(); + auto result = std::move(m_postponed_stmts); + m_postponed_stmts_references.clear(); + m_postponed_stmts_free.clear(); m_dependencies.clear(); m_dependencies_iterators.clear(); m_dependencies_filters.clear(); m_dependencies_has_t_attr.clear(); m_dependencies_space_ptr_type.clear(); - return res; + return result; } void symbol_dependency_tables::resolve_all_as_default() { for (auto& [target, dep_src] : m_dependencies) + { resolve_dependant_default(target); + } } -statement_ref::statement_ref(ref_t stmt_ref, size_t ref_count) - : stmt_ref(std::move(stmt_ref)) - , ref_count(ref_count) -{} - -dependency_adder::dependency_adder(symbol_dependency_tables& owner, - post_stmt_ptr dependency_source_stmt, - const dependency_evaluation_context& dep_ctx, - const library_info& li) - : m_owner(owner) - , m_ref_count(0) - , m_dep_ctx(dep_ctx) - , m_source_stmt(std::move(dependency_source_stmt)) - , m_li(li) -{} - -bool dependency_adder::add_dependency(id_index target, const resolvable* dependency_source) +symbol_dependency_tables::dependency_value* dependency_adder::add_dependency( + dependant target, const resolvable* dependency_source, bool check_cycle) { - bool added = m_owner.add_dependency(dependant(target), dependency_source, true, m_dep_ctx, m_li); + auto* dep = m_owner.add_dependency( + std::move(target), dependency_source, check_cycle, m_owner.m_postponed_stmts[m_id.value()].second, m_li); - if (added) - { - ++m_ref_count; - m_dependants.emplace_back(target); - } + if (dep) + m_owner.establish_statement_dependency(*dep, m_id); - return added; + return dep; } -bool dependency_adder::add_dependency(id_index target, data_attr_kind attr, const resolvable* dependency_source) +bool dependency_adder::add_dependency(id_index target, const resolvable* dependency_source) { - bool added = m_owner.add_dependency(dependant(attr_ref { attr, target }), dependency_source, true, m_dep_ctx, m_li); - - if (added) - { - ++m_ref_count; - m_dependants.emplace_back(std::in_place_type, attr, target); - } - - return added; + return add_dependency(dependant(target), dependency_source, true); } -void dependency_adder::add_dependency(space_ptr target, const resolvable* dependency_source) +bool dependency_adder::add_dependency(id_index target, data_attr_kind attr, const resolvable* dependency_source) { - m_owner.add_dependency(dependant(target), dependency_source, false, m_dep_ctx, m_li); - ++m_ref_count; - m_dependants.emplace_back(target); + return add_dependency(dependant(attr_ref { attr, target }), dependency_source, true); } -void dependency_adder::add_dependency() { ++m_ref_count; } - -void dependency_adder::finish() +void dependency_adder::add_dependency(space_ptr target, const resolvable* dependency_source) { - if (m_ref_count == 0) - return; - - auto [it, inserted] = m_owner.m_postponed_stmts.try_emplace(std::move(m_source_stmt), m_dep_ctx); - - assert(inserted); - - statement_ref ref(it, m_ref_count); - - for (auto& dep : m_dependants) - m_owner.m_dependency_source_stmts.emplace(std::move(dep), ref); - - m_dependants.clear(); + [[maybe_unused]] auto* dep = add_dependency(dependant(target), dependency_source, false); + assert(dep); } } // namespace hlasm_plugin::parser_library::context diff --git a/parser_library/src/context/ordinary_assembly/symbol_dependency_tables.h b/parser_library/src/context/ordinary_assembly/symbol_dependency_tables.h index b30b88a8a..55420a50c 100644 --- a/parser_library/src/context/ordinary_assembly/symbol_dependency_tables.h +++ b/parser_library/src/context/ordinary_assembly/symbol_dependency_tables.h @@ -65,26 +65,22 @@ struct dependency_evaluation_context {} }; -// helper structure to count dependencies of a statement -struct statement_ref -{ - using ref_t = std::unordered_map::const_iterator; - statement_ref(ref_t stmt_ref, size_t ref_count = (size_t)1); - - ref_t stmt_ref; - size_t ref_count; -}; +using postponed_statements_t = std::vector>; class dependency_adder; // class holding data about dependencies between symbols class symbol_dependency_tables { + friend struct resolve_dependant_visitor; struct dependency_value { const resolvable* m_resolvable; dependency_evaluation_context m_dec; size_t m_last_dependencies; + index_t related_statement_id; + addr_res_ptr related_source_addr; + dependency_value(const resolvable* r, dependency_evaluation_context dec, size_t last_dependencies) : m_resolvable(r) , m_dec(std::move(dec)) @@ -100,7 +96,7 @@ class symbol_dependency_tables std::vector m_dependencies_has_t_attr; std::vector m_dependencies_space_ptr_type; - void insert_depenency( + dependency_value* insert_depenency( dependant target, const resolvable* dependency_source, const dependency_evaluation_context& dep_ctx); dependant delete_dependency(std::unordered_map::iterator it); @@ -114,15 +110,17 @@ class symbol_dependency_tables dep_iterator dep_end(); size_t m_dependencies_skip_index = 0; - // statements where dependencies are from - std::unordered_map m_dependency_source_stmts; - // addresses where dependencies are from - std::unordered_map m_dependency_source_addrs; // list of statements containing dependencies that can not be checked yet - std::unordered_map m_postponed_stmts; + postponed_statements_t m_postponed_stmts; + std::vector m_postponed_stmts_references; + std::vector> m_postponed_stmts_free; ordinary_assembly_context& m_sym_ctx; + template + index_t add_postponed(post_stmt_ptr, T&&); + void delete_postponed(index_t); + bool check_cycle(dependant target, std::vector dependencies, const library_info& li); void resolve_dependant(dependant target, @@ -139,18 +137,15 @@ class symbol_dependency_tables std::vector extract_dependencies( const resolvable* dependency_source, const dependency_evaluation_context& dep_ctx, const library_info& li); bool update_dependencies(const dependency_value& v, const library_info& li); - std::vector extract_dependencies(const std::vector& dependency_sources, - const dependency_evaluation_context& dep_ctx, - const library_info& li); - - void try_erase_source_statement(const dependant& index); - bool add_dependency(dependant target, + dependency_value* add_dependency(dependant target, const resolvable* dependency_source, bool check_cycle, const dependency_evaluation_context& dep_ctx, const library_info& li); + void establish_statement_dependency(dependency_value& val, index_t id); + public: symbol_dependency_tables(ordinary_assembly_context& sym_ctx); @@ -184,8 +179,7 @@ class symbol_dependency_tables post_stmt_ptr dependency_source_stmt = nullptr); bool check_cycle(space_ptr target, const library_info& li); - // add statement dependency on its operands - void add_dependency(post_stmt_ptr target, const dependency_evaluation_context& dep_ctx, const library_info& li); + void add_postponed_statement(post_stmt_ptr target, dependency_evaluation_context dep_ctx); // method for creating more than one dependency assigned to one statement dependency_adder add_dependencies( @@ -201,7 +195,7 @@ class symbol_dependency_tables bool check_loctr_cycle(const library_info& li); // collect all postponed statements either if they still contain dependent objects - std::vector> collect_postponed(); + postponed_statements_t collect_postponed(); // assign default values to all unresoved dependants void resolve_all_as_default(); @@ -212,22 +206,22 @@ class symbol_dependency_tables // helper class to add dependencies class dependency_adder { - symbol_dependency_tables& m_owner; - size_t m_ref_count; + friend class symbol_dependency_tables; - std::vector m_dependants; - dependency_evaluation_context m_dep_ctx; + symbol_dependency_tables& m_owner; + index_t m_id; + const library_info& m_li; - post_stmt_ptr m_source_stmt; + dependency_adder(symbol_dependency_tables& owner, index_t id, const library_info& li) + : m_owner(owner) + , m_id(id) + , m_li(li) + {} - const library_info& m_li; + [[nodiscard]] symbol_dependency_tables::dependency_value* add_dependency( + dependant target, const resolvable* dependency_source, bool check_cycle); public: - dependency_adder(symbol_dependency_tables& owner, - post_stmt_ptr dependency_source_stmt, - const dependency_evaluation_context& dep_ctx, - const library_info& li); - // add symbol dependency on statement [[nodiscard]] bool add_dependency(id_index target, const resolvable* dependency_source); @@ -236,12 +230,6 @@ class dependency_adder // add space dependency void add_dependency(space_ptr target, const resolvable* dependency_source); - - // add statement dependency on its operands - void add_dependency(); - - // finish adding dependencies - void finish(); }; } // namespace hlasm_plugin::parser_library::context diff --git a/parser_library/src/processing/instruction_sets/asm_processor.cpp b/parser_library/src/processing/instruction_sets/asm_processor.cpp index c8655cb08..3d829a5a8 100644 --- a/parser_library/src/processing/instruction_sets/asm_processor.cpp +++ b/parser_library/src/processing/instruction_sets/asm_processor.cpp @@ -110,10 +110,9 @@ void asm_processor::process_sect(const context::section_kind kind, rebuilt_state hlasm_ctx.ord_ctx.set_section(sect_name, kind, std::move(sym_loc), lib_info); } context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_LOCTR(rebuilt_statement&& stmt) @@ -134,10 +133,9 @@ void asm_processor::process_LOCTR(rebuilt_statement&& stmt) hlasm_ctx.ord_ctx.set_location_counter(loctr_name, std::move(sym_loc), lib_info); } context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } struct override_symbol_candidates final : public context::dependency_solver_redirect @@ -279,10 +277,9 @@ void asm_processor::process_data_instruction(rebuilt_statement&& stmt) ops.empty() || std::ranges::find(ops, semantics::operand_type::EMPTY, &semantics::operand::type) != ops.end()) { context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); return; } @@ -425,7 +422,6 @@ void asm_processor::process_data_instruction(rebuilt_statement&& stmt) auto adder = hlasm_ctx.ord_ctx.symbol_dependencies().add_dependencies( std::move(dep_stmt), std::move(dep_solver).derive_current_dependency_evaluation_context(), lib_info); - adder.add_dependency(); bool cycle_ok = true; @@ -437,11 +433,8 @@ void asm_processor::process_data_instruction(rebuilt_statement&& stmt) if (!cycle_ok) add_diagnostic(diagnostic_op::error_E033(operands.front()->operand_range)); - auto sp = dependencies_spaces.begin(); - for (const auto& d : deps) + for (auto sp = dependencies_spaces.begin(); const auto& d : deps) adder.add_dependency(std::move(*sp++), &d); - - adder.finish(); } void asm_processor::process_DC(rebuilt_statement&& stmt) @@ -476,10 +469,9 @@ void asm_processor::process_COPY(rebuilt_statement&& stmt) else { context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } } @@ -534,10 +526,9 @@ void asm_processor::process_external(rebuilt_statement&& stmt, external_type t) } } context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_ORG(rebuilt_statement&& stmt) @@ -717,10 +708,9 @@ void asm_processor::process_OPSYN(rebuilt_statement&& stmt) } context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } asm_processor::asm_processor(const analyzing_context& ctx, @@ -751,10 +741,9 @@ void asm_processor::process(std::shared_ptr(std::move(rebuilt_stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } } std::optional asm_processor::extract_copy_id( @@ -958,10 +947,9 @@ void asm_processor::process_CCW(rebuilt_statement&& stmt) hlasm_ctx.ord_ctx.reserve_storage_area(ccw_length, ccw_align, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_CNOP(rebuilt_statement&& stmt) @@ -992,10 +980,9 @@ void asm_processor::process_CNOP(rebuilt_statement&& stmt) 0, context::alignment { (size_t)*byte_value, (size_t)*boundary_value }, lib_info); } - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } @@ -1025,10 +1012,9 @@ void asm_processor::process_START(rebuilt_statement&& stmt) if (ops.size() != 1) { context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); return; } @@ -1078,10 +1064,9 @@ void asm_processor::process_END(rebuilt_statement&& stmt) } } - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); hlasm_ctx.end_reached(); } @@ -1095,10 +1080,9 @@ void asm_processor::process_ALIAS(rebuilt_statement&& stmt) } context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_LTORG(rebuilt_statement&& stmt) { @@ -1122,10 +1106,9 @@ void asm_processor::process_LTORG(rebuilt_statement&& stmt) hlasm_ctx.ord_ctx.generate_pool(*this, hlasm_ctx.using_current(), lib_info); context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_USING(rebuilt_statement&& stmt) @@ -1271,10 +1254,9 @@ void asm_processor::process_PUSH(rebuilt_statement&& stmt) hlasm_ctx.using_push(); context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_POP(rebuilt_statement&& stmt) @@ -1284,10 +1266,9 @@ void asm_processor::process_POP(rebuilt_statement&& stmt) add_diagnostic(diagnostic_op::error_A165_POP_USING(stmt.stmt_range_ref())); context::ordinary_assembly_dependency_solver dep_solver(hlasm_ctx.ord_ctx, lib_info); - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); } void asm_processor::process_MNOTE(rebuilt_statement&& stmt) @@ -1432,11 +1413,10 @@ void asm_processor::process_TITLE(rebuilt_statement&& stmt) add_diagnostic(diagnostic_op::warning_W016(label.field_range)); } - hlasm_ctx.ord_ctx.symbol_dependencies().add_dependency( + hlasm_ctx.ord_ctx.symbol_dependencies().add_postponed_statement( std::make_unique(std::move(stmt), hlasm_ctx.processing_stack()), context::ordinary_assembly_dependency_solver(hlasm_ctx.ord_ctx, lib_info) - .derive_current_dependency_evaluation_context(), - lib_info); + .derive_current_dependency_evaluation_context()); } void asm_processor::process_PUNCH(rebuilt_statement&& stmt) diff --git a/parser_library/src/processing/instruction_sets/mach_processor.cpp b/parser_library/src/processing/instruction_sets/mach_processor.cpp index 2679a14aa..ecd3d4441 100644 --- a/parser_library/src/processing/instruction_sets/mach_processor.cpp +++ b/parser_library/src/processing/instruction_sets/mach_processor.cpp @@ -63,10 +63,9 @@ void mach_processor::process(std::shared_ptr(std::move(rebuilt_stmt), hlasm_ctx.processing_stack()), - std::move(dep_solver).derive_current_dependency_evaluation_context(), - lib_info); + std::move(dep_solver).derive_current_dependency_evaluation_context()); (void)hlasm_ctx.ord_ctx.reserve_storage_area(mach_instr->size_in_bits() / 8, context::halfword, lib_info); } diff --git a/parser_library/test/processing/org_test.cpp b/parser_library/test/processing/org_test.cpp index 90ce3b940..518348002 100644 --- a/parser_library/test/processing/org_test.cpp +++ b/parser_library/test/processing/org_test.cpp @@ -935,7 +935,7 @@ Y LR 1,1 analyzer a(input); a.analyze(); - EXPECT_TRUE(matches_message_codes(a.diags(), { "E033", "E068" })); + EXPECT_TRUE(matches_message_codes(a.diags(), { "E016", "E033", "E068" })); } TEST(org, unknown_part_underflow)