Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
  • dtc's avatar
    daf333f4
    Reworking of the values-type system to overcome a number of inconsistencies · daf333f4
    dtc authored
    causing problems:
    
    o Redefine coerce-to-values to convert a single value type into (values type),
      rather than the former definition (values type &rest t). A single value
      type such as fixnum is now equivalent to (values fixnum). Values-type-union
      and values-type-intersection will canonicalise values types with a
      single value such as (values fixnum) back to a single value type
      such as fixnum.
    
    o Now when the compiler makes assertions for the first value of
      continuations that may be generating multiple values it asserts the
      type as (values type &rest t), or as (value &optional type &rest t) if
      it is not sure that the continuation does generate a value.
    
    o Enhance the type check generation to better handle the now common
      values types with optional and rest arguments. Add the new function
      Values-types-asserted which converts asserted optional and rest
      arguments to required arguments that have been proven to be delivered,
      Thus an assertion such as (values &optional fixnum &rest t) will
      generate a fixnum type check if the proven type if (values t).
    
    o The compiler is now far more likely to pickup attempts to use an
      assertion to select a subset of values. For example
      (the (values fixnum) (values x y)) will generated a compiler warning.
    
    o Update single values type assertions where appropriate to clarify that
      the received values may be optional or that multiple values may be
      received. For example, a macro argument which had been asserted to be
      a list via (the list ,...) would now be asserted to be
      (the (values &optional list &rest t)) etc.
    
    o Have the IR1 translator for THE convert single value types into
      (values &optional type &rest t) so that code such as
      (the fixnum (values x y)) will still work acceptably. This does not
      restrict the possible type assertions as the values types may be used
      and are not modified.
    daf333f4
    History
    Reworking of the values-type system to overcome a number of inconsistencies
    dtc authored
    causing problems:
    
    o Redefine coerce-to-values to convert a single value type into (values type),
      rather than the former definition (values type &rest t). A single value
      type such as fixnum is now equivalent to (values fixnum). Values-type-union
      and values-type-intersection will canonicalise values types with a
      single value such as (values fixnum) back to a single value type
      such as fixnum.
    
    o Now when the compiler makes assertions for the first value of
      continuations that may be generating multiple values it asserts the
      type as (values type &rest t), or as (value &optional type &rest t) if
      it is not sure that the continuation does generate a value.
    
    o Enhance the type check generation to better handle the now common
      values types with optional and rest arguments. Add the new function
      Values-types-asserted which converts asserted optional and rest
      arguments to required arguments that have been proven to be delivered,
      Thus an assertion such as (values &optional fixnum &rest t) will
      generate a fixnum type check if the proven type if (values t).
    
    o The compiler is now far more likely to pickup attempts to use an
      assertion to select a subset of values. For example
      (the (values fixnum) (values x y)) will generated a compiler warning.
    
    o Update single values type assertions where appropriate to clarify that
      the received values may be optional or that multiple values may be
      received. For example, a macro argument which had been asserted to be
      a list via (the list ,...) would now be asserted to be
      (the (values &optional list &rest t)) etc.
    
    o Have the IR1 translator for THE convert single value types into
      (values &optional type &rest t) so that code such as
      (the fixnum (values x y)) will still work acceptably. This does not
      restrict the possible type assertions as the values types may be used
      and are not modified.