This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java: fixes for -fno-assume-compiled


Jeff Sturm writes:
 > Below are separate frontend and runtime patches.
 > 
 > The -fno-assume-compiled switch can eliminate the need for most external
 > data symbol references normally emitted by gcj, making it easy to build
 > Java executables mixed with native code and interpreted bytecode.
 > However it hasn't worked in a long time (if it ever did).
 > 
 > With these patches I can build and execute simple non-PIC Java
 > applications with -fno-assume-compiled.  It does not yet work with -fPIC
 > on i686-linux, but that doesn't affect use of -fassume-compiled, which is
 > the default behavior for gcj.
 > 
 > Regression tested on i686-pc-linux-gnu.  OK for mainline (after BiB merges
 > are through)?
 > 
 > Jeff
 > 
 > 2002-12-14  Jeff Sturm  <jsturm@one-point.com>
 > 
 > 	* class.c (build_static_field_ref): Check FIELD_FINAL.
 > 	* constants.c (alloc_class_constant): Use TYPE_CPOOL_DATA_REF
 > 	instead of current_constant_pool_data_ref.
 > 	* except.c (prepare_eh_table_type ): Use DECL_NAME of class type,
 > 	not build_internal_class_name.
 > 	* parse.y (patch_incomplete_class_ref): Always emit `class$' method.
 > 	Use it when class ref isn't certain to be compiled.
 > 

Could you explain this next hunk a bit more?  It seems to defeat an
optimization.  Perhaps the optimization didn't work, or didn't help?

 > Index: constants.c
 > ===================================================================
 > RCS file: /cvs/gcc/gcc/gcc/java/constants.c,v
 > retrieving revision 1.22
 > diff -u -p -r1.22 constants.c
 > --- constants.c	18 Nov 2002 15:46:32 -0000	1.22
 > +++ constants.c	14 Dec 2002 17:40:17 -0000
 > @@ -386,10 +386,12 @@ alloc_class_constant (clas)
 >  static tree
 >  build_constant_data_ref ()
 >  {
 > +  tree cpool_data_ref = NULL_TREE;
 > +
 >    if (TYPE_CPOOL_DATA_REF (current_class))
 > -    current_constant_pool_data_ref = TYPE_CPOOL_DATA_REF (current_class);
 > +    cpool_data_ref = TYPE_CPOOL_DATA_REF (current_class);
 > 
 > -  else if (current_constant_pool_data_ref == NULL_TREE)
 > +  if (cpool_data_ref == NULL_TREE)
 >      {
 >        tree decl;
 >        tree decl_name = mangled_classname ("_CD_", current_class);
 > @@ -398,10 +400,10 @@ build_constant_data_ref ()
 >  					   one_elt_array_domain_type));
 >        TREE_STATIC (decl) = 1;
 >        make_decl_rtl (decl, NULL);
 > -      TYPE_CPOOL_DATA_REF (current_class) = current_constant_pool_data_ref
 > +      TYPE_CPOOL_DATA_REF (current_class) = cpool_data_ref
 >  	= build1 (ADDR_EXPR, ptr_type_node, decl);
 >      }
 > -  return current_constant_pool_data_ref;
 > +  return cpool_data_ref;
 >  }
 > 
 >  /* Get the pointer value at the INDEX'th element of the constant pool. */

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]