X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ad5190b150d9238e9b73a4448aab3a550238fe27..e566c09daba9ad67b31f3992da9172eb04b807a8:/src/gras/DataDesc/ddt_exchange.c diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index b61f7f8fb4..60b19436e9 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -30,7 +30,7 @@ gras_dd_send_int(gras_socket_t sock, int *i, int stable) xbt_assert(int_type); } - DEBUG1("send_int(%u)", *i); + XBT_DEBUG("send_int(%u)", *i); gras_trp_send(sock, (char *) i, int_type->size[GRAS_THISARCH], stable); } @@ -55,7 +55,7 @@ gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) gras_dd_convert_elm(int_type, 1, r_arch, ptr, i); free(ptr); } - DEBUG1("recv_int(%u)", *i); + XBT_DEBUG("recv_int(%u)", *i); } /* @@ -81,19 +81,20 @@ static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char ** { char *l_data = NULL; - xbt_assert1(size > 0, "Cannot allocate %ld bytes!", size); + xbt_assert(size > 0, "Cannot allocate %ld bytes!", size); l_data = xbt_malloc((size_t) size); *l_ref = l_data; - DEBUG5("alloc_ref: l_data=%p, &l_data=%p; r_ref=%p; *r_ref=%p, r_len=%ld", - (void *) l_data, (void *) &l_data, - (void *) r_ref, (void *) (r_ref ? *r_ref : NULL), r_len); + XBT_DEBUG + ("alloc_ref: l_data=%p, &l_data=%p; r_ref=%p; *r_ref=%p, r_len=%ld", + (void *) l_data, (void *) &l_data, (void *) r_ref, + (void *) (r_ref ? *r_ref : NULL), r_len); if (detect_cycle && r_ref && !gras_dd_is_r_null(r_ref, r_len)) { void *ptr = xbt_malloc(sizeof(void *)); memcpy(ptr, l_ref, sizeof(void *)); - DEBUG2("Insert l_ref=%p under r_ref=%p", *(void **) ptr, + XBT_DEBUG("Insert l_ref=%p under r_ref=%p", *(void **) ptr, *(void **) r_ref); if (detect_cycle) @@ -105,7 +106,8 @@ static int gras_datadesc_memcpy_rec(gras_cbps_t state, xbt_dict_t refs, gras_datadesc_type_t type, - char *src, char *dst, int subsize, int detect_cycle) + char *src, char *dst, int subsize, + int detect_cycle) { @@ -113,7 +115,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, gras_datadesc_type_t sub_type; /* type on which we recurse */ int count = 0; - VERB5("Copy a %s (%s) from %p to %p (local sizeof=%ld)", + XBT_VERB("Copy a %s (%s) from %p to %p (local sizeof=%ld)", type->name, gras_datadesc_cat_names[type->category_code], src, dst, type->size[GRAS_THISARCH]); @@ -134,10 +136,10 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, char *field_dst; struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before copying it", type->name); - VERB1(">> Copy all fields of the structure %s", type->name); + XBT_VERB(">> Copy all fields of the structure %s", type->name); xbt_dynar_foreach(struct_data.fields, cpt, field) { field_src = src + field->offset[GRAS_THISARCH]; field_dst = dst + field->offset[GRAS_THISARCH]; @@ -147,39 +149,40 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, if (field->send) field->send(type, state, field_src); - DEBUG1("Copy field %s", field->name); + XBT_DEBUG("Copy field %s", field->name); count += - gras_datadesc_memcpy_rec(state, refs, sub_type, field_src, - field_dst, 0, detect_cycle - || sub_type->cycle); + gras_datadesc_memcpy_rec(state, refs, sub_type, field_src, + field_dst, 0, detect_cycle + || sub_type->cycle); if (XBT_LOG_ISENABLED(gras_ddt_exchange, xbt_log_priority_verbose)) { if (sub_type == gras_datadesc_by_name("unsigned int")) { - VERB2("Copied value for field '%s': %d (type: unsigned int)", + XBT_VERB("Copied value for field '%s': %d (type: unsigned int)", field->name, *(unsigned int *) field_dst); } else if (sub_type == gras_datadesc_by_name("int")) { - VERB2("Copied value for field '%s': %d (type: int)", field->name, - *(int *) field_dst); - - } else if (sub_type == gras_datadesc_by_name("unsigned long int")) { - VERB2 - ("Copied value for field '%s': %ld (type: unsigned long int)", - field->name, *(unsigned long int *) field_dst); + XBT_VERB("Copied value for field '%s': %d (type: int)", + field->name, *(int *) field_dst); + + } else if (sub_type == + gras_datadesc_by_name("unsigned long int")) { + XBT_VERB + ("Copied value for field '%s': %ld (type: unsigned long int)", + field->name, *(unsigned long int *) field_dst); } else if (sub_type == gras_datadesc_by_name("long int")) { - VERB2("Copied value for field '%s': %ld (type: long int)", + XBT_VERB("Copied value for field '%s': %ld (type: long int)", field->name, *(long int *) field_dst); } else if (sub_type == gras_datadesc_by_name("string")) { - VERB2("Copied value for field '%s': '%s' (type: string)", + XBT_VERB("Copied value for field '%s': '%s' (type: string)", field->name, *(char **) field_dst); } else { - VERB1("Copied a value for field '%s' (type not scalar?)", + XBT_VERB("Copied a value for field '%s' (type not scalar?)", field->name); } } } - VERB1("<< Copied all fields of the structure %s", type->name); + XBT_VERB("<< Copied all fields of the structure %s", type->name); break; } @@ -191,23 +194,25 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before copying it", type->name); /* retrieve the field number */ field_num = union_data.selector(type, state, src); - xbt_assert1(field_num > 0, + xbt_assert(field_num > 0, "union field selector of %s gave a negative value", type->name); - xbt_assert3(field_num < xbt_dynar_length(union_data.fields), + xbt_assert(field_num < xbt_dynar_length(union_data.fields), "union field selector of %s returned %d but there is only %lu fields", - type->name, field_num, xbt_dynar_length(union_data.fields)); + type->name, field_num, + xbt_dynar_length(union_data.fields)); /* Copy the content */ field = - xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t); + xbt_dynar_get_as(union_data.fields, field_num, + gras_dd_cat_field_t); sub_type = field->type; if (field->send) @@ -235,7 +240,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, /* Send the pointed data only if not already sent */ if (*(void **) src == NULL) { - VERB0("Not copying NULL referenced data"); + XBT_VERB("Not copying NULL referenced data"); *(void **) dst = NULL; break; } @@ -243,16 +248,18 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, reference_is_to_cpy = 1; if (detect_cycle && - (n_ref=xbt_dict_get_or_null_ext(refs, (char *) o_ref, sizeof(char *)))) { + (n_ref = + xbt_dict_get_or_null_ext(refs, (char *) o_ref, + sizeof(char *)))) { /* already known, no need to copy it */ - //INFO0("Cycle detected"); + //XBT_INFO("Cycle detected"); reference_is_to_cpy = 0; } if (reference_is_to_cpy) { int subsubcount = -1; void *l_referenced = NULL; - VERB2("Copy a ref to '%s' referenced at %p", sub_type->name, + XBT_VERB("Copy a ref to '%s' referenced at %p", sub_type->name, (void *) *o_ref); if (!pointer_type) { @@ -268,12 +275,14 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, subsub_type = array_data.type; subsubcount = array_data.fixed_size; if (subsubcount == -1) - subsubcount = array_data.dynamic_size(subsub_type, state, *o_ref); + subsubcount = + array_data.dynamic_size(subsub_type, state, *o_ref); if (subsubcount != 0) gras_dd_alloc_ref(refs, - subsub_type->size[GRAS_THISARCH] * subsubcount, - o_ref, pointer_type->size[GRAS_THISARCH], + subsub_type->size[GRAS_THISARCH] * + subsubcount, o_ref, + pointer_type->size[GRAS_THISARCH], (char **) &l_referenced, detect_cycle); } else { gras_dd_alloc_ref(refs, sub_type->size[GRAS_THISARCH], @@ -287,13 +296,13 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, || sub_type->cycle); *(void **) dst = l_referenced; - VERB3("'%s' previously referenced at %p now at %p", + XBT_VERB("'%s' previously referenced at %p now at %p", sub_type->name, *(void **) o_ref, l_referenced); } else { - VERB2 - ("NOT copying data previously referenced @%p (already done, @%p now)", - *(void **) o_ref, *(void **) n_ref); + XBT_VERB + ("NOT copying data previously referenced @%p (already done, @%p now)", + *(void **) o_ref, *(void **) n_ref); *(void **) dst = *n_ref; @@ -316,39 +325,43 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, array_count = subsize; if (array_count == -1) { array_count = array_data.dynamic_size(type, state, src); - xbt_assert1(array_count >= 0, - "Invalid (negative) array size for type %s", type->name); + xbt_assert(array_count >= 0, + "Invalid (negative) array size for type %s", + type->name); } /* send the content */ sub_type = array_data.type; elm_size = sub_type->aligned_size[GRAS_THISARCH]; if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) { - VERB1("Array of %ld scalars, copy it in one shot", array_count); - memcpy(dst, src, sub_type->aligned_size[GRAS_THISARCH] * array_count); + XBT_VERB("Array of %ld scalars, copy it in one shot", array_count); + memcpy(dst, src, + sub_type->aligned_size[GRAS_THISARCH] * array_count); count += sub_type->aligned_size[GRAS_THISARCH] * array_count; - } else if (sub_type->category_code == e_gras_datadesc_type_cat_array && - sub_type->category.array_data.fixed_size > 0 && - sub_type->category.array_data.type->category_code == + } else if (sub_type->category_code == e_gras_datadesc_type_cat_array + && sub_type->category.array_data.fixed_size > 0 + && sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) { - VERB1("Array of %ld fixed array of scalars, copy it in one shot", + XBT_VERB("Array of %ld fixed array of scalars, copy it in one shot", array_count); memcpy(dst, src, - sub_type->category.array_data.type->aligned_size[GRAS_THISARCH] + sub_type->category.array_data. + type->aligned_size[GRAS_THISARCH] * array_count * sub_type->category.array_data.fixed_size); count += - sub_type->category.array_data.type->aligned_size[GRAS_THISARCH] - * array_count * sub_type->category.array_data.fixed_size; + sub_type->category.array_data.type->aligned_size[GRAS_THISARCH] + * array_count * sub_type->category.array_data.fixed_size; } else { - VERB1("Array of %ld stuff, copy it in one after the other", + XBT_VERB("Array of %ld stuff, copy it in one after the other", array_count); for (cpt = 0; cpt < array_count; cpt++) { - VERB2("Copy the %dth stuff out of %ld", cpt, array_count); + XBT_VERB("Copy the %dth stuff out of %ld", cpt, array_count); count += - gras_datadesc_memcpy_rec(state, refs, sub_type, src_ptr, dst_ptr, - 0, detect_cycle || sub_type->cycle); + gras_datadesc_memcpy_rec(state, refs, sub_type, src_ptr, + dst_ptr, 0, detect_cycle + || sub_type->cycle); src_ptr += elm_size; dst_ptr += elm_size; } @@ -372,14 +385,13 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, */ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst) { - xbt_ex_t e; static gras_cbps_t state = NULL; static xbt_dict_t refs = NULL; /* all references already sent */ int size = 0; - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); - DEBUG3("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src, + XBT_DEBUG("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src, dst); if (!state) { state = gras_cbps_new(); @@ -387,11 +399,15 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst) } TRY { - size = gras_datadesc_memcpy_rec(state, refs, type, (char *) src, (char *) dst,0, type->cycle); - } _CLEANUP { + size = + gras_datadesc_memcpy_rec(state, refs, type, (char *) src, + (char *) dst, 0, type->cycle); + } + TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); - } CATCH(e) { + } + CATCH_ANONYMOUS { RETHROW; } return size; @@ -412,15 +428,15 @@ gras_datadesc_send_rec(gras_socket_t sock, unsigned int cpt; gras_datadesc_type_t sub_type; /* type on which we recurse */ - VERB2("Send a %s (%s)", + XBT_VERB("Send a %s (%s)", type->name, gras_datadesc_cat_names[type->category_code]); if (!strcmp(type->name, "string")) - VERB1("value: '%s'", *(char **) data); + XBT_VERB("value: '%s'", *(char **) data); if (type->send) { type->send(type, state, data); - DEBUG0("Run the emission callback"); + XBT_DEBUG("Run the emission callback"); } switch (type->category_code) { @@ -434,10 +450,10 @@ gras_datadesc_send_rec(gras_socket_t sock, char *field_data; struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before sending it", type->name); - VERB1(">> Send all fields of the structure %s", type->name); + XBT_VERB(">> Send all fields of the structure %s", type->name); xbt_dynar_foreach(struct_data.fields, cpt, field) { field_data = data; field_data += field->offset[GRAS_THISARCH]; @@ -445,16 +461,16 @@ gras_datadesc_send_rec(gras_socket_t sock, sub_type = field->type; if (field->send) { - DEBUG1("Run the emission callback of field %s", field->name); + XBT_DEBUG("Run the emission callback of field %s", field->name); field->send(type, state, field_data); } - VERB1("Send field %s", field->name); + XBT_VERB("Send field %s", field->name); gras_datadesc_send_rec(sock, state, refs, sub_type, field_data, detect_cycle || sub_type->cycle); } - VERB1("<< Sent all fields of the structure %s", type->name); + XBT_VERB("<< Sent all fields of the structure %s", type->name); break; } @@ -466,26 +482,28 @@ gras_datadesc_send_rec(gras_socket_t sock, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before sending it", type->name); /* retrieve the field number */ field_num = union_data.selector(type, state, data); - xbt_assert1(field_num > 0, + xbt_assert(field_num > 0, "union field selector of %s gave a negative value", type->name); - xbt_assert3(field_num < xbt_dynar_length(union_data.fields), + xbt_assert(field_num < xbt_dynar_length(union_data.fields), "union field selector of %s returned %d but there is only %lu fields", - type->name, field_num, xbt_dynar_length(union_data.fields)); + type->name, field_num, + xbt_dynar_length(union_data.fields)); /* Send the field number */ gras_dd_send_int(sock, &field_num, 0 /* not stable */ ); /* Send the content */ field = - xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t); + xbt_dynar_get_as(union_data.fields, field_num, + gras_dd_cat_field_t); sub_type = field->type; if (field->send) @@ -522,26 +540,28 @@ gras_datadesc_send_rec(gras_socket_t sock, /* Send the pointed data only if not already sent */ if (*(void **) data == NULL) { - VERB0("Not sending NULL referenced data"); + XBT_VERB("Not sending NULL referenced data"); break; } reference_is_to_send = 1; /* return ignored. Just checking whether it's known or not */ - if (detect_cycle && xbt_dict_get_or_null_ext(refs, (char *) ref, sizeof(char *))) { - //INFO0("Cycle detected"); + if (detect_cycle + && xbt_dict_get_or_null_ext(refs, (char *) ref, + sizeof(char *))) { + //XBT_INFO("Cycle detected"); reference_is_to_send = 0; } if (reference_is_to_send) { - VERB1("Sending data referenced at %p", (void *) *ref); + XBT_VERB("Sending data referenced at %p", (void *) *ref); if (detect_cycle) xbt_dict_set_ext(refs, (char *) ref, sizeof(void *), ref, NULL); gras_datadesc_send_rec(sock, state, refs, sub_type, *ref, detect_cycle || sub_type->cycle); } else { - VERB1("Not sending data referenced at %p (already done)", + XBT_VERB("Not sending data referenced at %p (already done)", (void *) *ref); } @@ -560,8 +580,9 @@ gras_datadesc_send_rec(gras_socket_t sock, count = array_data.fixed_size; if (count == -1) { count = array_data.dynamic_size(type, state, data); - xbt_assert1(count >= 0, - "Invalid (negative) array size for type %s", type->name); + xbt_assert(count >= 0, + "Invalid (negative) array size for type %s", + type->name); gras_dd_send_int(sock, &count, 0 /*non-stable */ ); } @@ -569,16 +590,16 @@ gras_datadesc_send_rec(gras_socket_t sock, sub_type = array_data.type; elm_size = sub_type->aligned_size[GRAS_THISARCH]; if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) { - VERB1("Array of %d scalars, send it in one shot", count); + XBT_VERB("Array of %d scalars, send it in one shot", count); gras_trp_send(sock, data, sub_type->aligned_size[GRAS_THISARCH] * count, 0 /* not stable */ ); - } else if (sub_type->category_code == e_gras_datadesc_type_cat_array && - sub_type->category.array_data.fixed_size > 0 && - sub_type->category.array_data.type->category_code == + } else if (sub_type->category_code == e_gras_datadesc_type_cat_array + && sub_type->category.array_data.fixed_size > 0 + && sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) { - VERB1("Array of %d fixed array of scalars, send it in one shot", + XBT_VERB("Array of %d fixed array of scalars, send it in one shot", count); gras_trp_send(sock, data, sub_type->category.array_data. @@ -610,12 +631,10 @@ gras_datadesc_send_rec(gras_socket_t sock, void gras_datadesc_send(gras_socket_t sock, gras_datadesc_type_t type, void *src) { - - xbt_ex_t e; static gras_cbps_t state = NULL; static xbt_dict_t refs = NULL; /* all references already sent */ - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); if (!state) { state = gras_cbps_new(); @@ -625,10 +644,12 @@ void gras_datadesc_send(gras_socket_t sock, TRY { gras_datadesc_send_rec(sock, state, refs, type, (char *) src, type->cycle); - } _CLEANUP { + } + TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); - } CATCH(e) { + } + CATCH_ANONYMOUS { RETHROW; } } @@ -659,7 +680,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, unsigned int cpt; gras_datadesc_type_t sub_type; - VERB2("Recv a %s @%p", type->name, (void *) l_data); + XBT_VERB("Recv a %s @%p", type->name, (void *) l_data); xbt_assert(l_data); switch (type->category_code) { @@ -684,10 +705,10 @@ gras_datadesc_recv_rec(gras_socket_t sock, struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before receiving it", type->name); - VERB1(">> Receive all fields of the structure %s", type->name); + XBT_VERB(">> Receive all fields of the structure %s", type->name); xbt_dynar_foreach(struct_data.fields, cpt, field) { char *field_data = l_data + field->offset[GRAS_THISARCH]; @@ -699,12 +720,12 @@ gras_datadesc_recv_rec(gras_socket_t sock, detect_cycle || sub_type->cycle); if (field->recv) { - DEBUG1("Run the reception callback of field %s", field->name); + XBT_DEBUG("Run the reception callback of field %s", field->name); field->recv(type, state, (void *) l_data); } } - VERB1("<< Received all fields of the structure %s", type->name); + XBT_VERB("<< Received all fields of the structure %s", type->name); break; } @@ -716,22 +737,23 @@ gras_datadesc_recv_rec(gras_socket_t sock, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before receiving it", type->name); /* retrieve the field number */ gras_dd_recv_int(sock, r_arch, &field_num); if (field_num < 0) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Received union field for %s is negative", type->name); if (field_num > xbt_dynar_length(union_data.fields)) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Received union field for %s is said to be #%d but there is only %lu fields", type->name, field_num, xbt_dynar_length(union_data.fields)); /* Recv the content */ field = - xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t); + xbt_dynar_get_as(union_data.fields, field_num, + gras_dd_cat_field_t); sub_type = field->type; gras_datadesc_recv_rec(sock, state, refs, sub_type, @@ -771,7 +793,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, /* Receive the pointed data only if not already sent */ if (gras_dd_is_r_null(r_ref, pointer_type->size[r_arch])) { - VERB1("Not receiving data remotely referenced @%p since it's NULL", + XBT_VERB("Not receiving data remotely referenced @%p since it's NULL", *(void **) r_ref); *(void **) l_data = NULL; free(r_ref); @@ -780,17 +802,18 @@ gras_datadesc_recv_rec(gras_socket_t sock, reference_is_to_recv = 1; if (detect_cycle && (l_ref = - xbt_dict_get_or_null_ext(refs, (char *) r_ref, - pointer_type->size[r_arch]))) { + xbt_dict_get_or_null_ext(refs, (char *) r_ref, + pointer_type->size + [r_arch]))) { reference_is_to_recv = 0; - //INFO0("Cycle detected"); + //XBT_INFO("Cycle detected"); } if (reference_is_to_recv) { int subsubcount = -1; void *l_referenced = NULL; - VERB2("Receiving a ref to '%s', remotely @%p", + XBT_VERB("Receiving a ref to '%s', remotely @%p", sub_type->name, *(void **) r_ref); if (sub_type->category_code == e_gras_datadesc_type_cat_array) { /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */ @@ -805,8 +828,9 @@ gras_datadesc_recv_rec(gras_socket_t sock, if (subsubcount != 0) gras_dd_alloc_ref(refs, - subsub_type->size[GRAS_THISARCH] * subsubcount, - r_ref, pointer_type->size[r_arch], + subsub_type->size[GRAS_THISARCH] * + subsubcount, r_ref, + pointer_type->size[r_arch], (char **) &l_referenced, detect_cycle); else l_referenced = NULL; @@ -823,13 +847,13 @@ gras_datadesc_recv_rec(gras_socket_t sock, detect_cycle || sub_type->cycle); *(void **) l_data = l_referenced; - VERB3("'%s' remotely referenced at %p locally at %p", + XBT_VERB("'%s' remotely referenced at %p locally at %p", sub_type->name, *(void **) r_ref, l_referenced); } else { - VERB2 - ("NOT receiving data remotely referenced @%p (already done, @%p here)", - *(void **) r_ref, *(void **) l_ref); + XBT_VERB + ("NOT receiving data remotely referenced @%p (already done, @%p here)", + *(void **) r_ref, *(void **) l_ref); *(void **) l_data = *l_ref; @@ -852,13 +876,13 @@ gras_datadesc_recv_rec(gras_socket_t sock, if (count == -1) gras_dd_recv_int(sock, r_arch, &count); if (count == -1) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Invalid (=-1) array size for type %s", type->name); /* receive the content */ sub_type = array_data.type; if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) { - VERB1("Array of %d scalars, get it in one shoot", count); + XBT_VERB("Array of %d scalars, get it in one shoot", count); if (sub_type->aligned_size[GRAS_THISARCH] >= sub_type->aligned_size[r_arch]) { gras_trp_recv(sock, (char *) l_data, @@ -868,20 +892,21 @@ gras_datadesc_recv_rec(gras_socket_t sock, } else { ptr = xbt_malloc(sub_type->aligned_size[r_arch] * count); - gras_trp_recv(sock, (char *) ptr, sub_type->size[r_arch] * count); + gras_trp_recv(sock, (char *) ptr, + sub_type->size[r_arch] * count); if (r_arch != GRAS_THISARCH) gras_dd_convert_elm(sub_type, count, r_arch, ptr, l_data); free(ptr); } - } else if (sub_type->category_code == e_gras_datadesc_type_cat_array && - sub_type->category.array_data.fixed_size >= 0 && - sub_type->category.array_data.type->category_code == + } else if (sub_type->category_code == e_gras_datadesc_type_cat_array + && sub_type->category.array_data.fixed_size >= 0 + && sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) { gras_datadesc_type_t subsub_type; array_data = sub_type->category.array_data; subsub_type = array_data.type; - VERB1("Array of %d fixed array of scalars, get it in one shot", + XBT_VERB("Array of %d fixed array of scalars, get it in one shot", count); if (subsub_type->aligned_size[GRAS_THISARCH] >= subsub_type->aligned_size[r_arch]) { @@ -893,8 +918,8 @@ gras_datadesc_recv_rec(gras_socket_t sock, r_arch, l_data, l_data); } else { ptr = - xbt_malloc(subsub_type->aligned_size[r_arch] * count * - array_data.fixed_size); + xbt_malloc(subsub_type->aligned_size[r_arch] * count * + array_data.fixed_size); gras_trp_recv(sock, (char *) ptr, subsub_type->size[r_arch] * count * @@ -909,7 +934,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, } else { /* not scalar content, get it recursively (may contain pointers) */ elm_size = sub_type->aligned_size[GRAS_THISARCH]; - VERB2("Receive a %d-long array of %s", count, sub_type->name); + XBT_VERB("Receive a %d-long array of %s", count, sub_type->name); ptr = l_data; for (cpt = 0; cpt < count; cpt++) { @@ -931,7 +956,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, type->recv(type, state, l_data); if (!strcmp(type->name, "string")) - VERB1("value: '%s'", *(char **) l_data); + XBT_VERB("value: '%s'", *(char **) l_data); } @@ -946,8 +971,6 @@ void gras_datadesc_recv(gras_socket_t sock, gras_datadesc_type_t type, int r_arch, void *dst) { - - xbt_ex_t e; static gras_cbps_t state = NULL; /* callback persistent state */ static xbt_dict_t refs = NULL; /* all references already sent */ @@ -956,14 +979,16 @@ gras_datadesc_recv(gras_socket_t sock, refs = xbt_dict_new(); } - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); TRY { gras_datadesc_recv_rec(sock, state, refs, type, r_arch, NULL, 0, (char *) dst, -1, type->cycle); - } _CLEANUP { + } + TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); - } CATCH(e) { + } + CATCH_ANONYMOUS { RETHROW; } }