public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Add a Field to java.lang.Object
@ 2011-06-08 17:20 Noah Heusser
  2011-06-08 18:31 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Noah Heusser @ 2011-06-08 17:20 UTC (permalink / raw)
  To: java

Hi

I'm trying to add an new extra field into java.lang.Object. I need that
to do some memory synchronization via Network.

If I just insert the new Field in libjava/java/lang/Object.h (access
form the Java World is not needed) I get a segmentation fault whenever I
try to run a Java Software using that Object.h. (It does no matter
whether I add it to _JvObjectPrefix or java::lang::Object)

If the JV_HASH_SYNCHRONIZATION Preprocessor Variable is not defined an
extra Filed sync_info gets inserted in Object.h.
But everywhere where extra Code is inserted depending on
JV_HASH_SYNCHRONIZATION it seems to deal with whether or not the Garbage
Collector needs to scan the Object.

If I add the Field in libjava/java/lang/Object.java I get a compile
Error when I compile gcj:
../../../../gcc-src/libjava/java/lang/Object.java:517:0: internal
compiler error: Segmentation fault



What extra change is needed after adding a Filed to Object?


Thanks for your Help
Noah

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add a Field to java.lang.Object
  2011-06-08 17:20 Add a Field to java.lang.Object Noah Heusser
@ 2011-06-08 18:31 ` Andrew Haley
  2011-06-10  9:39   ` Noah Heusser
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Haley @ 2011-06-08 18:31 UTC (permalink / raw)
  To: java

On 06/08/2011 06:20 PM, Noah Heusser wrote:

> I'm trying to add an new extra field into java.lang.Object. I need that
> to do some memory synchronization via Network.
> 
> If I just insert the new Field in libjava/java/lang/Object.h (access
> form the Java World is not needed) I get a segmentation fault whenever I
> try to run a Java Software using that Object.h. (It does no matter
> whether I add it to _JvObjectPrefix or java::lang::Object)
> 
> If the JV_HASH_SYNCHRONIZATION Preprocessor Variable is not defined an
> extra Filed sync_info gets inserted in Object.h.
> But everywhere where extra Code is inserted depending on
> JV_HASH_SYNCHRONIZATION it seems to deal with whether or not the Garbage
> Collector needs to scan the Object.
> 
> If I add the Field in libjava/java/lang/Object.java I get a compile
> Error when I compile gcj:
> ../../../../gcc-src/libjava/java/lang/Object.java:517:0: internal
> compiler error: Segmentation fault
> 
> What extra change is needed after adding a Filed to Object?

Add it to libjava/java/langObject.h
and gcc/java/class.c in make_class_data() after sync_info.
It must be after the GC bitmap marking descriptor.  Be aware that the offset
from the start of the object is used in the marking descriptor.  You're going
to have to get used to the way that works.

I think that's it, but you'll have to try it.

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add a Field to java.lang.Object
  2011-06-08 18:31 ` Andrew Haley
@ 2011-06-10  9:39   ` Noah Heusser
  0 siblings, 0 replies; 3+ messages in thread
From: Noah Heusser @ 2011-06-10  9:39 UTC (permalink / raw)
  To: java

Sorry that it took me so long to verify your Answer.
I must have fucked something up with other chances I made to the code.
But I tried it on a "virgin" Version of gcc-4.5.2 and there it worked.

> Add it to libjava/java/langObject.h
> and gcc/java/class.c in make_class_data() after sync_info.
It is also necessary to update the gcc/java/decl.c in Function
java_init_decl_processing.
The Position is easy to find, it is the only occurrence of sync_info. I
just added my PUSH_FIELD after the sync_info PUSH_FIELD.


Thanks for your Help!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-10  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 17:20 Add a Field to java.lang.Object Noah Heusser
2011-06-08 18:31 ` Andrew Haley
2011-06-10  9:39   ` Noah Heusser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).