Patch: java class registration via .jcr section

Richard Henderson rth@redhat.com
Sun Aug 5 20:39:00 GMT 2001


On Fri, Aug 03, 2001 at 11:05:02PM -0400, green@peach.cygnus.co.uk wrote:
> +asm (JCR_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
> +STATIC void *__JCR_LIST__[1] __attribute__ ((__unused__)) = { 0 };

Didn't I tell you not to do this?  This should be

STATIC void *__JCR_LIST__[] 
  __attribute__((unused, section(JCR_SECTION_NAME)))
  = { 0 };

> +#ifdef JCR_SECTION_ASM_OP
> +  , in_jcr
> +#endif

No, you don't need this.  Just use named_section.

> +#ifdef ASM_OUTPUT_JCR
> +  ASM_OUTPUT_JCR (asm_out_file, name);
> +#else

Why on God's green earth are you adding yet another way to 
output a label?  This should be

void
assemble_jcr (symbol)
     rtx symbol;
{
  named_section_flags (JCR_SECTION_NAME, SECTION_WRITE,
		       POINTER_SIZE / BITS_PER_UNIT);
  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
}
  
And, really, there's no particular need to have this in 
varasm.c at all.  Put it in java/class.c where it's used.

>  emit_register_classes ()
>  {
> +#ifdef JCR_SECTION
> +  tree t;
> +  for ( t = registered_class; t; t = TREE_CHAIN (t))
> +    assemble_jcr (XEXP (XEXP (DECL_RTL (t), 0), 0));
> +#else

You had an rtl checking failure here.  The outer XEXP should
have been an XSTR.  But with the above change to assemble_jcr,
you'll be dropping it entirely.

Further, let's avoid as much conditional compilation as possible
by testing targetm.have_named_sections rather than JCR_SECTION_NAME.



r~



More information about the Gcc-patches mailing list