[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug(s) in java.lang.String
From: |
Mark Wielaard |
Subject: |
Re: Bug(s) in java.lang.String |
Date: |
31 Jul 2002 23:41:47 +0200 |
Hi,
On Wed, 2002-07-31 at 23:14, Artur Biesiadowski wrote:
> Mark Wielaard wrote:
>
> > Another solution would be to encode the values in CharData not as
> > Strings but as actual char[] but that might be a lot less efficient
> > (source code may explode I mean, it shouldn't matter for the class
> > file).
>
> Just the opposite IMHO. Source would be not longer, at least not much,
> class file on other hand would be a lot, lot larger. Instead of using
> utf8 for 16bits (2-3 bytes per entry), in bytecode it would equal to
>
> aload_n
> sipush index
> sipush value
> castore
>
> which is 8 bytes. If we would use integers, it is more or less the same
> - instead of sipush value, ldc constant_index would be used, plus extra
> space in class file constants pool.
You are right. The class file format does not seem to have a way to
efficiently store arrays of primitive type. Which means that you have to
explicitly initialize those :{ Sigh.
I am still interested in how/why those Strings had a non-zero offset in
the first place. Maybe a compiler/VM may do such a thing and then we
have to take that into account in Character and String when we use them.
Cheers,
Mark