From aca66a36681ac7cbf7fcc2eac4dafc83d6559ef9 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 2 Sep 2009 16:14:08 -0700 Subject: Unify lex_cast* and avoid string copies We always use lex_cast either to string or from string, so I made that explicit, and got rid of some string copies in the process. There was also stringify(), which was redundant to lex_cast. We also always used lex_cast_hex to string, so that's now hard-coded and again eliminated a string copy. For lex_cast_qstring, there's no need to write the streamify the input, so a specialization now operates directly on the input. Hopefully this is a bit cleaner, and I do measure it to be a little faster on scripts with many probes. --- tapset-mark.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tapset-mark.cxx') diff --git a/tapset-mark.cxx b/tapset-mark.cxx index 6b4f47c5..b70098e3 100644 --- a/tapset-mark.cxx +++ b/tapset-mark.cxx @@ -108,7 +108,7 @@ mark_var_expanding_visitor::visit_target_symbol_arg (target_symbol* e) // Remember that we've seen a target variable. target_symbol_seen = true; - e->probe_context_var = "__mark_arg" + lex_cast(argnum); + e->probe_context_var = "__mark_arg" + lex_cast(argnum); e->type = mark_args[argnum-1]->stp_type; provide (e); } @@ -156,10 +156,10 @@ mark_var_expanding_visitor::visit_target_symbol_context (target_symbol* e) { if (i > 0) pf->raw_components += " "; - pf->raw_components += "$arg" + lex_cast(i+1); + pf->raw_components += "$arg" + lex_cast(i+1); target_symbol *tsym = new target_symbol; tsym->tok = e->tok; - tsym->base_name = "$arg" + lex_cast(i+1); + tsym->base_name = "$arg" + lex_cast(i+1); tsym->saved_conversion_error = 0; expression *texp = require (tsym); //same treatment as tracepoint @@ -414,7 +414,7 @@ mark_derived_probe::emit_probe_context_vars (translator_output* o) for (unsigned i = 0; i < mark_args.size(); i++) { - string localname = "__mark_arg" + lex_cast(i+1); + string localname = "__mark_arg" + lex_cast(i+1); switch (mark_args[i]->stp_type) { case pe_long: @@ -441,7 +441,7 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o) bool deref_fault_needed = false; for (unsigned i = 0; i < mark_args.size(); i++) { - string localname = "l->__mark_arg" + lex_cast(i+1); + string localname = "l->__mark_arg" + lex_cast(i+1); switch (mark_args[i]->stp_type) { case pe_long: @@ -475,7 +475,7 @@ mark_derived_probe::printargs(std::ostream &o) const { for (unsigned i = 0; i < mark_args.size(); i++) { - string localname = "$arg" + lex_cast(i+1); + string localname = "$arg" + lex_cast(i+1); switch (mark_args[i]->stp_type) { case pe_long: -- cgit