Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
8e45a89895 Use spaces, not tabs, in the Java and C# runtimes.
Add modelines to keep it that way.

Fix formatting, and english in comments.
2018-07-10 13:52:11 +02:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Paul Bone
ab44bbad3f Use a better algorithm for unwinding version_arrays.
The old version_array rewind code used linear stack space in order to
perform it's updates in the right order (newest to oldest) by following the
structure's next pointers (which are a oldest to newest list).  I previously
introduced week prev pointers so that walking over this structure newest to
oldest could be done with constant stack space.  However that is less
efficient than the method suggested by Peter Wang.

Peter suggested using a bitmap and traversing oldest-to-newest, marking
each update in the bitmap and checking the bitmap before making any update.
Thus preserving older values over newer ones (which is good, this code
_rewinds_ updates).  This patch implements Peter's suggestion and removes
the prev pointers from the structure for C and Java backends.

Thanks to Peter Wang for giving me a hand with C#.

library/version_array.m:
    As above.

runtime/mercury_bitmap.h:
    Add some macros for initialising bitmaps and testing, setting and clearing
    their bits.

library/bitmap.m:
java/runtime/MercuryBitmap.java:
    Move the Java MercuryBitmap class into the runtime library.  This makes
    it easier for other standard library modules to use this Java class.

library/bitmap.m:
runtime/mercury_dotnet.cs.in:
    Move C# MercuryBitmap class into runtime/mercury_dotnet.cs

library/bitmap.m:
    Add extra methods to the C# MercuryBitmap class.

tests/hard_coded/version_array_test.exp:
tests/hard_coded/version_array_test.m:
    Ensure that the test verifies that rolling back updates to a version
    array rolls back changes in the correct order: If two updates modify the
    same cell, then the older one should be visible in the result.

    Use longer arrays so that the bitmap used in the rollback code is more
    than one byte in length.
2014-09-10 12:04:53 +10:00