classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpath] Re: Bug(s) in java.lang.String


From: C. Scott Ananian
Subject: Re: [Classpath] Re: Bug(s) in java.lang.String
Date: Wed, 31 Jul 2002 18:00:32 -0400 (EDT)

On 31 Jul 2002, Mark Wielaard wrote:

> 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.

The bytecode compiler cannot do this, because the class file format does
not provide a means to encode String constants with non-zero offsets in
the constant pool.  But the JVM and a native compiler might well do so;
this is the expected behavior of C compilers, for example: they attempt
to reduce the storage space needed to store the strings "bar" and "foobar"
by using a pointer to the middle of "foobar" to represent "bar".  The
obvious Java parallel is to share the character arrays for the Strings
representing "foobar" and "bar" and just change the offset in the
String object.  [My own java compiler does not do this, but it should.]
  --scott

postcard anthrax insurgent terrorist munitions bomb planning North Korea 
Waihopai Boston Yeltsin Milosevic genetic Minister IDEA ASW World Trade Center 
                         ( http://cscott.net/ )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]