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/10 04:18:54 UTC

[drlvm]Help understanding string literal creation

> Hello,
>
> I am a graduate student at the university of Illinois at chicago,USA. As
> part of my research I have modified the String class of harmony JDK. I have
> added another character array(value_sample) to the class which keeps a copy
> of the value array. Now the problem I am facing is in the case of a string
> literal since no constructor for the string class is called explicitly , the
> value of value_sample array(which was added by me) is set to null. I have
> tried to look into creation of string constants but have not found much
> except that it is instantiated by the native code at compile time. I have
> looked in to the vm_strings.cpp class and have seen that the VM initialises
> the fields for String object in the init_fields method.
> I was thinking of adding the new filed I have crested here and recompiling
> the code.
> Am I on the right track?
> Also I would like to know which DLL file holds the code for vm_string.cpp
> class and how can I recompile the DLL ?
> Your help will be greatly appreciated as I have been struggling with this
> issue for more than a month now.
> Thanks and Regards
> Megha Chauhan

Re: [drlvm]Help understanding string literal creation

Posted by Megha Chauhan <me...@gmail.com>.
Hi,

coming back to the thread after a long break.
I was working with a very old release of harmony(almost 2 yrs old) and I
think at that time there was no InternMap class. Now I have the latest
release r629320 and yes it does step in to VM.intern and then into
VM.InternMap.intern . And I am trying to make changes the the String object
returned by VM.InternMap.intern method.
I am trying to assign a value to value_sample char array that I have already
added to the String Class.
So before this method returns the interned String Object I add
key.value_sample=key.toCharArray() .
But the VM crashes when I do this.
When I make changes to InternMap class I rebuild working_vm and copy the new
kernel.jar file to my harmony jdk jre/bin/default folder.
Do I need to copy the entire bin folder? I mean does kernel.jar depend on
something else too which must be changed when I change anything in
kernel.jar?

Any Help would be appreciated.

Thanks
Megha

On Sat, Apr 12, 2008 at 3:36 PM, Gregory Shimansky <gs...@apache.org>
wrote:

> On 11 апреля 2008 Megha Chauhan wrote:
> > "I think this translates into ldc bytecode that loads a string from a
> > constant. This bytecode requires to load a string from class' constant
> pool
> > and JIT inserts a call to a VM helper class_get_const_string_intern_addr
> > (see file C_Interface.cpp in DRLVM sources).
> > This helper executes Java code for String.intern and returns the
> reference
> > to the interned string back to the code generated for "ldc" bytecode. The
> > String.intern code in class library actually calls VM.intern which calls
> > InternMap.intern code from VM, but it is still pure Java code."
> >
> >  When I try to debug this using eclipse why does the breakpoint at
> > String.intern() or VM.intern() never get hit? Could it be bceacue the
> > control goes to the VM helper class C_interface.cpp first and then comes
> > back to the Java Code? I am trying to find a way to understand the
> control
> > flow here by basic debugging.
> > Thanks a lot for helping me with this.
>
> Are you sure that you use Harmony VM when you debug your program?
>
> I can't think of a reason why this breakpoint is not hit, usually Java code
> that is called through VM is reachable by simple StepIn in debugging. Maybe
> you've found some regression in JVMTI support...
>
> > On Thu, Apr 10, 2008 at 9:43 AM, Gregory Shimansky <
> gshimansky@apache.org>
> >
> > wrote:
> > > Megha Chauhan said the following on 10.04.2008 18:16:
> > > > 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" ;
> > >
> > > I think this translates into ldc bytecode that loads a string from a
> > > constant. This bytecode requires to load a string from class' constant
> > > pool and JIT inserts a call to a VM helper
> > > class_get_const_string_intern_addr (see file C_Interface.cpp in DRLVM
> > > sources).
> > >
> > > This helper executes Java code for String.intern and returns the
> > > reference to the interned string back to the code generated for "ldc"
> > > bytecode. The String.intern code in class library actually calls
> > > VM.intern which calls InternMap.intern code from VM, but it is still
> pure
> > > Java code.
> > >
> > >  So I am assuming that there is no java code involved.
> > >
> > >
> > > There is actually almost no VM native code involved.
> > >
> > >  Again, I am not sure.
> > >
> > > > Gregory : Can you point me to the java code that might be called
> during
> > > > string literal creation?
> > >
> > > See file InternMap.java in DRLVM sources.
> > >
> > >
> > >  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
> > >
> > > --
> > > Gregory
>
>
>
> --
> Gregory
>

