[svn:parrot] r43250 - trunk/src
cotto at svn.parrot.org
cotto at svn.parrot.org
Sat Dec 26 18:30:15 UTC 2009
Author: cotto
Date: Sat Dec 26 18:30:14 2009
New Revision: 43250
URL: https://trac.parrot.org/parrot/changeset/43250
Log:
[packfile] Only record pc => filename mappings in the debug segment if the filename has changed.
This results in a modest (.7%) speedup in profiling and small reduction in bytecode size.
Modified:
trunk/src/packfile.c
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Sat Dec 26 17:19:07 2009 (r43249)
+++ trunk/src/packfile.c Sat Dec 26 18:30:14 2009 (r43250)
@@ -2895,6 +2895,19 @@
ASSERT_ARGS(Parrot_debug_add_mapping)
PackFile_ConstTable * const ct = debug->code->const_table;
int insert_pos = 0;
+ opcode_t prev_filename_n;
+ STRING *filename_pstr;
+
+ /* If the previous mapping has the same filename, don't record it. */
+ if (debug->num_mappings) {
+ prev_filename_n = debug->mappings[debug->num_mappings-1]->filename;
+ filename_pstr = Parrot_str_new(interp, filename, 0);
+ if (ct->constants[prev_filename_n]->type == PFC_STRING &&
+ Parrot_str_equal(interp, filename_pstr,
+ ct->constants[prev_filename_n]->u.string)) {
+ return;
+ }
+ }
/* Allocate space for the extra entry. */
mem_realloc_n_typed(debug->mappings, debug->num_mappings + 1,
More information about the parrot-commits
mailing list