harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Wu" <wuyue...@gmail.com>
Subject Re: [nio_char][drlvm] Strange effect on DRLVM with charsets
Date Tue, 15 May 2007 06:54:31 GMT
I guess it is caused by some optimization of drlvm.
when you print the line "print something again...", it needs print a
line separator and vm find that there is a line separator in
memory.(recorded when print the first line) so it just prints the
bytes in the previous address, but unfortunately these bytes have been
reused while encoding, they were modified. so actually it prints the
modified bytes rather than line separator.

On 5/15/07, Tony Wu <wuyuehao@gmail.com> wrote:
> If I remove the first System.out.println("print something...");
> the output is ok too...
>
> print something again...
> and again...
>
> If I use print instead of println, also ok...
>
> On 5/15/07, Mikhail Markov <mikhail.a.markov@gmail.com> wrote:
> > Hi!
> >
> > While investigating H-3307 I've found a strange effect on DRLVM. The
> > following code:
> > import java.nio.charset.Charset;
> >
> > public class Test {
> >    public static void main(String[] args) {
> >        System.out.println("print something...");
> >        Charset charset = Charset.forName("ISO-8859-1");
> >        charset.encode("\u3400");
> >        System.out.println("print something again...");
> >        System.out.println("and again...");
> >    }
> > }
> >
> > prints additional symbols after charset.encode() line at the end of messages
> > in println():
> > print something...
> > print something again...→
> > and again...→
> >
> > If i remove charset.encode() line then the output is ok:
> > print something...
> > print something again...
> > and again...
> >
> > Another strange thing that if i remove first println line in the code above,
> > the last 2 println works ok, i.e. without any additional symbols
> >
> > This effect is only reproducible on DRLVM. I'm not quite understand what
> > happens here.
> >
> > Any thoughts?
> >
> > Thanks,
> > Mikhail
> >
>
>
> --
> Tony Wu
> China Software Development Lab, IBM
>


-- 
Tony Wu
China Software Development Lab, IBM

Mime
View raw message