Re: [drlvm]Help understanding string literal creation

Posted by Gregory Shimansky <gs...@apache.org>.
On 11 апреля 2008 Megha Chauhan wrote:
> "I think this translates into ldc bytecode that loads a string from a
> constant. This bytecode requires to load a string from class' constant pool
> and JIT inserts a call to a VM helper class_get_const_string_intern_addr
> (see file C_Interface.cpp in DRLVM sources).
> This helper executes Java code for String.intern and returns the reference
> to the interned string back to the code generated for "ldc" bytecode. The
> String.intern code in class library actually calls VM.intern which calls
> InternMap.intern code from VM, but it is still pure Java code."
>
>  When I try to debug this using eclipse why does the breakpoint at
> String.intern() or VM.intern() never get hit? Could it be bceacue the
> control goes to the VM helper class C_interface.cpp first and then comes
> back to the Java Code? I am trying to find a way to understand the control
> flow here by basic debugging.
> Thanks a lot for helping me with this.

Are you sure that you use Harmony VM when you debug your program?

I can't think of a reason why this breakpoint is not hit, usually Java code 
that is called through VM is reachable by simple StepIn in debugging. Maybe 
you've found some regression in JVMTI support...

> On Thu, Apr 10, 2008 at 9:43 AM, Gregory Shimansky <gs...@apache.org>
>
> wrote:
> > Megha Chauhan said the following on 10.04.2008 18:16:
> > > 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" ;
> >
> > I think this translates into ldc bytecode that loads a string from a
> > constant. This bytecode requires to load a string from class' constant
> > pool and JIT inserts a call to a VM helper
> > class_get_const_string_intern_addr (see file C_Interface.cpp in DRLVM
> > sources).
> >
> > This helper executes Java code for String.intern and returns the
> > reference to the interned string back to the code generated for "ldc"
> > bytecode. The String.intern code in class library actually calls
> > VM.intern which calls InternMap.intern code from VM, but it is still pure
> > Java code.
> >
> >  So I am assuming that there is no java code involved.
> >
> >
> > There is actually almost no VM native code involved.
> >
> >  Again, I am not sure.
> >
> > > Gregory : Can you point me to the java code that might be called during
> > > string literal creation?
> >
> > See file InternMap.java in DRLVM sources.
> >
> >
> >  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
> >
> > --
> > Gregory



-- 
Gregory

Re: [drlvm]Help understanding string literal creation

Posted by Megha Chauhan <me...@gmail.com>.
"I think this translates into ldc bytecode that loads a string from a
constant. This bytecode requires to load a string from class' constant pool
and JIT inserts a call to a VM helper class_get_const_string_intern_addr
(see file C_Interface.cpp in DRLVM sources).
This helper executes Java code for String.intern and returns the reference
to the interned string back to the code generated for "ldc" bytecode. The
String.intern code in class library actually calls VM.intern which calls
InternMap.intern code from VM, but it is still pure Java code."

 When I try to debug this using eclipse why does the breakpoint at
String.intern() or VM.intern() never get hit? Could it be bceacue the
control goes to the VM helper class C_interface.cpp first and then comes
back to the Java Code? I am trying to find a way to understand the control
flow here by basic debugging.
Thanks a lot for helping me with this.

..megha



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

