> On 20 Sep. 2017, at 13:18, Alan Silverstein <[email protected]> wrote:
>
> John,
>
>> Judy code has some debugging calls to check functions. Inside
>> DBGCODE().
>>
>> Unfortunately, the code for these functions aren't in the tarball or
>> repository. Any available?
>
> I'm surprised at that. I have nearly zero recollection of this, but I
> do have some libJudy sources on my home tree, where a find/grep
> revealed in tool/jhton.c (not in any release?) the following:
>
>
> This is probably a clone of, but identical to, something that appeared
> in a released header file -- but I don't know why you have DBGCODE()
> macros in the source without a definition anywhere.
No no, you misunderstand. DBGCODE is defined.
Its the subroutines INSIDE the actual uses of it that are not.
For example in JudyCommon/JudyIns.c we have:
DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);)
and later:
JU_INSERTINPLACE(Pjbl->jbl_Expanse, numJPs, offset, digit);
JU_INSERTINPLACE(Pjbl->jbl_jp, numJPs, offset, newJP);
DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse),
numJPs + 1, /* IndexSize = */ 1);)
++(Pjbl->jbl_NumJPs);
The problemn is JudyCheckPop and JudyCheckSorted are not defined
anywhere.
We have a bug in my Windows port of Judy, and I want to enable these
checks. But they don’t exist. And there’s NO WAY I have the expertise
to write them.
Those specific checks must have previously existed, but didn’t
make it into the repository.
We have a failure where an insert into a JudyL array is simply not
happening, causing 50% of all windows builds to fail. Because I
have no idea how Judy works .. I mean I have an idea but not
enough to search for a bug .. I thought to enable these checks.
We know the bug is occuring when the top level linear node
has to be split. The bug does not appear to happen on OSX or Linux
so it is probably due to me failing to port it to Windows correctly.
The crash is deterministic, but it is critically dependent on the
exact bit pattern of keys being inserted, which are in fact
memory addresses returned by malloc(). So the keys depend
on the exact process environment of the build. A tiny, one character
change in the Felix source, and the bug appears or goes away.
Run a crashing build 100 times and it crashes 100 times.
Once it runs, it runs.
The Windows port primarily consisted of fixing the incorrect
assumption that long is 64 bits on Win64. Its not. Long is 32 bits
on all Windows platforms. Plain int is 16 bits on all Windows platforms.
The main bug was code like this:
~1L
which tries to set all bits on except the lowest, but instead leaves the
top 32 bits clear. My change is
~(uintptr_t)1L
which works correctly on all platforms (32 or 64 bits as well).
Thats an unsigned integer the size of a void*.
Not every integer in Judy is 64 bits. Indexes for linear nodes
can be 8 bits for example. Of course code like:
index = ~index
is not standards conforming, it only works for twos complement integers.
That’s used all over the place too, but most boxes do use twos complement.
Anyhow whatever I messed up, or *failed* to convert,
I have not been able to find it. If we can’t find the problem we’ll
probably have to throw Judy out. STL map isn’t as fast and uses
more storage but it provides all the same access methods.
(Its just a pain to use, being stuck having to use the stupid iterators :)
It is, of course, possible, that Judy is working, and the JudyL array
is being corrupted by something else. But I doubt that, I’m pretty confident
the bug is in Windows Judy. Note that the ported code runs on both
Unix and Windows, its not a separate Judy. Same judy, just fixed to
work on windows as well as unix. Except it isn’t :)
—
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel