Skip to content
Snippets Groups Projects
  1. Mar 13, 2018
  2. Mar 03, 2018
  3. Mar 02, 2018
  4. Feb 27, 2018
  5. Feb 22, 2018
    • Arseny Kapoulkine's avatar
      Work around gcc issues with limits.h not defining LLONG_MIN · 2ec3579f
      Arseny Kapoulkine authored
      It looks like there are several cases where this might happen:
      
      - In some MinGW distributions, the LLONG_MIN/etc defines are guarded
      with:
      
      	#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
      
      Which means that you don't get them in strict ANSI mode. The previous
      workaround was specifically targeted towards this.
      
      - In some GCC distributions (notably GCC 6.3.0 in some configurations),
      LLONG_MIN/etc. defines are guarded with:
      
      	#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
      
      But __STDC_VERSION__ isn't defined as C99 even if you use -std=c++14 -
      which is probably technically valid, but not useful.
      
      To work around this, redefine the symbols whenever we are building with
      GCC and we need them and they aren't defined - doing this is better than
      not building. Instead of hard-coding the constants, use GCC-specific
      __LONG_LONG_MAX__ to compute them.
      
      Fixes #181.
      2ec3579f
  6. Jan 29, 2018
  7. Jan 23, 2018
  8. Jan 08, 2018
  9. Dec 30, 2017
  10. Dec 22, 2017
  11. Nov 14, 2017
  12. Nov 13, 2017
    • Arseny Kapoulkine's avatar
      Merge pull request #170 from zeux/move · 7c6d0010
      Arseny Kapoulkine authored
      This change implements move ctor and assign support for xml_document.
      
      All node handles remain valid after the move and point to the new document; the only exception is the document node itself (that remains unmoved).
      
      Move is O(document size) in theory because it needs to relocate immediate document children (there is just one in conformant documents) and all memory pages; in practice the memory pages only need the header adjusted, which is ~0.1% of the actual data size.
      
      Move requires no allocations in general, except when using compact mode where some moves need to grow the hash table which can fail (throw).
      
      Fixes #104
    • Arseny Kapoulkine's avatar
      Fix -Wshadow warning · 3860b507
      Arseny Kapoulkine authored
      3860b507
    • Arseny Kapoulkine's avatar
      tests: Add compact move tests · 58611c87
      Arseny Kapoulkine authored
      This helps make sure our error handling logic works and is exercised.
      58611c87
    • Arseny Kapoulkine's avatar
      Implement correct move error handling for compact mode · 4bd8771c
      Arseny Kapoulkine authored
      In compact mode, we currently can not support zero-allocation moves
      since some pointer assignments required during the move need to allocate
      hash table slots.
      
      This is mostly applicable to xml_document_struct::first_child, since the
      pointer to this element is used as a hash table key, but there are some
      contrived cases where parents of root's children need a hash slot and
      didn't have it before.
      
      These cases can be fixed by changing the compact encoding to be a bit
      more move friendly, but for now it's easier to handle the error and
      throw/return during move.
      
      When this happens, the source document doesn't change.
      4bd8771c
    • Arseny Kapoulkine's avatar
      Add count argument to compact_hash_table::rehash/reserve · 91a3c288
      Arseny Kapoulkine authored
      This allows us to do a single reserve for a known amount of assignments
      that is larger than the default minimum per reserve (16).
      91a3c288
    • Arseny Kapoulkine's avatar
      CMake: Add __declspec(dllexport) for shared library builds · 6016e218
      Arseny Kapoulkine authored
      This makes sure that MSVC shared library build actually exports all the
      needed symbols and generates import table.
      
      Somehow, this is actually enough to make pugixml link as a DLL - there's
      no need to specify __declspec(dllimport) even though pugixml exports
      classes via DLL.
      
      Fixes #113.
      6016e218
  13. Nov 11, 2017
  14. Oct 30, 2017
    • Arseny Kapoulkine's avatar
      build: Simplify config=sanitize · 6fe31d14
      Arseny Kapoulkine authored
      These days OSX clang supports UB sanitizer so we can just use the same
      settings for all systems.
      6fe31d14
    • Arseny Kapoulkine's avatar
      build: Switch fuzz builds to use Clang 5.0 sanitize=fuzzer · ba950432
      Arseny Kapoulkine authored
      The old fuzzer location is deprecated; this also makes it almost trivial
      to fuzz, provided that the clang is set up correctly... on Ubuntu 17.10,
      a command sequence like this works now:
      
          sudo apt install clang-5.0
          sudo apt install libfuzzer-5.0
          sudo cp /usr/lib/llvm-5.0/lib/libFuzzer.a /usr/lib/libLLVMFuzzer.a
          CXX=clang++-5.0 make fuzz_parse
      ba950432
  15. Oct 26, 2017
  16. Oct 21, 2017
    • Arseny Kapoulkine's avatar
      Clarify a note about compact hash behavior during move · 3af93a39
      Arseny Kapoulkine authored
      After move some nodes in the hash table can have keys that point to
      other; this makes the table somewhat larger but this does not impact
      correctness.
      
      The reason is that for us to access a key in the hash table, there
      should be a compact_pointer/string object with the state indicating that
      it is stored in a hash table, and with the address matching the key. For
      this to happen, we had to have put this object into this state which
      would mean that we'd overwrite the hash entry with the new, correct
      value.
      
      When nodes/pages are being removed, we do not clean up keys from the
      hash table - it's safe for the same reason, and thus move doesn't
      introduce additional contracts here.
      3af93a39
    • Arseny Kapoulkine's avatar
      tests: Add more move tests · b0fc587a
      Arseny Kapoulkine authored
      We now check that appending a child to a moved document performs no
      allocations - this is already the case, but if we neglected to copy the
      allocator state this test would fail.
      b0fc587a
  17. Sep 26, 2017
    • Arseny Kapoulkine's avatar
      tests: Adjust move coverage tests · 50bc0d5a
      Arseny Kapoulkine authored
      Large test wasn't testing shared parent condition properly - add one
      more level of hierarchy so that it works as expected.
      50bc0d5a
    • Arseny Kapoulkine's avatar
      tests: Add more move tests · 26ead385
      Arseny Kapoulkine authored
      Add a test that checks that static buffer pointer was moved correctly
      by checking if offset_debug still works.
      26ead385
    • Arseny Kapoulkine's avatar
      tests: Add more move tests · 402b967f
      Arseny Kapoulkine authored
      Make sure we have coverage for empty documents and for large documents
      that trigger compact_shared_parent != root for some pages.
      402b967f
    • Arseny Kapoulkine's avatar
      tests: Add more document move tests · faba4786
      Arseny Kapoulkine authored
      Verify that move doesn't allocate and that it preserves structures
      required for tree memory management and append_buffer in tact.
      faba4786
    • Arseny Kapoulkine's avatar
      Fix -Wshadow warning · febf25d1
      Arseny Kapoulkine authored
      febf25d1
    • Arseny Kapoulkine's avatar
      tests: Add basic move tests · 6eb7519d
      Arseny Kapoulkine authored
      These just verify that move ctor/assignment operator work as expected in
      simple cases - there are a number of ways in which the internal
      structure can be incorrect...
      6eb7519d
    • Arseny Kapoulkine's avatar
      Implement move support for xml_document · a567f12d
      Arseny Kapoulkine authored
      This change implements the initial version of move construction and
      assignment support for documents.
      
      When moving a document to another document, we always make sure move
      target is in "clean" state (empty document), and proceed by relocating
      all structures in the most efficient way possible.
      
      Complications arise from the fact that the root (document) node is
      embedded into xml_document object, so all pointers to it have to change;
      this includes parent pointers of all first-level children as well as
      allocator pointers in all memory pages and previous pointer in the first
      on-heap memory page.
      
      Additionally, compact mode makes everything even more complicated
      because some of the pointers we need to update are stored in the hash
      table (in fact, document first_child pointer is very likely to be there;
      some parent pointers in first-level children will be using
      compact_shared_parent but some won't be) which requires allocating a new
      hash table which can fail.
      
      Some details of this process are not fully fleshed out, especially for
      compact mode; and this definitely requires many tests.
      a567f12d
  18. Sep 25, 2017
  19. Aug 30, 2017
  20. Aug 22, 2017
    • Arseny Kapoulkine's avatar
      docs: Update encoding conversion description · 4f2ad720
      Arseny Kapoulkine authored
      We support Latin-1 and automatically detect it by parsing the encoding
      from document declaration; both of these were omitted from the
      description of the automatic detection.
      
      Additionally, the description has been rewritten to be more concise and
      a bit more abstract - there's no need to specify the algorithm precisely
      here.
      
      Fixes #158.
      4f2ad720
Loading