> Megha Chauhan said the following on 10.04.2008 18:16:
>
> > 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" ;
> >
>
> I think this translates into ldc bytecode that loads a string from a
> constant. This bytecode requires to load a string from class' constant pool
> and JIT inserts a call to a VM helper class_get_const_string_intern_addr
> (see file C_Interface.cpp in DRLVM sources).
>
> This helper executes Java code for String.intern and returns the reference
> to the interned string back to the code generated for "ldc" bytecode. The
> String.intern code in class library actually calls VM.intern which calls
> InternMap.intern code from VM, but it is still pure Java code.
>
>  So I am assuming that there is no java code involved.
> >
>
> There is actually almost no VM native code involved.
>
>  Again, I am not sure.
> > Gregory : Can you point me to the java code that might be called during
> > string literal creation?
> >
>
> See file InternMap.java in DRLVM sources.
>
>
>  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
> > >
> > >
> > >
> >
>
> --
> Gregory
>
>

Re: [drlvm]Help understanding string literal creation

Posted by Gregory Shimansky <gs...@apache.org>.
Megha Chauhan said the following on 10.04.2008 18:16:
> 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" ;

I think this translates into ldc bytecode that loads a string from a 
constant. This bytecode requires to load a string from class' constant 
pool and JIT inserts a call to a VM helper 
class_get_const_string_intern_addr (see file C_Interface.cpp in DRLVM 
sources).

This helper executes Java code for String.intern and returns the 
reference to the interned string back to the code generated for "ldc" 
bytecode. The String.intern code in class library actually calls 
VM.intern which calls InternMap.intern code from VM, but it is still 
pure Java code.

> So I am assuming that there is no java code involved.

There is actually almost no VM native code involved.

> Again, I am not sure.
> Gregory : Can you point me to the java code that might be called during
> string literal creation?

See file InternMap.java in DRLVM sources.

> Thanks
> Megha
> 
> On Thu, Apr 10, 2008 at 9:07 AM, Gregory Shimansky <gs...@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
>>
>>
> 


-- 
Gregory


Re: [drlvm]Help understanding string literal creation

Posted by Megha Chauhan <me...@gmail.com>.
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 <gs...@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
>
>

Re: [drlvm]Help understanding string literal creation

Posted by Gregory Shimansky <gs...@apache.org>.
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


Re: [drlvm]Help understanding string literal creation

Posted by Aleksey Shipilev <al...@gmail.com>.
Megha,

You might follow the basic guidelines [1] for building Harmony, it
will include building of DRLVM. Please refer there for exact
prerequisite list. You're free to use any editor/IDE you like :)

Thanks,
Aleksey.

[1] http://harmony.apache.org/quickhelp_contributors.html


On Thu, Apr 10, 2008 at 4:39 PM, Megha Chauhan <me...@gmail.com> wrote:
> 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?

Re: [drlvm]Help understanding string literal creation

Posted by Megha Chauhan <me...@gmail.com>.
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.
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.

Thanks and Regards
Megha

On Thu, Apr 10, 2008 at 4:03 AM, Tim Ellison <t....@gmail.com> wrote:

