From 07c17d677a8080492b4a67b664f4cc9557f5dda3 Mon Sep 17 00:00:00 2001 From: graydon Date: Thu, 24 Nov 2005 05:55:52 +0000 Subject: 2005-11-23 Graydon Hoare * elaborate.h (get_symbol_within_expression): Make visible. * elaborate.cxx (get_symbol_within_expression): Make non-static. (stat_decl_collector): New struct. (semantic_pass_stats): New semantic pass. (semantic_pass): Call it. (semantic_pass_symbols): Remove collection of statistic_decls from files. (visit_stat_op): Only fail if inferred type is not pe_long. * parse.cxx (parser::parse): Don't pass per-file statistic_decl into parse_global. (parser::parse_global): Don't parse global statistic_decls, they're obsolete. * parse.hh (parser::parse_global): Adjust signature to match. * session.h (statistic_decl::operator==): New method. * staptree.h (print_format::is_empty): New method. (stapfile::stat_decls): Remove field. * staptree.cxx (string_to_components): Fix bugs in format-string parser. * translate.cxx (var): Make private fields protected. (var::init): Support HIST_NONE stats. (aggvar): New struct. (mapvar::is_parallel): New method. (mapvar::call_prefix): Use it. (mapvar::calculate_aggregate): New method. (mapvar::fetch_existing_aggregate): New method. (mapvar::get): Support pe_stats. (mapvar::init): Use is_parallel(), and support HIST_NONE. (itervar::itervar): Only fault on pe_unknown. (itervar::start): Use mapvar::is_parallel and mapvar::fetch_existing_aggregate. (emit_map_type_instantiations): Include alloc.c before pmap-gen.c. Include pmap-gen.c for pe_stats maps. (c_unparser::gensym_aggregate): New method. (c_unparser::visit_foreach_loop): Handle mapvar::is_parallel case. (arrayindex_downcaster): New struct. (expression_is_arrayindex): New function. (c_tmpcounter::visit_stat_op): New method. (c_unparser::visit_stat_op): Implement. (c_unparser::visit_hist_op): Add commentary, still not implemented. * testsuite/buildok/stat_{insert,extract}.stp: New tests. * testsuite/semok/ten.stp: Correct for changes to global declarations. * testsuite/semko/*.stp: Likewise. --- parse.cxx | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'parse.cxx') diff --git a/parse.cxx b/parse.cxx index b7de56e2..2ceb6f5f 100644 --- a/parse.cxx +++ b/parse.cxx @@ -672,7 +672,7 @@ parser::parse () if (t->type == tok_identifier && t->content == "probe") parse_probe (f->probes, f->aliases); else if (t->type == tok_identifier && t->content == "global") - parse_global (f->globals, f->stat_decls); + parse_global (f->globals); else if (t->type == tok_identifier && t->content == "function") parse_functiondecl (f->functions); else if (t->type == tok_embedded) @@ -886,8 +886,7 @@ parser::parse_statement () void -parser::parse_global (vector & globals, - std::map &stat_decls) +parser::parse_global (vector & globals) { const token* t0 = next (); if (! (t0->type == tok_identifier && t0->content == "global")) @@ -899,33 +898,6 @@ parser::parse_global (vector & globals, if (! (t->type == tok_identifier)) throw parse_error ("expected identifier"); - statistic_decl sd; - - if (t->content == "log_hist") - { - std::string tmp; - expect_op ("("); - t = expect_ident (tmp); - expect_op (","); - expect_number (sd.logarithmic_buckets); - expect_op (")"); - sd.type = statistic_decl::logarithmic; - } - else if (t->content == "linear_hist") - { - std::string tmp; - expect_op ("("); - t = expect_ident (tmp); - expect_op (","); - expect_number (sd.linear_low); - expect_op (","); - expect_number (sd.linear_high); - expect_op (","); - expect_number (sd.linear_step); - expect_op (")"); - sd.type = statistic_decl::linear; - } - for (unsigned i=0; iname == t->content) throw parse_error ("duplicate global name"); @@ -935,12 +907,6 @@ parser::parse_global (vector & globals, d->tok = t; globals.push_back (d); - if (sd.type != statistic_decl::none) - { - d->type = pe_stats; - stat_decls[d->name] = sd; - } - t = peek (); if (t && t->type == tok_operator && t->content == ",") { -- cgit