From: simonpj Date: Fri, 4 May 2001 08:09:42 +0000 (+0000) Subject: [project @ 2001-05-04 08:09:42 by simonpj] X-Git-Tag: Approximately_9120_patches~2001 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=30c2423b5dbe5ba5b0c428ede139f57b26a10f2b;p=ghc-hetmet.git [project @ 2001-05-04 08:09:42 by simonpj] **** MERGE WITH 5.00 BRANCH ******** -------------------------------- Make CPR work only for small products -------------------------------- GHC was barfing when doing CPR for programs involving very large products. A one-line fix in MkId.mkDataCon makes it only do CPR for smaller products (I chose 10). Comments -- We do not treat very big tuples as CPR-ish: -- a) for a start we get into trouble because there aren't -- "enough" unboxed tuple types (a tiresome restriction, -- but hard to fix), -- b) more importantly, big unboxed tuples get returned mainly -- on the stack, and are often then allocated in the heap -- by the caller. So doing CPR for them may in fact make -- things worse. This should fix the error Failed to find interface decl for PrelGHC.(#,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,#) I hope. --- diff --git a/ghc/compiler/basicTypes/MkId.lhs b/ghc/compiler/basicTypes/MkId.lhs index e1ba24d..bee9eb4 100644 --- a/ghc/compiler/basicTypes/MkId.lhs +++ b/ghc/compiler/basicTypes/MkId.lhs @@ -31,6 +31,7 @@ module MkId ( #include "HsVersions.h" +import BasicTypes ( Arity ) import TysPrim ( openAlphaTyVars, alphaTyVar, alphaTy, intPrimTy, realWorldStatePrimTy ) @@ -151,10 +152,22 @@ mkDataConId work_name data_con tycon = dataConTyCon data_con cpr_info | isProductTyCon tycon && isDataTyCon tycon && - arity > 0 = ReturnsCPR + arity > 0 && + arity <= mAX_CPR_SIZE = ReturnsCPR | otherwise = NoCPRInfo -- ReturnsCPR is only true for products that are real data types; -- that is, not unboxed tuples or newtypes + +mAX_CPR_SIZE :: Arity +mAX_CPR_SIZE = 10 +-- We do not treat very big tuples as CPR-ish: +-- a) for a start we get into trouble because there aren't +-- "enough" unboxed tuple types (a tiresome restriction, +-- but hard to fix), +-- b) more importantly, big unboxed tuples get returned mainly +-- on the stack, and are often then allocated in the heap +-- by the caller. So doing CPR for them may in fact make +-- things worse. \end{code} The wrapper for a constructor is an ordinary top-level binding that evaluates