> Gregory Shimansky wrote:
>
> > On 10 April 2008 Aleksey Shipilev wrote:
> >
> > > Hi Megha!
> > >
> > > Probably you're on the right way. Modifying the String class is tough
> > > task since it is kernel class and should be provided with appropriate
> > >
> >
> > Actually it is formally not a kernel class. It is not included with
> > other kernel classes in DRLVM. But VM uses the knowledge of field names in
> > String that hold the data (they are count, offset and value).
> >
>
> That's right.  It started off life as a kernel class, but we agreed there
> was enough common behavior in there that it made sense to share it across
> all implementations.  However, recognizing that the VM/JIT will have some
> knowledge of it's shape, any changes require special consideration first (a
> so-called 'golden-ticket').
>
> see: http://markmail.org/message/bdme4cylnlmltkwt
>
> Regards,
> Tim
>
>
>  support from the VM. vm_strings.cpp is the part of DRLVM that provides
> > > such the support. You must be able to recompile it during the normal
> > > build process of DRLVM then, and particularly this thing would reside
> > > in libharmonyvm.so or harmonyvm.dll.
> > >
> > > Thanks,
> > > Aleksey.
> > >
> > > On Thu, Apr 10, 2008 at 6:18 AM, Megha Chauhan <me...@gmail.com>
> > > wrote:
> > >
> > > > Hello,
> > > > >
> > > > >   > I am a graduate student at the university of Illinois at
> > > > chicago,USA.
> > > >  > As part of my research I have modified the String class of
> > > > harmony
> > > >  > JDK. I have added another character array(value_sample) to the
> > > > class
> > > >  > which keeps a copy of the value array. Now the problem I am
> > > > facing is
> > > >  > in the case of a string literal since no constructor for the
> > > > string
> > > >  > class is called explicitly , the value of value_sample
> > > > array(which was
> > > >  > added by me) is set to null. I have tried to look into creation
> > > > of
> > > >  > string constants but have not found much except that it is
> > > >  > instantiated by the native code at compile time. I have looked in
> > > > to
> > > >  > the vm_strings.cpp class and have seen that the VM initialises
> > > > the
> > > >  > fields for String object in the init_fields method.
> > > >  > I was thinking of adding the new filed I have crested here and
> > > >  > recompiling the code.
> > > >  > Am I on the right track?
> > > >  > Also I would like to know which DLL file holds the code for
> > > >  > vm_string.cpp class and how can I recompile the DLL ?
> > > >  > Your help will be greatly appreciated as I have been struggling
> > > > with
> > > >  > this issue for more than a month now.
> > > >  > Thanks and Regards
> > > >  > Megha Chauhan
> > > >
> > >
> >
> >
> >

Re: [drlvm]Help understanding string literal creation

Posted by Tim Ellison <t....@gmail.com>.
Gregory Shimansky wrote:
> On 10 April 2008 Aleksey Shipilev wrote:
>> Hi Megha!
>>
>> Probably you're on the right way. Modifying the String class is tough
>> task since it is kernel class and should be provided with appropriate
> 
> Actually it is formally not a kernel class. It is not included with other 
> kernel classes in DRLVM. But VM uses the knowledge of field names in String 
> that hold the data (they are count, offset and value).

That's right.  It started off life as a kernel class, but we agreed 
there was enough common behavior in there that it made sense to share it 
across all implementations.  However, recognizing that the VM/JIT will 
have some knowledge of it's shape, any changes require special 
consideration first (a so-called 'golden-ticket').

see: http://markmail.org/message/bdme4cylnlmltkwt

Regards,
Tim

>> support from the VM. vm_strings.cpp is the part of DRLVM that provides
>> such the support. You must be able to recompile it during the normal
>> build process of DRLVM then, and particularly this thing would reside
>> in libharmonyvm.so or harmonyvm.dll.
>>
>> Thanks,
>> Aleksey.
>>
>> On Thu, Apr 10, 2008 at 6:18 AM, Megha Chauhan <me...@gmail.com> wrote:
>>>> Hello,
>>>>
>>>  > I am a graduate student at the university of Illinois at chicago,USA.
>>>  > As part of my research I have modified the String class of harmony
>>>  > JDK. I have added another character array(value_sample) to the class
>>>  > which keeps a copy of the value array. Now the problem I am facing is
>>>  > in the case of a string literal since no constructor for the string
>>>  > class is called explicitly , the value of value_sample array(which was
>>>  > added by me) is set to null. I have tried to look into creation of
>>>  > string constants but have not found much except that it is
>>>  > instantiated by the native code at compile time. I have looked in to
>>>  > the vm_strings.cpp class and have seen that the VM initialises the
>>>  > fields for String object in the init_fields method.
>>>  > I was thinking of adding the new filed I have crested here and
>>>  > recompiling the code.
>>>  > Am I on the right track?
>>>  > Also I would like to know which DLL file holds the code for
>>>  > vm_string.cpp class and how can I recompile the DLL ?
>>>  > Your help will be greatly appreciated as I have been struggling with
>>>  > this issue for more than a month now.
>>>  > Thanks and Regards
>>>  > Megha Chauhan
> 
> 
> 

