|
11 | 11 | assert hashlib.sha256(fixture.read_bytes()).hexdigest()==receipt['generated_c_sha256'] |
12 | 12 | shutil.copyfile(fixture,out/'pin_program.c') |
13 | 13 | results=[] |
14 | | -for name,kq in [('host-trace',0)]: |
| 14 | +for name,kq in [('host-trace',0),('index-prefix',0)]: |
15 | 15 | d=out/name;d.mkdir(exist_ok=True) |
16 | 16 | rt=d/'rt';shutil.copytree(root/'rt',rt,dirs_exist_ok=True) |
17 | 17 | gpu=(rt/'gpu.h').read_text() |
18 | | - if name=='phase-trace': |
| 18 | + if name=='index-prefix': |
| 19 | + gpu=gpu.replace('if((mask&((KW)1<<i)) && v-base<bytes) v=KPTR(c,h0)+(v-base);', |
| 20 | + 'if((mask&((KW)1<<i)) && k_in(&out,v) && KIX(&out,v)>=lo && KIX(&out,v)<out.hp) v=KPTR(c,h0+KIX(&out,v)-lo);') |
| 21 | + gpu=gpu.replace('KW relocated=KPTR(c,h0)+(root-base);','KW relocated=KPTR(c,h0+KIX(&out,root)-lo);') |
| 22 | + elif name=='phase-trace': |
19 | 23 | validator=r""" |
20 | 24 | KNOINLINE bool k_trace_value(KTHR KCtx *c,KW v,KW root,KU stage) { |
21 | 25 | if(KIS_LI(v,0) || (k_in(c,v) && !(v&7) && c->H[KIX(c,v)-1]==(K_BARE|2))) return true; |
|
60 | 64 | assert gpu.count(old)==1 |
61 | 65 | gpu=gpu.replace(old,'return r; // diagnostic control only\n '+old) |
62 | 66 |
|
63 | | - if name=='host-trace': |
| 67 | + if name in ('host-trace','index-prefix'): |
64 | 68 | host=(rt/'gpuhost.h').read_text() |
65 | 69 | helper=r""" |
66 | 70 | static KW trace_roots[512];static unsigned trace_nr; |
|
0 commit comments