[svn:parrot] r48632 - in trunk: include/parrot src src/pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Tue Aug 24 16:33:45 UTC 2010
Author: plobsing
Date: Tue Aug 24 16:33:45 2010
New Revision: 48632
URL: https://trac.parrot.org/parrot/changeset/48632
Log:
remove unneeded visit vtable from Hash
Modified:
trunk/include/parrot/hash.h
trunk/src/hash.c
trunk/src/pmc/hash.pmc
Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h Tue Aug 24 16:22:28 2010 (r48631)
+++ trunk/include/parrot/hash.h Tue Aug 24 16:33:45 2010 (r48632)
@@ -207,16 +207,6 @@
__attribute__nonnull__(2);
PARROT_EXPORT
-void parrot_hash_visit(PARROT_INTERP,
- ARGMOD(Hash *hash),
- ARGMOD(void *pinfo))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*hash)
- FUNC_MODIFIES(*pinfo);
-
-PARROT_EXPORT
void parrot_mark_hash(PARROT_INTERP, ARGMOD(Hash *hash))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -412,6 +402,21 @@
__attribute__nonnull__(3)
FUNC_MODIFIES(*dest);
+void Parrot_hash_freeze(PARROT_INTERP,
+ ARGIN(const Hash *hash),
+ ARGMOD(PMC *info))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*info);
+
+void Parrot_hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*hash)
+ FUNC_MODIFIES(*info);
+
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
int PMC_compare(PARROT_INTERP, ARGIN(PMC *a), ARGIN(PMC *b))
@@ -462,10 +467,6 @@
, PARROT_ASSERT_ARG(hash))
#define ASSERT_ARGS_parrot_hash_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(hash))
-#define ASSERT_ARGS_parrot_hash_visit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(hash) \
- , PARROT_ASSERT_ARG(pinfo))
#define ASSERT_ARGS_parrot_mark_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(hash))
@@ -552,6 +553,14 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(hash) \
, PARROT_ASSERT_ARG(dest))
+#define ASSERT_ARGS_Parrot_hash_freeze __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(hash) \
+ , PARROT_ASSERT_ARG(info))
+#define ASSERT_ARGS_Parrot_hash_thaw __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(hash) \
+ , PARROT_ASSERT_ARG(info))
#define ASSERT_ARGS_PMC_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(a) \
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c Tue Aug 24 16:22:28 2010 (r48631)
+++ trunk/src/hash.c Tue Aug 24 16:33:45 2010 (r48632)
@@ -49,21 +49,6 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*hash);
-static void hash_freeze(PARROT_INTERP,
- ARGIN(const Hash *hash),
- ARGMOD(PMC *info))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*info);
-
-static void hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*hash)
- FUNC_MODIFIES(*info);
-
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
static size_t key_hash_cstring(SHIM_INTERP,
@@ -102,14 +87,6 @@
#define ASSERT_ARGS_expand_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(hash))
-#define ASSERT_ARGS_hash_freeze __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(hash) \
- , PARROT_ASSERT_ARG(info))
-#define ASSERT_ARGS_hash_thaw __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(hash) \
- , PARROT_ASSERT_ARG(info))
#define ASSERT_ARGS_key_hash_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(value))
#define ASSERT_ARGS_key_hash_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -514,7 +491,7 @@
/*
-=item C<static void hash_thaw(PARROT_INTERP, Hash *hash, PMC *info)>
+=item C<void Parrot_hash_thaw(PARROT_INTERP, Hash *hash, PMC *info)>
Visits the contents of a hash during freeze/thaw.
@@ -524,12 +501,11 @@
*/
-static void
-hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
+void
+Parrot_hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
{
- ASSERT_ARGS(hash_thaw)
+ ASSERT_ARGS(Parrot_hash_thaw)
- /* during thaw, info->extra is the key/value count */
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;
@@ -607,23 +583,21 @@
/*
-=item C<static void hash_freeze(PARROT_INTERP, const Hash *hash, PMC *info)>
+=item C<void Parrot_hash_freeze(PARROT_INTERP, const Hash *hash, PMC *info)>
Freezes hash into a string.
Takes an interpreter, a pointer to the hash, and a pointer to the structure
containing the string start location.
-Use by parrot_hash_visit.
-
=cut
*/
-static void
-hash_freeze(PARROT_INTERP, ARGIN(const Hash *hash), ARGMOD(PMC *info))
+void
+Parrot_hash_freeze(PARROT_INTERP, ARGIN(const Hash *hash), ARGMOD(PMC *info))
{
- ASSERT_ARGS(hash_freeze)
+ ASSERT_ARGS(Parrot_hash_freeze)
const Hash_key_type key_type = hash->key_type;
const PARROT_DATA_TYPE entry_type = hash->entry_type;
const size_t entries = hash->entries;
@@ -665,39 +639,6 @@
/*
-=item C<void parrot_hash_visit(PARROT_INTERP, Hash *hash, void *pinfo)>
-
-Freezes or thaws a hash as specified. Takes an interpreter, a pointer to the
-hash, and a pointer to the structure identifying what to do and the location of
-the string.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-parrot_hash_visit(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(void *pinfo))
-{
- ASSERT_ARGS(parrot_hash_visit)
- PMC* const info = (PMC*) pinfo;
-
- switch (VTABLE_get_integer(interp, info)) {
- case VISIT_THAW_NORMAL:
- hash_thaw(interp, hash, info);
- break;
- case VISIT_FREEZE_NORMAL:
- hash_freeze(interp, hash, info);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "unimplemented visit mode");
- }
-}
-
-
-/*
-
=item C<static void expand_hash(PARROT_INTERP, Hash *hash)>
Expands a hash when necessary.
Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc Tue Aug 24 16:22:28 2010 (r48631)
+++ trunk/src/pmc/hash.pmc Tue Aug 24 16:33:45 2010 (r48632)
@@ -1154,21 +1154,6 @@
/*
-=item C<void visit(PMC *info)>
-
-Used during archiving to visit the elements in the hash.
-
-=cut
-
-*/
-
- VTABLE void visit(PMC *info) {
- parrot_hash_visit(INTERP, (Hash *)SELF.get_pointer(), info);
- SUPER(info);
- }
-
-/*
-
=item C<void freeze(PMC *info)>
Used to archive the hash.
@@ -1184,6 +1169,8 @@
VTABLE_push_integer(INTERP, info, VTABLE_elements(INTERP, SELF));
VTABLE_push_integer(INTERP, info, (INTVAL)hash->key_type);
VTABLE_push_integer(INTERP, info, hash->entry_type);
+
+ Parrot_hash_freeze(INTERP, hash, info);
}
/*
@@ -1238,6 +1225,8 @@
PARROT_ASSERT(hash->entry_type == v_type);
hash->entries = elems;
+
+ Parrot_hash_thaw(INTERP, hash, info);
}
}
}
More information about the parrot-commits
mailing list