summaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-10 21:43:21 +0200
committerMike Pall <mike>2011-04-10 21:43:21 +0200
commit23f847f4ed0464adf62d63eafa5c759c03793f83 (patch)
tree101b39232c08f77285b5f28efc49466755ddf4c9 /src/lj_record.c
parenta1f66abe4ef8ddcf07e207c77b1ae55ebac81f7e (diff)
downloadluajit-23f847f4ed0464adf62d63eafa5c759c03793f83.tar.gz
luajit-23f847f4ed0464adf62d63eafa5c759c03793f83.tar.bz2
luajit-23f847f4ed0464adf62d63eafa5c759c03793f83.zip
Optimize lookups in empty proxy tables.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index c89c51be..dc0eea41 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1016,6 +1016,12 @@ static TRef rec_idx_key(jit_State *J, RecordIndex *ix)
1016 } 1016 }
1017 1017
1018 /* Otherwise the key is located in the hash part. */ 1018 /* Otherwise the key is located in the hash part. */
1019 if (t->hmask == 0) { /* Shortcut for empty hash part. */
1020 /* Guard that the hash part stays empty. */
1021 TRef tmp = emitir(IRTI(IR_FLOAD), ix->tab, IRFL_TAB_HMASK);
1022 emitir(IRTGI(IR_EQ), tmp, lj_ir_kint(J, 0));
1023 return lj_ir_kkptr(J, niltvg(J2G(J)));
1024 }
1019 if (tref_isinteger(key)) /* Hash keys are based on numbers, not ints. */ 1025 if (tref_isinteger(key)) /* Hash keys are based on numbers, not ints. */
1020 ix->key = key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); 1026 ix->key = key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
1021 if (tref_isk(key)) { 1027 if (tref_isk(key)) {
@@ -1105,7 +1111,7 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
1105 xref = rec_idx_key(J, ix); 1111 xref = rec_idx_key(J, ix);
1106 xrefop = IR(tref_ref(xref))->o; 1112 xrefop = IR(tref_ref(xref))->o;
1107 loadop = xrefop == IR_AREF ? IR_ALOAD : IR_HLOAD; 1113 loadop = xrefop == IR_AREF ? IR_ALOAD : IR_HLOAD;
1108 /* NYI: workaround until lj_meta_tset() inconsistency is solved. */ 1114 /* The lj_meta_tset() inconsistency is gone, but better play safe. */
1109 oldv = xrefop == IR_KKPTR ? (cTValue *)ir_kptr(IR(tref_ref(xref))) : ix->oldv; 1115 oldv = xrefop == IR_KKPTR ? (cTValue *)ir_kptr(IR(tref_ref(xref))) : ix->oldv;
1110 1116
1111 if (ix->val == 0) { /* Indexed load */ 1117 if (ix->val == 0) { /* Indexed load */