Skip to content

Instantly share code, notes, and snippets.

@master-q
Created July 28, 2012 11:29
Show Gist options
  • Save master-q/3192919 to your computer and use it in GitHub Desktop.
Save master-q/3192919 to your computer and use it in GitHub Desktop.
newCAFの第三引数は何者なのか?
(gdb) b newCAF
Breakpoint 1 at 0x69c15c: file rts/sm/Storage.c, line 353.
(gdb) run +RTS -V0
Starting program: /home/kiwamu/src/DiveIntoRTS/Main +RTS -V0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, newCAF (reg=0x94ee18, caf=0x90c8a0, bh=0x7ffff6c04000) at rts/sm/Storage.c:353
353 if (lockCAF(caf,bh) == 0) return 0;
(gdb) l
348 }
349
350 StgWord
351 newCAF(StgRegTable *reg, StgClosure *caf, StgClosure *bh)
352 {
353 if (lockCAF(caf,bh) == 0) return 0;
354
355 if(keepCAFs)
356 {
357 // HACK:
(gdb) print bh
$1 = (StgClosure *) 0x7ffff6c04000
(gdb) print *bh
$4 = {header = {info = 0x6a65f8}, payload = 0x7ffff6c04008}
(gdb) x 0x6a65f8
0x6a65f8 <stg_CAF_BLACKHOLE_info>: 0xfffee3e9
@master-q
Copy link
Author

 cg2:
     if (Sp - 16 < SpLim) goto cg4;
     Hp = Hp + 16;
     if (Hp > HpLim) goto cg6;
     I64[Hp - 8] = stg_CAF_BLACKHOLE_info;
     I64[Hp + 0] = CurrentTSO;
     (_cg7::I64,) = foreign "ccall"
       newCAF((BaseReg, PtrHint), (R1, PtrHint), (Hp - 8, PtrHint)); # <= 第三引数はstg_CAF_BLACKHOLE_infoへのポインタになる
     if (_cg7::I64 == 0) goto cg8;
     goto cg9;

@master-q
Copy link
Author

ごめん。勘違いだった。そうか。bhはinfoではなくて、closureか!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment