Re: gitweb on darcs.haskell.org?

2011-06-21 Thread Edward Z. Yang
All of the GHC repos are mirrored to Github, which offers similar facilities. Of course, it wouldn't be too much work to setup gitweb on darcs.haskell.org, I don't think. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org h

Re: MonoLocalBinds and hoopl

2011-06-17 Thread Edward Z. Yang
In case it wasn't clear, I'd very much be in favor of implementing this refinement. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: MonoLocalBinds and hoopl

2011-06-14 Thread Edward Z. Yang
I ran into some more code like this, and I realized there was something pretty important: the majority of let-bindings do not have any free varaibles. They could very well be floated to the top level without having to make any source level changes. So maybe let should be generalized, if no free va

Re: testsuite results

2011-05-15 Thread Edward Z. Yang
To chime in, latest validate for me on x86-32 had two fails: OVERALL SUMMARY for test run started at Sun May 15 16:16:28 BST 2011 2773 total tests, which gave rise to 10058 test cases, of which 0 caused framework failures 7598 were skipped 2377 expected passes 81 expec

Re: Tracing idea

2011-05-12 Thread Edward Z. Yang
Mar 01 05:46:01 -0500 2011: > On 21/02/2011 01:08, Edward Z. Yang wrote: > > Excerpts from Tyson Whitehead's message of Sun Feb 20 07:14:56 -0500 2011: > >> I believe a back trace on the actual call stack is generally considered not > >> that useful in a lazy la

Re: performance issues in simple arithmetic code

2011-04-28 Thread Edward Z. Yang
Excerpts from Denys Rtveliashvili's message of Thu Apr 28 04:41:48 -0400 2011: > Well.. I found some places in C-- compiler which are supposed to convert > division and multiplication by 2^n into shifts. And I believe these work > sometimes. > > However in this case I am a bit puzzled because eve

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
Excerpts from Bas van Dijk's message of Sun Apr 24 16:10:46 -0400 2011: > Well the whole block of code is under a mask_ so if FFI calls are not > interruptible the queued up exceptions should not be fired. Ah, I didn't know that. I think it would be extremely surprising for users if FFI calls eve

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
Excerpts from Bas van Dijk's message of Sun Apr 24 12:23:19 -0400 2011: > On 24 April 2011 10:26, Edward Z. Yang wrote: > > No, you have to use the 'interruptible' keyword. > > Good, I need them to be uninterruptible. So I guess I can apply > uninterruptibleMask_

Re: Are FFI calls interruptible?

2011-04-24 Thread Edward Z. Yang
No, you have to use the 'interruptible' keyword. Cheers, Edward Excerpts from Bas van Dijk's message of Sat Apr 23 20:07:05 -0400 2011: > Hello, > > Quick question: are safe/unsafe FFI calls interruptible? > > Thanks, > > Bas > ___ Glasgow-haskell-

Re: GHC/LLDB integration

