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]

Re: Java: [BC] Implement type assertion table


I tried out the type assertion patch today.

Bryce> +bool
Bryce> +vfy_is_assignable_from (vfy_jclass target, vfy_jclass source)
Bryce> +{
[ ... ]
Bryce> +  /* Any class is always assignable to itself, or java.lang.Object. */
Bryce> +  if (source == target || target == object_type_node)
Bryce> +    return true;

We can do further optimizations in the case of arrays.  An array is
always assignable to Serializable or Cloneable, and never assignable
to anything other than Object or another array type.  Likewise,
non-arrays are never assignable to an array type.

On the subject of arrays, I saw a crash running Eclipse because the
assertion table held some array types, but link.cc isn't ensuring that
all the necessary supers are installed.  (Actually linking seems to be
a problem in general.)  I have a runtime patch for this, but it seems
to me that if we stripped off the arrays in the compiler we could
probably improve the chances of sharing entries (and utf8consts) and
potentially reduce the size of the table.

Tom


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