1. 27 Oct, 2015 1 commit
  2. 25 Oct, 2015 8 commits
    • David Gibson's avatar
      lqueue: Streamline interface with TCON_CONTAINER · 42b7ab48
      David Gibson authored
      The interfaces the lqueue module currently has implement (partial) type
      safety in a somewhat clunky way - types and member names need to be passed
      to a number of entry points.
      
      This patch uses the new TCON_CONTAINER magic to stash the typing
      information into the declaration of the queue object, so it no longer needs
      to be explicitly passed to later calls.
      
      This does alter the lqueue interface incompatibly.  I think the module
      is young enough that we can reasonably do that.  One other module,
      'aga', was using lqueue, and this also includes fixes so that it still
      works.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      42b7ab48
    • David Gibson's avatar
      lstack: Streamline interface with TCON_CONTAINER · e47d78e9
      David Gibson authored
      The interfaces the lstack module currently has implement (partial) type
      safety in a somewhat clunk way - types and member names need to be passed
      to a number of entry points.
      
      This patch uses the new TCON_CONTAINER magic to stash the typing
      information into the declaration of the stack object, so it no longer needs
      to be explicitly passed to later calls.
      
      This does alter the lstack interface incompatibly.  I think the module
      is young enough that we can reasonably do that.  One other module,
      'aga', was using lstack, and this also includes fixes so that it still
      works.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      e47d78e9
    • David Gibson's avatar
      tcon: Encode information on container members in "type" canaries · 0ddea413
      David Gibson authored
      Add "container canaries" to tcon.  This allows information about a specific
      member of a container structure to be encoded with TCON or TCON_WRAP.  Once
      that's done, tcon_container_of() and tcon_member_of() can be used to
      translate between member and container pointers based on the canary
      information, without having to repeat the type and member details.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      0ddea413
    • David Gibson's avatar
      tcon: Encode integer values into "type" canaries · fd48aee6
      David Gibson authored
      Add the ability to encode, as well as types, integer values (must be
      positive, compile time constant and in the range of size_t) into TCON
      constructed "type" canaries.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      fd48aee6
    • David Gibson's avatar
      tcon: Add tcon_sizeof() helper · cc3db07e
      David Gibson authored
      Add a new tcon_sizeof() helper macro which returns the size of a type for
      which a canary has been constructed with TCON or TCON_WRAP.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      cc3db07e
    • David Gibson's avatar
      tcon: Add an alternate way of building type canaries · 43992de4
      David Gibson authored
      The tcon module allows you to add "type canaries" to a structures, which
      can be used for later typechecks.  The canaries are implemented using
      a flexible array member, to avoid them taking any actual space at runtime.
      That means the canaries must go at the end of your structure.
      
      That doesn't seem like a big limitation, except that it also means the
      structure containing the canaries must be at the end of any structure it
      is embedded in in turn, which is a rather more serious limitation.
      
      This patch adds a TCON_WRAP() macro which wraps a given type in a new type
      which also contains type canaries, and doesn't suffer the last member
      limitation.  The drawback is that if the wrapped type has smaller size than
      a pointer, the type canaries will pad the wrapped type out to the size of a
      pointer.
      
      By constructing the wrappers carefully, the existing tcon macros will work
      on both wrapper types constructed with TCON_WRAP and on structures
      explicitly including TCON type canaries.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      43992de4
    • David Gibson's avatar
      lstack, lqueue: Move from MODS_WITH_SRC to MODS_NO_SRC · fced03d3
      David Gibson authored
      The lstack and lqueue modules are entirely implemented in a single header.
      However, in Makefile-ccan they're listed in MODS_WITH_SRC, instead of
      MODS_NO_SRC.  This appears to be harmless, but this patch moves them to
      the correct category anyway.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      fced03d3
    • David Gibson's avatar
      ptrint: ptr2int and int2ptr are constant functions · 14addbab
      David Gibson authored
      By construction these functions depend only on their arguments, so declare
      them as CONST_FUNCTION using the helper from ccan/compiler.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      14addbab
  3. 21 Oct, 2015 2 commits
  4. 20 Oct, 2015 1 commit
  5. 18 Oct, 2015 2 commits
  6. 16 Oct, 2015 1 commit
  7. 15 Oct, 2015 4 commits
    • Rusty Russell's avatar
      mem: get clever with memeqzero(). · 6e5c2f3f
      Rusty Russell authored
      Best of both worlds.
      
      Before:
      1: 6ns
      2: 7ns
      4: 7ns
      8: 7ns
      16: 7ns
      32: 8ns
      64: 9ns
      128: 13ns
      256: 24ns
      512: 47ns
      1024: 92ns
      2048: 185ns
      4096: 376ns
      8192: 739ns
      16384: 1463ns
      32768: 2914ns
      65536: 5800ns
      2: 7ns
      3: 7ns
      5: 7ns
      9: 7ns
      17: 7ns
      33: 8ns
      65: 9ns
      129: 20ns
      257: 31ns
      513: 49ns
      1025: 96ns
      2049: 189ns
      4097: 381ns
      8193: 745ns
      16385: 1477ns
      32769: 2930ns
      65537: 5824ns
      total = 599391004
      
      After:
      1: 3ns
      2: 3ns
      4: 4ns
      8: 5ns
      16: 12ns
      32: 13ns
      64: 15ns
      128: 19ns
      256: 25ns
      512: 35ns
      1024: 57ns
      2048: 105ns
      4096: 183ns
      8192: 324ns
      16384: 607ns
      32768: 1317ns
      65536: 2774ns
      2: 3ns
      3: 3ns
      5: 4ns
      9: 6ns
      17: 11ns
      33: 13ns
      65: 14ns
      129: 19ns
      257: 24ns
      513: 35ns
      1025: 57ns
      2049: 106ns
      4097: 183ns
      8193: 324ns
      16385: 607ns
      32769: 1315ns
      65537: 2773ns
      total = 599391004
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      6e5c2f3f
    • Rusty Russell's avatar
      mem: optimize. · b967dac8
      Rusty Russell authored
      Better for larger, worse for smaller compares.
      
      Before:
      1: 3ns
      2: 3ns
      4: 5ns
      8: 9ns
      16: 11ns
      32: 33ns
      64: 45ns
      128: 87ns
      256: 157ns
      512: 296ns
      1024: 579ns
      2048: 1139ns
      4096: 2251ns
      8192: 4505ns
      16384: 9704ns
      32768: 18482ns
      65536: 36144ns
      2: 4ns
      3: 6ns
      5: 8ns
      9: 9ns
      17: 12ns
      33: 22ns
      65: 45ns
      129: 90ns
      257: 175ns
      513: 357ns
      1025: 607ns
      2049: 1204ns
      4097: 2278ns
      8193: 4552ns
      16385: 9011ns
      32769: 18405ns
      65537: 36153ns
      total = 599391004
      
      After:
      1: 6ns
      2: 7ns
      4: 7ns
      8: 7ns
      16: 7ns
      32: 8ns
      64: 9ns
      128: 13ns
      256: 24ns
      512: 47ns
      1024: 92ns
      2048: 185ns
      4096: 376ns
      8192: 739ns
      16384: 1463ns
      32768: 2914ns
      65536: 5800ns
      2: 7ns
      3: 7ns
      5: 7ns
      9: 7ns
      17: 7ns
      33: 8ns
      65: 9ns
      129: 20ns
      257: 31ns
      513: 49ns
      1025: 96ns
      2049: 189ns
      4097: 381ns
      8193: 745ns
      16385: 1477ns
      32769: 2930ns
      65537: 5824ns
      total = 599391004
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      b967dac8
    • Rusty Russell's avatar
      mem: add memzero benchmark. · ca2551bc
      Rusty Russell authored
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      ca2551bc
    • Rusty Russell's avatar
      mem: add memeqzero. · 299170fa
      Rusty Russell authored
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      299170fa
  8. 09 Oct, 2015 2 commits
  9. 29 Sep, 2015 1 commit
  10. 28 Sep, 2015 1 commit
  11. 24 Sep, 2015 2 commits
  12. 14 Sep, 2015 1 commit
  13. 13 Sep, 2015 3 commits
  14. 12 Sep, 2015 1 commit
  15. 09 Sep, 2015 3 commits
  16. 08 Sep, 2015 1 commit
  17. 06 Sep, 2015 4 commits
  18. 20 Aug, 2015 2 commits