[svn:parrot] r49010 - trunk/src/pmc

luben at svn.parrot.org luben at svn.parrot.org
Wed Sep 15 01:59:07 UTC 2010


Author: luben
Date: Wed Sep 15 01:59:06 2010
New Revision: 49010
URL: https://trac.parrot.org/parrot/changeset/49010

Log:
Do not create empty hashes in get_X_keyed_str vtables

Modified:
   trunk/src/pmc/callcontext.pmc

Modified: trunk/src/pmc/callcontext.pmc
==============================================================================
--- trunk/src/pmc/callcontext.pmc	Wed Sep 15 01:08:50 2010	(r49009)
+++ trunk/src/pmc/callcontext.pmc	Wed Sep 15 01:59:06 2010	(r49010)
@@ -1344,7 +1344,8 @@
     }
 
     VTABLE INTVAL get_integer_keyed_str(STRING *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_string(INTERP, hash, key);
@@ -1358,7 +1359,8 @@
     }
 
     VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_string(INTERP, hash, key);
@@ -1373,7 +1375,8 @@
 
 
     VTABLE STRING * get_string_keyed_str(STRING *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_string(INTERP, hash, key);
@@ -1387,7 +1390,8 @@
     }
 
     VTABLE PMC * get_pmc_keyed_str(STRING *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_string(INTERP, hash, key);
@@ -1405,7 +1409,8 @@
     }
 
     VTABLE INTVAL get_integer_keyed(PMC *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_pmc(INTERP, hash, key);
@@ -1419,7 +1424,8 @@
     }
 
     VTABLE FLOATVAL get_number_keyed(PMC *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_pmc(INTERP, hash, key);
@@ -1433,7 +1439,8 @@
     }
 
     VTABLE STRING * get_string_keyed(PMC *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_pmc(INTERP, hash, key);
@@ -1447,7 +1454,8 @@
     }
 
     VTABLE PMC * get_pmc_keyed(PMC *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void     * const k    = hash_key_from_pmc(INTERP, hash, key);
@@ -1465,7 +1473,8 @@
     }
 
     VTABLE INTVAL exists_keyed(PMC *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void * const k = hash_key_from_pmc(INTERP, hash, key);
@@ -1476,7 +1485,8 @@
     }
 
     VTABLE INTVAL exists_keyed_str(STRING *key) {
-        Hash * const hash = get_hash(INTERP, SELF);
+        Hash *hash;
+        GETATTR_CallContext_hash(INTERP, SELF, hash);
 
         if (hash) {
             void * const k = hash_key_from_string(INTERP, hash, key);
@@ -1512,6 +1522,7 @@
         PMC * const  dest = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
         INTVAL       num;
         Pcc_cell    *our_cells, *dest_cells;
+        Hash        *hash;
 
         GET_ATTR_num_positionals(INTERP, SELF, num);
         /* Copy positionals */
@@ -1526,6 +1537,8 @@
         GET_ATTR_arg_flags(INTERP, SELF, arg_flags);
         GET_ATTR_return_flags(INTERP, SELF, return_flags);
 
+        GET_ATTR_hash(INTERP, SELF, hash);
+
         if (!PMC_IS_NULL(type_tuple))
             SET_ATTR_type_tuple(INTERP, dest, VTABLE_clone(INTERP, type_tuple));
 
@@ -1538,8 +1551,8 @@
         if (!PMC_IS_NULL(return_flags))
             SET_ATTR_return_flags(INTERP, dest, VTABLE_clone(INTERP, return_flags));
 
-        parrot_hash_clone(INTERP, get_hash(INTERP, SELF),
-            get_hash(INTERP, dest));
+        if (hash)
+        parrot_hash_clone(INTERP, hash, get_hash(INTERP, dest));
 
         return dest;
     }


More information about the parrot-commits mailing list