Turning ForceSpecConstr/NoSpecConstr into pragmas?
Manuel M T Chakravarty
chak
Thu Oct 10 03:02:31 UTC 2013
This feature was implemented as an annotation by Roman in part because Simon was keen to see the then new annotation feature used, in part because we were unsure whether the design would last, and it part as it seemed easier than hacking it into GHC.
Personally, I would have always preferred it to be a proper pragma, mainly for the reason that causes grief now (i.e., because it requires stage2). So, as far as I'm concerned, please make it a pragma.
Manuel
Austin Seipp <austin at well-typed.com>:
> Hello all,
>
> Early last week I was reminded of something, which was that vector/dph
> depend on the stage2 compiler - this is because both packages use
> annotations to specify ForceSpecConstr and NoSpecConstr on several key
> datatypes.
>
> For most of our platforms (now including ARM,) this should generally
> be OK, because we have stage2 and the linker available to support it.
>
> But in particular, it makes vector and dph unusable for cross
> compilers. This might be somewhat problematic for e.g. iOS or an RPi,
> where we only have a stage1 cross compiler - but it's reasonable to
> assume we may want to use vector there! And more and more libraries
> depend on vector these days.
>
> I believe these are the only instances in which vector/dph needs
> stage2. So I ask: is it reasonable to change this to a pragma built
> into the compiler? That is,
>
> ------------------------------------------------------------
> data SPEC = SPEC | SPEC2
> {-# ANN type SPEC ForceSpecConstr #-}
>
> data PArray a
> = PArray Int# (PData a)
> {-# ANN type PArray NoSpecConstr #-}
> -------------------------------------------------------------
>
> becomes something like:
>
> -------------------------------------------------------------
> data SPEC = SPEC | SPEC2
> {-# SPECIALIZE Constructor SPEC #-}
>
> data PArray a
> = PArray Int# (PData a)
> {-# NOSPECIALIZE Constructor PArray #-}
> -------------------------------------------------------------
>
> I'm not particularly interested in a bikeshedding discussion about the
> exact syntax for the pragma (although this somewhat falls in line with
> 'INLINE ConLike' as a special case,) - I just want to know if this
> sounds reasonable.
>
> Looking at SpecConstr in the compiler, there seems to be quite a lot
> of note summarising that we need a better design - in particular,
> notes about nuking NoSpecConstr (as it appeared before
> ForceSpecConstr,) and turning ForceSpecConstr into a library type of
> some sort. I don't propose changing any of this really, just removing
> the dependency on the annotations.
>
> But if someone thinks a library type would be better suited for this -
> I'm totally fine with that too and am all-ears for a suggestion.
>
> And of course, both of these can continue to be supported for a while,
> although the patches to vector, at least, would be trivial to switch
> it over.
>
> Ben, Manuel, Simon - you three are the experts here I believe.
> Thoughts? Perhaps I'm missing something key here?
>
> --
> Regards,
>
> Austin Seipp, Haskell Consultant
> Well-Typed LLP, http://www.well-typed.com/
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
More information about the ghc-devs
mailing list