Hello,

I think I've found a problem with the JudyTables.c code generator. I
was having some trouble trying to cross compile judy for the iphone.
Unfortunately, I was running into the following malloc error:

flx_pkgconfig(70749) malloc: *** error for object 0x100954: incorrect
checksum for freed object - object was probably modified after being
freed.
*** set a breakpoint in malloc_error_break to debug
flx_pkgconfig(70749) malloc: *** error for object 0x1014b4: incorrect
checksum for freed object - object was probably modified after being
freed.
*** set a breakpoint in malloc_error_break to debug
flx_pkgconfig(70749) malloc: *** error for object 0x1014ce: pointer
being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

The stack trace suggested that this was somehwere within judy:

#0  0x934c8f6a in malloc_error_break ()
#1  0x934ca114 in szone_error ()
#2  0x934ca287 in free_list_checksum_botch ()
#3  0x933d71a6 in tiny_malloc_from_free_list ()
#4  0x933d62c1 in szone_malloc_should_clear ()
#5  0x933d6168 in malloc_zone_malloc ()
#6  0x933d4238 in malloc ()
#7  0x0004ab83 in JudyMalloc (Words=3) at
src/judy/src/JudyCommon/JudyMalloc.c:43
#8  0x0004281a in j__udyLAllocJBBJP (NumJPs=1, Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLMallocIF.c:255
#9  0x0003855d in j__udyStageJBBtoJBB (PjpLeaf=0x1005f8,
PStageJBB=0xbfffe234, PjpArray=0xbfffe134, PSubCount=0xbfffe304
"\023", Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLCascade.c:272
#10 0x00039911 in j__udyLCascade3 (Pjp=0x1005f8, Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLCascade.c:902
#11 0x00040c62 in j__udyInsWalk (Pjp=0x1005f8, Index=1050192,
Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:804
#12 0x00041a25 in j__udyInsWalk (Pjp=0x1005f8, Index=1050192,
Pjpm=0x1004b0) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:1650
#13 0x000422b8 in JudyLIns (PPArray=0x1001a8, Index=1050192,
PJError=0x1001b8) at
build/iphone-simulator/debug/src/judy/src/JudyL/JudyLIns.c:1847
#14 0x0001fb71 in flx::gc::collector::flx_collector_t::impl_allocate
(this=0x100170, shape=0x5e9e0, nobj=1) at src/gc/flx_collector.cpp:128
#15 0x000216f9 in flx::gc::collector::flx_ts_collector_t::v_allocate
(this=0x100170, ptr_map=0x5e9e0, x=1) at
src/gc/flx_ts_collector.cpp:16
#16 0x00021430 in flx::gc::generic::collector_t::allocate
(this=0x100170, shape=0x5e9e0, x=1) at flx_gc.hpp:115
#17 0x00021324 in flx::gc::generic::gc_profile_t::allocate
(this=0x100200, shape=0x5e9e0, count=1, allow_gc=true) at
src/gc/flx_gc.cpp:92
#18 0x000213e1 in operator new (amt=8, gcp=@0x100200, shape=@0x5e9e0,
allow_gc=true) at src/gc/flx_gc.cpp:149
#19 0x00008ace in
flxusr::flx_pkgconfig::_i26865_f26865_aux_uncurry::apply
(this=0xbfffe9d8, _arg=@0xbfffe9ec) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1704
#20 0x00008f81 in flxusr::flx_pkgconfig::add::apply (this=0xbfffeb00,
_arg=@0xbfffeb18) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1507
#21 0x00010bdd in flxusr::flx_pkgconfig::parse_args::stack_call
(this=0xbfffed1c, _arg=@0xbfffedc8) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:859
#22 0x00010914 in flxusr::flx_pkgconfig::parse_args::stack_call
(this=0xbfffef58, _arg=@0x100274) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:848
#23 0x00015206 in flxusr::flx_pkgconfig::_init_::resume
(this=0x1002f0) at
build/iphone-simulator/debug/src/flx_pkgconfig/flx_pkgconfig.cpp:1024
#24 0x0001d808 in flx::rtl::fthread_t::run (this=0x100330) at
src/rtl/flx_rtl.cpp:113
#25 0x0001ddb9 in flx::run::sync_state_t::frun (this=0xbffff13c) at
src/rtl/flx_sync.cpp:63
#26 0x00002a8d in doflx (data=0x100370) at flx_run.include:99
#27 0x000034ef in run_felix_pthread (debug_driver=false, gcp=0x100200,
thread_control=0xbffff44c, library=0xbffff2c0, instance=0xbffff2d8) at
flx_run.include:323
#28 0x000037e0 in run_felix (debug_driver=false, gcp=0x100200,
thread_control=0xbffff44c, filename=0xbffff5f4
"/Users/erickt/Projects/felix/felix/build/iphone-simulator/debug/bin/flx_pkgconfig",
flx_argc=4, flx_argv=0xbffff4fc) at flx_run.include:466
#29 0x0000453e in main (argc=4, argv=0xbffff4fc) at flx_run.include:681


I think the problem is stemming from the code generator, judytables.
Since I can't run judytables on the iphone, I have to compile it on my
host platform (a 64 bit machine) and have it generate code for the 32
bit iphone. Unfortunately, I think judy is baking in some of the host
platform information into the code it generates. I believe the
culprits are:

src/JudyCommon/JudyTables.c, line 33:
#define BPW sizeof(Word_t)      // define bytes per word

src/Judy.h, line 110:
#ifndef _WORD_T
#define _WORD_T
#if defined(_WIN64)
typedef unsigned long long   Word_t, * PWord_t;  // expect 32-bit or
64-bit words.
#else
typedef unsigned long    Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#endif
#endif


Would it be safe to just replace the Word_t definition with:

#ifndef _WORD_T
#define _WORD_T
#ifdef JU_64BIT
typedef uint64_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#else
typedef uint32_t Word_t, * PWord_t;  // expect 32-bit or 64-bit words.
#endif
#endif

This gets rid of the error, but then I'm seeing some warnings like:


In file included from src/judy/src/Judy1/Judy1.h:72,
                 from
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c:36:
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf1’:
src/judy/src/JudyCommon/JudyPrivate.h:1556: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1556: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf2’:
src/judy/src/JudyCommon/JudyPrivate.h:1563: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1563: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeaf3’:
src/judy/src/JudyCommon/JudyPrivate.h:1570: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1570: warning: comparison is
always false due to limited range of data type
src/judy/src/JudyCommon/JudyPrivate.h: In function ‘j__udySearchLeafW’:
src/judy/src/JudyCommon/JudyPrivate.h:1609: warning: large integer
implicitly truncated to unsigned type
src/judy/src/JudyCommon/JudyPrivate.h:1609: warning: comparison is
always false due to limited range of data type
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c: In
function ‘main’:
build/iphone-simulator/debug/src/judy/src/Judy1/Judy1TablesGen.c:219:
warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long
unsigned int’


As best as I can tell, these are safe to ignore, but I'm not positive.
Any help would be appreciated. Thanks.

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to