Re: Native Threads in the RTS

2002-11-18 Thread Wolfgang Thaller
Nicolas Oury wrote: I don't know if what I say is pertinent, but there was another problem that was discussed in the thread about threaded RTS. One may want to use a finalizer in a particular thread. For example, a finalizer that put make a rotating cube on screen must be ran in the same thread

Re: first stab at -ffunction-sections

2002-11-18 Thread William Lee Irwin III
On Mon, Nov 18, 2002 at 04:57:50PM -, Simon Marlow wrote: > You should be aware that -split-objs (the trick we use to build our > libraries in lots of little bits) gets most of the benefit that you'd > get from using -ffunction-sections. You might get slightly more > fine-grained discarding of

Re: Native Threads in the RTS

2002-11-18 Thread Nicolas Oury
I don't know if it is planned but I think it could be great to be able to have, in the new OS thread for OpenGL, an "expressivity only" concurrence system. I mean that to be able to fork user threads that are executed in the new OS thread. These new threads would be blocked on other threads in

Re: unsafePerformIO and IORefs

2002-11-18 Thread Lennart Augustsson
Yes, there are several reasons for having UNSAFE in the name. :-) -- Lennart Ashley Yakeley wrote: At 2002-11-18 11:05, Sven Panne wrote: global :: a -> IORef a global a = unsafePerformIO (newIORef a) This is useful, you can do this with it: ref = global Nothing convert :: a ->

Re: Native Threads in the RTS

2002-11-18 Thread Nicolas Oury
I don't know if what I say is pertinent, but there was another problem that was discussed in the thread about threaded RTS. One may want to use a finalizer in a particular thread. For example, a finalizer that put make a rotating cube on screen must be ran in the same thread as the Opengl/GLUT th

Re: unsafePerformIO and IORefs

2002-11-18 Thread Ashley Yakeley
At 2002-11-18 11:05, Sven Panne wrote: >global :: a -> IORef a >global a = unsafePerformIO (newIORef a) This is useful, you can do this with it: ref = global Nothing convert :: a -> IO b convert a = do writeIORef ref (Just a) Just b <- readIORef ref return b -- Ashley Yakel

Re: unsafePerformIO and IORefs

2002-11-18 Thread Michael Weber
On Mon, Nov 18, 2002 at 10:36:05AM -0800, Hal Daume III wrote: > You can't. CSE (common subexpression elimination) will replace any > occurances of 'newState 0' in a function body with the same value. > > In short: don't use upIO :) Sorry, cannot resist to pour a little salt onto the wound :) [

Re: unsafePerformIO and IORefs

2002-11-18 Thread Sven Panne
Hal Daume III wrote: > You can't. [...] Well, you can, but only for CAFs. This idiom/hack is used quite happily throughout GHC, HOpenGL, H/Direct, ... Slightly modified stuff from GHC's sources: -- global variables in Haskell :-) -

Re: unsafePerformIO and IORefs

2002-11-18 Thread Hal Daume III
You can't. CSE (common subexpression elimination) will replace any occurances of 'newState 0' in a function body with the same value. In short: don't use upIO :) If I'm wrong, someone will correct me. But expect a few "what are you trying to do" email messages or people suggesting implicit pare

unsafePerformIO and IORefs

2002-11-18 Thread Nicolas Oury
I want to write something like type State a = IORef a newState :: a -> State a newState v = unsafePerformIO (newIORef v) But I don't want the compileer to inline this nor to inline any application of this. {#NOINLINE newState#} But how can I stop this function to be inlined when applied for

RE: first stab at -ffunction-sections

2002-11-18 Thread Simon Marlow
> On Mon, Nov 18, 2002 at 11:55:27AM -, Simon Marlow wrote: > > What exactly are you trying to use -ffunction-sections for? > I'm pretty > > sure it won't work as things stand currently, unless you > can guarantee > > to be able to find a text/data boundary symbol for the > garbage collect

Re: first stab at -ffunction-sections

2002-11-18 Thread William Lee Irwin III
On Mon, Nov 18, 2002 at 11:55:27AM -, Simon Marlow wrote: > What exactly are you trying to use -ffunction-sections for? I'm pretty > sure it won't work as things stand currently, unless you can guarantee > to be able to find a text/data boundary symbol for the garbage collector > (currently it

RE: -Werror Request

2002-11-18 Thread Simon Marlow
> If it's not too much work, I'd like to request a "-Werror" > option for GHC > that would turn warnings into errors. Sometimes warnings one > would like to catch get lost in a long make process. We agree, it's on the TODO list. Cheers, Simon ___

Re: Bug? [was: Implicit params]

2002-11-18 Thread Jorge Adriano
> Now fixed in the HEAD, and will be in 5.04.2 > > Thanks for pointing it out. > > Simon Thanks :) J.A. ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

RE: Class/Implicit Param/Module Interface bug

2002-11-18 Thread Simon Peyton-Jones
These bugs are now fixed in the HEAD. I hope the fixes will make it into 5.04.2 as well. Thanks for identifying them. It was all horribly bogus before. Simon | -Original Message- | From: Ashley Yakeley [mailto:[EMAIL PROTECTED]] | Sent: 13 November 2002 13:46 | To: Simon Peyton-Jones |

RE: Bug? [was: Implicit params]

2002-11-18 Thread Simon Peyton-Jones
Now fixed in the HEAD, and will be in 5.04.2 Thanks for pointing it out. Simon | -Original Message- | From: Jorge Adriano [mailto:[EMAIL PROTECTED]] | Sent: 14 November 2002 21:10 | To: Iavor S. Diatchki | Cc: Haskell Cafe; [EMAIL PROTECTED] | Subject: Bug? [was: Implicit params] | | On

RE: first stab at -ffunction-sections

2002-11-18 Thread Simon Marlow
> This could be an artifact of the -j64 (BTW, has anyone else > noticed the > makefiles can only keep 5 or 6 cpus busy at a time much of the time, > and often less?). There are probably still bugs in our build system w.r.t. make -jN. I occasionally use it to build the compiler, but rarely any ot

RE: Native Threads in the RTS

2002-11-18 Thread Simon Marlow
> We can't currently allow several Haskell threads to really run > simultaneosly [e.g. on two separate processors, or preemtively > scheduled on a single processor], because they always mutate the same > global heap. Currently, GHC switches its green threads only at times > when the heap is in

RE: Native Threads in the RTS

2002-11-18 Thread Simon Marlow
> I'm still unconvinced that the current optional > RTS support for mixed green/native threads is the right way > to go. It looks to > me like a workaround for poor OS support for really > lightweight threads. It is a workaround for the lack of truly lightweight threads at the OS level. But I

RE: Silly question about IORefs and MVars

2002-11-18 Thread Simon Marlow
> I have a silly question about IORefs and MVars. > > When do we have to use MVars if a var is accessed by multiple > threads. > In fact, I wonder why IORefs updates aren't safe : > it seems that preemptive scheduling takes place during memory > allocation > and I can't see where there could

RE: Native Threads in the RTS

2002-11-18 Thread Simon Peyton-Jones
| I propose adding something like | | forkNativeThread :: IO () -> IO () I haven't talked to Simon about this, but it sounds possible. Three thoughts. First, before doing anything like this I'd like to ask you or someone else, or a group, to write a clear exposition of what the problem is and