[Haskell-cafe] Implementing a New primop

Antoine Latter aslatter at gmail.com
Fri Oct 14 23:59:24 CEST 2011

Hi Paul,

The ghc-users list might get you a quicker response to this sort of

Maybe a good start would be to give us a listing of which files you've
modified so far.


On Fri, Oct 14, 2011 at 4:49 PM, Paul Monday <paul.monday at parsci.com> wrote:
> Alright, I wandered through some primtype issues, but I'm having another odd
> problem as I try to define my own primop.  I've followed what the various
> wiki pages have to offer
> (primarily http://hackage.haskell.org/trac/ghc/wiki/AddingNewPrimitiveOperations and http://hackage.haskell.org/trac/ghc/wiki/Commentary/PrimOps)
> without success.  I even unraveled my PrimOp to be, basically, an exact copy
> of another PrimOp without luck.
> The primop I'm attempting to add is now very, very simple and copies
> FloatAddOp exactly so there must be an additional file I have to modify
> before the primop is "completely" added.
> ./compiler/prelude/primops.txt.pp
> primop   FloatVAddOp   "plusFloatVec#"      Dyadic
>    Float# -> Float# -> Float#
>    with commutable = True
> ./compiler/codeGen/CgPrimOp.hs
> translateOp FloatVAddOp = Just (MO_F_Add W32)
> The compiler error is below.  I have the feeling that an interface is not
> being built somewhere … this must be a simple one but I can't find any
> references to this error anywhere … has anyone seen this one before?????
> "inplace/bin/ghc-stage1"   -H64m -O0 -fasm    -package-name ghc-7.3.20111007
> -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm
> -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci
> -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main
> -icompiler/nativeGen -icompiler/parser -icompiler/prelude
> -icompiler/profiling -icompiler/rename -icompiler/simplCore
> -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn
> -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils
> -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen
> -Icompiler/stage2/build -Icompiler/stage2/build/autogen
> -Icompiler/../libffi/build/include -Icompiler/stage2
> -Icompiler/../libraries/base/cbits -Icompiler/../libraries/base/include
> -Icompiler/. -Icompiler/parser -Icompiler/utils   -optP-DGHCI -optP-include
> -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.11.2
> -package array- -package base- -package bin-package-db-
> -package bytestring- -package containers- -package
> directory- -package filepath- -package hoopl- -package
> hpc- -package old-time- -package process- -package
> template-haskell- -package unix-  -Wall
> -fno-warn-name-shadowing -fno-warn-orphans -XHaskell98
> -XNondecreasingIndentation -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards
> -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances
> -XMultiParamTypeClasses -XFlexibleInstances -XRank2Types
> -XScopedTypeVariables -XDeriveDataTypeable -DGHCI_TABLES_NEXT_TO_CODE
> -DSTAGE=2 -O0 -fasm  -no-user-package-conf -rtsopts     -odir
> compiler/stage2/build -hidir compiler/stage2/build -stubdir
> compiler/stage2/build -hisuf hi -osuf  o -hcsuf hc -c
> compiler/iface/BinIface.hs -o compiler/stage2/build/BinIface.o
> ghc-stage1: panic! (the 'impossible' happened)
>   (GHC version 7.3.20111007 for x86_64-unknown-linux):
> applyTypeToArgs
>     ghc-prim:GHC.Prim.sizeofMutableArray#{(w) v 91V} [gid[PrimOp]]
>       @ e{tv i4L2} [tv] ds{v i4Lc} [lid] i#{v i4Lg} [lid]
>     forall a{tv 12} [tv].
>     ghc-prim:GHC.Prim.MutableArray#{(w) tc 31m}
>       e{tv i4L2} [tv] a{tv 12} [tv]
>     -> ghc-prim:GHC.Prim.Int#{(w) tc 3G}
> Paul Monday
> Parallel Scientific, LLC.
> paul.monday at parsci.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list