Ticket #2917: alignment.patch

File alignment.patch, 6.8 KB (added by guest, 7 years ago)

Patch to use alignment.

Line 
1
2New patches:
3
4[Use alignment when allocating for a Storable.
5[email protected]**20090107154132] {
6hunk ./Foreign/Marshal/Alloc.hs 35
7-import Foreign.Storable         ( Storable(sizeOf) )
8+import Foreign.Storable         ( Storable(sizeOf, alignment) )
9+import Foreign.Ptr              ( alignPtr )
10hunk ./Foreign/Marshal/Alloc.hs 78
11-    doMalloc dummy  = mallocBytes (sizeOf dummy)
12+    doMalloc dummy  = do
13+        let align = alignment dummy
14+        ptr <- mallocBytes (sizeOf dummy + align - 1)
15+        return (alignPtr ptr align)
16hunk ./Foreign/Marshal/Alloc.hs 103
17-    doAlloca       :: Storable a' => a' -> (Ptr a' -> IO b') -> IO b'
18-    doAlloca dummy  = allocaBytes (sizeOf dummy)
19+    doAlloca           :: Storable a' => a' -> (Ptr a' -> IO b') -> IO b'
20+    doAlloca dummy act  =
21+        let align = alignment dummy
22+        in  allocaBytes (sizeOf dummy + align - 1) $ \ ptr ->
23+            act (alignPtr ptr align)
24hunk ./Foreign/Marshal/Array.hs 65
25-import Foreign.Ptr      (Ptr, plusPtr)
26-import Foreign.Storable (Storable(sizeOf,peekElemOff,pokeElemOff))
27+import Foreign.Ptr      (Ptr, plusPtr, alignPtr)
28+import Foreign.Storable (Storable(sizeOf,peekElemOff,pokeElemOff,alignment))
29hunk ./Foreign/Marshal/Array.hs 90
30-    doMalloc dummy size  = mallocBytes (size * sizeOf dummy)
31+    doMalloc dummy size  = do
32+        let align = alignment dummy
33+        ptr <- mallocBytes (size * sizeOf dummy + align - 1)
34+        return (alignPtr ptr align)
35hunk ./Foreign/Marshal/Array.hs 107
36-    doAlloca            :: Storable a' => a' -> Int -> (Ptr a' -> IO b') -> IO b'
37-    doAlloca dummy size  = allocaBytes (size * sizeOf dummy)
38+    doAlloca                :: Storable a' => a' -> Int -> (Ptr a' -> IO b') -> IO b'
39+    doAlloca dummy size act  =
40+        let align = alignment dummy
41+        in  allocaBytes (size * sizeOf dummy + align - 1) $ \ ptr ->
42+            act (alignPtr ptr align)
43hunk ./Foreign/Marshal/Array.hs 125
44-    doRealloc dummy ptr size  = reallocBytes ptr (size * sizeOf dummy)
45+    doRealloc dummy ptr size  = do
46+        let align = alignment dummy
47+        ptr <- reallocBytes ptr (size * sizeOf dummy + align - 1)
48+        return (alignPtr ptr align)
49}
50
51Context:
52
53[Fix build when we have HTYPE_TCFLAG_T
54Ian Lynagh <[email protected]>**20090105102020]
55[Fix the build on Windows
56Ian Lynagh <[email protected]>**20090105014625]
57[Add errno to the IOError type
58Ian Lynagh <[email protected]>**20090104173018]
59[Fix typo (reqwests -> requests); trac #2908, spotted by bancroft
60Ian Lynagh <[email protected]>**20090104154405]
61[More compact error messages for record selectors
62[email protected]**20090102145325
63 
64 Make recSelError generate the standard part of the record selector
65 error message (i.e. "No match in record selector") rather than have
66 that string duplicated for every record selector.
67 
68]
69[extra dependencies for the new build system
70Simon Marlow <[email protected]>**20081217104655]
71[warning fix: don't use -XPatternSignatures in GHC >= 6.10
72Simon Marlow <[email protected]>**20081217104637]
73[Rollback INLINE patches
74Simon Marlow <[email protected]>**20081216104143
75 
76 rolling back:
77 
78 Fri Dec  5 17:00:15 GMT 2008  [email protected]
79   * Update INLINE pragmas for new INLINE story
80   
81   - (.) and foldr should inline when applied to only two arguments
82   - Make unpackCString# NOINLINE; it inlines too much (with little gain)
83   
84 
85     M ./GHC/Base.lhs -10 +31
86]
87[FIX #1364: added support for C finalizers that run as soon as the value is no longer reachable.
88Ivan Tomac <[email protected]>**20081210150510
89 
90 Patch amended by Simon Marlow:
91   - mkWeakFinalizer# commoned up with mkWeakFinalizerEnv#
92]
93[Fix #2760: deprecate mkNorepType, add mkNoRepType
94Jose Pedro Magalhaes <[email protected]>**20081121141905]
95[Update INLINE pragmas for new INLINE story
96[email protected]**20081205170015
97 
98 - (.) and foldr should inline when applied to only two arguments
99 - Make unpackCString# NOINLINE; it inlines too much (with little gain)
100 
101]
102[Fix #2750: change Prelude.(,) to Prelude.(,,)
103Jose Pedro Magalhaes <[email protected]>**20081201113411]
104[Fix typo (or out of date reference) in throwTo documentation.
105shelarcy <[email protected]>**20081129024639]
106[Add more description of what "round" does, from the H98 report
107Ian Lynagh <[email protected]>**20081119143131]
108[re-instate the gcd/Integer and lcm/Integer RULES
109Simon Marlow <[email protected]>**20081120101826
110 Fixes a performance regression between 6.8.3 and 6.10.1
111]
112[Change an "undefined" into a more informative error; trac #2782
113Ian Lynagh <[email protected]>**20081116160228]
114[updating Haddock documentation
115[email protected]**20081111095023
116 
117 Fixed the broken link from Data.Generics to Data.Data.
118]
119[add GHC.Conc.runSparks (required by GHC patch "Run sparks in batches")
120Simon Marlow <[email protected]>**20081106095419]
121[FIX #2722: update RULES for the Category/Arrow split
122Ross Paterson <[email protected]>**20081104144515
123 
124 The rule
125 
126        arr id = id
127 
128 interacts unpleasantly with the advice to define
129 
130        id = arr id
131 
132 in instances of Category that are also instances of Arrow (#2722).
133 
134 Also changed a couple of >>>'s to .'s in later rules.
135]
136[Add AnnotationWrapper type so GHC can capture annotation dictionaries during compilation
137Max Bolingbroke <[email protected]>**20081016122608]
138[docs about how exceptions are handled by forkIO'd threads (#2651)
139Simon Marlow <[email protected]>**20081016100410]
140[Import n_capabilities via import symbol when linking dynamically
141Clemens Fruhwirth <[email protected]>**20081013161220]
142[add link to the new syb wiki
143[email protected]**20081013111605]
144[changing haddock links
145[email protected]**20081010095434]
146[add readTVarIO :: TVar a -> IO a
147Simon Marlow <[email protected]>**20081010113835]
148[removed (->) instance from Data.Data
149[email protected]**20081006075254]
150[non-GHC: delete unnecessary imports
151Ross Paterson <[email protected]>**20081007134809]
152[added new module Data.Data
153'Jose Pedro Magalhaes <[email protected]>'**20081002140535
154 
155 The new Data.Data module contains all of Data.Generics.Basics
156 and most of Data.Generics.Instances. The missing instances were
157 deemed dubious and moved to the syb package.
158]
159[add new Data.Data module
160'Jose Pedro Magalhaes <[email protected]>'**20081002082735]
161[restore Complex's derived Data instance
162'Jose Pedro Magalhaes <[email protected]>'**20081002082655]
163[update Data.Generics import
164'Jose Pedro Magalhaes <[email protected]>'**20081002082604]
165[Don't use ^(2::Int) in Data.Complex.magnitude; partially fixes trac #2450
166Ian Lynagh <[email protected]>**20081004142651
167 We still might want to make a RULE for this, so the bug is not fully fixed.
168]
169[Restore the Haskell 98 behaviour of Show Ratio (#1920)
170Simon Marlow <[email protected]>**20080923134949]
171[Pad version number to 4.0.0.0
172Ian Lynagh <[email protected]>**20080920155801]
173[TAG 6.10 branch has been forked
174Ian Lynagh <[email protected]>**20080919123437]
175Patch bundle hash:
176d07bd7c2e94332c181e53cd9d4d2a08ef164b240