diff options
author | Mike Pall <mike> | 2010-01-09 23:59:43 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-01-09 23:59:43 +0100 |
commit | 99d153bef9725db226614558d01df829afafee3c (patch) | |
tree | ec5c4778a0ac5e054fc8c3d337381e1d52f626bc /src/lj_opt_mem.c | |
parent | 2cc554db0cb37ac3600cccab97c657bb532e3c4e (diff) | |
download | luajit-99d153bef9725db226614558d01df829afafee3c.tar.gz luajit-99d153bef9725db226614558d01df829afafee3c.tar.bz2 luajit-99d153bef9725db226614558d01df829afafee3c.zip |
Improve alias analysis of upvalues using a disambiguation hash value.
All upvalue objects hold a disambiguation hash value now.
It's built from the parent prototype and the slot number.
Different hash values imply the upvalues cannot alias.
Same hash values don't imply anything (collision or different closures).
Upvalue disambiguation makes use of a reduced hash due to IR contraints.
Diffstat (limited to 'src/lj_opt_mem.c')
-rw-r--r-- | src/lj_opt_mem.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index 521c8590..57948311 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -277,12 +277,17 @@ static AliasRet aa_uref(IRIns *refa, IRIns *refb) | |||
277 | { | 277 | { |
278 | if (refa->o != refb->o) | 278 | if (refa->o != refb->o) |
279 | return ALIAS_NO; /* Different UREFx type. */ | 279 | return ALIAS_NO; /* Different UREFx type. */ |
280 | if (refa->op1 != refb->op1) | 280 | if (refa->op1 == refb->op1) { /* Same function. */ |
281 | return ALIAS_MAY; /* Different function. */ | 281 | if (refa->op2 == refb->op2) |
282 | else if (refa->op2 == refb->op2) | 282 | return ALIAS_MUST; /* Same function, same upvalue idx. */ |
283 | return ALIAS_MUST; /* Same function, same upvalue idx. */ | 283 | else |
284 | else | 284 | return ALIAS_NO; /* Same function, different upvalue idx. */ |
285 | return ALIAS_NO; /* Same function, different upvalue idx. */ | 285 | } else { /* Different functions, check disambiguation hash values. */ |
286 | if (((refa->op2 ^ refb->op2) & 0xff)) | ||
287 | return ALIAS_NO; /* Upvalues with different hash values cannot alias. */ | ||
288 | else | ||
289 | return ALIAS_MAY; /* No conclusion can be drawn for same hash value. */ | ||
290 | } | ||
286 | } | 291 | } |
287 | 292 | ||
288 | /* ULOAD forwarding. */ | 293 | /* ULOAD forwarding. */ |