public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Boehm, Hans" <hans.boehm@hp.com>
To: Dave Korn <dave.korn.cygwin@googlemail.com>, GCC Java <java@gcc.gnu.org>
Subject: RE: Two quick GC questions [was Re: [REVIVED: PATCH PR42811,4.5  regression]  java.lang.ExceptionInInitializerError in ecj1]
Date: Thu, 18 Feb 2010 22:06:00 -0000	[thread overview]
Message-ID: <238A96A773B3934685A7269CC8A8D0425784FAA73B@GVW0436EXB.americas.hpqcorp.net> (raw)
In-Reply-To: <4B7DA9FA.1020307@gmail.com>

 

> -----Original Message-----
> From: java-owner@gcc.gnu.org [mailto:java-owner@gcc.gnu.org] 
> On Behalf Of Dave Korn
> Sent: Thursday, February 18, 2010 12:59 PM
> To: GCC Java
> Cc: Dave Korn
> Subject: Two quick GC questions [was Re: [REVIVED: PATCH 
> PR42811,4.5 regression] java.lang.ExceptionInInitializerError in ecj1]
> 
> On 18/02/2010 15:56, Dave Korn wrote:
> 
> >>> Running 
> /gnu/gcc/gcc/libjava/testsuite/libjava.loader/loader.exp ...
> >>> FAIL: 
> >>> 
> /gnu/gcc/obj-pr42811-3/i686-pc-cygwin/libjava/testsuite/TestEarlyGC.
> >>> exe output - 
> >>> 
> /gnu/gcc/obj-pr42811-3/i686-pc-cygwin/libjava/testsuite/TestEarlyGC.
> >>> exe
> >> *sigh*, and it turns out to be because some memory is getting 
> >> released by the garbage collector when its still in use.  I'm busy 
> >> trying to learn how the GC works real fast so I can figure 
> out what's going wrong.
> 
>   Well, it turns out to be fairly straightforward: there is 
> no code to register the .data and .bss sections of the main 
> executable as static data regions with the GC, so it has no 
> idea there's a live pointer to an object(*) in there, and 
> happily frees it up.
> 
>   This leads me to two quick questions about the GC:
> 
> 1- There's no call to GC_INIT anywhere under libjava/, and I 
> can't find anything in boehm.cc that even looks suitable for 
> the purpose.  Does anyone know how the main exe's data/bss 
> sections are supposed to get registered on a posixy system?
The GC normally does that internally, whether or not GC_INIT is called.  GC_init_inner() does not need to get called, but the collector tries to do that automatically when it can, though IIRC gcj should call GC_init()directly, possibly not through the GC_INIT() macro.

In the simplest case, GC_init_inner calls GC_register_data_segments.  In other cases, GC_register_dynamic_libraries does it, and GC_register_main_static_data() returns false,
avoiding the call the GC_register_data_segments.


> 
> 2- Libgcj statically links its own personal private copy of 
> boehm-gc, rather than using a shared library; does anyone 
> know why it was designed this way?
Way back when, it needed a custon GC configuration.  But those options have generally become runtime configurable, so I suspect that's no longer true, though it may need to make some initialization calls to get the right configuration.

Hans
> 
> >   I'm now very sure that the problem is a side-effect of the libgcj 
> > DLL being rebased at runtime, and not related to the clearing of 
> > memory in _Jv_GetJVMTIEnv (which isn't even called in this 
> testcase).
> 
>   This remains the case, btw.
> 
>     cheers,
>       DaveK
> --
> (*) - The object in question happens to be the jstring "C" 
> passed as a name to defineClass, and next time through the 
> loop it's been replaced by a hashmap object and defineClass 
> throws when it finds it has the wrong object type as an argument.
> 
> 

  reply	other threads:[~2010-02-18 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B6C9B26.3010106@gmail.com>
     [not found] ` <4B6D0C67.5030500@gmail.com>
2010-02-14 22:23   ` JVMTI events system and _jvmtiEnvironments uninitialised memory problem? [was Re: [PATCH " Dave Korn
     [not found]   ` <4B78BA6D.5000603@gmail.com>
     [not found]     ` <7230133d1002150504r23738e28if92303426c349661@mail.gmail.com>
     [not found]       ` <4B7CC61E.1050709@gmail.com>
     [not found]         ` <4B7D631B.8030401@gmail.com>
2010-02-18 20:41           ` Two quick GC questions [was Re: [REVIVED: PATCH " Dave Korn
2010-02-18 22:06             ` Boehm, Hans [this message]
2010-02-19  7:04               ` Dave Korn
2010-02-18 22:13             ` Bryce McKinlay
2010-02-19  3:22               ` Boehm, Hans
2010-02-20 18:22             ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=238A96A773B3934685A7269CC8A8D0425784FAA73B@GVW0436EXB.americas.hpqcorp.net \
    --to=hans.boehm@hp.com \
    --cc=dave.korn.cygwin@googlemail.com \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).