/* This program is free software; you can redistribute it and/or modify it
under the terms of the license (GNU LGPL) which comes with this package. */
+#include "xbt/misc.h" /* min()/max() */
#include "gras/DataDesc/datadesc_private.h"
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions");
}
}
-static void
-gras_ddt_new(const char *name,
- gras_datadesc_type_t **dst) {
+static gras_datadesc_type_t *gras_ddt_new(const char *name) {
gras_error_t errcode;
gras_datadesc_type_t *res;
res->name = (char*)strdup(name);
res->name_len = strlen(name);
+ res->cycle = 0;
- *dst=res;
gras_set_add(gras_datadesc_set_local,
(gras_set_elm_t*)res,&gras_ddt_freev);
GRAS_OUT;
+ return res;
}
/**
VERB1("Discarding redefinition of %s",name);
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
for (arch = 0; arch < gras_arch_count; arch ++) {
long int sz;
VERB1("Discarding redefinition of %s",name);
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
for (arch=0; arch<gras_arch_count; arch ++) {
res->size[arch] = 0;
res->aligned_size[arch] = 0;
}
res->category_code = e_gras_datadesc_type_cat_struct;
- gras_dynar_new(&(res->category.struct_data.fields),
- sizeof(gras_dd_cat_field_t*),
- &gras_dd_cat_field_free);
+ res->category.struct_data.fields =
+ gras_dynar_new(sizeof(gras_dd_cat_field_t*),
+ &gras_dd_cat_field_free);
GRAS_OUT;
return res;
struct_type->category.struct_data.closed = 1;
}
+/**
+ * gras_datadesc_cycle_set:
+ *
+ * Tell GRAS that the pointers of the type described by @ddt may present
+ * some loop, and that the cycle detection mecanism is needed.
+ *
+ * Note that setting this option when not needed have a rather bad effect
+ * on the performance (several times slower on big data).
+ */
+void
+gras_datadesc_cycle_set(gras_datadesc_type_t *ddt) {
+ ddt->cycle = 1;
+}
+/**
+ * gras_datadesc_cycle_unset:
+ *
+ * Tell GRAS that the pointers of the type described by @ddt do not present
+ * any loop and that cycle detection mecanism are not needed.
+ * (default)
+ */
+void
+gras_datadesc_cycle_unset(gras_datadesc_type_t *ddt) {
+ ddt->cycle = 0;
+}
+
/**
* gras_datadesc_union:
*
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
for (arch=0; arch<gras_arch_count; arch ++) {
res->size[arch] = 0;
}
res->category_code = e_gras_datadesc_type_cat_union;
- gras_dynar_new(&(res->category.union_data.fields),
- sizeof(gras_dd_cat_field_t*),
- &gras_dd_cat_field_free);
+ res->category.union_data.fields =
+ gras_dynar_new(sizeof(gras_dd_cat_field_t*),
+ &gras_dd_cat_field_free);
res->category.union_data.selector = selector;
return res;
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
gras_assert0(pointer_type, "Cannot get the description of data pointer");
VERB1("Discarding redefinition of %s",name);
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
gras_assert0(pointer_type, "Cannot get the description of data pointer");
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
for (arch=0; arch<gras_arch_count; arch ++) {
return res;
}
- gras_ddt_new(name,&res);
+ res = gras_ddt_new(name);
for (arch=0; arch<gras_arch_count; arch ++) {
res->size[arch] = 0; /* make sure it indicates "dynamic" */