[svn:parrot] r35681 - trunk/compilers/pirc/src
[email protected] Sat, 17 Jan 2009 05:24:31 -0800 (PST)
Newsgroups
perl.cvs.parrot
Message-ID
<[email protected] >
Author: kjs
Date: Sat Jan 17 05:24:30 2009
New Revision: 35681
Modified:
trunk/compilers/pirc/src/bcgen.c
Log:
[pirc] add a #define for debug messages.
Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c (original)
+++ trunk/compilers/pirc/src/bcgen.c Sat Jan 17 05:24:30 2009
@@ -21,6 +21,12 @@
# define PMCNULL ((PMC *)NULL)
#endif
+/* turn this on when debugging */
+#define DEBUGBC 0
+
+
+
+
/*
=head1 DESCRIPTION
@@ -182,7 +188,9 @@
constant = bc->interp->code->const_table->constants[index];
if (constant->type == PFC_STRING) {
if (string_equal(bc->interp, constant->u.string, parrotstr) == 0) {
+#if DEBUGBC
fprintf(stderr, "found string %s at index %d\n", str, index);
+#endif
return index;
}
}
@@ -198,8 +206,9 @@
constant->type = PFC_STRING;
constant->u.string = parrotstr;
- /*fprintf(stderr, "add_string_const (%s) at index: %d\n", str, index);
- */
+#if DEBUGBC
+ fprintf(stderr, "add_string_const (%s) at index: %d\n", str, index);
+#endif
return index;
@@ -254,7 +263,9 @@
if (constant->type == PFC_KEY) {
STRING *s2 = key_set_to_string(bc->interp, constant->u.key);
if (string_equal(bc->interp, s1, s2) == 0) {
+#if DEBUGBC
fprintf(stderr, "found equal key (%d)\n", index);
+#endif
return index;
}
}
@@ -266,7 +277,9 @@
constant = bc->interp->code->const_table->constants[index];
constant->type = PFC_KEY;
constant->u.key = key;
+#if DEBUGBC
fprintf(stderr, "new key const (%d)\n", index);
+#endif
return index;
}
@@ -505,8 +518,9 @@
opcode_t
emit_opcode(bytecode * const bc, opcode_t op) {
*bc->opcursor = op;
-
+#if DEBUGBC
fprintf(stderr, "\n[%d]", op);
+#endif
return (bc->opcursor++ - bc->interp->code->base.data);
}
@@ -526,10 +540,9 @@
opcode_t
emit_int_arg(bytecode * const bc, int intval) {
*bc->opcursor = intval;
-
+#if DEBUGBC
fprintf(stderr, "{%d}", intval);
-
-
+#endif
return (bc->opcursor++ - bc->interp->code->base.data);
}