2011-04-20 Thread Edward Z. Yang
Hello William, You can find "the state of the art" (which isn't very advanced :-) in debugging GHC compiled code with GDB here: http://hackage.haskell.org/trac/ghc/wiki/Debugging/CompiledCode Maybe others can give more specific advice. Cheers, Edward Excerpts from William Knop's message of

C-- roundtripping: switch, if and other control flow statements

2011-04-15 Thread Edward Z. Yang
Hello all, I'm interested in improving GHC's C-- parser's support (and also making accomodations for the parser in our C-- pretty-printer) to the point where we can round-trip output from -ddump-opt-cmm with no semantic change. There are several roadblocks on the way here, but the one I'm current

Re: Validate failures on the new codegen

2011-04-07 Thread Edward Z. Yang
Excerpts from Karel Gardas's message of Thu Apr 07 13:14:46 -0400 2011: > OK! Thanks for the information. So this -fnew-codegen is this famous > codegen which is using hoopl for data-dependency tracking or something > like that if I understand correctly Yep. > And which is producing just C-- in

Re: -DDEBUG and testsuite

2011-04-06 Thread Edward Z. Yang
d add checks for -dno-debug-output, though if some tests are checking for debug output, that might be tricky. Edward Excerpts from Simon Marlow's message of Tue Apr 05 15:35:45 -0400 2011: > On 05/04/11 17:50, Edward Z. Yang wrote: > > Hello all, > > > > If I run '

-DDEBUG and testsuite

2011-04-05 Thread Edward Z. Yang
Hello all, If I run 'make fast' in the testsuite, with a stage2 compiler that has been built with -DDEBUG, should I be getting extra failures? Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailma

Re: FFI and LLVM

2011-03-30 Thread Edward Z. Yang
The main thing about FFI support is calling conventions, and LLVM supports a variety of them, so if your LLVM code is using a calling convention GHC supports, you should be able to manage it (there probably isn't any toolchain support though, so you'll have to build the LLVM bits manually and then

Re: Tracing idea

2011-02-20 Thread Edward Z. Yang
Excerpts from Tyson Whitehead's message of Sun Feb 20 07:14:56 -0500 2011: > I believe a back trace on the actual call stack is generally considered not > that useful in a lazy language as it corresponds to the evaluation sequence, > That is, it is demand centric while written code is production

Tracing idea

2011-02-19 Thread Edward Z. Yang
I was thinking it might be useful if we had a per-thread circular buffer in memory for which we pushed a pointer to the info table we had just entered. In the event of a crash, you could dump the contents of the buffer to see what code had been recently executed. To reduce overhead, one might onl

Re: 4221 on new codegen

2011-02-01 Thread Edward Z. Yang
sage of Tue Feb 01 03:44:41 -0500 2011: > On 01/02/2011 00:01, Edward Z. Yang wrote: > > Current theory: > > > >c1jj: > >_s1ep::I32 = I32[(slot<_s1ep::I32> + 4)]; // CmmAssign > >_s1fP::I32 = I32[(slot<_s1fP::I32> + 4)]; // CmmA

Re: 4221 on new codegen

2011-01-31 Thread Edward Z. Yang
Current theory: c1jj: _s1ep::I32 = I32[(slot<_s1ep::I32> + 4)]; // CmmAssign _s1fP::I32 = I32[(slot<_s1fP::I32> + 4)]; // CmmAssign // outOfLine should follow: _s1eq::F64 = F64[_s1fP::I32 + 3]; // CmmAssign I32[(young + 4)] = c1jh; // CmmStore foreign

4221 on new codegen

2011-01-29 Thread Edward Z. Yang
Test 4221 (under the ffi folder) segfaults with the new codegen turned on. Before: 0xb7a68c78: 0x822fadc 0xb7a68c74: 0xb7ab8f94 0xb7a68c70: 0xb7ab8fa4 0xb7a68c6c: 0x8134dc0 0xb7a68c68: 0xb7ab8f94 0xb7a68c64: 0x822f9f4 0xb7a68c60: 0xb7ab8f48 0xb7a68c5c: 0xb7ab8f8

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
*you feel a sudden sense of deja vu* Here is my current play on things: - I can probably get a devel2 build with the new codegen turned on for everything. This list of errors is from that build. However, this build was originally failing, so I'm going to do a fresh devel2

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
Ok, I have a stage2 compiler built with the new codegen all the way, and here are the new failing cases: 1372(normal) 2047(normal) 4030(normal) OldException001(normal) async001(normal) bug1465(normal) cabal01(normal) cabal03(normal) cgrun016(normal) cgrun045(normal)

Re: New codegen failing test-cases

2011-01-13 Thread Edward Z. Yang
Yep, switching > inlineStmt u a (CmmCall target regs es srt ret) > = CmmCall (infn target) regs es' srt ret > where infn (CmmCallee fn cconv) = CmmCallee fn cconv > infn (CmmPrim p) = CmmPrim p > es' = [ (CmmHinted (inlineExpr u a e) hint) | (CmmHinted e hint) <- es to > inline

Re: New codegen failing test-cases

2011-01-12 Thread Edward Z. Yang
With further poking, I think the new codegen is actually tickling an existing bug in the native code generator optimizations, since the cmmz output looks ok: cSH: _sQR::I32 = I32[_sRi::I32 + 3]; // CmmAssign _sQS::I32 = I32[_sRi::I32 + 7]; // CmmAssign _sQT:

Re: RFC: migrating to git

2011-01-12 Thread Edward Z. Yang
Excerpts from Roman Leshchinskiy's message of Wed Jan 12 18:20:25 -0500 2011: > How would we get the current functionality of darcs-all pull? Is it even > possible? Here is the rebase-y workflow. Untested, so I might have gotten one or two details wrong. > Suppose I want to hack on GHC and base

Re: New codegen failing test-cases

2011-01-12 Thread Edward Z. Yang
I appear to have tracked down the bug for ffi021: the new code generator doesn't appear to clear the tag bit for the pointer to heap before: // outOfLine should follow: (_sR1::I32,) = foreign "ccall" _sQR::I32((I32[_sRi::I32 + 7], `signed'), (I32[_sRi

Re: New codegen failing test-cases

2011-01-11 Thread Edward Z. Yang
Hello Simon, Have you gotten a chance to look at these two hunks? (see below) Thanks, Edward Excerpts from Edward Z. Yang's message of Fri Dec 10 10:59:26 -0500 2010: > Ok, I've got a patch that fixes this segfault. In the process I looked > at all patches to Cg* modules after Nov 2009 and look

Re: New codegen failing test-cases

2010-12-10 Thread Edward Z. Yang
Ok, I've got a patch that fixes this segfault. In the process I looked at all patches to Cg* modules after Nov 2009 and looked for changes that weren't applied to the new codegen. I skipped the LLVM patch, but picked up the rest of the blackhole changes. There are, however, two hunks that I am n

Re: New codegen failing test-cases

2010-12-09 Thread Edward Z. Yang
Ok, looking at 4030, which is this simple program: main = do tid <- block $ forkIO $ let x = x in x killThread tid It segfaults in stg_BLACKHOLE_info when attempting to dereference... something (I haven't quite figured out what yet; what's usually stored in 0x4(%esi) on 32-bit x86 when

Re: New codegen failing test-cases

2010-12-09 Thread Edward Z. Yang
Here is the new set of failing test-cases on the shiny new branch. I should stick the merged branch somewhere; any suggestions? 4030(normal) 4221(normal) IndTypesPerf(normal) T1969(normal) T3064(normal) T3294(normal) T3736(normal) T3807(normal) T4003(normal)

MonoLocalBinds and hoopl

2010-12-09 Thread Edward Z. Yang
Hello all, Here's an experience report for porting hoopl to manage MonoLocalBinds. The Compiler.Hoop.XUtil module has a rather interesting (but probably common) style of code writing, along the lines of this: fbnf3 (ff, fm, fl) block = unFF3 $ scottFoldBlock (ScottBlock f m l cat) block whe

Re: New codegen failing test-cases

2010-12-08 Thread Edward Z. Yang
Final status report for tonight, before I crash in bed; I've managed to make it compile all the way to hoopl. It seems like hoopl doesn't typecheck anymore? I haven't been following the typechecker changes too closely so some guidance would be appreciated. libraries/hoopl/src/Compiler/Hoopl/Util.h

Re: New codegen failing test-cases

2010-12-08 Thread Edward Z. Yang
Ian, I'd love a little guidance with this patch: Thu Oct 21 13:08:53 BST 2010 Ian Lynagh * Use takeUniqFromSupply in emitProcWithConvention We were using the supply's unique, and then passing the same supply to initUs_, which sounds like a bug waiting to happen. { hunk ./compiler/c

Re: New codegen failing test-cases

2010-12-08 Thread Edward Z. Yang
I've done a bit more chewing away at the branch and have gotten to 19Sep10. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

RE: [darcs-users] How to develop on a (GHC) branch with darcs

2010-12-08 Thread Edward Z. Yang
I like Git for Computer Scientists [1] and Git in pictures [2]. It also sounds like a Git for Darcs users might be in order. Edward [1] http://eagain.net/articles/git-for-computer-scientists/ [2] http://blog.nelhage.com/2010/01/git-in-pictures/ ___ Gl

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
Oh, that explains the co error! Thanks a bunch. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
When I revert the PArr -> ParallelArray changes in those directories, I then get: ghc-stage1: panic! (the 'impossible' happened) (GHC version 7.1.20101126 for i386-unknown-linux): match_co Cheers, Edward ___ Glasgow-haskell-users mailing list Gla

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
I get the same error for the other branch too. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
Excerpts from David Terei's message of Fri Dec 03 23:44:33 -0500 2010: > http://darcs.haskell.org/ghc-cmm-03Sep10/ This branch fails to build for me: "inplace/bin/ghc-stage1" -M -dep-makefile libraries/dph/dph-par/dist-install/build/.depend-v.haskell.tmp -include-pkg-deps -H64m -O -fasm -packa

Re: New codegen failing test-cases

2010-12-04 Thread Edward Z. Yang
I'm working off HEAD, so this is good info to know. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

New codegen failing test-cases

2010-12-03 Thread Edward Z. Yang
I fired up the new codegen and ran make fast on the regression suite and the following new tests started failing: 3207(normal) 4030(normal) cgrun016(normal) cgrun045(normal) cgrun051(normal) dsrun005(normal) dsrun007(normal) dsrun008(normal) exceptionsrun001(normal) e

Re: ANN: HaLVM 1.0: the Haskell Lightweight Virtual Machine

2010-11-30 Thread Edward Z. Yang
Great news and great stuff! Looking forward to playing around with it. Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: Terminate unused worker threads

2010-11-17 Thread Edward Z. Yang
Hello Ryan, Adding the extra spare_workers_no field bookkeeping doesn't add very much overhead, since whenever spare_worker's is changing we already have taken out the lock. As for using a lock-free data structures, I can't say I have a good feel for how performance might change in that case. :-)

Re: Terminate unused worker threads

2010-11-17 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Nov 17 06:15:46 -0500 2010: > I suggest keeping track of the number of items in the queue. Ok, I added a spare_workers_no field to the Capability struct. > So I think the main thing missing is a call to workerTaskStop(). Added. > It would be really ni

Re: Signal handler scheduling on single-threaded RTS

2010-11-15 Thread Edward Z. Yang
Oh, there's quite a simple fix for this: don't have the FFI call handle the SIGINT; only handle a signal the RTS generates. I guess we should do a little more legwork to make sure interruptible(?) user threads don't see signals. Edward ___ Glasgow-haske

Re: Odd behavior of ncurses with -threaded

2010-11-11 Thread Edward Z. Yang
Excerpts from Donn Cave's message of Thu Nov 11 17:07:20 -0500 2010: > > ghc: 6.12.1 > > linux: 2.6.32 > > ncurses: 5.7 > > Someone probably should. It's tempting to conclude that the bug > is in ncurses, and perhaps it is, and maybe there's nothing to be > done about it anyway, but a langu

Re: Signal handler scheduling on single-threaded RTS

2010-11-11 Thread Edward Z. Yang
Relatedly, it seems that it takes a nontrivial amount of time for the multithreaded RTS to "realize" that a thread has emitted a signal. I wonder if there's a more direct way an FFI call can say "when I get back to Haskell, immediately start propagating an exception." Edward _

Signal handler scheduling on single-threaded RTS

2010-11-10 Thread Edward Z. Yang
I've been poking the bad behavior Brian described here: http://blog.ezyang.com/2010/08/interrupting-ghc/comment-page-1/#comment-1334 and in the process noticed something kind of interesting about thread scheduling in non-multithreaded mode (i.e. without -threaded). When the single-threaded R

Terminate unused worker threads

2010-11-07 Thread Edward Z. Yang
I finally got some spare time to do some GHC hacking, and after feeling my way around http://hackage.haskell.org/trac/ghc/ticket/4262 I came up with the following patch, which appears to work (that is, bound the number of worker threads hanging around after FFI calls): diff -rN -u old-ghc-clean/rt

Re: Does GhcDebugged work?

2010-09-28 Thread Edward Z. Yang
Excerpts from Ian Lynagh's message of Tue Sep 28 13:18:17 -0400 2010: > Yes, unless you make clean. > > (it works by putting Validating=YES in mk/are-validating.mk) Oof, ok, I bet that was what I was seeing. Thanks, Edward ___ Glasgow-haskell-users mai

Does GhcDebugged work?

2010-09-24 Thread Edward Z. Yang
I wasted an afternoon compiling GHC with GhcDebugged = YES in my mk/build.mk, only to have ghc-stage2 tell me it wasn't compiled with -debug. Looking at mk/config.mk.in, it seems that GhcDebugged is unconditionally set to NO. What am I doing wrong? Edward

Re: Interruptible GHC

2010-09-17 Thread Edward Z. Yang
Here's what the Windows version would look like (if I could get HEAD to build, that is :-) void interruptOSThread (OSThreadId id) { HANDLE hdl; PCSIO pCSIO; if (!(hdl = OpenThread(THREAD_TERMINATE,FALSE,id))) { sysErrorBelch("interruptOSThread: OpenThread"); stg_exit(EX

Re: Interruptible GHC

2010-09-16 Thread Edward Z. Yang
It looks like the problem was that the default handler for SIGINT was scheduling code to run, when we really just wanted to get EINTR. I'm sketchily using SIGPIPE right now; maybe we should use SIGUSR1 or something. Edward ___ Glasgow-haskell-users maili

Re: Interruptible GHC

2010-09-16 Thread Edward Z. Yang
There are some invariants that are being violated by pthread_kill(id, SIGINT) and I'm having difficulty understanding them. I get the following errors: cd ./concurrent/should_run && '/home/ezyang/Dev/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -no-user-package-conf -rtsopts

Re: Interruptible GHC

2010-09-15 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Sep 15 04:34:06 -0400 2010: > It's not clear to me when to emit the warning: the system we're > compiling on is not necessarily the one we're going to run on. This is > more often the case for us where we're building distributions, than for > other pe

Re: how to terminate an external program after timeout?

2010-09-14 Thread Edward Z. Yang
A possible cute solution would be to ulimit the processes permitted cpu time. Cheers, Edward ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: Interruptible GHC

2010-09-14 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Sep 13 05:10:13 -0400 2010: > The idea of having user-definable cancellation mechanisms seems quite > sensible, given that we have so many ways to do this. However it seems > quite hard in practice: for pthread_cancel, the RTS has to behave quite > di

Interruptible GHC

2010-09-10 Thread Edward Z. Yang
So I did a writeup of what I thought might be the next direction to go with the interruptible patch: http://blog.ezyang.com/2010/09/towards-platform-agnostic-interruptibility/ The really interesting bit (which I didn't cover) is what information to give to the user functioSo I did a writeup o

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-08 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Wed Sep 08 03:40:42 -0400 2010: > Maybe. As a first step I think we could just document what happens when > a call is interrupted (pthread_cancel() on POSIX, ??? on Windows) and > let the user handle it. Is there even a good lowest-common-denominator > t

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-06 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Sep 06 05:57:59 -0400 2010: > What did you have in mind with respect to "portable equivalents of > pthread functions"? I'm not sure we need to do anything along these > lines at all, and I'd much rather we didn't enforce any threading > abstraction on

Re: SIGALRM, SIGVTALRM, and third party libraries

2010-09-03 Thread Edward Z. Yang
Excerpts from Bryan O'Sullivan's message of Fri Sep 03 17:00:03 -0400 2010: > What I am wondering is if there's a practical downside to doing this. Am I > going to accidentally kill something? This is a very important gap in the > usability of GHC with native libraries, and if this approach actuall

Re: FFI, signals and exceptions

2010-09-01 Thread Edward Z. Yang
I cooked up a Darcs patch implementing the new language keyword 'interruptible' sans tests, Windows support and avoiding executing interruptible calls on bound worker threads. However, being a Darcs newbie I ended up sending the patch to cvs-ghc, not this list. Let me know if you'd like me to exp

Re: FFI, signals and exceptions

2010-08-31 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Tue Aug 31 05:02:13 -0400 2010: > I think the idea of annotating interruptible calls should be good > enough. Simple blocking system calls like "read" can all be annotated > as interruptible without any problems. Also, pthread_cancel() provides > ways to

Re: FFI, signals and exceptions

2010-08-27 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Fri Aug 27 04:05:46 -0400 2010: > You should walk cap->suspended_ccalls instead, no lock is required for that. > > For stress testing, you want to construct an example that has lots of > threads making foreign cals and other threads calling throwTo to > int

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Ahem, the logic in that last iteration was not quite correct. Here is the more correct version: case BlockedOnCCall: case BlockedOnCCall_NoUnblockExc: { #ifdef THREADED_RTS Task *task = NULL; if (!target->bound) { // walk all_tasks to find the correct worker

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Thu Aug 26 04:08:06 -0400 2010: > You don't want to do this for a bound thread (when target->bound != > NULL), because the OS thread will have interesting things on its C stack > and pthread_cancel discards the entire stack. A worker thread on the > other

Re: FFI, signals and exceptions

2010-08-26 Thread Edward Z. Yang
Here is a possible implementation: Task *task = NULL; blockedThrowTo(cap,target,msg); if (target->bound) { // maybe not supposed to kill bound threads, but it // seems to work ok (as long as they don't want to try // to recover!) task = target->bound->ta

Re: FFI, signals and exceptions

2010-08-25 Thread Edward Z. Yang
Excerpts from Edward Z. Yang's message of Thu Aug 26 01:22:22 -0400 2010: > I spent some time looking at the code, and I've been having a difficult > time finding the thread ID of the worker thread that is performing the > safe FFI call. The target TSO is the suspended Haskell thread, which > afai

Re: FFI, signals and exceptions

2010-08-25 Thread Edward Z. Yang
Excerpts from Simon Marlow's message of Mon Aug 09 11:23:42 -0400 2010: > That might be quite interesting to try, actually. You'll need to modify the > RTS: the place where we decide what to do when a throwTo is received for a > thread involved in a foreign call is around line 396 of rts/RaiseAsyn

Re: FFI, signals and exceptions

2010-08-06 Thread Edward Z. Yang
Excerpts from Corey O'Connor's message of Fri Aug 06 16:15:21 -0400 2010: > In your test cases that fail are your C computations foreign unsafe imports? First thing I checked. :-) They were safe imports, and the Haskell code did get called--just the C code kept marching on. Cheers, Edward ___

FFI, signals and exceptions

2010-07-30 Thread Edward Z. Yang
Hello all, I am currently investigating techniques to nicely handle SIGINTs when FFI code is running. Yes, I know it sounds kind of crazy. Ignoring the problems of cleaning up the unceremoniously terminated C computation, I'm having difficulty getting the FFI to /stop/ running when I get the sig

Re: mallocForeignPtr vs. C

2010-07-13 Thread Edward Z. Yang
Excerpts from Axel Simon's message of Tue Jul 13 16:28:29 -0400 2010: > Well, if the C code hangs on to the StablePtr that wraps the > ForeignPtr, its finalizer won't be run. But can run again once the > StablePtr is freed. So you can take out the Ptr in the ForeignPtr and > use it in C land

Re: mallocForeignPtr vs. C

2010-07-13 Thread Edward Z. Yang
Excerpts from Axel Simon's message of Tue Jul 13 16:03:01 -0400 2010: > If your C code has a way to properly unref a pointer then you could > wrap your ForeignPtr in a StablePtr and pass that to C land. Once C > has freed the StablePtr the ForeignPtr can become dead when Haskell > has dropped

Re: mallocForeignPtr vs. C

2010-07-12 Thread Edward Z. Yang
Excerpts from Evan Laforge's message of Mon Jul 12 16:43:45 -0400 2010: > Yeah, that's definitely the safest and simplest. But the copying > defeats the purpose of passing a pointer in the first place, which was > to not have to copy the giant array just to pass it. Well, if your C code wasn't sq

Re: mallocForeignPtr vs. C

2010-07-12 Thread Edward Z. Yang
Excerpts from Evan Laforge's message of Mon Jul 12 16:23:39 -0400 2010: > Well, what I'm worried about is that withForeignPtr says you should > only use the pointer from inside it. The situation here is that I've > passed a pointer to C. C wants to share ownership of the pointer, so > even if all

Re: mallocForeignPtr vs. C

2010-07-12 Thread Edward Z. Yang
Excerpts from Evan Laforge's message of Mon Jul 12 14:56:11 -0400 2010: > But I'm not convinced that's actually enough because the C code is > still running outside of a withForeignPtr. I would have to do > something really hairy like call back to C from the haskell callback, > wrapping it in with

Custom reducing functions for DPH

2010-05-10 Thread Edward Z. Yang
Hello all, I was asking this question on #haskell and thoughtpolice directed me here for a possibly more up-to-date information. Some of the important primitives offered by Data Parallel Haskell are reduction primitives such as sumP and prodP, which take a data parallel array and reduce it to a s

<    1   2