On 10/24/2012 3:59 PM, john skaller wrote:
> On 25/10/2012, at 2:35 AM, Tim Margheim wrote:
>> Thanks.  John's answer fixes the crashing loop.  I still have the access 
>> violation in 64-bit mode when populating the tree, though.
> Repost your code with the fix.
> Do you know which call causes the access violation, i.e. exactly where?
I didn't repost it because I hadn't changed that code--the violation was 
occurring in the first loop (which populates the tree), and I had only 
changed the third loop.  It was a "Attempted to read or write protected 
memory" error, and it was occurring somewhere in JudySLIns.

However, I fixed it!  (I got a hint from a compiler warning I'd 
missed.)  I tracked it down to this in JudyPrivate.h:
#define cJU_ALLONES  (~0UL)
which I had to change to
#define cJU_ALLONES  (~0ULL)

That fixed the access violation.

It turns out that the Judy code uses some literal values with a UL 
suffix, e.g. "0x100UL".  And in WIN64, that's only 32 bits--which can 
lead to shenanigans, since the code expects it to be 64 bits when in 
64-bit mode.  So I need to do "0x100ULL", or perhaps "(Word_t)0x100".  
Though a run-time typecast would add some instructions (right?), so 0ULL 
might be better.  But it would be a pain to have to litter the source 
code with things like:
#if defined(_WIN64)
bitposmaskL = (1ULL << (cJU_BITSPERSUBEXPL - 1));
#else
bitposmaskL = (1UL << (cJU_BITSPERSUBEXPL - 1));
#endif

Perhaps it could be done with a macro like this in Judy.h or JudyPrivate.h:
#if defined(_WIN64)
#define WORD_VALUE_1 1ULL
#else
#define WORD_VALUE_1 1UL
#endif

Then the line of code would be:
bitposmaskL = (WORD_VALUE_1 << (cJU_BITSPERSUBEXPL - 1));

Doug, what do you think?


---
Tim Margheim
Neuric Technologies, LLC

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to