harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Megha Chauhan" <megc...@gmail.com>
Subject Re: [drlvm]Help understanding string literal creation
Date Thu, 10 Apr 2008 14:16:45 GMT
I am not sure that String literal creation is done from java code. Any other
String object is done from java code but String literal creation is
something special. The object is instantiated at compile time only. I am
sure that no string constructor is called when a string literal is
created(but there might be some other way). Eclipse debugger is not able to
step into any code when a breakpoint is set at :
String str = "Test String" ;
So I am assuming that there is no java code involved.
Again, I am not sure.
Gregory : Can you point me to the java code that might be called during
string literal creation?

Thanks
Megha

On Thu, Apr 10, 2008 at 9:07 AM, Gregory Shimansky <gshimansky@apache.org>
wrote:

> Megha Chauhan said the following on 10.04.2008 16:39:
>
> > Hello everyone,
> >
> > Thanks a lot for the response. Now, since I have a very small change in
> > the
> > String class is it possible for me to just add that extra field in the
> > init_fields method of vm_string.cpp and somehow recompile the DLL?
> > Basically I am not sure what kind of setup I need to do this change?
> > I am still not very clear as to what classes are involved in a String
> > Literal creation.
> > As far as I understand there are no Java methods involved. For example
> > when
> > we write something like :
> > String str ="Test String" ;
> > The VM automatically calls the native methods and instantiates a String
> > object at compile time itself.
> > The String.intern() method can be called on already existing String
> > objects
> > and not during string literal creation.
> >
>
> AFAIK when a string is created in Java no VM code is executed, all of the
> stuff is done in Java only. The vm_strings.cpp code is used for creating
> string objects from native code. If you grep for "string_create" you will
> see that it is used only in JNI and in VM initialization code.
>
> The String.intern is also implemented in Java code since HARMONY-1016 was
> integrated.
>
>  Can someone point me to any documentation that tells about the sequence
> > of
> > methods that are called for a string literal creation?
> > And what sort of setup would I need to make the changes to
> > vm_strings.cpp
> > class and recompile the DLL.
> >
>
> For recompiling the VM you need the standard setup for building DRLVM. See
> the URL that Aleksey Shipilev gave in his reply.
>
> --
> Gregory
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message