Re: [drlvm]Help understanding string literal creation

Posted by Gregory Shimansky <gs...@apache.org>.
On 10 April 2008 Aleksey Shipilev wrote:
> Hi Megha!
>
> Probably you're on the right way. Modifying the String class is tough
> task since it is kernel class and should be provided with appropriate

Actually it is formally not a kernel class. It is not included with other 
kernel classes in DRLVM. But VM uses the knowledge of field names in String 
that hold the data (they are count, offset and value).

> support from the VM. vm_strings.cpp is the part of DRLVM that provides
> such the support. You must be able to recompile it during the normal
> build process of DRLVM then, and particularly this thing would reside
> in libharmonyvm.so or harmonyvm.dll.
>
> Thanks,
> Aleksey.
>
> On Thu, Apr 10, 2008 at 6:18 AM, Megha Chauhan <me...@gmail.com> wrote:
> > > Hello,
> > >
> >  > I am a graduate student at the university of Illinois at chicago,USA.
> >  > As part of my research I have modified the String class of harmony
> >  > JDK. I have added another character array(value_sample) to the class
> >  > which keeps a copy of the value array. Now the problem I am facing is
> >  > in the case of a string literal since no constructor for the string
> >  > class is called explicitly , the value of value_sample array(which was
> >  > added by me) is set to null. I have tried to look into creation of
> >  > string constants but have not found much except that it is
> >  > instantiated by the native code at compile time. I have looked in to
> >  > the vm_strings.cpp class and have seen that the VM initialises the
> >  > fields for String object in the init_fields method.
> >  > I was thinking of adding the new filed I have crested here and
> >  > recompiling the code.
> >  > Am I on the right track?
> >  > Also I would like to know which DLL file holds the code for
> >  > vm_string.cpp class and how can I recompile the DLL ?
> >  > Your help will be greatly appreciated as I have been struggling with
> >  > this issue for more than a month now.
> >  > Thanks and Regards
> >  > Megha Chauhan



-- 
Gregory

Re: [drlvm]Help understanding string literal creation

Posted by Aleksey Shipilev <al...@gmail.com>.
Hi Megha!

Probably you're on the right way. Modifying the String class is tough
task since it is kernel class and should be provided with appropriate
support from the VM. vm_strings.cpp is the part of DRLVM that provides
such the support. You must be able to recompile it during the normal
build process of DRLVM then, and particularly this thing would reside
in libharmonyvm.so or harmonyvm.dll.

Thanks,
Aleksey.

On Thu, Apr 10, 2008 at 6:18 AM, Megha Chauhan <me...@gmail.com> wrote:
> > Hello,
>  >
>  > I am a graduate student at the university of Illinois at chicago,USA. As
>  > part of my research I have modified the String class of harmony JDK. I have
>  > added another character array(value_sample) to the class which keeps a copy
>  > of the value array. Now the problem I am facing is in the case of a string
>  > literal since no constructor for the string class is called explicitly , the
>  > value of value_sample array(which was added by me) is set to null. I have
>  > tried to look into creation of string constants but have not found much
>  > except that it is instantiated by the native code at compile time. I have
>  > looked in to the vm_strings.cpp class and have seen that the VM initialises
>  > the fields for String object in the init_fields method.
>  > I was thinking of adding the new filed I have crested here and recompiling
>  > the code.
>  > Am I on the right track?
>  > Also I would like to know which DLL file holds the code for vm_string.cpp
>  > class and how can I recompile the DLL ?
>  > Your help will be greatly appreciated as I have been struggling with this
>  > issue for more than a month now.
>  > Thanks and Regards
>  > Megha Chauhan
>