Ticket #370 (closed defect: fixed)

Opened 2 months ago

Last modified 4 days ago

AREF/ASET optimizations with undeclared rank

Reported by: gz Assigned to: gb
Priority: normal Milestone:
Component: Performance Version:
Keywords: Cc:

Description

From gb:

(declare (type (simple-array double-float) a b))

declares that A and B are SIMPLE-ARRAYs with unspecified dimensionality. We'll generally only try to open-code the AREF/CCL::ASET if the dimensionality of the array is specified in the declaration.

In "reasonably safe" code, if the declared dimensionality of the array was unpecified (or specified as *), we could treat

(aref a i)

as

(%typed-aref (type-of a) a i)

and typecheck that A is in fact a one-dimensional array of the declared type before doing anything with it. If A was in fact of the wrong dimensionality, we'd get a type error (A isn't a simple-one-dimensional-array of the specified type) rather than a wrong-number-of-subscripts error, but I don't think that AREF's error behavior is too rigidly specified. In unsafe code, we crash and burn if the actual dimensionality doesn't match, but win in more cases if it does.

Change History

01/03/09 16:34:08 changed by rme

  • status changed from new to closed.
  • resolution set to fixed.

Fixed by r11286/r11287, I think.