[svn:parrot] r38822 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat May 16 10:35:32 UTC 2009
Author: chromatic
Date: Sat May 16 10:35:31 2009
New Revision: 38822
URL: https://trac.parrot.org/parrot/changeset/38822
Log:
[PMC] Modified PMC initializations to avoid unnecessary use of
mem_allocate_zeroed_* functions, as they're slightly more expensive than
non-zeroed allocations -- especially as these initializers immediately
overwrite allocated memory.
Modified:
trunk/src/pmc/fixedpmcarray.pmc
trunk/src/pmc/namespace.pmc
trunk/src/pmc/nci.pmc
trunk/src/pmc/string.pmc
trunk/src/pmc/unmanagedstruct.pmc
Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc Sat May 16 10:06:09 2009 (r38821)
+++ trunk/src/pmc/fixedpmcarray.pmc Sat May 16 10:35:31 2009 (r38822)
@@ -373,7 +373,7 @@
return;
PMC_size(SELF) = size;
- data = mem_allocate_n_zeroed_typed(size, PMC *);
+ data = mem_allocate_n_typed(size, PMC *);
for (i = 0; i < size; i++)
data[i] = PMCNULL;
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Sat May 16 10:06:09 2009 (r38821)
+++ trunk/src/pmc/namespace.pmc Sat May 16 10:35:31 2009 (r38822)
@@ -148,7 +148,6 @@
mem_allocate_zeroed_typed(Parrot_NameSpace_attributes);
PARROT_NAMESPACE(SELF)->vtable = PMCNULL;
PARROT_NAMESPACE(SELF)->_class = PMCNULL;
- PARROT_NAMESPACE(SELF)->_class = PMCNULL;
SELF.set_pointer(parrot_new_hash(INTERP));
PObj_custom_mark_destroy_SETALL(SELF);
}
Modified: trunk/src/pmc/nci.pmc
==============================================================================
--- trunk/src/pmc/nci.pmc Sat May 16 10:06:09 2009 (r38821)
+++ trunk/src/pmc/nci.pmc Sat May 16 10:35:31 2009 (r38822)
@@ -25,7 +25,7 @@
void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_info) {
char *sig_c = Parrot_str_to_cstring(interp, sig);
size_t sig_length = strlen(sig_c);
- char *param_sig = mem_allocate_n_zeroed_typed(sig_length, char);
+ char *param_sig = mem_allocate_n_typed(sig_length, char);
size_t j = 0;
size_t i;
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc Sat May 16 10:06:09 2009 (r38821)
+++ trunk/src/pmc/string.pmc Sat May 16 10:35:31 2009 (r38822)
@@ -34,9 +34,8 @@
*/
VTABLE void init() {
-
Parrot_String_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_String_attributes);
+ mem_allocate_typed(Parrot_String_attributes);
attrs->str_val = Parrot_str_new_noinit(INTERP, enum_stringrep_one, 0);
PMC_data(SELF) = attrs;
Modified: trunk/src/pmc/unmanagedstruct.pmc
==============================================================================
--- trunk/src/pmc/unmanagedstruct.pmc Sat May 16 10:06:09 2009 (r38821)
+++ trunk/src/pmc/unmanagedstruct.pmc Sat May 16 10:35:31 2009 (r38822)
@@ -653,8 +653,8 @@
pmclass UnManagedStruct need_ext no_ro {
ATTR void *ptr; /* the struct that this UnManagedStruct isn't managing */
- ATTR INTVAL size; /* the size of the struct */
ATTR PMC *init; /* the initializer used with this UnManagedStruct */
+ ATTR INTVAL size; /* the size of the struct */
/*
@@ -707,7 +707,9 @@
*/
VTABLE void init_pmc(PMC *value) {
- SELF.init();
+ Parrot_UnManagedStruct_attributes *attrs =
+ mem_allocate_typed(Parrot_UnManagedStruct_attributes);
+ PMC_data(SELF) = attrs;
SELF.set_pmc(value);
}
More information about the parrot-commits
mailing list