diff --git a/compilers/imcc/imcc.l b/compilers/imcc/imcc.l index 40fd80ff97..ca19ce8522 100644 --- a/compilers/imcc/imcc.l +++ b/compilers/imcc/imcc.l @@ -1070,8 +1070,8 @@ define_macro(PARROT_INTERP, ARGIN(const char *name), ARGIN(const params_t *param m = mem_gc_allocate_zeroed_typed(interp, macro_t); if (!IMCC_INFO(interp)->macros) - IMCC_INFO(interp)->macros = parrot_new_cstring_hash(interp); - parrot_hash_put(interp, IMCC_INFO(interp)->macros, + IMCC_INFO(interp)->macros = Parrot_hsh_new_cstring_hash(interp); + Parrot_hsh_put(interp, IMCC_INFO(interp)->macros, PARROT_const_cast(char *, name), m); } @@ -1090,7 +1090,7 @@ find_macro(PARROT_INTERP, const char *name) if (!IMCC_INFO(interp)->macros) return NULL; - return (macro_t *)parrot_hash_get(interp, IMCC_INFO(interp)->macros, name); + return (macro_t *)Parrot_hsh_get(interp, IMCC_INFO(interp)->macros, name); } static int diff --git a/compilers/imcc/imclexer.c b/compilers/imcc/imclexer.c index e96162fde9..41e862287c 100644 --- a/compilers/imcc/imclexer.c +++ b/compilers/imcc/imclexer.c @@ -5490,8 +5490,8 @@ define_macro(PARROT_INTERP, ARGIN(const char *name), ARGIN(const params_t *param m = mem_gc_allocate_zeroed_typed(interp, macro_t); if (!IMCC_INFO(interp)->macros) - IMCC_INFO(interp)->macros = parrot_new_cstring_hash(interp); - parrot_hash_put(interp, IMCC_INFO(interp)->macros, + IMCC_INFO(interp)->macros = Parrot_hsh_new_cstring_hash(interp); + Parrot_hsh_put(interp, IMCC_INFO(interp)->macros, PARROT_const_cast(char *, name), m); } @@ -5510,7 +5510,7 @@ find_macro(PARROT_INTERP, const char *name) if (!IMCC_INFO(interp)->macros) return NULL; - return (macro_t *)parrot_hash_get(interp, IMCC_INFO(interp)->macros, name); + return (macro_t *)Parrot_hsh_get(interp, IMCC_INFO(interp)->macros, name); } static int diff --git a/compilers/imcc/optimizer.c b/compilers/imcc/optimizer.c index c61d38c028..9838890620 100644 --- a/compilers/imcc/optimizer.c +++ b/compilers/imcc/optimizer.c @@ -803,7 +803,7 @@ eval_ins(PARROT_INTERP, ARGIN(const char *op), size_t ops, ARGIN(SymReg **r)) ASSERT_ARGS(eval_ins) opcode_t eval[4], *pc; int i; - op_info_t *op_info = (op_info_t *)parrot_hash_get(interp, interp->op_hash, (void *)op); + op_info_t *op_info = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, (void *)op); if (!op_info || !STREQ(op_info->full_name, op)) IMCC_fatal(interp, 1, "eval_ins: op '%s' not found\n", op); /* now fill registers */ diff --git a/compilers/imcc/parser_util.c b/compilers/imcc/parser_util.c index cff0766a6e..7ba87ef092 100644 --- a/compilers/imcc/parser_util.c +++ b/compilers/imcc/parser_util.c @@ -210,7 +210,7 @@ check_op(PARROT_INTERP, ARGOUT(op_info_t **op_info), ARGOUT(char *fullname), { ASSERT_ARGS(check_op) op_fullname(fullname, name, r, narg, keyvec); - *op_info = (op_info_t *)parrot_hash_get(interp, interp->op_hash, fullname); + *op_info = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, fullname); if (*op_info && !STREQ((*op_info)->full_name, fullname)) *op_info = NULL; } @@ -230,7 +230,7 @@ int is_op(PARROT_INTERP, ARGIN(const char *name)) { ASSERT_ARGS(is_op) - return parrot_hash_exists(interp, interp->op_hash, (void *)name); + return Parrot_hsh_exists(interp, interp->op_hash, (void *)name); } /* @@ -272,7 +272,7 @@ var_arg_ins(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), } op_fullname(fullname, name, r, 1, 0); - op = (op_info_t *)parrot_hash_get(interp, interp->op_hash, fullname); + op = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, fullname); PARROT_ASSERT(op && STREQ(op->full_name, fullname)); @@ -336,13 +336,13 @@ INS(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), char fullname[64] = "", format[128] = ""; op_fullname(fullname, name, r, n, keyvec); - op = (op_info_t *)parrot_hash_get(interp, interp->op_hash, fullname); + op = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, fullname); if (op && !STREQ(op->full_name, fullname)) op = NULL; /* maybe we have a fullname */ if (!op) { - op = (op_info_t *)parrot_hash_get(interp, interp->op_hash, name); + op = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, name); if (op && !STREQ(op->full_name, name)) op = NULL; } @@ -353,7 +353,7 @@ INS(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), if (n_name) { name = n_name; op_fullname(fullname, name, r, n, keyvec); - op = (op_info_t *)parrot_hash_get(interp, interp->op_hash, fullname); + op = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, fullname); if (op && !STREQ(op->full_name, fullname)) op = NULL; } @@ -1047,7 +1047,7 @@ try_find_op(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), if (changed) { op_info_t *op; op_fullname(fullname, name, r, n, keyvec); - op = (op_info_t *)parrot_hash_get(interp, interp->op_hash, fullname); + op = (op_info_t *)Parrot_hsh_get(interp, interp->op_hash, fullname); if (op && !STREQ(op->full_name, fullname)) op = NULL; return op; @@ -1151,7 +1151,7 @@ imcc_init(PARROT_INTERP) =item C -A callback for parrot_chash_destroy_values() to free all macro-allocated memory. +A callback for Parrot_hsh_chash_destroy_values() to free all macro-allocated memory. =cut @@ -1194,7 +1194,7 @@ imcc_destroy(PARROT_INTERP) Hash * const macros = IMCC_INFO(interp)->macros; if (macros) - parrot_chash_destroy_values(interp, macros, imcc_destroy_macro_values); + Parrot_hsh_chash_destroy_values(interp, macros, imcc_destroy_macro_values); if (IMCC_INFO(interp)->globals) mem_sys_free(IMCC_INFO(interp)->globals); diff --git a/compilers/imcc/pbc.c b/compilers/imcc/pbc.c index 5f7279f8ac..e340d00b67 100644 --- a/compilers/imcc/pbc.c +++ b/compilers/imcc/pbc.c @@ -1089,13 +1089,13 @@ add_const_str(PARROT_INTERP, ARGIN(STRING *s)) /* initialize rlookup cache */ if (!ct->string_hash) - ct->string_hash = parrot_create_hash(interp, + ct->string_hash = Parrot_hsh_create_hash(interp, enum_type_INTVAL, Hash_key_type_STRING_enc); ct->str.constants[ct->str.const_count] = s; - parrot_hash_put(interp, ct->string_hash, s, + Parrot_hsh_put(interp, ct->string_hash, s, (void *)ct->str.const_count); return ct->str.const_count++; diff --git a/docs/dev/c_functions.pod b/docs/dev/c_functions.pod index 666c15fcee..4fee527cd6 100644 --- a/docs/dev/c_functions.pod +++ b/docs/dev/c_functions.pod @@ -212,7 +212,7 @@ without wanting to know its value. PARROT_EXPORT PARROT_PURE_FUNCTION INTVAL - parrot_hash_size(SHIM_INTERP, NOTNULL(const Hash *hash)) + Parrot_hsh_size(SHIM_INTERP, NOTNULL(const Hash *hash)) { return hash->entries; } diff --git a/include/parrot/hash.h b/include/parrot/hash.h index c336eeba52..25091af5fb 100644 --- a/include/parrot/hash.h +++ b/include/parrot/hash.h @@ -124,10 +124,10 @@ enum ORDERED_HASH_ITEM_PART { /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ PARROT_EXPORT -void parrot_dump_hash(SHIM_INTERP, SHIM(const Hash *hash)); +void Parrot_hsh_dump_hash(SHIM_INTERP, SHIM(const Hash *hash)); PARROT_EXPORT -void parrot_hash_clone(PARROT_INTERP, +void Parrot_hsh_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest)) __attribute__nonnull__(1) @@ -136,20 +136,20 @@ void parrot_hash_clone(PARROT_INTERP, FUNC_MODIFIES(*dest); PARROT_EXPORT -void parrot_hash_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) +void Parrot_hsh_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) __attribute__nonnull__(1) __attribute__nonnull__(2) __attribute__nonnull__(3) FUNC_MODIFIES(*hash); PARROT_EXPORT -void parrot_hash_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash)) +void Parrot_hsh_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_EXPORT PARROT_WARN_UNUSED_RESULT -INTVAL parrot_hash_exists(PARROT_INTERP, +INTVAL Parrot_hsh_exists(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(void *key)) __attribute__nonnull__(1) @@ -159,7 +159,7 @@ INTVAL parrot_hash_exists(PARROT_INTERP, PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL -void * parrot_hash_get(PARROT_INTERP, +void * Parrot_hsh_get(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(const void *key)) __attribute__nonnull__(1) @@ -169,7 +169,7 @@ void * parrot_hash_get(PARROT_INTERP, PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL -HashBucket * parrot_hash_get_bucket(PARROT_INTERP, +HashBucket * Parrot_hsh_get_bucket(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(const void *key)) __attribute__nonnull__(1) @@ -178,7 +178,7 @@ HashBucket * parrot_hash_get_bucket(PARROT_INTERP, PARROT_EXPORT PARROT_IGNORABLE_RESULT PARROT_CANNOT_RETURN_NULL -HashBucket* parrot_hash_put(PARROT_INTERP, +HashBucket* Parrot_hsh_put(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN_NULLOK(void *key), ARGIN_NULLOK(void *value)) @@ -189,43 +189,43 @@ HashBucket* parrot_hash_put(PARROT_INTERP, PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_PURE_FUNCTION -INTVAL parrot_hash_size(SHIM_INTERP, ARGIN(const Hash *hash)) +INTVAL Parrot_hsh_size(SHIM_INTERP, ARGIN(const Hash *hash)) __attribute__nonnull__(2); PARROT_EXPORT -void parrot_mark_hash(PARROT_INTERP, ARGMOD(Hash *hash)) +void Parrot_hsh_mark_hash(PARROT_INTERP, ARGMOD(Hash *hash)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*hash); PARROT_EXPORT PARROT_CANNOT_RETURN_NULL -Hash* parrot_new_cstring_hash(PARROT_INTERP) +Hash* Parrot_hsh_new_cstring_hash(PARROT_INTERP) __attribute__nonnull__(1); PARROT_EXPORT PARROT_CANNOT_RETURN_NULL -Hash* parrot_new_hash(PARROT_INTERP) +Hash* Parrot_hsh_new_hash(PARROT_INTERP) __attribute__nonnull__(1); PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL -Hash* parrot_new_intval_hash(PARROT_INTERP) +Hash* Parrot_hsh_new_intval_hash(PARROT_INTERP) __attribute__nonnull__(1); PARROT_EXPORT PARROT_CANNOT_RETURN_NULL -Hash * parrot_new_pointer_hash(PARROT_INTERP) +Hash * Parrot_hsh_new_pointer_hash(PARROT_INTERP) __attribute__nonnull__(1); PARROT_CAN_RETURN_NULL -void* hash_key_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL key) +void* Parrot_hsh_key_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL key) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CAN_RETURN_NULL -void* hash_key_from_pmc(PARROT_INTERP, +void* Parrot_hsh_key_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(PMC *key)) __attribute__nonnull__(1) @@ -233,21 +233,21 @@ void* hash_key_from_pmc(PARROT_INTERP, __attribute__nonnull__(3); PARROT_CAN_RETURN_NULL -void* hash_key_from_string(PARROT_INTERP, +void* Parrot_hsh_key_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(STRING *key)) __attribute__nonnull__(1) __attribute__nonnull__(2) __attribute__nonnull__(3); -INTVAL hash_key_to_int(PARROT_INTERP, +INTVAL Parrot_hsh_key_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CANNOT_RETURN_NULL -PMC* hash_key_to_pmc(PARROT_INTERP, +PMC* Parrot_hsh_key_to_pmc(PARROT_INTERP, ARGIN(const Hash * const hash), ARGIN(void *key)) __attribute__nonnull__(1) @@ -255,72 +255,72 @@ PMC* hash_key_to_pmc(PARROT_INTERP, __attribute__nonnull__(3); PARROT_CANNOT_RETURN_NULL -STRING* hash_key_to_string(PARROT_INTERP, +STRING* Parrot_hsh_key_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CAN_RETURN_NULL -void* hash_value_from_int(PARROT_INTERP, +void* Parrot_hsh_value_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL value) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CAN_RETURN_NULL -void* hash_value_from_number(PARROT_INTERP, +void* Parrot_hsh_value_from_number(PARROT_INTERP, ARGIN(const Hash *hash), FLOATVAL value) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CAN_RETURN_NULL -void* hash_value_from_pmc(PARROT_INTERP, +void* Parrot_hsh_value_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(PMC *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CAN_RETURN_NULL -void* hash_value_from_string(PARROT_INTERP, +void* Parrot_hsh_value_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(STRING *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); -INTVAL hash_value_to_int(PARROT_INTERP, +INTVAL Parrot_hsh_value_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); -FLOATVAL hash_value_to_number(PARROT_INTERP, +FLOATVAL Parrot_hsh_value_to_number(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CANNOT_RETURN_NULL -PMC* hash_value_to_pmc(PARROT_INTERP, +PMC* Parrot_hsh_value_to_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); PARROT_CANNOT_RETURN_NULL -STRING* hash_value_to_string(PARROT_INTERP, +STRING* Parrot_hsh_value_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) __attribute__nonnull__(1) __attribute__nonnull__(2); -void parrot_chash_destroy(PARROT_INTERP, ARGMOD(Hash *hash)) +void Parrot_hsh_chash_destroy(PARROT_INTERP, ARGMOD(Hash *hash)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*hash); -void parrot_chash_destroy_values(PARROT_INTERP, +void Parrot_hsh_chash_destroy_values(PARROT_INTERP, ARGMOD(Hash *hash), NOTNULL(value_free func)) __attribute__nonnull__(1) @@ -330,20 +330,20 @@ void parrot_chash_destroy_values(PARROT_INTERP, PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT -Hash * parrot_create_hash(PARROT_INTERP, +Hash * Parrot_hsh_create_hash(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type) __attribute__nonnull__(1); PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT -Hash * parrot_create_hash_sized(PARROT_INTERP, +Hash * Parrot_hsh_create_hash_sized(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type, UINTVAL size) __attribute__nonnull__(1); -void parrot_hash_clone_prunable(PARROT_INTERP, +void Parrot_hsh_clone_prunable(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest), int deep) @@ -352,7 +352,7 @@ void parrot_hash_clone_prunable(PARROT_INTERP, __attribute__nonnull__(3) FUNC_MODIFIES(*dest); -void Parrot_hash_freeze(PARROT_INTERP, +void Parrot_hsh_freeze(PARROT_INTERP, ARGIN(const Hash *hash), ARGMOD(PMC *info)) __attribute__nonnull__(1) @@ -362,115 +362,115 @@ void Parrot_hash_freeze(PARROT_INTERP, PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT -Hash * Parrot_hash_thaw(PARROT_INTERP, ARGMOD(PMC *info)) +Hash * Parrot_hsh_thaw(PARROT_INTERP, ARGMOD(PMC *info)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*info); -#define ASSERT_ARGS_parrot_dump_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) -#define ASSERT_ARGS_parrot_hash_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_dump_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) +#define ASSERT_ARGS_Parrot_hsh_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(dest)) -#define ASSERT_ARGS_parrot_hash_delete __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_delete __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_parrot_hash_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_hash_exists __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_exists __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_parrot_hash_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_parrot_hash_get_bucket __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_get_bucket __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_hash_put __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_put __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_hash_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_mark_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_mark_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_new_cstring_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_new_cstring_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_parrot_new_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_new_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_parrot_new_intval_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_new_intval_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_parrot_new_pointer_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_new_pointer_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_hash_key_from_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_from_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_key_from_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_from_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_hash_key_from_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_from_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_hash_key_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_key_to_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_to_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(key)) -#define ASSERT_ARGS_hash_key_to_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_key_to_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_from_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_from_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_from_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_from_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_from_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_from_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_from_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_from_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_to_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_to_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_to_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_to_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_hash_value_to_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_value_to_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_chash_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_chash_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) -#define ASSERT_ARGS_parrot_chash_destroy_values __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_chash_destroy_values __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(func)) -#define ASSERT_ARGS_parrot_create_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_create_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_parrot_create_hash_sized __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_create_hash_sized __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) -#define ASSERT_ARGS_parrot_hash_clone_prunable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_clone_prunable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash) \ , PARROT_ASSERT_ARG(dest)) -#define ASSERT_ARGS_Parrot_hash_freeze __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ +#define ASSERT_ARGS_Parrot_hsh_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 = (\ +#define ASSERT_ARGS_Parrot_hsh_thaw __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(info)) /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ diff --git a/lib/Parrot/Pmc2c/PMCEmitter.pm b/lib/Parrot/Pmc2c/PMCEmitter.pm index 8d48d5e8de..3758fe5a6a 100644 --- a/lib/Parrot/Pmc2c/PMCEmitter.pm +++ b/lib/Parrot/Pmc2c/PMCEmitter.pm @@ -879,12 +879,12 @@ EOC else { $cout .= <<"EOC"; if (isa == NULL) { - isa = parrot_new_hash(interp); + isa = Parrot_hsh_new_hash(interp); } EOC } $cout .= <<"EOC"; - parrot_hash_put(interp, isa, (void *)(CONST_STRING_GEN(interp, "$classname")), PMCNULL); + Parrot_hsh_put(interp, isa, (void *)(CONST_STRING_GEN(interp, "$classname")), PMCNULL); return isa; } diff --git a/src/call/args.c b/src/call/args.c index e4bd37704b..dfb3037102 100644 --- a/src/call/args.c +++ b/src/call/args.c @@ -492,7 +492,7 @@ dissect_aggregate_arg(PARROT_INTERP, ARGMOD(PMC *call_object), ARGIN(PMC *aggreg parrot_hash_iterate(hash, VTABLE_set_pmc_keyed_str(interp, call_object, (STRING *)_bucket->key, - hash_value_to_pmc(interp, hash, _bucket->value));) + Parrot_hsh_value_to_pmc(interp, hash, _bucket->value));) } else { Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, @@ -789,7 +789,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), /* We've used up all the parameters, but have extra positional * args left over. */ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "too many positional arguments: %d passed, %d expected", @@ -816,7 +816,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), num_positionals = 0; if (named_count > 0){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "named parameters must follow all positional parameters"); @@ -844,7 +844,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), STRING *param_name; if (!(param_flags & PARROT_ARG_STRING)){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "named parameters must have a name specified"); @@ -862,14 +862,14 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), /* Mark the name as used, cannot be filled again. */ if (named_used_list==NULL) /* Only created if needed. */ - named_used_list = parrot_create_hash(interp, + named_used_list = Parrot_hsh_create_hash(interp, enum_type_INTVAL, Hash_key_type_STRING); - parrot_hash_put(interp, named_used_list, param_name, (void *)1); + Parrot_hsh_put(interp, named_used_list, param_name, (void *)1); } else if (named_count > 0){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "named parameters must follow all positional parameters"); @@ -897,7 +897,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), break; default: if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "invalid parameter type"); break; @@ -946,7 +946,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), if (err_check){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "too few positional arguments: " @@ -968,7 +968,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), /* All remaining parameters must be named. */ if (!(param_flags & PARROT_ARG_NAME)){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "named parameters must follow all positional parameters"); @@ -980,7 +980,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), GETATTR_CallContext_arg_flags(interp, call_object, arg_sig); if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); /* We've used up all the positional parameters, but have extra * positional args left over. */ @@ -1012,17 +1012,17 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), named_arg_list, named_arg_index); if ((named_used_list == NULL) - || !parrot_hash_exists(interp, named_used_list, name)) { + || !Parrot_hsh_exists(interp, named_used_list, name)) { VTABLE_set_pmc_keyed_str(interp, collect_named, name, VTABLE_get_pmc_keyed_str(interp, call_object, name)); /* Mark the name as used, cannot be filled again. */ if (named_used_list==NULL) /* Only created if needed. */ - named_used_list = parrot_create_hash(interp, + named_used_list = Parrot_hsh_create_hash(interp, enum_type_INTVAL, Hash_key_type_STRING); - parrot_hash_put(interp, named_used_list, name, (void *)1); + Parrot_hsh_put(interp, named_used_list, name, (void *)1); ++named_count; } @@ -1036,7 +1036,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), /* Store the name. */ if (!(param_flags & PARROT_ARG_STRING)){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "named parameters must have a name specified"); @@ -1057,10 +1057,10 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), /* Mark the name as used, cannot be filled again. */ if (named_used_list==NULL) /* Only created if needed. */ - named_used_list = parrot_create_hash(interp, + named_used_list = Parrot_hsh_create_hash(interp, enum_type_INTVAL, Hash_key_type_STRING); - parrot_hash_put(interp, named_used_list, param_name, (void *)1); + Parrot_hsh_put(interp, named_used_list, param_name, (void *)1); ++named_count; /* Fill the named parameter. */ @@ -1083,7 +1083,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), break; default: if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "invalid parameter type"); break; @@ -1122,7 +1122,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), else { if (err_check){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "too few named arguments: " @@ -1143,7 +1143,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), GETATTR_CallContext_hash(interp, call_object, h); if (!h || !h->entries){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); return; } @@ -1154,7 +1154,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), if (named_used_list==NULL){ if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); return; @@ -1181,9 +1181,9 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), STRING * const name = VTABLE_get_string_keyed_int(interp, named_arg_list, named_arg_index); - if (!parrot_hash_exists(interp, named_used_list, name)) { + if (!Parrot_hsh_exists(interp, named_used_list, name)) { if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "too many named arguments: '%S' not used", @@ -1194,7 +1194,7 @@ fill_params(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object), } } if (named_used_list != NULL) - parrot_hash_destroy(interp, named_used_list); + Parrot_hsh_destroy(interp, named_used_list); } diff --git a/src/dynpmc/dynlexpad.pmc b/src/dynpmc/dynlexpad.pmc index 65921e4c4e..746d2f1976 100644 --- a/src/dynpmc/dynlexpad.pmc +++ b/src/dynpmc/dynlexpad.pmc @@ -49,7 +49,7 @@ lexinfo. else attrs->init = NULL; - hash = parrot_new_hash(INTERP); + hash = Parrot_hsh_new_hash(INTERP); attrs->hash = hash; PObj_custom_mark_destroy_SETALL(SELF); } @@ -79,7 +79,7 @@ Returns the number of elements in the hash. */ VTABLE INTVAL elements() { - return parrot_hash_size(INTERP, PARROT_DYNLEXPAD(SELF)->hash); + return Parrot_hsh_size(INTERP, PARROT_DYNLEXPAD(SELF)->hash); } /* @@ -101,7 +101,7 @@ Returns whether a lexical C exists in the hash. VTABLE INTVAL exists_keyed_str(STRING* name) { PMC *std_pad; - if (parrot_hash_exists(INTERP, PARROT_DYNLEXPAD(SELF)->hash, name)) + if (Parrot_hsh_exists(INTERP, PARROT_DYNLEXPAD(SELF)->hash, name)) return 1; std_pad = PARROT_DYNLEXPAD(SELF)->init; if (std_pad) @@ -122,7 +122,7 @@ lexical doesn't exist. */ VTABLE PMC* get_pmc_keyed_str(STRING* name) { - HashBucket *b = parrot_hash_get_bucket(INTERP, + HashBucket *b = Parrot_hsh_get_bucket(INTERP, PARROT_DYNLEXPAD(SELF)->hash, name); if (!b) { @@ -178,7 +178,7 @@ doesn't exist, it is created. if (std_pad && VTABLE_exists_keyed_str(INTERP, std_pad, name)) VTABLE_set_pmc_keyed_str(INTERP, std_pad, name, value); - parrot_hash_put(INTERP, PARROT_DYNLEXPAD(SELF)->hash, name, value); + Parrot_hsh_put(INTERP, PARROT_DYNLEXPAD(SELF)->hash, name, value); } /* @@ -193,7 +193,7 @@ Destroy DynLexPad. VTABLE void destroy() { if (PARROT_DYNLEXPAD(SELF)->hash) { - parrot_hash_destroy(INTERP, PARROT_DYNLEXPAD(SELF)->hash); + Parrot_hsh_destroy(INTERP, PARROT_DYNLEXPAD(SELF)->hash); PARROT_DYNLEXPAD(SELF)->hash = NULL; } } @@ -211,7 +211,7 @@ Marks the lexpad hash as live. PMC *std_pad = PARROT_DYNLEXPAD(SELF)->init; Parrot_gc_mark_PMC_alive(INTERP, std_pad); if (PARROT_DYNLEXPAD(SELF)->hash) - parrot_mark_hash(INTERP, PARROT_DYNLEXPAD(SELF)->hash); + Parrot_hsh_mark_hash(INTERP, PARROT_DYNLEXPAD(SELF)->hash); } diff --git a/src/global_setup.c b/src/global_setup.c index 2717694917..d96634c71e 100644 --- a/src/global_setup.c +++ b/src/global_setup.c @@ -228,7 +228,7 @@ Parrot_gbl_setup_2(PARROT_INTERP) } else { op_lib_t *core_ops = PARROT_CORE_OPLIB_INIT(interp, 1); - interp->op_hash = parrot_create_hash_sized(interp, enum_type_ptr, + interp->op_hash = Parrot_hsh_create_hash_sized(interp, enum_type_ptr, Hash_key_type_cstring, core_ops->op_count); parrot_hash_oplib(interp, core_ops); } diff --git a/src/hash.c b/src/hash.c index 4a875add9b..735e702de2 100644 --- a/src/hash.c +++ b/src/hash.c @@ -351,7 +351,7 @@ Creates and returns a hash value from a string. Takes an interpreter, a pointer to a string, and a seed value. Returns the hash value. -Used by parrot_new_cstring_hash. +Used by Parrot_hsh_new_cstring_hash. =cut @@ -526,7 +526,7 @@ hash_compare(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *a), /* -=item C +=item C Prints out the hash in human-readable form, at least once someone implements this. @@ -537,15 +537,15 @@ this. PARROT_EXPORT void -parrot_dump_hash(SHIM_INTERP, SHIM(const Hash *hash)) +Parrot_hsh_dump_hash(SHIM_INTERP, SHIM(const Hash *hash)) { - ASSERT_ARGS(parrot_dump_hash) + ASSERT_ARGS(Parrot_hsh_dump_hash) } /* -=item C +=item C Marks the hash and its contents as live. Assumes that key and value are non-null in all buckets. @@ -556,9 +556,9 @@ non-null in all buckets. PARROT_EXPORT void -parrot_mark_hash(PARROT_INTERP, ARGMOD(Hash *hash)) +Parrot_hsh_mark_hash(PARROT_INTERP, ARGMOD(Hash *hash)) { - ASSERT_ARGS(parrot_mark_hash) + ASSERT_ARGS(Parrot_hsh_mark_hash) int mark_key = 0; int mark_value = 0; @@ -680,7 +680,7 @@ parrot_mark_hash_both(PARROT_INTERP, ARGIN(Hash *hash)) /* -=item C +=item C Visits the contents of a hash during freeze/thaw. @@ -693,15 +693,15 @@ C is the visit info, (see include/parrot/pmc_freeze.h>). PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT Hash * -Parrot_hash_thaw(PARROT_INTERP, ARGMOD(PMC *info)) +Parrot_hsh_thaw(PARROT_INTERP, ARGMOD(PMC *info)) { - ASSERT_ARGS(Parrot_hash_thaw) + ASSERT_ARGS(Parrot_hsh_thaw) const size_t num_entries = VTABLE_shift_integer(interp, info); const Hash_key_type key_type = (Hash_key_type)VTABLE_shift_integer(interp, info); const PARROT_DATA_TYPE entry_type = (PARROT_DATA_TYPE)VTABLE_shift_integer(interp, info); size_t entry_index; - Hash *hash = parrot_create_hash_sized(interp, entry_type, key_type, num_entries); + Hash *hash = Parrot_hsh_create_hash_sized(interp, entry_type, key_type, num_entries); /* special case for great speed */ if (key_type == Hash_key_type_STRING @@ -752,19 +752,19 @@ Parrot_hash_thaw(PARROT_INTERP, ARGMOD(PMC *info)) case enum_hash_int: { const INTVAL i = VTABLE_shift_integer(interp, info); - parrot_hash_put(interp, hash, key, (void *)i); + Parrot_hsh_put(interp, hash, key, (void *)i); break; } case enum_hash_string: { STRING * const s = VTABLE_shift_string(interp, info); - parrot_hash_put(interp, hash, key, (void *)s); + Parrot_hsh_put(interp, hash, key, (void *)s); break; } case enum_hash_pmc: { PMC * const p = VTABLE_shift_pmc(interp, info); - parrot_hash_put(interp, hash, key, (void *)p); + Parrot_hsh_put(interp, hash, key, (void *)p); break; } default: @@ -780,7 +780,7 @@ Parrot_hash_thaw(PARROT_INTERP, ARGMOD(PMC *info)) /* -=item C +=item C Freezes hash into a string. @@ -792,9 +792,9 @@ containing the string start location. */ void -Parrot_hash_freeze(PARROT_INTERP, ARGIN(const Hash *hash), ARGMOD(PMC *info)) +Parrot_hsh_freeze(PARROT_INTERP, ARGIN(const Hash *hash), ARGMOD(PMC *info)) { - ASSERT_ARGS(Parrot_hash_freeze) + ASSERT_ARGS(Parrot_hsh_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; @@ -897,11 +897,11 @@ free list, we know that it's time to resize the hashtable. Algorithm for expansion: We exactly double the size of the hashtable. Keys are assigned to buckets with the formula - bucket_index = hash(key) % parrot_hash_size + bucket_index = hash(key) % Parrot_hsh_size When doubling the size of the hashtable, we know that every key is either already in the correct bucket, or belongs in the current bucket plus -C (the old C). In fact, because the +C (the old C). In fact, because the hashtable is always a power of two in size, it depends only on the next bit in the hash value, after the ones previously used. @@ -1035,7 +1035,7 @@ expand_hash(PARROT_INTERP, ARGMOD(Hash *hash)) /* -=item C +=item C Creates a new Parrot STRING hash. @@ -1046,10 +1046,10 @@ Creates a new Parrot STRING hash. PARROT_EXPORT PARROT_CANNOT_RETURN_NULL Hash* -parrot_new_hash(PARROT_INTERP) +Parrot_hsh_new_hash(PARROT_INTERP) { - ASSERT_ARGS(parrot_new_hash) - return parrot_create_hash(interp, + ASSERT_ARGS(Parrot_hsh_new_hash) + return Parrot_hsh_create_hash(interp, enum_type_PMC, Hash_key_type_STRING); } @@ -1057,7 +1057,7 @@ parrot_new_hash(PARROT_INTERP) /* -=item C +=item C Creates a new C string hash in C. @@ -1068,10 +1068,10 @@ Creates a new C string hash in C. PARROT_EXPORT PARROT_CANNOT_RETURN_NULL Hash* -parrot_new_cstring_hash(PARROT_INTERP) +Parrot_hsh_new_cstring_hash(PARROT_INTERP) { - ASSERT_ARGS(parrot_new_cstring_hash) - return parrot_create_hash(interp, + ASSERT_ARGS(Parrot_hsh_new_cstring_hash) + return Parrot_hsh_create_hash(interp, enum_type_PMC, Hash_key_type_cstring); } @@ -1079,7 +1079,7 @@ parrot_new_cstring_hash(PARROT_INTERP) /* -=item C +=item C Create and return a new hash with void * keys and values. @@ -1090,10 +1090,10 @@ Create and return a new hash with void * keys and values. PARROT_EXPORT PARROT_CANNOT_RETURN_NULL Hash * -parrot_new_pointer_hash(PARROT_INTERP) +Parrot_hsh_new_pointer_hash(PARROT_INTERP) { - ASSERT_ARGS(parrot_new_pointer_hash) - return parrot_create_hash(interp, + ASSERT_ARGS(Parrot_hsh_new_pointer_hash) + return Parrot_hsh_create_hash(interp, enum_type_ptr, Hash_key_type_ptr); } @@ -1101,7 +1101,7 @@ parrot_new_pointer_hash(PARROT_INTERP) /* -=item C +=item C Creates and returns new Hash PMC with INTVAL keys and values. C can be C or 0. @@ -1115,17 +1115,17 @@ PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Hash* -parrot_new_intval_hash(PARROT_INTERP) +Parrot_hsh_new_intval_hash(PARROT_INTERP) { - ASSERT_ARGS(parrot_new_intval_hash) - return parrot_create_hash(interp, + ASSERT_ARGS(Parrot_hsh_new_intval_hash) + return Parrot_hsh_create_hash(interp, enum_type_INTVAL, Hash_key_type_int); } /* -=item C Creates and initializes a hash. Function pointers determine its behaviors. @@ -1139,9 +1139,9 @@ Memory from this function must be freed. PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT Hash * -parrot_create_hash(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type) +Parrot_hsh_create_hash(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type) { - ASSERT_ARGS(parrot_create_hash) + ASSERT_ARGS(Parrot_hsh_create_hash) Hash * const hash = (Hash*) Parrot_gc_allocate_fixed_size_storage(interp, sizeof (Hash)); hash->entry_type = val_type; @@ -1159,10 +1159,10 @@ parrot_create_hash(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_ /* -=item C -Creates and initializes a hash, similar to C. +Creates and initializes a hash, similar to C. Preallocates at least C buckets. @@ -1173,22 +1173,22 @@ Preallocates at least C buckets. PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT Hash * -parrot_create_hash_sized(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type, +Parrot_hsh_create_hash_sized(PARROT_INTERP, PARROT_DATA_TYPE val_type, Hash_key_type hkey_type, UINTVAL size) { - ASSERT_ARGS(parrot_create_hash_sized) + ASSERT_ARGS(Parrot_hsh_create_hash_sized) - Hash *hash = parrot_create_hash(interp, val_type, hkey_type); + Hash *hash = Parrot_hsh_create_hash(interp, val_type, hkey_type); allocate_buckets(interp, hash, size); return hash; } /* -=item C +=item C Frees the memory allocated to the specified hash and its bucket store. Used by -parrot_chash_destroy. +Parrot_hsh_chash_destroy. Unlike the C library function free(), the hash function must not be NULL. @@ -1198,9 +1198,9 @@ Unlike the C library function free(), the hash function must not be NULL. PARROT_EXPORT void -parrot_hash_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash)) +Parrot_hsh_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash)) { - ASSERT_ARGS(parrot_hash_destroy) + ASSERT_ARGS(Parrot_hsh_destroy) if (hash->buckets){ if (hash->mask > SPLIT_POINT) Parrot_gc_free_memory_chunk(interp, hash->buckets); @@ -1214,7 +1214,7 @@ parrot_hash_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash)) /* -=item C +=item C Deletes the specified hash by freeing the memory allocated to all the key-value pairs, and finally the hash itself. @@ -1224,19 +1224,19 @@ pairs, and finally the hash itself. */ void -parrot_chash_destroy(PARROT_INTERP, ARGMOD(Hash *hash)) +Parrot_hsh_chash_destroy(PARROT_INTERP, ARGMOD(Hash *hash)) { - ASSERT_ARGS(parrot_chash_destroy) + ASSERT_ARGS(Parrot_hsh_chash_destroy) parrot_hash_iterate(hash, mem_gc_free(interp, _bucket->key); mem_gc_free(interp, _bucket->value);); - parrot_hash_destroy(interp, hash); + Parrot_hsh_destroy(interp, hash); } /* -=item C Deletes the specified hash by freeing the memory allocated to all the key-value @@ -1250,22 +1250,22 @@ The callback returns C and takes a C. */ void -parrot_chash_destroy_values(PARROT_INTERP, ARGMOD(Hash *hash), NOTNULL(value_free func)) +Parrot_hsh_chash_destroy_values(PARROT_INTERP, ARGMOD(Hash *hash), NOTNULL(value_free func)) { - ASSERT_ARGS(parrot_chash_destroy_values) + ASSERT_ARGS(Parrot_hsh_chash_destroy_values) UINTVAL i; parrot_hash_iterate(hash, mem_gc_free(interp, _bucket->key); func(_bucket->value);); - parrot_hash_destroy(interp, hash); + Parrot_hsh_destroy(interp, hash); } /* -=item C +=item C Returns the number of used entries in the hash. @@ -1277,9 +1277,9 @@ PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_PURE_FUNCTION INTVAL -parrot_hash_size(SHIM_INTERP, ARGIN(const Hash *hash)) +Parrot_hsh_size(SHIM_INTERP, ARGIN(const Hash *hash)) { - ASSERT_ARGS(parrot_hash_size) + ASSERT_ARGS(Parrot_hsh_size) return hash->entries; } @@ -1287,7 +1287,7 @@ parrot_hash_size(SHIM_INTERP, ARGIN(const Hash *hash)) /* -=item C Returns the bucket for C, if found, and NULL otherwise. @@ -1300,9 +1300,9 @@ PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL HashBucket * -parrot_hash_get_bucket(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(const void *key)) +Parrot_hsh_get_bucket(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(const void *key)) { - ASSERT_ARGS(parrot_hash_get_bucket) + ASSERT_ARGS(Parrot_hsh_get_bucket) DECL_CONST_CAST; if (hash->entries <= 0) @@ -1333,7 +1333,7 @@ parrot_hash_get_bucket(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(cons /* -=item C Returns the value keyed by C, or C if no bucket is found. @@ -1346,17 +1346,17 @@ PARROT_EXPORT PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL void * -parrot_hash_get(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(const void *key)) +Parrot_hsh_get(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(const void *key)) { - ASSERT_ARGS(parrot_hash_get) - const HashBucket * const bucket = parrot_hash_get_bucket(interp, hash, key); + ASSERT_ARGS(Parrot_hsh_get) + const HashBucket * const bucket = Parrot_hsh_get_bucket(interp, hash, key); return bucket ? bucket->value : NULL; } /* -=item C +=item C Returns whether the key exists in the hash. @@ -1367,10 +1367,10 @@ Returns whether the key exists in the hash. PARROT_EXPORT PARROT_WARN_UNUSED_RESULT INTVAL -parrot_hash_exists(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(void *key)) +Parrot_hsh_exists(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(void *key)) { - ASSERT_ARGS(parrot_hash_exists) - const HashBucket * const bucket = parrot_hash_get_bucket(interp, hash, key); + ASSERT_ARGS(Parrot_hsh_exists) + const HashBucket * const bucket = Parrot_hsh_get_bucket(interp, hash, key); return bucket ? 1 : 0; } @@ -1464,7 +1464,7 @@ parrot_hash_store_value_in_bucket(PARROT_INTERP, ARGMOD(Hash *hash), /* -=item C Puts the key and value into the hash. Note that C is B copied. @@ -1477,10 +1477,10 @@ PARROT_EXPORT PARROT_IGNORABLE_RESULT PARROT_CANNOT_RETURN_NULL HashBucket* -parrot_hash_put(PARROT_INTERP, ARGMOD(Hash *hash), +Parrot_hsh_put(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN_NULLOK(void *key), ARGIN_NULLOK(void *value)) { - ASSERT_ARGS(parrot_hash_put) + ASSERT_ARGS(Parrot_hsh_put) HashBucket *bucket = NULL; size_t hashval; @@ -1515,7 +1515,7 @@ parrot_hash_put(PARROT_INTERP, ARGMOD(Hash *hash), /* -=item C +=item C Deletes the key from the hash. @@ -1525,9 +1525,9 @@ Deletes the key from the hash. PARROT_EXPORT void -parrot_hash_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) +Parrot_hsh_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) { - ASSERT_ARGS(parrot_hash_delete) + ASSERT_ARGS(Parrot_hsh_delete) const UINTVAL hashval = key_hash(interp, hash, key) & hash->mask; if (hash->buckets){ HashBucket **prev = &hash->index[hashval]; @@ -1550,7 +1550,7 @@ parrot_hash_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) /* -=item C +=item C Clones C to C. @@ -1560,15 +1560,15 @@ Clones C to C. PARROT_EXPORT void -parrot_hash_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest)) +Parrot_hsh_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest)) { - ASSERT_ARGS(parrot_hash_clone) - parrot_hash_clone_prunable(interp, hash, dest, 1); + ASSERT_ARGS(Parrot_hsh_clone) + Parrot_hsh_clone_prunable(interp, hash, dest, 1); } /* -=item C helper function to Clone C to C @@ -1580,10 +1580,10 @@ allows deep cloning of PMC types if deep set */ void -parrot_hash_clone_prunable(PARROT_INTERP, ARGIN(const Hash *hash), +Parrot_hsh_clone_prunable(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest), int deep) { - ASSERT_ARGS(parrot_hash_clone_prunable) + ASSERT_ARGS(Parrot_hsh_clone_prunable) /* dest hash has the same size as source hash */ if (dest->buckets){ @@ -1712,7 +1712,7 @@ TYPE hash_value_to_TYPE convert from values type. /* -=item C +=item C Cast INTVAL to hash key. @@ -1722,9 +1722,9 @@ Cast INTVAL to hash key. PARROT_CAN_RETURN_NULL void* -hash_key_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL key) +Parrot_hsh_key_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL key) { - ASSERT_ARGS(hash_key_from_int) + ASSERT_ARGS(Parrot_hsh_key_from_int) void *ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1748,7 +1748,7 @@ hash_key_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL key) /* -=item C Cast STRING to hash key. @@ -1759,9 +1759,9 @@ Cast STRING to hash key. PARROT_CAN_RETURN_NULL void* -hash_key_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(STRING *key)) +Parrot_hsh_key_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(STRING *key)) { - ASSERT_ARGS(hash_key_from_string) + ASSERT_ARGS(Parrot_hsh_key_from_string) void *ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1791,7 +1791,7 @@ hash_key_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(STRING *key)) /* -=item C +=item C Cast PMC* to hash key. @@ -1801,9 +1801,9 @@ Cast PMC* to hash key. PARROT_CAN_RETURN_NULL void* -hash_key_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(PMC *key)) +Parrot_hsh_key_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(PMC *key)) { - ASSERT_ARGS(hash_key_from_pmc) + ASSERT_ARGS(Parrot_hsh_key_from_pmc) void *ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1860,7 +1860,7 @@ hash_key_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(PMC *key)) /* -=item C +=item C Cast hash key to INTVAL. @@ -1869,9 +1869,9 @@ Cast hash key to INTVAL. */ INTVAL -hash_key_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) +Parrot_hsh_key_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) { - ASSERT_ARGS(hash_key_to_int) + ASSERT_ARGS(Parrot_hsh_key_to_int) INTVAL ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1894,7 +1894,7 @@ hash_key_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) /* -=item C +=item C Cast hash key to STRING. @@ -1904,9 +1904,9 @@ Cast hash key to STRING. PARROT_CANNOT_RETURN_NULL STRING* -hash_key_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) +Parrot_hsh_key_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *key)) { - ASSERT_ARGS(hash_key_to_string) + ASSERT_ARGS(Parrot_hsh_key_to_string) STRING *ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1932,7 +1932,7 @@ hash_key_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *ke /* -=item C +=item C Cast hash key to PMC*. @@ -1942,9 +1942,9 @@ Cast hash key to PMC*. PARROT_CANNOT_RETURN_NULL PMC* -hash_key_to_pmc(PARROT_INTERP, ARGIN(const Hash * const hash), ARGIN(void *key)) +Parrot_hsh_key_to_pmc(PARROT_INTERP, ARGIN(const Hash * const hash), ARGIN(void *key)) { - ASSERT_ARGS(hash_key_to_pmc) + ASSERT_ARGS(Parrot_hsh_key_to_pmc) PMC *ret; switch (hash->key_type) { case Hash_key_type_int: @@ -1970,7 +1970,7 @@ hash_key_to_pmc(PARROT_INTERP, ARGIN(const Hash * const hash), ARGIN(void *key)) /* -=item C Cast INTVAL to hash value. @@ -1981,9 +1981,9 @@ Cast INTVAL to hash value. PARROT_CAN_RETURN_NULL void* -hash_value_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL value) +Parrot_hsh_value_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL value) { - ASSERT_ARGS(hash_value_from_int) + ASSERT_ARGS(Parrot_hsh_value_from_int) void *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2007,7 +2007,7 @@ hash_value_from_int(PARROT_INTERP, ARGIN(const Hash *hash), INTVAL value) /* -=item C Cast STRING to hash value. @@ -2018,10 +2018,10 @@ Cast STRING to hash value. PARROT_CAN_RETURN_NULL void* -hash_value_from_string(PARROT_INTERP, ARGIN(const Hash *hash), +Parrot_hsh_value_from_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(STRING *value)) { - ASSERT_ARGS(hash_value_from_string) + ASSERT_ARGS(Parrot_hsh_value_from_string) void *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2050,7 +2050,7 @@ hash_value_from_string(PARROT_INTERP, ARGIN(const Hash *hash), /* -=item C +=item C Cast PMC to hash value. @@ -2060,10 +2060,10 @@ Cast PMC to hash value. PARROT_CAN_RETURN_NULL void* -hash_value_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), +Parrot_hsh_value_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(PMC *value)) { - ASSERT_ARGS(hash_value_from_pmc) + ASSERT_ARGS(Parrot_hsh_value_from_pmc) void *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2089,7 +2089,7 @@ hash_value_from_pmc(PARROT_INTERP, ARGIN(const Hash *hash), /* -=item C Cast FLOATVAL to hash value. @@ -2100,9 +2100,9 @@ Cast FLOATVAL to hash value. PARROT_CAN_RETURN_NULL void* -hash_value_from_number(PARROT_INTERP, ARGIN(const Hash *hash), FLOATVAL value) +Parrot_hsh_value_from_number(PARROT_INTERP, ARGIN(const Hash *hash), FLOATVAL value) { - ASSERT_ARGS(hash_value_from_number) + ASSERT_ARGS(Parrot_hsh_value_from_number) void *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2129,7 +2129,7 @@ hash_value_from_number(PARROT_INTERP, ARGIN(const Hash *hash), FLOATVAL value) /* -=item C +=item C Cast hash value to INTVAL. @@ -2138,9 +2138,9 @@ Cast hash value to INTVAL. */ INTVAL -hash_value_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) +Parrot_hsh_value_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) { - ASSERT_ARGS(hash_value_to_int) + ASSERT_ARGS(Parrot_hsh_value_to_int) INTVAL ret; switch (hash->entry_type) { case enum_type_ptr: @@ -2162,7 +2162,7 @@ hash_value_to_int(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *val /* -=item C Cast hash value to STRING. @@ -2173,9 +2173,9 @@ Cast hash value to STRING. PARROT_CANNOT_RETURN_NULL STRING* -hash_value_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) +Parrot_hsh_value_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) { - ASSERT_ARGS(hash_value_to_string) + ASSERT_ARGS(Parrot_hsh_value_to_string) STRING *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2196,7 +2196,7 @@ hash_value_to_string(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void * /* -=item C +=item C Cast hash value to PMC. @@ -2206,9 +2206,9 @@ Cast hash value to PMC. PARROT_CANNOT_RETURN_NULL PMC* -hash_value_to_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) +Parrot_hsh_value_to_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) { - ASSERT_ARGS(hash_value_to_pmc) + ASSERT_ARGS(Parrot_hsh_value_to_pmc) PMC *ret; switch (hash->entry_type) { case enum_type_INTVAL: @@ -2229,7 +2229,7 @@ hash_value_to_pmc(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *val /* -=item C Cast hash value to FLOATVAL. @@ -2239,9 +2239,9 @@ Cast hash value to FLOATVAL. */ FLOATVAL -hash_value_to_number(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) +Parrot_hsh_value_to_number(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN_NULLOK(void *value)) { - ASSERT_ARGS(hash_value_to_number) + ASSERT_ARGS(Parrot_hsh_value_to_number) FLOATVAL ret; switch (hash->entry_type) { case enum_type_INTVAL: diff --git a/src/hll.c b/src/hll.c index e7d90f75c5..4dccd7ca26 100644 --- a/src/hll.c +++ b/src/hll.c @@ -174,7 +174,7 @@ Parrot_hll_register_HLL(PARROT_INTERP, ARGIN(STRING *hll_name)) /* create HLL typemap hash */ type_hash = Parrot_pmc_new_constant(interp, enum_class_Hash); - VTABLE_set_pointer(interp, type_hash, parrot_new_intval_hash(interp)); + VTABLE_set_pointer(interp, type_hash, Parrot_hsh_new_intval_hash(interp)); VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_typemap, type_hash); return idx; diff --git a/src/interp/inter_create.c b/src/interp/inter_create.c index 61dacd1ecb..96cfe8f729 100644 --- a/src/interp/inter_create.c +++ b/src/interp/inter_create.c @@ -459,7 +459,7 @@ Parrot_really_destroy(PARROT_INTERP, SHIM(int exit_code), SHIM(void *arg)) /* get rid of ops */ if (interp->op_hash) - parrot_hash_destroy(interp, interp->op_hash); + Parrot_hsh_destroy(interp, interp->op_hash); /* free vtables */ Parrot_vtbl_free_vtables(interp); diff --git a/src/multidispatch.c b/src/multidispatch.c index 7360e3cd40..5ae9a054c9 100644 --- a/src/multidispatch.c +++ b/src/multidispatch.c @@ -1100,7 +1100,7 @@ Parrot_mmd_cache_create(PARROT_INTERP) { ASSERT_ARGS(Parrot_mmd_cache_create) /* String hash. */ - Hash *cache = parrot_new_hash(interp); + Hash *cache = Parrot_hsh_new_hash(interp); return cache; } @@ -1175,7 +1175,7 @@ Parrot_mmd_cache_lookup_by_values(PARROT_INTERP, ARGMOD(MMD_Cache *cache), STRING * const key = mmd_cache_key_from_values(interp, name, values); if (key) - return (PMC *)parrot_hash_get(interp, cache, key); + return (PMC *)Parrot_hsh_get(interp, cache, key); return PMCNULL; } @@ -1202,7 +1202,7 @@ Parrot_mmd_cache_store_by_values(PARROT_INTERP, ARGMOD(MMD_Cache *cache), STRING * const key = mmd_cache_key_from_values(interp, name, values); if (key) - parrot_hash_put(interp, cache, key, chosen); + Parrot_hsh_put(interp, cache, key, chosen); } @@ -1278,7 +1278,7 @@ Parrot_mmd_cache_lookup_by_types(PARROT_INTERP, ARGMOD(MMD_Cache *cache), const STRING * const key = mmd_cache_key_from_types(interp, name, types); if (key) - return (PMC *)parrot_hash_get(interp, cache, key); + return (PMC *)Parrot_hsh_get(interp, cache, key); return PMCNULL; } @@ -1306,7 +1306,7 @@ Parrot_mmd_cache_store_by_types(PARROT_INTERP, ARGMOD(MMD_Cache *cache), STRING * const key = mmd_cache_key_from_types(interp, name, types); if (key) - parrot_hash_put(interp, cache, key, chosen); + Parrot_hsh_put(interp, cache, key, chosen); } @@ -1328,7 +1328,7 @@ Parrot_mmd_cache_mark(PARROT_INTERP, ARGMOD(MMD_Cache *cache)) /* As a small future optimization, note that we only *really* need to mark * keys - the candidates will be referenced outside the cache, provided it's * invalidated properly. */ - parrot_mark_hash(interp, cache); + Parrot_hsh_mark_hash(interp, cache); } @@ -1347,7 +1347,7 @@ void Parrot_mmd_cache_destroy(PARROT_INTERP, ARGMOD(MMD_Cache *cache)) { ASSERT_ARGS(Parrot_mmd_cache_destroy) - parrot_hash_destroy(interp, cache); + Parrot_hsh_destroy(interp, cache); } diff --git a/src/packfile.c b/src/packfile.c index d2186af325..3b8a2438ce 100644 --- a/src/packfile.c +++ b/src/packfile.c @@ -3348,11 +3348,11 @@ find_constants(PARROT_INTERP, ARGIN(PackFile_ConstTable *ct)) PARROT_ASSERT(interp->thread_data); if (!interp->thread_data->const_tables) { - interp->thread_data->const_tables = parrot_new_pointer_hash(interp); + interp->thread_data->const_tables = Parrot_hsh_new_pointer_hash(interp); } tables = interp->thread_data->const_tables; - new_ct = (PackFile_ConstTable *)parrot_hash_get(interp, tables, ct); + new_ct = (PackFile_ConstTable *)Parrot_hsh_get(interp, tables, ct); if (!new_ct) { /* need to construct it */ @@ -3381,7 +3381,7 @@ find_constants(PARROT_INTERP, ARGIN(PackFile_ConstTable *ct)) for (i = 0; i < new_ct->pmc.const_count; ++i) clone_constant(interp, &new_ct->pmc.constants[i]); - parrot_hash_put(interp, tables, ct, new_ct); + Parrot_hsh_put(interp, tables, ct, new_ct); } return new_ct; @@ -3420,7 +3420,7 @@ Parrot_destroy_constants(PARROT_INTERP) PackFile_ConstTable * const ct = (PackFile_ConstTable *)_bucket->value; PackFile_ConstTable_clear(interp, ct); mem_gc_free(interp, ct);); - parrot_hash_destroy(interp, hash); + Parrot_hsh_destroy(interp, hash); } /* @@ -3462,7 +3462,7 @@ PackFile_ConstTable_clear(PARROT_INTERP, ARGMOD(PackFile_ConstTable *self)) } if (self->string_hash) { - parrot_hash_destroy(interp, self->string_hash); + Parrot_hsh_destroy(interp, self->string_hash); self->string_hash = NULL; } diff --git a/src/packout.c b/src/packout.c index c3ec15cbd7..b882549068 100644 --- a/src/packout.c +++ b/src/packout.c @@ -262,7 +262,7 @@ PackFile_ConstTable_rlookup_str(PARROT_INTERP, int i; if (ct->string_hash) { - HashBucket *bucket = parrot_hash_get_bucket(interp, ct->string_hash, s); + HashBucket *bucket = Parrot_hsh_get_bucket(interp, ct->string_hash, s); if (bucket) { i = (int)PTR2INTVAL(bucket->value); return i; diff --git a/src/pmc/addrregistry.pmc b/src/pmc/addrregistry.pmc index fcda9b0a17..d55f42cf13 100644 --- a/src/pmc/addrregistry.pmc +++ b/src/pmc/addrregistry.pmc @@ -46,11 +46,11 @@ Initializes the instance. */ VTABLE void init() { - Hash *pmc_registry = parrot_create_hash(INTERP, + Hash *pmc_registry = Parrot_hsh_create_hash(INTERP, enum_type_int, Hash_key_type_PMC_ptr); - Hash *str_registry = parrot_create_hash(INTERP, + Hash *str_registry = Parrot_hsh_create_hash(INTERP, enum_type_int, Hash_key_type_STRING); @@ -77,8 +77,8 @@ Mark any PMCs and STRINGs in this registry. GET_ATTR_str_registry(INTERP, SELF, str_registry); GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry); - parrot_mark_hash(interp, pmc_registry); - parrot_mark_hash(interp, str_registry); + Parrot_hsh_mark_hash(interp, pmc_registry); + Parrot_hsh_mark_hash(interp, str_registry); } @@ -99,8 +99,8 @@ Destroy this PMC. GET_ATTR_str_registry(INTERP, SELF, str_registry); GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry); - parrot_hash_destroy(interp, pmc_registry); - parrot_hash_destroy(interp, str_registry); + Parrot_hsh_destroy(interp, pmc_registry); + Parrot_hsh_destroy(interp, str_registry); SET_ATTR_str_registry(INTERP, SELF, NULL); SET_ATTR_pmc_registry(INTERP, SELF, NULL); @@ -132,7 +132,7 @@ Returns true if the hash size is not zero. const void *value; GET_ATTR_pmc_registry(INTERP, SELF, hash); - value = parrot_hash_get(INTERP, hash, key); + value = Parrot_hsh_get(INTERP, hash, key); if (value) return (INTVAL)value; @@ -146,8 +146,8 @@ Returns true if the hash size is not zero. GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry); GET_ATTR_str_registry(INTERP, SELF, str_registry); - return parrot_hash_size(INTERP, pmc_registry) + - parrot_hash_size(INTERP, str_registry); + return Parrot_hsh_size(INTERP, pmc_registry) + + Parrot_hsh_size(INTERP, str_registry); } VTABLE INTVAL get_bool() { @@ -156,8 +156,8 @@ Returns true if the hash size is not zero. GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry); GET_ATTR_str_registry(INTERP, SELF, str_registry); - return (parrot_hash_size(INTERP, pmc_registry) + - parrot_hash_size(INTERP, str_registry)) != 0; + return (Parrot_hsh_size(INTERP, pmc_registry) + + Parrot_hsh_size(INTERP, str_registry)) != 0; } /* @@ -190,12 +190,12 @@ reaches 0, delete the entry. GET_ATTR_pmc_registry(INTERP, SELF, hash); - oldval = parrot_hash_get(INTERP, hash, key); + oldval = Parrot_hsh_get(INTERP, hash, key); if (oldval) newval += (long)oldval; - parrot_hash_put(INTERP, hash, key, (void *)newval); + Parrot_hsh_put(INTERP, hash, key, (void *)newval); } VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { @@ -206,18 +206,18 @@ reaches 0, delete the entry. GET_ATTR_str_registry(INTERP, SELF, hash); - oldval = parrot_hash_get(INTERP, hash, key); + oldval = Parrot_hsh_get(INTERP, hash, key); if (oldval) newval += (long)oldval; - parrot_hash_put(INTERP, hash, key, (void *)newval); + Parrot_hsh_put(INTERP, hash, key, (void *)newval); } VTABLE void set_integer_keyed(PMC *key, INTVAL value) { Hash *hash; GET_ATTR_pmc_registry(INTERP, SELF, hash); - parrot_hash_put(INTERP, hash, key, (void *)value); + Parrot_hsh_put(INTERP, hash, key, (void *)value); } VTABLE void delete_keyed(PMC *key) { @@ -225,16 +225,16 @@ reaches 0, delete the entry. void *value; GET_ATTR_pmc_registry(INTERP, SELF, hash); - value = parrot_hash_get(INTERP, hash, key); + value = Parrot_hsh_get(INTERP, hash, key); /* these casts look bad, but they avoid type punning warnings with -O */ if (value) { long val = (long)value; if (val == 1L) - parrot_hash_delete(INTERP, hash, key); + Parrot_hsh_delete(INTERP, hash, key); else { value = (void *)(--val); - parrot_hash_put(INTERP, hash, key, value); + Parrot_hsh_put(INTERP, hash, key, value); } } } @@ -244,16 +244,16 @@ reaches 0, delete the entry. void *value; GET_ATTR_str_registry(INTERP, SELF, hash); - value = parrot_hash_get(INTERP, hash, key); + value = Parrot_hsh_get(INTERP, hash, key); /* these casts look bad, but they avoid type punning warnings with -O */ if (value) { long val = (long)value; if (val == 1L) - parrot_hash_delete(INTERP, hash, key); + Parrot_hsh_delete(INTERP, hash, key); else { value = (void *)(--val); - parrot_hash_put(INTERP, hash, key, value); + Parrot_hsh_put(INTERP, hash, key, value); } } } diff --git a/src/pmc/callcontext.pmc b/src/pmc/callcontext.pmc index 6aed79515f..722b815cdc 100644 --- a/src/pmc/callcontext.pmc +++ b/src/pmc/callcontext.pmc @@ -387,7 +387,7 @@ get_hash(PARROT_INTERP, ARGIN(PMC *SELF)) GETATTR_CallContext_hash(interp, SELF, hash); if (!hash) { - hash = parrot_create_hash(interp, + hash = Parrot_hsh_create_hash(interp, enum_type_ptr, Hash_key_type_STRING); @@ -685,7 +685,7 @@ stored.) if (hash) { parrot_hash_iterate(hash, FREE_CELL(INTERP, (Pcc_cell *)_bucket->value);); - parrot_hash_destroy(INTERP, hash); + Parrot_hsh_destroy(INTERP, hash); SET_ATTR_hash(INTERP, SELF, NULL); } } @@ -714,7 +714,7 @@ stored.) if (hash) { parrot_hash_iterate(hash, FREE_CELL(INTERP, (Pcc_cell *)_bucket->value);); - parrot_hash_destroy(INTERP, hash); + Parrot_hsh_destroy(INTERP, hash); } Parrot_pcc_free_registers(INTERP, SELF); @@ -1237,11 +1237,11 @@ return current Namespace VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { Hash * const hash = get_hash(INTERP, SELF); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, (void *)key); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, (void *)key, (void *)cell); + Parrot_hsh_put(INTERP, hash, (void *)key, (void *)cell); } cell->u.i = value; @@ -1250,11 +1250,11 @@ return current Namespace VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) { Hash * const hash = get_hash(INTERP, SELF); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, (void *)key); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, (void *)key, (void *)cell); + Parrot_hsh_put(INTERP, hash, (void *)key, (void *)cell); } cell->u.n = value; @@ -1263,11 +1263,11 @@ return current Namespace VTABLE void set_string_keyed_str(STRING *key, STRING *value) { Hash * const hash = get_hash(INTERP, SELF); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, (void *)key); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, (void *)key, (void *)cell); + Parrot_hsh_put(INTERP, hash, (void *)key, (void *)cell); } cell->u.s = value; @@ -1276,11 +1276,11 @@ return current Namespace VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { Hash * const hash = get_hash(INTERP, SELF); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, (void *)key); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, (void *)key, (void *)cell); + Parrot_hsh_put(INTERP, hash, (void *)key, (void *)cell); } cell->u.p = value; @@ -1289,12 +1289,12 @@ return current Namespace VTABLE void set_integer_keyed(PMC *key, INTVAL value) { Hash * const hash = get_hash(INTERP, SELF); - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, k, (void *)cell); + Parrot_hsh_put(INTERP, hash, k, (void *)cell); } cell->u.i = value; @@ -1303,12 +1303,12 @@ return current Namespace VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { Hash * const hash = get_hash(INTERP, SELF); - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, k, (void *)cell); + Parrot_hsh_put(INTERP, hash, k, (void *)cell); } cell->u.n = value; @@ -1317,12 +1317,12 @@ return current Namespace VTABLE void set_string_keyed(PMC *key, STRING *value) { Hash * const hash = get_hash(INTERP, SELF); - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, k, (void *)cell); + Parrot_hsh_put(INTERP, hash, k, (void *)cell); } cell->u.s = value; @@ -1331,12 +1331,12 @@ return current Namespace VTABLE void set_pmc_keyed(PMC *key, PMC *value) { Hash * const hash = get_hash(INTERP, SELF); - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell *cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (!cell) { cell = ALLOC_CELL(INTERP); - parrot_hash_put(INTERP, hash, k, (void *)cell); + Parrot_hsh_put(INTERP, hash, k, (void *)cell); } cell->u.p = value; @@ -1348,8 +1348,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_string(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_string(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_intval(INTERP, cell); @@ -1363,8 +1363,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_string(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_string(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_floatval(INTERP, cell); @@ -1379,8 +1379,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_string(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_string(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_string(INTERP, cell); @@ -1394,8 +1394,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_string(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_string(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) { INTVAL type = CELL_TYPE_MASK(cell); @@ -1413,8 +1413,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_intval(INTERP, cell); @@ -1428,8 +1428,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_floatval(INTERP, cell); @@ -1443,8 +1443,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) return autobox_string(INTERP, cell); @@ -1458,8 +1458,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_pmc(INTERP, hash, key); - Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + Pcc_cell * const cell = (Pcc_cell *)Parrot_hsh_get(INTERP, hash, k); if (cell) { INTVAL type = CELL_TYPE_MASK(cell); @@ -1477,8 +1477,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_pmc(INTERP, hash, key); - return parrot_hash_exists(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_pmc(INTERP, hash, key); + return Parrot_hsh_exists(INTERP, hash, k); } return 0; @@ -1489,8 +1489,8 @@ return current Namespace GETATTR_CallContext_hash(INTERP, SELF, hash); if (hash) { - void * const k = hash_key_from_string(INTERP, hash, key); - return parrot_hash_exists(INTERP, hash, k); + void * const k = Parrot_hsh_key_from_string(INTERP, hash, key); + return Parrot_hsh_exists(INTERP, hash, k); } return 0; @@ -1552,7 +1552,7 @@ Creates and returns a clone of the signature. SET_ATTR_return_flags(INTERP, dest, VTABLE_clone(INTERP, return_flags)); if (hash) - parrot_hash_clone(INTERP, hash, get_hash(INTERP, dest)); + Parrot_hsh_clone(INTERP, hash, get_hash(INTERP, dest)); return dest; } diff --git a/src/pmc/class.pmc b/src/pmc/class.pmc index 7f017cd060..8ee2746564 100644 --- a/src/pmc/class.pmc +++ b/src/pmc/class.pmc @@ -662,7 +662,7 @@ arguments. The class is attached to the current HLL namespace. _class->vtable_overrides = Parrot_pmc_new(INTERP, enum_class_Hash); _class->parent_overrides = Parrot_pmc_new(INTERP, enum_class_Hash); - _class->isa_cache = parrot_create_hash(INTERP, + _class->isa_cache = Parrot_hsh_create_hash(INTERP, enum_type_INTVAL, Hash_key_type_PMC_ptr); @@ -724,7 +724,7 @@ arguments. The class is attached to the current HLL namespace. void destroy() { Parrot_Class_attributes * const _class = PARROT_CLASS(SELF); - parrot_hash_destroy(INTERP, _class->isa_cache); + Parrot_hsh_destroy(INTERP, _class->isa_cache); } /* @@ -768,7 +768,7 @@ Marks any referenced strings and PMCs in the structure as live. Parrot_gc_mark_PMC_alive(INTERP, _class->resolve_method); Parrot_gc_mark_PMC_alive(INTERP, _class->meth_cache); if (_class->isa_cache) - parrot_mark_hash(INTERP, _class->isa_cache); + Parrot_hsh_mark_hash(INTERP, _class->isa_cache); } @@ -994,7 +994,7 @@ Adds the supplied PMC to the list of parents for the class. /* Add to the lists of our immediate parents and all parents. */ VTABLE_push_pmc(INTERP, _class->parents, parent); - parrot_hash_put(INTERP, _class->isa_cache, (void *)parent, (void *)1); + Parrot_hsh_put(INTERP, _class->isa_cache, (void *)parent, (void *)1); calculate_mro(INTERP, SELF, parent_count + 1); } @@ -1042,7 +1042,7 @@ if the class has been instantiated. "Can't remove_parent: is not a parent."); VTABLE_delete_keyed_int(INTERP, _class->parents, index); - parrot_hash_put(INTERP, _class->isa_cache, (void *)parent, (void *)0); + Parrot_hsh_put(INTERP, _class->isa_cache, (void *)parent, (void *)0); calculate_mro(INTERP, SELF, parent_count - 1); } @@ -1162,7 +1162,7 @@ Array of Class PMCs representing the direct parents of this class. Hash *src = (Hash *)VTABLE_get_pointer(interp, found); Hash *dest = (Hash *)VTABLE_get_pointer(interp, hash); - parrot_hash_clone_prunable(interp, src, dest, 0); + Parrot_hsh_clone_prunable(interp, src, dest, 0); return hash; } @@ -1424,7 +1424,7 @@ Returns whether the class is or inherits from C<*class>. goto found; if (_class->instantiated) { - b = parrot_hash_get_bucket(INTERP, _class->isa_cache, + b = Parrot_hsh_get_bucket(INTERP, _class->isa_cache, (void *)classobj); if (b) return (INTVAL)b->value; @@ -1437,7 +1437,7 @@ Returns whether the class is or inherits from C<*class>. || classobj->vtable->base_type == enum_class_PMCProxy) { STRING *classname = make_class_name(INTERP, classobj); PARROT_ASSERT(SELF->vtable->isa_hash); - if (parrot_hash_exists(INTERP, SELF->vtable->isa_hash, classname)) + if (Parrot_hsh_exists(INTERP, SELF->vtable->isa_hash, classname)) goto found; } @@ -1455,7 +1455,7 @@ Returns whether the class is or inherits from C<*class>. cache_and_return: if (_class->instantiated) - parrot_hash_put(INTERP, _class->isa_cache, (void *)classobj, + Parrot_hsh_put(INTERP, _class->isa_cache, (void *)classobj, (void *)retval); return retval; diff --git a/src/pmc/default.pmc b/src/pmc/default.pmc index 949417ad9a..48e022b7c5 100644 --- a/src/pmc/default.pmc +++ b/src/pmc/default.pmc @@ -983,7 +983,7 @@ true (1) is returned; otherwise, false (0) is returned. else { Hash * const isa_hash = SELF->vtable->isa_hash; STRING * const pmc_name = VTABLE_get_string(INTERP, lookup); - return parrot_hash_exists(INTERP, isa_hash, pmc_name); + return Parrot_hsh_exists(INTERP, isa_hash, pmc_name); } } @@ -1007,7 +1007,7 @@ true (1) is returned; otherwise, false (0) is returned. if (!isa_hash) return STRING_equal(INTERP, SELF->vtable->whoami, _class); - return parrot_hash_exists(INTERP, isa_hash, (void *)_class); + return Parrot_hsh_exists(INTERP, isa_hash, (void *)_class); } } diff --git a/src/pmc/hash.pmc b/src/pmc/hash.pmc index d0a7fb715c..e814ac446e 100644 --- a/src/pmc/hash.pmc +++ b/src/pmc/hash.pmc @@ -91,7 +91,7 @@ get_next_hash(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key)) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, "Hash entry type must be PMC for multipart keys."); - bucket = parrot_hash_get_bucket(interp, hash, key); + bucket = Parrot_hsh_get_bucket(interp, hash, key); if (bucket) next_hash = (PMC *)bucket->value; @@ -126,7 +126,7 @@ Free hash structure. Parrot_Hash_attributes * const attr = (Parrot_Hash_attributes *) PMC_data(SELF); - attr->hash = parrot_new_hash(INTERP); + attr->hash = Parrot_hsh_new_hash(INTERP); PObj_custom_mark_destroy_SETALL(SELF); } @@ -134,7 +134,7 @@ Free hash structure. Parrot_Hash_attributes * const attr = (Parrot_Hash_attributes *) PMC_data(SELF); - attr->hash = parrot_create_hash(INTERP, + attr->hash = Parrot_hsh_create_hash(INTERP, (PARROT_DATA_TYPE)value_type, Hash_key_type_STRING); PObj_custom_mark_destroy_SETALL(SELF); @@ -143,7 +143,7 @@ Free hash structure. VTABLE void destroy() { Hash * const hash = (Hash *)SELF.get_pointer(); if (hash) - parrot_hash_destroy(INTERP, hash); + Parrot_hsh_destroy(INTERP, hash); } /* @@ -159,7 +159,7 @@ Marks the hash as live. VTABLE void mark() { Hash * const hash = (Hash *)SELF.get_pointer(); if (hash && hash->entries) - parrot_mark_hash(INTERP, hash); + Parrot_hsh_mark_hash(INTERP, hash); } /* @@ -175,7 +175,7 @@ Creates and returns a clone of the hash. VTABLE PMC *clone() { PMC * const dest = Parrot_pmc_new(INTERP, SELF->vtable->base_type); - parrot_hash_clone(INTERP, (Hash *)SELF.get_pointer(), + Parrot_hsh_clone(INTERP, (Hash *)SELF.get_pointer(), (Hash *)VTABLE_get_pointer(INTERP, dest)); return dest; @@ -198,7 +198,7 @@ Use C as this PMC's Hash*. PARROT_HASH(SELF)->hash = new_hash; if (old_hash) - parrot_hash_destroy(INTERP, old_hash); + Parrot_hsh_destroy(INTERP, old_hash); } @@ -224,17 +224,17 @@ NB: this method will destroy all old data! : enum_type_PMC; if (type == Hash_key_type_STRING) - new_hash = parrot_create_hash(INTERP, + new_hash = Parrot_hsh_create_hash(INTERP, entry_type, Hash_key_type_STRING); else if (type == Hash_key_type_int) /* new_int_hash set BOTH keys and values to INTVAL */ - new_hash = parrot_create_hash(INTERP, + new_hash = Parrot_hsh_create_hash(INTERP, entry_type, Hash_key_type_int); else if (type == Hash_key_type_PMC) /* new_int_hash set BOTH keys and values to INTVAL */ - new_hash = parrot_create_hash(INTERP, + new_hash = Parrot_hsh_create_hash(INTERP, entry_type, Hash_key_type_PMC); else @@ -247,7 +247,7 @@ NB: this method will destroy all old data! PARROT_HASH(SELF)->hash = new_hash; if (old_hash) - parrot_hash_destroy(INTERP, old_hash); + Parrot_hsh_destroy(INTERP, old_hash); } METHOD set_key_type(INTVAL type) { @@ -295,7 +295,7 @@ NB: this method will destroy all old data! case enum_type_INTVAL: case enum_type_STRING: case enum_type_PMC: - new_hash = parrot_create_hash(INTERP, + new_hash = Parrot_hsh_create_hash(INTERP, (PARROT_DATA_TYPE)type, old_hash ? old_hash->key_type : Hash_key_type_STRING); break; @@ -307,7 +307,7 @@ NB: this method will destroy all old data! PARROT_HASH(SELF)->hash = new_hash; if (old_hash) - parrot_hash_destroy(INTERP, old_hash); + Parrot_hsh_destroy(INTERP, old_hash); } METHOD get_value_type() { @@ -341,7 +341,7 @@ Returns the size of the hash. */ VTABLE INTVAL get_integer() { - return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()); + return Parrot_hsh_size(INTERP, (Hash *)SELF.get_pointer()); } VTABLE FLOATVAL get_number() { @@ -423,24 +423,24 @@ Return a representation of the hash contents. VTABLE INTVAL get_integer_keyed_str(STRING *key) { const Hash * const hash = (Hash*)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_string(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_string(INTERP, hash, key)); if (!b) return 0; - return hash_value_to_int(INTERP, hash, b->value); + return Parrot_hsh_value_to_int(INTERP, hash, b->value); } VTABLE INTVAL get_integer_keyed_int(INTVAL key) { const Hash * const hash = (Hash*)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_int(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_int(INTERP, hash, key)); if (!b) return 0; - return hash_value_to_int(INTERP, hash, b->value); + return Parrot_hsh_value_to_int(INTERP, hash, b->value); } /* @@ -455,8 +455,8 @@ Returns the integer value for the element at C<*key>. /* Handling Keys */ VTABLE INTVAL get_integer_keyed(PMC *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - const void * const hash_key = hash_key_from_pmc(INTERP, hash, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, hash_key); + const void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, hash_key); if (!b) return 0; @@ -465,7 +465,7 @@ Returns the integer value for the element at C<*key>. /* Stop recursion. This is last step */ if (!key) - return hash_value_to_int(INTERP, hash, b->value); + return Parrot_hsh_value_to_int(INTERP, hash, b->value); if (hash->entry_type != enum_type_PMC) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, @@ -485,7 +485,7 @@ Returns the integer value for the element at C<*key>. VTABLE void set_integer_keyed(PMC *key, INTVAL value) { Hash * const hash = (Hash *)SELF.get_pointer(); - void * const hash_key = hash_key_from_pmc(INTERP, hash, key); + void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); if (PObj_constant_TEST(SELF) && !PObj_constant_TEST((PObj *)key)) @@ -496,8 +496,8 @@ Returns the integer value for the element at C<*key>. key = Parrot_key_next(INTERP, key); if (!key) { - parrot_hash_put(INTERP, hash, hash_key, - hash_value_from_int(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, hash_key, + Parrot_hsh_value_from_int(INTERP, hash, value)); } else { PMC * const next_hash = get_next_hash(INTERP, hash, hash_key); @@ -511,8 +511,8 @@ Returns the integer value for the element at C<*key>. VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) { Hash * const hash = (Hash *)SELF.get_pointer(); - parrot_hash_put(INTERP, hash, hash_key_from_int(INTERP, hash, key), - hash_value_from_int(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, Parrot_hsh_key_from_int(INTERP, hash, key), + Parrot_hsh_value_from_int(INTERP, hash, value)); } /* @@ -532,8 +532,8 @@ Returns the integer value for the element at C<*key>. EXCEPTION_INVALID_OPERATION, "Used non-constant key in constant hash."); - parrot_hash_put(INTERP, hash, hash_key_from_string(INTERP, hash, key), - hash_value_from_int(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key), + Parrot_hsh_value_from_int(INTERP, hash, value)); } @@ -549,24 +549,24 @@ Returns the integer value for the element at C<*key>. VTABLE FLOATVAL get_number_keyed_str(STRING *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_string(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_string(INTERP, hash, key)); if (!b) return 0.0; - return hash_value_to_number(INTERP, hash, b->value); + return Parrot_hsh_value_to_number(INTERP, hash, b->value); } VTABLE FLOATVAL get_number_keyed_int(INTVAL key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_int(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_int(INTERP, hash, key)); if (!b) return 0.0; - return hash_value_to_number(INTERP, hash, b->value); + return Parrot_hsh_value_to_number(INTERP, hash, b->value); } /* @@ -581,8 +581,8 @@ Returns the floating-point value for the element at C<*key>. /* I can't migrate this function right now. Some problem with JITting */ VTABLE FLOATVAL get_number_keyed(PMC *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - void * const hash_key = hash_key_from_pmc(INTERP, hash, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, hash_key); + void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, hash_key); if (!b) return 0.0; @@ -590,7 +590,7 @@ Returns the floating-point value for the element at C<*key>. key = Parrot_key_next(INTERP, key); if (!key) - return hash_value_to_number(INTERP, hash, b->value); + return Parrot_hsh_value_to_number(INTERP, hash, b->value); if (hash->entry_type != enum_type_PMC) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, @@ -613,24 +613,24 @@ Returns the floating-point value for the element at C<*key>. VTABLE STRING *get_string_keyed_str(STRING *key) { const Hash * const hash = (Hash*)SELF.get_pointer(); HashBucket * const b = - parrot_hash_get_bucket(INTERP, hash, hash_key_from_string(INTERP, hash, key)); + Parrot_hsh_get_bucket(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key)); /* XXX: shouldn't we return STRINGNULL? */ if (!b) return CONST_STRING(INTERP, ""); - return hash_value_to_string(INTERP, hash, b->value); + return Parrot_hsh_value_to_string(INTERP, hash, b->value); } VTABLE STRING *get_string_keyed_int(INTVAL key) { const Hash * const hash = (Hash*)SELF.get_pointer(); HashBucket * const b = - parrot_hash_get_bucket(INTERP, hash, hash_key_from_int(INTERP, hash, key)); + Parrot_hsh_get_bucket(INTERP, hash, Parrot_hsh_key_from_int(INTERP, hash, key)); if (!b) return CONST_STRING(INTERP, ""); - return hash_value_to_string(INTERP, hash, b->value); + return Parrot_hsh_value_to_string(INTERP, hash, b->value); } /* @@ -645,8 +645,8 @@ Returns the string value for the element at C<*key>. VTABLE STRING *get_string_keyed(PMC *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - const void * const hash_key = hash_key_from_pmc(INTERP, hash, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, hash_key); + const void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, hash_key); if (!b) return CONST_STRING(INTERP, ""); @@ -655,7 +655,7 @@ Returns the string value for the element at C<*key>. /* Stop recursion. This is last step */ if (!key) - return hash_value_to_string(INTERP, hash, b->value); + return Parrot_hsh_value_to_string(INTERP, hash, b->value); if (hash->entry_type != enum_type_PMC) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, @@ -675,7 +675,7 @@ Returns the string value for the element at C<*key>. VTABLE void set_string_keyed(PMC *key, STRING *value) { Hash * const hash = (Hash *)SELF.get_pointer(); - void * const hash_key = hash_key_from_pmc(INTERP, hash, key); + void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); if (PObj_constant_TEST(SELF)){ if (!PObj_constant_TEST((PObj *)key)) @@ -691,8 +691,8 @@ Returns the string value for the element at C<*key>. key = Parrot_key_next(INTERP, key); if (!key) { - parrot_hash_put(INTERP, hash, hash_key, - hash_value_from_string(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, hash_key, + Parrot_hsh_value_from_string(INTERP, hash, value)); } else { PMC * const next_hash = get_next_hash(INTERP, hash, hash_key); @@ -726,8 +726,8 @@ Returns the string value for the element at C<*key>. "Used non-constant STRING value in constant hash."); } - parrot_hash_put(INTERP, hash, hash_key_from_string(INTERP, hash, key), - hash_value_from_string(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key), + Parrot_hsh_value_from_string(INTERP, hash, value)); } VTABLE void set_string_keyed_int(INTVAL key, STRING *value) { @@ -739,9 +739,9 @@ Returns the string value for the element at C<*key>. EXCEPTION_INVALID_OPERATION, "Used non-constant STRING value in constant hash."); - parrot_hash_put(INTERP, hash, - hash_key_from_int(INTERP, hash, key), - hash_value_from_string(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, + Parrot_hsh_key_from_int(INTERP, hash, key), + Parrot_hsh_value_from_string(INTERP, hash, value)); } /* @@ -767,7 +767,7 @@ Returns the PMC value for the element at C<*key>. if (!hash->entries) return PMCNULL; - b = parrot_hash_get_bucket(INTERP, hash, key); + b = Parrot_hsh_get_bucket(INTERP, hash, key); if (!b) return PMCNULL; @@ -776,25 +776,25 @@ Returns the PMC value for the element at C<*key>. if (hash->entry_type == enum_type_PMC) return (PMC *)b->value; else - return hash_value_to_pmc(INTERP, hash, b->value); + return Parrot_hsh_value_to_pmc(INTERP, hash, b->value); } VTABLE PMC *get_pmc_keyed_int(INTVAL key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_int(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_int(INTERP, hash, key)); if (!b) return PMCNULL; - return hash_value_to_pmc(INTERP, hash, b->value); + return Parrot_hsh_value_to_pmc(INTERP, hash, b->value); } /* Compound Key */ VTABLE PMC *get_pmc_keyed(PMC *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - const void * const hash_key = hash_key_from_pmc(INTERP, hash, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, hash_key); + const void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, hash_key); if (!b) return PMCNULL; @@ -803,7 +803,7 @@ Returns the PMC value for the element at C<*key>. /* Stop recursion. This is last step */ if (!key) - return hash_value_to_pmc(INTERP, hash, b->value); + return Parrot_hsh_value_to_pmc(INTERP, hash, b->value); if (hash->entry_type != enum_type_PMC) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, @@ -823,7 +823,7 @@ Returns the PMC value for the element at C<*key>. VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { Hash * const hash = (Hash *)SELF.get_pointer(); - void * const hash_key = hash_key_from_pmc(INTERP, hash, key); + void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); if (PObj_constant_TEST(SELF) && !PObj_constant_TEST((PObj *)key)) @@ -834,8 +834,8 @@ Returns the PMC value for the element at C<*key>. key = Parrot_key_next(INTERP, key); if (!key) { - parrot_hash_put(INTERP, hash, hash_key, - hash_value_from_number(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, hash_key, + Parrot_hsh_value_from_number(INTERP, hash, value)); } else { PMC * const next_hash = get_next_hash(INTERP, hash, hash_key); @@ -866,8 +866,8 @@ Sets C as the value for C<*key>. EXCEPTION_INVALID_OPERATION, "Used non-constant STRING key in constant hash."); - parrot_hash_put(INTERP, hash, hash_key_from_string(INTERP, hash, key), - hash_value_from_number(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key), + Parrot_hsh_value_from_number(INTERP, hash, value)); } /* @@ -880,7 +880,7 @@ Sets C as the value for C<*key>. VTABLE void set_pmc_keyed(PMC *key, PMC *value) { Hash * const hash = (Hash *)SELF.get_pointer(); - void * const hash_key = hash_key_from_pmc(INTERP, hash, key); + void * const hash_key = Parrot_hsh_key_from_pmc(INTERP, hash, key); if (PObj_constant_TEST(SELF)) { if (!PObj_constant_TEST((PObj *)key)) @@ -897,7 +897,7 @@ Sets C as the value for C<*key>. key = Parrot_key_next(INTERP, key); if (!key) { - parrot_hash_put(INTERP, hash, hash_key, value); + Parrot_hsh_put(INTERP, hash, hash_key, value); } else { PMC * const next_hash = get_next_hash(INTERP, hash, hash_key); @@ -934,8 +934,8 @@ Sets C<*value> as the value for C<*key>. "Used non-constant STRING value in constant hash."); } - parrot_hash_put(INTERP, hash, hash_key_from_string(INTERP, hash, key), - hash_value_from_pmc(INTERP, hash, value)); + Parrot_hsh_put(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key), + Parrot_hsh_value_from_pmc(INTERP, hash, value)); } /* @@ -948,8 +948,8 @@ Sets C<*value> as the value for C<*key>. VTABLE INTVAL exists_keyed_str(STRING *key) { Hash * const hash = (Hash *)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_string(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_string(INTERP, hash, key)); return b != NULL; } @@ -965,8 +965,8 @@ Returns whether a key C<*key> exists in the hash. VTABLE INTVAL exists_keyed(PMC *key) { Hash * const h = (Hash *)SELF.get_pointer(); - void * const sx = hash_key_from_pmc(INTERP, h, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, h, sx); + void * const sx = Parrot_hsh_key_from_pmc(INTERP, h, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, h, sx); /* no such key */ if (!b) @@ -996,14 +996,14 @@ Returns whether a key C<*key> exists in the hash. VTABLE INTVAL defined_keyed_str(STRING *key) { const Hash * const hash = (Hash *)SELF.get_pointer(); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, - hash_key_from_string(INTERP, hash, key)); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, + Parrot_hsh_key_from_string(INTERP, hash, key)); /* no such key */ if (!b) return 0; - return VTABLE_defined(INTERP, hash_value_to_pmc(INTERP, hash, b->value)); + return VTABLE_defined(INTERP, Parrot_hsh_value_to_pmc(INTERP, hash, b->value)); } /* @@ -1018,8 +1018,8 @@ Returns whether the value for C<*key> is defined. VTABLE INTVAL defined_keyed(PMC *key) { Hash * const h = (Hash *)SELF.get_pointer(); - void * const sx = hash_key_from_pmc(INTERP, h, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, h, sx); + void * const sx = Parrot_hsh_key_from_pmc(INTERP, h, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, h, sx); /* no such key */ if (!b) @@ -1028,7 +1028,7 @@ Returns whether the value for C<*key> is defined. key = Parrot_key_next(INTERP, key); if (!key) - return VTABLE_defined(INTERP, hash_value_to_pmc(INTERP, h, b->value)); + return VTABLE_defined(INTERP, Parrot_hsh_value_to_pmc(INTERP, h, b->value)); if (h->entry_type != enum_type_PMC) Parrot_ex_throw_from_c_args(INTERP, NULL, @@ -1048,7 +1048,7 @@ Returns whether the value for C<*key> is defined. VTABLE void delete_keyed_str(STRING *key) { Hash * const hash = (Hash *)SELF.get_pointer(); - parrot_hash_delete(INTERP, hash, hash_key_from_string(INTERP, hash, key)); + Parrot_hsh_delete(INTERP, hash, Parrot_hsh_key_from_string(INTERP, hash, key)); } /* @@ -1063,8 +1063,8 @@ Deletes the element associated with C<*key>. VTABLE void delete_keyed(PMC *key) { Hash * const h = (Hash *)SELF.get_pointer(); - void * const sx = hash_key_from_pmc(INTERP, h, key); - HashBucket * const b = parrot_hash_get_bucket(INTERP, h, sx); + void * const sx = Parrot_hsh_key_from_pmc(INTERP, h, key); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, h, sx); /* no such key */ if (!b) @@ -1073,7 +1073,7 @@ Deletes the element associated with C<*key>. key = Parrot_key_next(INTERP, key); if (!key) { - parrot_hash_delete(INTERP, h, sx); + Parrot_hsh_delete(INTERP, h, sx); return; } @@ -1096,7 +1096,7 @@ Returns true if the hash size is not zero. */ VTABLE INTVAL get_bool() { - return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()) != 0; + return Parrot_hsh_size(INTERP, (Hash *)SELF.get_pointer()) != 0; } /* @@ -1110,7 +1110,7 @@ Returns the number of elements in the hash. */ VTABLE INTVAL elements() { - return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()); + return Parrot_hsh_size(INTERP, (Hash *)SELF.get_pointer()); } /* @@ -1197,7 +1197,7 @@ Used to archive the hash. */ VTABLE void freeze(PMC *info) { - Parrot_hash_freeze(INTERP, (Hash *)SELF.get_pointer(), info); + Parrot_hsh_freeze(INTERP, (Hash *)SELF.get_pointer(), info); } /* @@ -1211,7 +1211,7 @@ Used to unarchive the hash. */ VTABLE void thaw(PMC *info) { - SELF.set_pointer((void *)Parrot_hash_thaw(INTERP, info)); + SELF.set_pointer((void *)Parrot_hsh_thaw(INTERP, info)); /* Thawed Hash was created from pmc_new_noinit */ PObj_custom_mark_destroy_SETALL(SELF); } diff --git a/src/pmc/hashiterator.pmc b/src/pmc/hashiterator.pmc index b7ba155d6d..4e2da59718 100644 --- a/src/pmc/hashiterator.pmc +++ b/src/pmc/hashiterator.pmc @@ -281,7 +281,7 @@ the next one. if (attrs->elements < 0) return CONST_STRING(INTERP, ""); - return hash_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key); + return Parrot_hsh_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key); } } diff --git a/src/pmc/hashiteratorkey.pmc b/src/pmc/hashiteratorkey.pmc index b115de49be..f2fde8cf31 100644 --- a/src/pmc/hashiteratorkey.pmc +++ b/src/pmc/hashiteratorkey.pmc @@ -43,7 +43,7 @@ Get "key". if (!attrs->parrot_hash || !attrs->bucket) return PMCNULL; - return hash_key_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->key); + return Parrot_hsh_key_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->key); } METHOD key() { @@ -54,7 +54,7 @@ Get "key". METHOD value() { Parrot_HashIteratorKey_attributes *attrs = PARROT_HASHITERATORKEY(SELF); - PMC *ret = hash_value_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->value); + PMC *ret = Parrot_hsh_value_to_pmc(INTERP, attrs->parrot_hash, attrs->bucket->value); RETURN(PMC* ret); } @@ -71,7 +71,7 @@ Get "key". if (!attrs->parrot_hash || !attrs->bucket) return CONST_STRING(INTERP, ""); - return hash_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key); + return Parrot_hsh_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key); } /* diff --git a/src/pmc/imageiofreeze.pmc b/src/pmc/imageiofreeze.pmc index ac44936901..d6825cd311 100644 --- a/src/pmc/imageiofreeze.pmc +++ b/src/pmc/imageiofreeze.pmc @@ -241,7 +241,7 @@ Initializes the PMC. VTABLE void init() { PARROT_IMAGEIOFREEZE(SELF)->seen = Parrot_pmc_new(INTERP, enum_class_Hash); VTABLE_set_pointer(INTERP, PARROT_IMAGEIOFREEZE(SELF)->seen, - parrot_new_intval_hash(INTERP)); + Parrot_hsh_new_intval_hash(INTERP)); PARROT_IMAGEIOFREEZE(SELF)->todo = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray); @@ -430,7 +430,7 @@ hasn't been seen yet, it is also pushed onto the todo list. else { Hash * const hash = (Hash *)VTABLE_get_pointer(INTERP, PARROT_IMAGEIOFREEZE(SELF)->seen); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, v); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, v); if (b) { id = (UINTVAL)b->value; @@ -456,7 +456,7 @@ hasn't been seen yet, it is also pushed onto the todo list. ? (INTVAL) enum_class_Object : v->vtable->base_type); - parrot_hash_put(INTERP, hash, v, (void *)id); + Parrot_hsh_put(INTERP, hash, v, (void *)id); VTABLE_push_pmc(INTERP, PARROT_IMAGEIOFREEZE(SELF)->todo, v); } } diff --git a/src/pmc/imageiosize.pmc b/src/pmc/imageiosize.pmc index fea8f33fe1..6ca167bfe1 100644 --- a/src/pmc/imageiosize.pmc +++ b/src/pmc/imageiosize.pmc @@ -51,7 +51,7 @@ Initializes the PMC. PARROT_IMAGEIOSIZE(SELF)->seen = Parrot_pmc_new(INTERP, enum_class_Hash); VTABLE_set_pointer(INTERP, PARROT_IMAGEIOSIZE(SELF)->seen, - parrot_new_intval_hash(INTERP)); + Parrot_hsh_new_intval_hash(INTERP)); PObj_flag_CLEAR(private1, SELF); @@ -76,7 +76,7 @@ Initializes the PMC with a pre-existing C. PARROT_IMAGEIOSIZE(SELF)->seen = Parrot_pmc_new(INTERP, enum_class_Hash); VTABLE_set_pointer(INTERP, PARROT_IMAGEIOSIZE(SELF)->seen, - parrot_new_intval_hash(INTERP)); + Parrot_hsh_new_intval_hash(INTERP)); PObj_flag_SET(private1, SELF); @@ -243,7 +243,7 @@ hasn't been seen yet, it is also pushed onto the todo list. if (!PMC_IS_NULL(v)) { Hash * const hash = (Hash *)VTABLE_get_pointer(INTERP, PARROT_IMAGEIOSIZE(SELF)->seen); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, v); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, v); is_new = !b; } @@ -252,7 +252,7 @@ hasn't been seen yet, it is also pushed onto the todo list. if (is_new) { Hash * const hash = (Hash *)VTABLE_get_pointer(INTERP, PARROT_IMAGEIOSIZE(SELF)->seen); - parrot_hash_put(INTERP, hash, v, v); + Parrot_hsh_put(INTERP, hash, v, v); VTABLE_push_integer(INTERP, SELF, v->vtable->base_type); VTABLE_push_pmc(INTERP, PARROT_IMAGEIOSIZE(SELF)->todo, v); diff --git a/src/pmc/imageiostrings.pmc b/src/pmc/imageiostrings.pmc index 4b68cb2bc3..cbdacdf9be 100644 --- a/src/pmc/imageiostrings.pmc +++ b/src/pmc/imageiostrings.pmc @@ -46,7 +46,7 @@ Initializes the PMC. PARROT_IMAGEIOSTRINGS(SELF)->seen = Parrot_pmc_new(INTERP, enum_class_Hash); VTABLE_set_pointer(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->seen, - parrot_new_intval_hash(INTERP)); + Parrot_hsh_new_intval_hash(INTERP)); PARROT_IMAGEIOSTRINGS(SELF)->list = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray); @@ -166,10 +166,10 @@ Checks new pmcs for strings. if (!PMC_IS_NULL(v)) { Hash * const hash = (Hash *)VTABLE_get_pointer(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->seen); - HashBucket * const b = parrot_hash_get_bucket(INTERP, hash, v); + HashBucket * const b = Parrot_hsh_get_bucket(INTERP, hash, v); if (!b) { /* not yet seen */ - parrot_hash_put(INTERP, hash, v, v); + Parrot_hsh_put(INTERP, hash, v, v); VTABLE_push_pmc(INTERP, PARROT_IMAGEIOSTRINGS(SELF)->todo, v); } } diff --git a/src/pmc/lexpad.pmc b/src/pmc/lexpad.pmc index 85fd686062..e3f1ae6fdc 100644 --- a/src/pmc/lexpad.pmc +++ b/src/pmc/lexpad.pmc @@ -91,7 +91,7 @@ Return the LexInfo PMC, if any or a Null PMC. VTABLE INTVAL elements() { PMC *info; GET_ATTR_lexinfo(INTERP, SELF, info); - return parrot_hash_size(INTERP, + return Parrot_hsh_size(INTERP, (Hash *)VTABLE_get_pointer(INTERP, info)); } @@ -102,7 +102,7 @@ Return the LexInfo PMC, if any or a Null PMC. hash = (Hash *)VTABLE_get_pointer(INTERP, info); return hash->entries - ? (parrot_hash_get_bucket(INTERP, hash, name) != 0) + ? (Parrot_hsh_get_bucket(INTERP, hash, name) != 0) : 0; } @@ -123,7 +123,7 @@ Return the LexInfo PMC, if any or a Null PMC. if (!hash->entries) return PMCNULL; - b = parrot_hash_get_bucket(INTERP, hash, name); + b = Parrot_hsh_get_bucket(INTERP, hash, name); if (!b) return PMCNULL; @@ -145,7 +145,7 @@ Return the LexInfo PMC, if any or a Null PMC. GET_ATTR_lexinfo(INTERP, SELF, info); hash = (Hash *)VTABLE_get_pointer(INTERP, info); - b = parrot_hash_get_bucket(INTERP, hash, name); + b = Parrot_hsh_get_bucket(INTERP, hash, name); if (!b) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LEX_NOT_FOUND, diff --git a/src/pmc/namespace.pmc b/src/pmc/namespace.pmc index 66b3953894..a1c6a4b92c 100644 --- a/src/pmc/namespace.pmc +++ b/src/pmc/namespace.pmc @@ -293,9 +293,9 @@ add_multi_to_namespace(PARROT_INTERP, ARGIN(PMC *SELF), ARGIN(STRING *key), GETATTR_NameSpace_hash(interp, SELF, hash); - parrot_hash_put(interp, hash, - hash_key_from_string(interp, hash, key), - hash_value_from_pmc(interp, hash, value)); + Parrot_hsh_put(interp, hash, + Parrot_hsh_key_from_string(interp, hash, key), + Parrot_hsh_value_from_pmc(interp, hash, value)); } } } @@ -345,7 +345,7 @@ Initialize a C PMC. PARROT_NAMESPACE(SELF)->vtable = PMCNULL; PARROT_NAMESPACE(SELF)->methods = PMCNULL; PARROT_NAMESPACE(SELF)->_class = PMCNULL; - SELF.set_pointer(parrot_new_hash(INTERP)); + SELF.set_pointer(Parrot_hsh_new_hash(INTERP)); PObj_custom_mark_destroy_SETALL(SELF); } @@ -362,7 +362,7 @@ Marks the namespace as live. Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(SELF); if (nsinfo->hash) - parrot_mark_hash(INTERP, nsinfo->hash); + Parrot_hsh_mark_hash(INTERP, nsinfo->hash); Parrot_gc_mark_PMC_alive(INTERP, nsinfo->parent); Parrot_gc_mark_PMC_alive(INTERP, nsinfo->_class); @@ -437,7 +437,7 @@ really a public API. /* If it's a multi-sub and the first in this NS... */ add_multi_to_namespace(INTERP, SELF, key, value); - old = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), key); + old = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); if (!old) SUPER(key, value); @@ -475,7 +475,7 @@ really a public API. VTABLE_set_pmc_keyed_int(INTERP, new_tuple, NS_slot_var_sub, old); - parrot_hash_put(INTERP, (Hash *)SELF.get_pointer(), key, new_tuple); + Parrot_hsh_put(INTERP, (Hash *)SELF.get_pointer(), key, new_tuple); /* distinction from a plain FPA, which doesn't extend the * namespace storage */ } @@ -483,7 +483,7 @@ really a public API. else if (new_tuple) { VTABLE_set_pmc_keyed_int(INTERP, new_tuple, NS_slot_ns, old); VTABLE_set_pmc_keyed_int(INTERP, new_tuple, NS_slot_var_sub, value); - parrot_hash_put(INTERP, (Hash *)SELF.get_pointer(), key, new_tuple); + Parrot_hsh_put(INTERP, (Hash *)SELF.get_pointer(), key, new_tuple); } } @@ -530,7 +530,7 @@ really a public API. VTABLE PMC *get_pmc_keyed_str(STRING *key) { Hash * const hash = (Hash *)SELF.get_pointer(); - PMC *ns = (PMC *)parrot_hash_get(INTERP, hash, key); + PMC *ns = (PMC *)Parrot_hsh_get(INTERP, hash, key); if (!ns) return PMCNULL; @@ -619,7 +619,7 @@ TOTAL KLUDGE. ON THE CHOPPING BLOCK. */ VTABLE void *get_pointer_keyed_str(STRING *key) { - PMC *ns = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), key); + PMC *ns = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); /* Be extra careful about returning PMCNULL */ if (! PMC_IS_NULL(ns)) { @@ -884,7 +884,7 @@ Return the namespace with the given name. METHOD find_namespace(STRING *key) { STRING * const s_ns = CONST_STRING(INTERP, "NameSpace"); - PMC * const ns = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), + PMC * const ns = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); if (!ns) @@ -909,7 +909,7 @@ Return the Sub PMC with the given name. METHOD find_sub(STRING *key) { STRING * const s_sub = CONST_STRING(INTERP, "Sub"); - PMC * const sub = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), + PMC * const sub = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); if (!sub) @@ -933,7 +933,7 @@ Return the PMC with the given name. */ METHOD find_var(STRING *key) { - PMC * const val = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), key); + PMC * const val = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); if (!val) RETURN(PMC *PMCNULL); @@ -955,7 +955,7 @@ does not delete the PMC. METHOD del_namespace(STRING *name) { Hash * const hash = (Hash *)SELF.get_pointer(); - PMC * const ns = (PMC *)parrot_hash_get(INTERP, hash, name); + PMC * const ns = (PMC *)Parrot_hsh_get(INTERP, hash, name); STRING * const s_ns = CONST_STRING(INTERP, "NameSpace"); if (PMC_IS_NULL(ns)) @@ -966,7 +966,7 @@ does not delete the PMC. "Invalid type %d for '%Ss' in del_namespace()", ns->vtable->base_type, name); - parrot_hash_delete(INTERP, hash, name); + Parrot_hsh_delete(INTERP, hash, name); } /* @@ -983,7 +983,7 @@ delete the PMC. METHOD del_sub(STRING *name) { Hash * const hash = (Hash *)SELF.get_pointer(); - PMC * const sub = (PMC *)parrot_hash_get(INTERP, hash, name); + PMC * const sub = (PMC *)Parrot_hsh_get(INTERP, hash, name); STRING * const s_sub = CONST_STRING(INTERP, "Sub"); if (PMC_IS_NULL(sub)) @@ -994,7 +994,7 @@ delete the PMC. "Invalid type %d for '%Ss' in del_sub()", sub->vtable->base_type, name); - parrot_hash_delete(INTERP, hash, name); + Parrot_hsh_delete(INTERP, hash, name); } /* @@ -1008,7 +1008,7 @@ Deletes the contained variable-like PMC with the given name. */ METHOD del_var(STRING *name) { - parrot_hash_delete(INTERP, (Hash *)SELF.get_pointer(), name); + Parrot_hsh_delete(INTERP, (Hash *)SELF.get_pointer(), name); } /* @@ -1023,7 +1023,7 @@ to retrieve symbols, if a NameSpace with the same name exists. */ METHOD get_sym(STRING *key) { - PMC *ns = (PMC *)parrot_hash_get(INTERP, (Hash *)SELF.get_pointer(), key); + PMC *ns = (PMC *)Parrot_hsh_get(INTERP, (Hash *)SELF.get_pointer(), key); if (!ns) RETURN(PMC *PMCNULL); diff --git a/src/pmc/pmcproxy.pmc b/src/pmc/pmcproxy.pmc index 2c18933ad2..8e2f2591a2 100644 --- a/src/pmc/pmcproxy.pmc +++ b/src/pmc/pmcproxy.pmc @@ -232,7 +232,7 @@ Returns whether the class is or inherits from C<*classname>. if (INTERP->vtables[_proxy->id]) { Hash *isa_hash = INTERP->vtables[_proxy->id]->isa_hash; PARROT_ASSERT(isa_hash); - if (parrot_hash_exists(INTERP, isa_hash, classname)) + if (Parrot_hsh_exists(INTERP, isa_hash, classname)) return 1; } @@ -280,7 +280,7 @@ Returns whether the class is or inherits from C<*classname>. return 1; } - if (isa_hash && parrot_hash_exists(INTERP, isa_hash, classname)) + if (isa_hash && Parrot_hsh_exists(INTERP, isa_hash, classname)) return 1; } diff --git a/src/pmc/unmanagedstruct.pmc b/src/pmc/unmanagedstruct.pmc index cdd610698d..a130185af3 100644 --- a/src/pmc/unmanagedstruct.pmc +++ b/src/pmc/unmanagedstruct.pmc @@ -233,8 +233,8 @@ key_2_idx(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key)) if (types->vtable->base_type == enum_class_OrderedHash) { Hash * const hash = (Hash *)VTABLE_get_pointer(interp, VTABLE_get_pmc(interp, types)); - HashBucket * const b = parrot_hash_get_bucket(interp, hash, - hash_key_from_string(interp, hash, VTABLE_get_string(interp, key))); + HashBucket * const b = Parrot_hsh_get_bucket(interp, hash, + Parrot_hsh_key_from_string(interp, hash, VTABLE_get_string(interp, key))); if (!b) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_KEY_NOT_FOUND, diff --git a/src/runcore/main.c b/src/runcore/main.c index 1602833ecd..f93b3997e3 100644 --- a/src/runcore/main.c +++ b/src/runcore/main.c @@ -342,11 +342,11 @@ parrot_hash_oplib(PARROT_INTERP, ARGIN(op_lib_t *lib)) for (i = 0; i < lib->op_count; i++) { op_info_t *op = &lib->op_info_table[i]; - parrot_hash_put(interp, interp->op_hash, (void *)op->full_name, + Parrot_hsh_put(interp, interp->op_hash, (void *)op->full_name, (void *)op); - if (!parrot_hash_exists(interp, interp->op_hash, (void *)op->name)) - parrot_hash_put(interp, interp->op_hash, (void *)op->name, + if (!Parrot_hsh_exists(interp, interp->op_hash, (void *)op->name)) + Parrot_hsh_put(interp, interp->op_hash, (void *)op->name, (void *)op); } } diff --git a/src/runcore/profiling.c b/src/runcore/profiling.c index dbee9a17cf..c484fe8c51 100644 --- a/src/runcore/profiling.c +++ b/src/runcore/profiling.c @@ -262,7 +262,7 @@ init_profiling_core(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore), A runcore->profiling_flags = 0; runcore->runloop_count = 0; runcore->time_size = 32; - runcore->line_cache = parrot_new_pointer_hash(interp); + runcore->line_cache = Parrot_hsh_new_pointer_hash(interp); runcore->time = mem_gc_allocate_n_typed(interp, runcore->time_size, UHUGEINTVAL); @@ -524,15 +524,15 @@ ARGIN(PMC *ctx_pmc)) Parrot_Context *ctx = PMC_data_typed(ctx_pmc, Parrot_Context *); - INTVAL line_num = hash_value_to_int(interp, runcore->line_cache, - parrot_hash_get(interp, runcore->line_cache, ctx->current_pc)); + INTVAL line_num = Parrot_hsh_value_to_int(interp, runcore->line_cache, + Parrot_hsh_get(interp, runcore->line_cache, ctx->current_pc)); /* Parrot_Sub_get_line_from_pc eats up about 20-30% of execution time * *with* this cache in place. */ if (line_num == 0) { line_num = Parrot_Sub_get_line_from_pc(interp, Parrot_pcc_get_sub(interp, ctx_pmc), ctx->current_pc); - parrot_hash_put(interp, runcore->line_cache, ctx->current_pc, (void *) line_num); + Parrot_hsh_put(interp, runcore->line_cache, ctx->current_pc, (void *) line_num); } return line_num; } @@ -918,7 +918,7 @@ destroy_profiling_core(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore) "output from this file.\n", filename_cstr); Parrot_str_free_cstring(filename_cstr); - parrot_hash_destroy(interp, runcore->line_cache); + Parrot_hsh_destroy(interp, runcore->line_cache); if (runcore->output_fn != record_values_none) fclose(runcore->profile_fd); diff --git a/src/string/api.c b/src/string/api.c index 2d81bbc334..d29bd39ba6 100644 --- a/src/string/api.c +++ b/src/string/api.c @@ -143,7 +143,7 @@ Parrot_str_init(PARROT_INTERP) } /* Set up the cstring cache, then load the basic encodings */ - const_cstring_hash = parrot_create_hash_sized(interp, + const_cstring_hash = Parrot_hsh_create_hash_sized(interp, enum_type_PMC, Hash_key_type_cstring, n_parrot_cstrings); @@ -168,7 +168,7 @@ Parrot_str_init(PARROT_INTERP) parrot_cstrings[i].len, Parrot_default_encoding_ptr, PObj_external_FLAG|PObj_constant_FLAG); - parrot_hash_put(interp, const_cstring_hash, + Parrot_hsh_put(interp, const_cstring_hash, PARROT_const_cast(char *, parrot_cstrings[i].string), (void *)s); interp->const_cstring_table[i] = s; } @@ -196,7 +196,7 @@ Parrot_str_finish(PARROT_INTERP) mem_internal_free(interp->const_cstring_table); interp->const_cstring_table = NULL; Parrot_deinit_encodings(interp); - parrot_hash_destroy(interp, interp->const_cstring_hash); + Parrot_hsh_destroy(interp, interp->const_cstring_hash); } } @@ -610,7 +610,7 @@ Parrot_str_new_constant(PARROT_INTERP, ARGIN(const char *buffer)) ASSERT_ARGS(Parrot_str_new_constant) DECL_CONST_CAST; Hash * const cstring_cache = (Hash *)interp->const_cstring_hash; - STRING *s = (STRING *)parrot_hash_get(interp, + STRING *s = (STRING *)Parrot_hsh_get(interp, cstring_cache, buffer); if (s) @@ -620,7 +620,7 @@ Parrot_str_new_constant(PARROT_INTERP, ARGIN(const char *buffer)) Parrot_default_encoding_ptr, PObj_external_FLAG|PObj_constant_FLAG); - parrot_hash_put(interp, cstring_cache, + Parrot_hsh_put(interp, cstring_cache, PARROT_const_cast(char *, buffer), (void *)s); return s; diff --git a/src/vtables.c b/src/vtables.c index 8795b81880..c75465e3b7 100644 --- a/src/vtables.c +++ b/src/vtables.c @@ -70,8 +70,8 @@ Parrot_vtbl_clone_vtable(PARROT_INTERP, ARGIN(const VTABLE *base_vtable)) /* when called from global PMC initialization, not all vtables have isa_hash * when called at runtime, they do */ if (base_vtable->isa_hash) { - new_vtable->isa_hash = parrot_new_hash(interp); - parrot_hash_clone(interp, base_vtable->isa_hash, new_vtable->isa_hash); + new_vtable->isa_hash = Parrot_hsh_new_hash(interp); + Parrot_hsh_clone(interp, base_vtable->isa_hash, new_vtable->isa_hash); } @@ -101,7 +101,7 @@ Parrot_vtbl_destroy_vtable(PARROT_INTERP, ARGFREE_NOTNULL(VTABLE *vtable)) VTABLE * const ro_vtable = vtable->ro_variant_vtable; if (ro_vtable->isa_hash) { - parrot_hash_destroy(interp, ro_vtable->isa_hash); + Parrot_hsh_destroy(interp, ro_vtable->isa_hash); if (ro_vtable->isa_hash == vtable->isa_hash) vtable->isa_hash = NULL; @@ -113,7 +113,7 @@ Parrot_vtbl_destroy_vtable(PARROT_INTERP, ARGFREE_NOTNULL(VTABLE *vtable)) } if (vtable->isa_hash) { - parrot_hash_destroy(interp, vtable->isa_hash); + Parrot_hsh_destroy(interp, vtable->isa_hash); vtable->isa_hash = NULL; }