This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Compiling multidimensional arrays
- From: Per Bothner <per at bothner dot com>
- To: Charles Turner <chturne at gmail dot com>
- Cc: Kawa mailing list <kawa at sourceware dot org>
- Date: Mon, 16 Sep 2013 20:49:52 -0700
- Subject: Re: Compiling multidimensional arrays
- Authentication-results: sourceware.org; auth=none
- References: <CAPMhJv2u5e-8NeWMUgdcTqSYbajy4J0EfQY66xJadx62pH4=0A at mail dot gmail dot com>
On 09/12/2013 05:51 PM, Charles Turner wrote:
The branching order is an instanceof ObjectType test, and if that
fails, an instanceof ArrayType test. What? ArrayType is a subclass of
ObjectType! How can that branch be taken? Because of that, it seems
Kawa will never emit the multianewarray instruction even if it
correctly handled md arrays in the first place. In r1378, Per made the
following comment:
(emitNewArray): Use anewarray even if element type is ArrayType.
I assume that's because md arrays don't work anyway, so it makes sense
to use the faster anewarray when creating arrays of one dimension, but
why keep the old instanceof ArrayType branch around and not even
comment why it's there? Am I missing something?
I checked in a fix so the logic makes sense, though multianewarray
is only used when dims > 1 - which doesn't happen in the Kawa codebase.
I also noted in the comment that the dims>1 case isn't tested ...
--
--Per Bothner
per@bothner.com http://per.bothner.com/