Patch for Review: JvGetStringUTF and JvTempCString

Mohan Embar gnustuff@thisiscool.com
Tue Aug 12 15:14:00 GMT 2003


Hi Bryce,

>I totally agree that we have a problem here, I just wonder if this is 
>the right solution. Two things that would make me like this better:
>
>1. Can it be made to allocate only the space that it needs on the 
>stack?

How? (The only way I can think of doing this in one line is with a macro.)

>Always allocating 500 bytes seems a bit wasteful. I wonder about 
>large stack allocations since they will reduce the locality of the 
>stack - increasing the chance of cache misses etc.

I was worried about this too, but for embedded targets. I was going to
go lower in my patch (256 bytes). I agree that this isn't perfect.

>2. Can we use _Jv_AllocBytes rather than _Jv_Malloc/_Jv_Free in the 
>need-to-allocate case? The former is *faster* given thread local 
>allocation, possibly so even after accounting for the GC's marking 
>overhead.

I'll happily go with anything you all come up with as long as I don't
have to look at those three lines again. Like I said before, the beauty
of encapsulating this is that we can always tweak it with compile-time
transparency later on.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/






More information about the Java-patches mailing list