You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Megha Chauhan <me...@gmail.com> on 2008/04/29 00:13:06 UTC

Modifying String Class

Hi,

I am trying to modify the String Class and have added one more field which
keeps a copy of the value field.
I have added this field to all the constructors and it works fine when
creating an object with 'new' keyword.
I am having trouble getting this to work with constant strings. I have tried
to add this to vm_strings.cpp init_fields() method.
I have also tried to initialize the field in VM.intern() after the string is
returned from internmap.intern() but in this case the VM is not able to load
and crashes.
Can someone tell me what needs to be done to add a new field to String.java
and make constant strings have that field?
Thanks
Megha

Re: Modifying String Class

Posted by Megha Chauhan <me...@gmail.com>.
Thanks Pavel!! It worked.


On Wed, Apr 30, 2008 at 7:47 AM, Pavel Pervov <pm...@gmail.com> wrote:

> Megha,
>
> Please, look into string_set_fields_separate (in
> vm/vmcore/src/util/vm_strings.cpp:207): there you'll find setting
> j/l/String object fields. You can add setting your additional field
> there.
>
> WBR,
>    Pavel.
> On 4/29/08, Megha Chauhan <me...@gmail.com> wrote:
> > Hi,
> >
> > I am trying to modify the String Class and have added one more field
> which
> > keeps a copy of the value field.
> > I have added this field to all the constructors and it works fine when
> > creating an object with 'new' keyword.
> > I am having trouble getting this to work with constant strings. I have
> tried
> > to add this to vm_strings.cpp init_fields() method.
> > I have also tried to initialize the field in VM.intern() after the
> string is
> > returned from internmap.intern() but in this case the VM is not able to
> load
> > and crashes.
> > Can someone tell me what needs to be done to add a new field to
> String.java
> > and make constant strings have that field?
> > Thanks
> > Megha
> >
>
>
> --
> Pavel Pervov,
> Intel Enterprise Solutions Software Division
>

Re: Modifying String Class

Posted by Pavel Pervov <pm...@gmail.com>.
Megha,

Please, look into string_set_fields_separate (in
vm/vmcore/src/util/vm_strings.cpp:207): there you'll find setting
j/l/String object fields. You can add setting your additional field
there.

WBR,
    Pavel.
On 4/29/08, Megha Chauhan <me...@gmail.com> wrote:
> Hi,
>
> I am trying to modify the String Class and have added one more field which
> keeps a copy of the value field.
> I have added this field to all the constructors and it works fine when
> creating an object with 'new' keyword.
> I am having trouble getting this to work with constant strings. I have tried
> to add this to vm_strings.cpp init_fields() method.
> I have also tried to initialize the field in VM.intern() after the string is
> returned from internmap.intern() but in this case the VM is not able to load
> and crashes.
> Can someone tell me what needs to be done to add a new field to String.java
> and make constant strings have that field?
> Thanks
> Megha
>


-- 
Pavel Pervov,
Intel Enterprise Solutions Software Division