Re: NULL (was Re: cvs commit: parrot interpreter.c stacks.c)

2002-11-09 Thread Leopold Toetsch
Nicholas Clark wrote:


On Sat, Nov 09, 2002 at 11:09:39AM -, [EMAIL PROTECTED] wrote:



 -interpreter->ctx.int_reg_base->prev = NULL;




It's not likely to be a portability problem, as I seem to remember that the C
FAQ is only able to mention one very obscure platform where NULL was not all
bits zero in memory. 


Yep C-FAQ 5.17 lists these machines (Prime50, Eclipse MV, CDC 180, old 
HP 3000)

To NULL or not to NULL, this is the question.


I believe that a bigger assumption (not sure if we're making it; didn't spot
it) is that float 0.0 and double 0.0 are written as all bits zero in memory.



NRegs were memset to 0, Parrot_clear_n() sets them to 0.0.

But we seem to have a real problem WRT JIT and floats. Some perl6 tests 
still break, when run through -j. I could imagine different float 
formats for 80/64 bit floats is the reason.


Nicholas Clark



leo






NULL (was Re: cvs commit: parrot interpreter.c stacks.c)

2002-11-09 Thread Nicholas Clark
On Sat, Nov 09, 2002 at 11:09:39AM -, [EMAIL PROTECTED] wrote:

>   -/* Initialize the integer register chunk */
>   -interpreter->ctx.int_reg_base->used = 0;
>   +/* Initialize the register chunks */
>interpreter->ctx.int_reg_base->free = FRAMES_PER_INT_REG_CHUNK;
>   -interpreter->ctx.int_reg_base->next = NULL;
>   -interpreter->ctx.int_reg_base->prev = NULL;

By doing this you are assuming that the in memory representation of a NULL
pointer is all bits NULL. This isn't guaranteed. (What *is* guaranteed by
the standard is that a NULL pointer casts to 0, and that all other pointers
cast to non-zero)

It's not likely to be a portability problem, as I seem to remember that the C
FAQ is only able to mention one very obscure platform where NULL was not all
bits zero in memory. (Sorry, not online at the moment, so no URL) However, I
have a niggling thought that someone telling me that some compiler product in
memory leak debug mode (possibly a Microsoft compiler) was able to have NULL
pointers *not* stored as all bits zero in memory, and so could fault confusion
between 0 and NULL

I believe that a bigger assumption (not sure if we're making it; didn't spot
it) is that float 0.0 and double 0.0 are written as all bits zero in memory.

Nicholas Clark
-- 
Brainfuck better than perl? http://www.perl.org/advocacy/spoofathon/



[CVS ci] (was: Should memory be washed?)

2002-11-09 Thread Leopold Toetsch
Dan Sugalski wrote:


At 8:58 PM +0100 11/6/02, Leopold Toetsch wrote:



If we want this, then lets have Parrot_{re,}allocate{,zeroed}.
The allocate_string variants are ok with unzeroed mem already.



Which was my thought here. Things that care can ask for zeroed memory, 
which they may get anyway. (Or we may keep a big pool of zeroed memory 
around as it's cheaper to clean large blocks or something)

This patch implements the first step of mem alloc cleanup:

- NEW mem_sys_allocate_zeroed (calloc)
- mem_sys_allocate uses malloc now
- NEW Parrot_allocate_zeroed
- Parrot_allocate uses malloc in res_lea now

implying the following rules:

Buffer headers and such are guaranteed to be zeroed.
Mem allocated via Parrot_allocate may or may not be zeroed, depending on 
allocator scheme.
The _allocate_string variants do never guarantee to deliver zeroed memory.

Next step is going through files and look, where allocating zeroed 
memory looks cheaper and use mem_sys_allocate_zeroed.

leo



mem leaks test summary

2002-11-09 Thread Leopold Toetsch
After removing IntQueue this is the state of memory leaks[1] (i386/linux):

Failed Test  Status Wstat Total Fail  Failed  List of failed
---
t/op/hacks.t  21  50,00%  1
t/op/rx.t237  30,43%  8-9, 12-14, 21-22
9 subtests skipped.
Failed 2/35 test scripts, 94.29% okay. 8/494 subtests failed, 98.38% 
okay.

- hacks.t uses PIO_open/PIO_new which doesn't keep track of IO objects
- rx.t is broken WRT bitmaps and intstack

[1] a test passes, when output matches and when it doesn't show 
WARNINGs/ERRORs (s. testyamd script)

leo



[CVS ci] removed (was: removiing classes/intqueue.pmc)

2002-11-09 Thread Leopold Toetsch
Leopold Toetsch wrote:


If no one hollers, I'll remove the IntQueue class.
- only used in some tests AFAIK
- functionality may be written in terms of intlist push/pop
- has a weird syntax for queue/dequeue
- is broken WRT memory management and clone



IntQueue is history.

Please run 'make realclean; perl Configure.pl; make -s' to get pmc class 
enums reordered.


leo