[svn:parrot] r39488 - trunk/src

petdance at svn.parrot.org petdance at svn.parrot.org
Wed Jun 10 06:25:08 UTC 2009


Author: petdance
Date: Wed Jun 10 06:25:07 2009
New Revision: 39488
URL: https://trac.parrot.org/parrot/changeset/39488

Log:
adding some consts, and ornamenting some parms for the headerizer

Modified:
   trunk/src/embed.c

Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c	Wed Jun 10 06:16:46 2009	(r39487)
+++ trunk/src/embed.c	Wed Jun 10 06:25:07 2009	(r39488)
@@ -34,9 +34,13 @@
         __attribute__nonnull__(1);
 
 PARROT_CANNOT_RETURN_NULL
+PARROT_OBSERVER
 static const char * op_name(PARROT_INTERP, int k)
         __attribute__nonnull__(1);
 
+static void print_constant_table(PARROT_INTERP)
+        __attribute__nonnull__(1);
+
 static void print_debug(PARROT_INTERP, SHIM(int status), SHIM(void *p))
         __attribute__nonnull__(1);
 
@@ -60,6 +64,8 @@
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_op_name __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_print_constant_table __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_print_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_print_profile __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -689,6 +695,7 @@
 */
 
 PARROT_CANNOT_RETURN_NULL
+PARROT_OBSERVER
 static const char *
 op_name(PARROT_INTERP, int k)
 {
@@ -730,10 +737,10 @@
 {
     ASSERT_ARGS(calibrate)
     opcode_t code[] = { 1 };      /* noop */
-    opcode_t *pc    = code;
-    size_t   count  = 1000000;
+    const opcode_t *pc    = code;
+    const size_t   count  = 1000000;
     size_t   n      = count;
-    FLOATVAL start  = Parrot_floatval_time();
+    const FLOATVAL start  = Parrot_floatval_time();
     FLOATVAL now    = start;
 
     /* op timing isn't free; it requires at least one time fetch per op */
@@ -1067,15 +1074,16 @@
 
 */
 static void
-print_constant_table(PARROT_INTERP) {
-    INTVAL numconstants = interp->code->const_table->const_count;
+print_constant_table(PARROT_INTERP)
+{
+    const INTVAL numconstants = interp->code->const_table->const_count;
     INTVAL i;
 
     /* TODO: would be nice to print the name of the file as well */
     Parrot_io_printf(interp, "=head1 Constant-table\n\n");
 
     for (i = 0; i < numconstants; ++i) {
-        PackFile_Constant *c = interp->code->const_table->constants[i];
+        const PackFile_Constant * const c = interp->code->const_table->constants[i];
 
         switch (c->type) {
             case PFC_NUMBER:
@@ -1167,11 +1175,11 @@
 Parrot_disassemble(PARROT_INTERP, SHIM(const char *outfile), Parrot_disassemble_options options)
 {
     PDB_line_t *line;
-    PDB_t      *pdb             = mem_allocate_zeroed_typed(PDB_t);
-    int         num_mappings    = 0;
-    int         curr_mapping    = 0;
-    int         op_code_seq_num = 0;
-    int         debugs;
+    PDB_t * const pdb   = mem_allocate_zeroed_typed(PDB_t);
+    int num_mappings    = 0;
+    int curr_mapping    = 0;
+    int op_code_seq_num = 0;
+    int debugs;
 
     interp->pdb     = pdb;
     pdb->cur_opcode = interp->code->base.data;
@@ -1260,7 +1268,7 @@
 void
 Parrot_run_native(PARROT_INTERP, native_func_t func)
 {
-    PackFile       *pf = PackFile_new(interp, 0);
+    PackFile * const pf = PackFile_new(interp, 0);
     static opcode_t program_code[2];
 
     program_code[0] = interp->op_lib->op_code("enternative", 0);
@@ -1302,7 +1310,7 @@
      * before compiling a string */
 
     if (!interp->initial_pf) {
-        PackFile *pf = PackFile_new_dummy(interp, "compile_string");
+        PackFile * const pf = PackFile_new_dummy(interp, "compile_string");
         /* Assumption: there is no valid reason to fail to create it.
          * If the assumption changes, replace the assertion with a
          * runtime check */


More information about the parrot-commits mailing list