[svn:parrot] r47814 - trunk/src

chromatic at svn.parrot.org chromatic at svn.parrot.org
Fri Jun 25 03:12:52 UTC 2010


Author: chromatic
Date: Fri Jun 25 03:12:52 2010
New Revision: 47814
URL: https://trac.parrot.org/parrot/changeset/47814

Log:
[hash] Hoisted constants in hash_thaw().
A good optimizing compiler should be able to optimize much more here now.

Modified:
   trunk/src/hash.c

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Thu Jun 24 22:34:19 2010	(r47813)
+++ trunk/src/hash.c	Fri Jun 25 03:12:52 2010	(r47814)
@@ -592,15 +592,17 @@
     ASSERT_ARGS(hash_thaw)
 
     /* during thaw, info->extra is the key/value count */
-    const size_t     num_entries = (size_t) hash->entries;
-    size_t           entry_index;
+    const size_t           num_entries = (size_t) hash->entries;
+    const Hash_key_type    key_type    = hash->key_type;
+    const PARROT_DATA_TYPE entry_type  = hash->entry_type;
+    size_t                 entry_index;
 
     hash->entries = 0;
 
     for (entry_index = 0; entry_index < num_entries; ++entry_index) {
         HashBucket *b;
 
-        switch (hash->key_type) {
+        switch (key_type) {
           case Hash_key_type_int:
             {
                 const INTVAL i_key = VTABLE_shift_integer(interp, info);
@@ -625,7 +627,7 @@
             break;
         }
 
-        switch (hash->entry_type) {
+        switch (entry_type) {
           case enum_hash_int:
             {
                 const INTVAL i = VTABLE_shift_integer(interp, info);


More information about the parrot-commits mailing list