X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6760cb07d6b57be16928d95339d71e57c4e24f36..e492be5ee5e8a76eef7899758c841c618ccf505d:/src/gras/DataDesc/ddt_convert.c diff --git a/src/gras/DataDesc/ddt_convert.c b/src/gras/DataDesc/ddt_convert.c index 11e9f19fe1..e329d76215 100644 --- a/src/gras/DataDesc/ddt_convert.c +++ b/src/gras/DataDesc/ddt_convert.c @@ -18,18 +18,25 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_convert, gras_ddt, /*** *** Table of all known architectures: *** - l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:) gras_arch=0; gras_arch_name=little32;; - l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=1; gras_arch_name=little32_4;; - - l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:) gras_arch=2; gras_arch_name=little64;; - - B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:) gras_arch=3; gras_arch_name=big32;; - B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=4; gras_arch_name=big32_8_4;; - B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=5; gras_arch_name=big32_4;; - B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:) gras_arch=6; gras_arch_name=big32_2;; - - B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:) gras_arch=7; gras_arch_name=big64;; - +l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1: #gras_arch=0; gras_size=32; gras_arch_name=little32_1; +l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #gras_arch=1; gras_size=32; gras_arch_name=little32_2; +l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=2; gras_size=32; gras_arch_name=little32_4; +l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #gras_arch=3; gras_size=32; gras_arch_name=little32_8; +l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=4; gras_size=64; gras_arch_name=little64; +l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=5; gras_size=64; gras_arch_name=little64_2; + +B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #gras_arch=6; gras_size=32; gras_arch_name=big32_8; +B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=7; gras_size=32; gras_arch_name=big32_8_4; +B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=8; gras_size=32; gras_arch_name=big32_4; +B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #gras_arch=9; gras_size=32; gras_arch_name=big32_2; +B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=10; gras_size=64; gras_arch_name=big64; +B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4: #gras_arch=11; gras_size=64; gras_arch_name=big64_8_4; + + PLEASE DO NOT MESS WITH THESE HARDCODED VALUES + + + Grep GRAS_THISARCH in buildtools/Cmake/CompleteInFiles.cmake for details + ***/ const gras_arch_desc_t gras_arches[gras_arch_count] = { @@ -49,6 +56,9 @@ const gras_arch_desc_t gras_arches[gras_arch_count] = { {"little64", 0, {1, 2, 4, 8, 8, 8, 8, 4, 8}, /* alpha, ia64 */ {1, 2, 4, 8, 8, 8, 8, 4, 8}}, + {"little64_2", 0, {1, 2, 4, 4, 8, 8, 8, 4, 8}, /* win64 */ + {1, 2, 4, 4, 8, 8, 8, 4, 8}}, + {"big32_8", 1, {1, 2, 4, 4, 8, 4, 4, 4, 8}, {1, 2, 4, 4, 8, 4, 4, 4, 8}}, @@ -79,7 +89,8 @@ const char *gras_datadesc_arch_name(int code) /** * Local function doing the grunt work */ -static void gras_dd_reverse_bytes(void *to, const void *from, size_t length); +static void gras_dd_reverse_bytes(void *to, const void *from, + size_t length); /** * gras_dd_convert_elm: @@ -109,9 +120,10 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, r_size = type->size[r_arch]; l_size = type->size[GRAS_THISARCH]; - DEBUG4("r_size=%lu l_size=%lu, src=%p dst=%p", r_size, l_size, src, dst); + XBT_DEBUG("r_size=%lu l_size=%lu, src=%p dst=%p", r_size, l_size, src, + dst); - DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l', + XBT_DEBUG("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l', gras_arches[GRAS_THISARCH].endian ? 'B' : 'l'); if (r_size != l_size) { @@ -137,14 +149,14 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, int padding; int sizeChange = l_size - r_size; int lowOrderFirst = !gras_arches[r_arch].endian || - gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian; + gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian; - DEBUG5("Resize integer %d from %lu @%p to %lu @%p", + XBT_DEBUG("Resize integer %d from %lu @%p to %lu @%p", cpt, r_size, r_data, l_size, l_data); - xbt_assert0(r_data != l_data, "Impossible to resize in place"); + xbt_assert(r_data != l_data, "Impossible to resize in place"); if (sizeChange < 0) { - DEBUG3("Truncate %d bytes (%s,%s)", -sizeChange, + XBT_DEBUG("Truncate %d bytes (%s,%s)", -sizeChange, lowOrderFirst ? "lowOrderFirst" : "bigOrderFirst", scal.encoding == e_gras_dd_scalar_encoding_sint ? "signed" : "unsigned"); @@ -154,15 +166,15 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, : r_data, l_size); if (scal.encoding == e_gras_dd_scalar_encoding_sint) { - DEBUG0("This is signed"); + XBT_DEBUG("This is signed"); /* Make sure the high order bit of r_data and l_data are the same */ l_sign = gras_arches[GRAS_THISARCH].endian - ? ((unsigned char *) l_data + l_size - 1) - : (unsigned char *) l_data; + ? ((unsigned char *) l_data + l_size - 1) + : (unsigned char *) l_data; r_sign = gras_arches[r_arch].endian - ? ((unsigned char *) r_data + r_size - 1) - : (unsigned char *) r_data; - DEBUG2("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign); + ? ((unsigned char *) r_data + r_size - 1) + : (unsigned char *) r_data; + XBT_DEBUG("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign); if ((*r_sign > 127) != (*l_sign > 127)) { if (*r_sign > 127) @@ -172,16 +184,16 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, } } } else { - DEBUG1("Extend %d bytes", sizeChange); + XBT_DEBUG("Extend %d bytes", sizeChange); if (scal.encoding != e_gras_dd_scalar_encoding_sint) { - DEBUG0("This is signed"); + XBT_DEBUG("This is signed"); padding = 0; /* pad unsigned with 0 */ } else { /* extend sign */ r_sign = - gras_arches[r_arch].endian ? ((unsigned char *) r_data + r_size - - 1) - : (unsigned char *) r_data; + gras_arches[r_arch].endian ? ((unsigned char *) r_data + + r_size - 1) + : (unsigned char *) r_data; padding = (*r_sign > 127) ? 0xff : 0; } @@ -216,14 +228,15 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, for (cpt = 0, r_data = dst, l_data = dst; cpt < count; cpt++, r_data = (char *) r_data + l_size, /* resizing already done */ l_data = (char *) l_data + l_size) { - DEBUG1("Flip elm %d", cpt); + XBT_DEBUG("Flip elm %d", cpt); gras_dd_reverse_bytes(l_data, r_data, l_size); } } } -static void gras_dd_reverse_bytes(void *to, const void *from, size_t length) +static void gras_dd_reverse_bytes(void *to, const void *from, + size_t length) { char charBegin;