2006-05-31

More low-level FFI

I'm following the first plan which is finish low-level FFI for the Judy datatypes. Judy1, JudyL and JudySL are done. Missing only JudyHS.

I've sent an email to haskell mailing list and Bulat Ziganshin replied with very nice suggestions on the possible APIs. He(?) mentioned a project called Collections, which defines new interfaces for collection types in Haskell, and suggested creating similar APIs. I think it's a good time to get all this into a Wiki page in Haskell.org.

And last, I did a little hack to get "malloc error" test working. When you insert a new element into a Judy array, sometimes it's necessary to allocate new memory, and if something goes wrong, the C-function returns a pointer to address -1 (0xfffff...). I was having trouble to get this value on a Ptr Value type (so it could be compared to result of insert), to solve (at least for now) this I just created an adhoc function that returns exactly what I need, and used foreign import ccall with the type I wanted (Ptr Value). Tested it using bash's ulimit command, which can limit the total memory available for processes, to execute a program that inserts a huge amount of data into a judy array.

That's all for now. I hope finish my compiler project today, so maybe some work on JudyHS happens tonight.

No comments:

About Me