comparison slides/2018/05/29/memo.txt @ 45:f5dac10540d7

auto-Update generated slides by script
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 29 May 2018 18:44:59 +0900
parents
children 8972d59ad904
comparison
equal deleted inserted replaced
44:8c7be076e6e6 45:f5dac10540d7
1 ❯ lldb -- /Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar nqp.moarvm examples/hello_world.nqp [13:52:54]
2 (lldb) target create "/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar"
3 Current executable set to '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64).
4 (lldb) settings set -- target.run-args "nqp.moarvm" "examples/hello_world.nqp"
5 (lldb) b add_bb_facts
6 Breakpoint 1: where = libmoar.dylib`add_bb_facts + 32 at facts.c:362, address = 0x0000000000118540
7 (lldb) c
8 error: invalid process
9 (lldb) run
10 Process 8479 launched: '/Users/anatofuz/workspace/cr/Basic/build_perl6/bin/moar' (x86_64)
11 Process 8479 stopped
12 * thread #2, stop reason = breakpoint 1.1
13 frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362
14 359 MVMint32 i, is_phi;
15 360
16 361 /* Look for instructions that provide or propagate facts. */
17 -> 362 MVMSpeshIns *ins = bb->first_ins;
18 363 while (ins) {
19 364 /* See if there's deopt and logged annotations. Sync cur_deopt_idx
20 365 * and, for logged+deopt-one, add logged facts and guards. */
21 Target 0: (moar) stopped.
22 (lldb) bt
23 * thread #2, stop reason = breakpoint 1.1
24 * frame #0: 0x00000001001bb540 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:362
25 frame #1: 0x00000001001bb503 libmoar.dylib`MVM_spesh_facts_discover(tc=0x0000000100802e30, g=0x0000000100f4efe0, p=0x0000000100f514d0) at facts.c:659
26 frame #2: 0x00000001001b4eb7 libmoar.dylib`MVM_spesh_candidate_add(tc=0x0000000100802e30, p=0x0000000100f514d0) at candidate.c:61
27 frame #3: 0x00000001001cf991 libmoar.dylib`worker(tc=0x0000000100802e30, callsite=0x00000001006c9150, args=0x0000000000000000) at worker.c:16
28 frame #4: 0x000000010014e8e2 libmoar.dylib`invoke_handler(tc=0x0000000100802e30, invokee=0x0000000102014840, callsite=0x00000001006c9150, args=0x0000000000000000) at MVMCFunction.c:9
29 frame #5: 0x00000001000e8494 libmoar.dylib`thread_initial_invoke(tc=0x0000000100802e30, data=0x0000000100802050) at threads.c:59
30 frame #6: 0x00000001000aefee libmoar.dylib`MVM_interp_run(tc=0x0000000100802e30, initial_invoke=(libmoar.dylib`thread_initial_invoke at threads.c:50), invoke_data=0x0000000100802050) at interp.c:93
31 frame #7: 0x00000001000e7a35 libmoar.dylib`start_thread(data=0x0000000100802050) at threads.c:87
32 frame #8: 0x00007fff7b9fe661 libsystem_pthread.dylib`_pthread_body + 340
33 frame #9: 0x00007fff7b9fe50d libsystem_pthread.dylib`_pthread_start + 377
34 frame #10: 0x00007fff7b9fdbf9 libsystem_pthread.dylib`thread_start + 13
35
36 (lldb) n
37 Process 8479 stopped
38 * thread #2, stop reason = step over
39 frame #0: 0x00000001001bb579 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:370
40 367 MVMSpeshAnn *ann_deopt_one = NULL;
41 368 MVMSpeshAnn *ann_logged = NULL;
42 369 MVMint32 is_deopt_ins = 0;
43 -> 370 while (ann) {
44 371 switch (ann->type) {
45 372 case MVM_SPESH_ANN_DEOPT_ONE_INS:
46 373 ann_deopt_one = ann;
47 Target 0: (moar) stopped.
48 (lldb)
49 Process 8479 stopped
50 * thread #2, stop reason = step over
51 frame #0: 0x00000001001bb620 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:385
52 382 }
53 383 ann = ann->next;
54 384 }
55 -> 385 if (ann_deopt_one && ann_logged)
56 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged);
57 387
58 388 /* Look through operands for reads and writes. */
59 Target 0: (moar) stopped.
60 (lldb) l
61 389 is_phi = ins->info->opcode == MVM_SSA_PHI;
62 390 for (i = 0; i < ins->info->num_operands; i++) {
63 391 /* Reads need usage tracking; if the read is after a deopt point
64 392 * relative to the write then give it an extra usage bump. */
65 393 if ((is_phi && i > 0)
66 394 || (!is_phi && (ins->info->operands[i] & MVM_operand_rw_mask) == MVM_operand_read_reg)) {
67 395 MVMSpeshFacts *facts = &(g->facts[ins->operands[i].reg.orig][ins->operands[i].reg.i]);
68 (lldb) l
69 396 facts->usages += facts->deopt_idx == cur_deopt_idx ? 1 : 2;
70 397 }
71 398
72 399 /* Writes need the current deopt index and the writing instruction
73 400 * to be specified. A write that's on a deopt instruction bumps
74 401 * the usage too. */
75 402 if ((is_phi && i == 0)
76 (lldb) n
77 Process 8479 stopped
78 * thread #2, stop reason = step over
79 frame #0: 0x00000001001bb65b libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:389
80 386 log_facts(tc, g, bb, ins, p, ann_deopt_one, ann_logged);
81 387
82 388 /* Look through operands for reads and writes. */
83 -> 389 is_phi = ins->info->opcode == MVM_SSA_PHI;
84 390 for (i = 0; i < ins->info->num_operands; i++) {
85 391 /* Reads need usage tracking; if the read is after a deopt point
86 392 * relative to the write then give it an extra usage bump. */
87 Target 0: (moar) stopped.
88 (lldb) p MVM_SSA_PHI
89 error: use of undeclared identifier 'MVM_SSA_PHI'
90 (lldb) nexr
91 error: 'nexr' is not a valid command.
92 error: Unrecognized command 'nexr'.
93 (lldb) n
94 Process 8479 stopped
95 * thread #2, stop reason = step over
96 frame #0: 0x00000001001bb677 libmoar.dylib`add_bb_facts(tc=0x0000000100802e30, g=0x0000000100f4efe0, bb=0x0000000102115e00, p=0x0000000100f514d0, cur_deopt_idx=-1) at facts.c:390
97 387
98 388 /* Look through operands for reads and writes. */
99 389 is_phi = ins->info->opcode == MVM_SSA_PHI;
100 -> 390 for (i = 0; i < ins->info->num_operands; i++) {
101 391 /* Reads need usage tracking; if the read is after a deopt point
102 392 * relative to the write then give it an extra usage bump. */
103 393 if ((is_phi && i > 0)
104 Target 0: (moar) stopped.
105 (lldb) p is_phi
106 (MVMint32) $14 = 0
107 (lldb) p ins
108 (MVMSpeshIns *) $15 = 0x0000000102115e60
109 (lldb) p *ins
110 (MVMSpeshIns) $16 = {
111 info = 0x00000001005757c0
112 operands = 0x0000000000000000
113 prev = 0x0000000000000000
114 next = 0x0000000000000000
115 annotations = 0x0000000000000000
116 }
117 (lldb) p *ins->info
118 (MVMOpInfo) $17 = {
119 opcode = 0
120 name = 0x00000001002def92 "no_op"
121 mark = {
122 [0] = ' '
123 [1] = ' '
124 }
125 num_operands = 0
126 pure = '\0'
127 deopt_point = '\0'
128 logged = '\0'
129 no_inline = '\0'
130 jittivity = '\0'
131 uses_hll = '\0'
132 operands = ([0] = '\0', [1] = '\0', [2] = '\0', [3] = '\0', [4] = '\0', [5] = '\0', [6] = '\0', [7] = '\0')
133 }
134
135
136 * profilingの箇所を見ていく
137
138 * perlスクリプトをperl6に移植する
139 * markdownのparserみたいなのを書き換えてみるなど
140 * タイトループを早くするのか,ここのハッシュを早くするのか,オブジェクトのオペレーションを早くするのか…
141 * 手近な場所をとにかく見ていきたい
142
143 * native codeをやるのかvmをやるのか
144
145 * bytecode interpureter, gc関連を書き直すという手もある
146
147 * gcc vs clang
148
149 * llvm側でtail coll呼び出す時はフラグを見ている
150 * code grarであるというフラグを渡している感じ
151
152 * script言語--> 上手く並列化出来ない