[svn:parrot] r49160 - in branches/typesafe_consttable: compilers/imcc src

plobsing at svn.parrot.org plobsing at svn.parrot.org
Sun Sep 19 20:42:00 UTC 2010


Author: plobsing
Date: Sun Sep 19 20:41:59 2010
New Revision: 49160
URL: https://trac.parrot.org/parrot/changeset/49160

Log:
fix some minor logic bugs

Modified:
   branches/typesafe_consttable/compilers/imcc/pbc.c
   branches/typesafe_consttable/src/packout.c

Modified: branches/typesafe_consttable/compilers/imcc/pbc.c
==============================================================================
--- branches/typesafe_consttable/compilers/imcc/pbc.c	Sun Sep 19 16:51:22 2010	(r49159)
+++ branches/typesafe_consttable/compilers/imcc/pbc.c	Sun Sep 19 20:41:59 2010	(r49160)
@@ -1083,20 +1083,20 @@
 
     /* otherwise... */
     {
-        if (!ct->str.constants) {
+        if (!ct->str.constants)
             ct->str.constants =
                 mem_gc_allocate_n_zeroed_typed(interp, 1, STRING *);
 
-            /* initialize rlookup cache */
-            ct->string_hash = parrot_create_hash(interp,
-                    enum_type_INTVAL,
-                    Hash_key_type_STRING_enc);
-        }
-        else {
+        else
             ct->str.constants =
                 mem_gc_realloc_n_typed_zeroed(interp, ct->str.constants,
                     ct->str.const_count + 1, ct->str.const_count, STRING *);
-        }
+
+        /* initialize rlookup cache */
+        if (!ct->string_hash)
+            ct->string_hash = parrot_create_hash(interp,
+                    enum_type_INTVAL,
+                    Hash_key_type_STRING_enc);
 
         ct->str.constants[ct->str.const_count] = s;
 
@@ -1670,8 +1670,9 @@
     ASSERT_ARGS(build_key)
 
     PackFile_ConstTable *ct = interp->code->const_table;
-    SymReg *reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
-    PMC    *head, *tail;
+    SymReg *reg  = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
+    PMC    *head = NULL;
+    PMC    *tail = NULL;
     opcode_t regno, k;
 
     for (; reg; reg = reg->nextkey) {

Modified: branches/typesafe_consttable/src/packout.c
==============================================================================
--- branches/typesafe_consttable/src/packout.c	Sun Sep 19 16:51:22 2010	(r49159)
+++ branches/typesafe_consttable/src/packout.c	Sun Sep 19 20:41:59 2010	(r49160)
@@ -191,7 +191,9 @@
 
     for (i = 0; i < self->pmc.const_count; i++) {
         PMC *c = self->pmc.constants[i];
+        size += 1;
         if (c->vtable->base_type == enum_class_Key) {
+            size += 1;
             while (c) {
                 size += 2;
                 GETATTR_Key_next_key(interp, c, c);


More information about the parrot-commits mailing list