Hi Mark, On Jan 25, 2008 10:16 PM, Mark Wielaard <[EMAIL PROTECTED]> wrote: > Hi Robert, > > Robert Lougher <[EMAIL PROTECTED]> writes: > > This is getting a bit hostile for no reason.... Thinking about > > alignment gives an interesting solution. > > > > 1) Strings are not null-terminated > > 2) For most strings the alignment gives the VM room to terminate in > > place when GetStringChars is called > > 3) Copy strings that can't be terminated in place. > > Note that Strings have a backing [j]char array which can be shared between > different Strings, and often are when read in in one go and then split in > different sub-String objects. All these Strings have a shared slice of this > backing jchar array, so there isn't any place to terminate it because that > place > will overlap with another slice that can belong to another String. >
Whoops, you're right :) > You should know, because I learned all I know about this and pinning of the > backing storage of a String (not the String object itself) by reading your > jamvm > code! :) > > BTW. I would really recommend anybody wanting to know how the VM and JNI specs > truly work/can be implemented in practice take a look at jamvm, it is a truly > remarkable clear, concise and small implementation. Nothing bad about other > runtimes, but jamvm is small enough that you can read the code, sit down with > the spec and compare them almost directly to get a really nice insight in how > things are/can be done. > How many beers did we agree I'll buy you at FOSDEM? ;) Rob. > Cheers, > > Mark > >
