1 /* $NetBSD: ltable.c,v 1.6 2016/01/28 14:41:39 lneto Exp $ */ 2 3 /* 4 ** Id: ltable.c,v 2.117 2015/11/19 19:16:22 roberto Exp 5 ** Lua tables (hash) 6 ** See Copyright Notice in lua.h 7 */ 8 9 #define ltable_c 10 #define LUA_CORE 11 12 #include "lprefix.h" 13 14 15 /* 16 ** Implementation of tables (aka arrays, objects, or hash tables). 17 ** Tables keep its elements in two parts: an array part and a hash part. 18 ** Non-negative integer keys are all candidates to be kept in the array 19 ** part. The actual size of the array is the largest 'n' such that 20 ** more than half the slots between 1 and n are in use. 21 ** Hash uses a mix of chained scatter table with Brent's variation. 22 ** A main invariant of these tables is that, if an element is not 23 ** in its main position (i.e. the 'original' position that its hash gives 24 ** to it), then the colliding element is in its own main position. 25 ** Hence even when the load factor reaches 100%, performance remains good. 26 */ 27 28 #ifndef _KERNEL 29 #include <math.h> 30 #include <limits.h> 31 #endif /* _KERNEL */ 32 33 #include "lua.h" 34 35 #include "ldebug.h" 36 #include "ldo.h" 37 #include "lgc.h" 38 #include "lmem.h" 39 #include "lobject.h" 40 #include "lstate.h" 41 #include "lstring.h" 42 #include "ltable.h" 43 #include "lvm.h" 44 45 46 /* 47 ** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is 48 ** the largest integer such that MAXASIZE fits in an unsigned int. 49 */ 50 #define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) 51 #define MAXASIZE (1u << MAXABITS) 52 53 /* 54 ** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest 55 ** integer such that 2^MAXHBITS fits in a signed int. (Note that the 56 ** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still 57 ** fits comfortably in an unsigned int.) 58 */ 59 #define MAXHBITS (MAXABITS - 1) 60 61 62 #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) 63 64 #define hashstr(t,str) hashpow2(t, (str)->hash) 65 #define hashboolean(t,p) hashpow2(t, p) 66 #define hashint(t,i) hashpow2(t, i) 67 68 69 /* 70 ** for some types, it is better to avoid modulus by power of 2, as 71 ** they tend to have many 2 factors. 72 */ 73 #define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) 74 75 76 #define hashpointer(t,p) hashmod(t, point2uint(p)) 77 78 79 #define dummynode (&dummynode_) 80 81 #define isdummy(n) ((n) == dummynode) 82 83 static const Node dummynode_ = { 84 {NILCONSTANT}, /* value */ 85 {{NILCONSTANT, 0}} /* key */ 86 }; 87 88 89 #ifndef _KERNEL 90 /* 91 ** Hash for floating-point numbers. 92 ** The main computation should be just 93 ** n = frexp(n, &i); return (n * INT_MAX) + i 94 ** but there are some numerical subtleties. 95 ** In a two-complement representation, INT_MAX does not has an exact 96 ** representation as a float, but INT_MIN does; because the absolute 97 ** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the 98 ** absolute value of the product 'frexp * -INT_MIN' is smaller or equal 99 ** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when 100 ** adding 'i'; the use of '~u' (instead of '-u') avoids problems with 101 ** INT_MIN. 102 */ 103 #if !defined(l_hashfloat) 104 static int l_hashfloat (lua_Number n) { 105 int i; 106 lua_Integer ni; 107 n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); 108 if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ 109 lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); 110 return 0; 111 } 112 else { /* normal case */ 113 unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); 114 return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); 115 } 116 } 117 #endif 118 #endif /* _KERNEL */ 119 120 121 /* 122 ** returns the 'main' position of an element in a table (that is, the index 123 ** of its hash value) 124 */ 125 static Node *mainposition (const Table *t, const TValue *key) { 126 switch (ttype(key)) { 127 case LUA_TNUMINT: 128 return hashint(t, ivalue(key)); 129 #ifndef _KERNEL 130 case LUA_TNUMFLT: 131 return hashmod(t, l_hashfloat(fltvalue(key))); 132 #endif /* _KERNEL */ 133 case LUA_TSHRSTR: 134 return hashstr(t, tsvalue(key)); 135 case LUA_TLNGSTR: 136 return hashpow2(t, luaS_hashlongstr(tsvalue(key))); 137 case LUA_TBOOLEAN: 138 return hashboolean(t, bvalue(key)); 139 case LUA_TLIGHTUSERDATA: 140 return hashpointer(t, pvalue(key)); 141 case LUA_TLCF: 142 return hashpointer(t, fvalue(key)); 143 default: 144 lua_assert(!ttisdeadkey(key)); 145 return hashpointer(t, gcvalue(key)); 146 } 147 } 148 149 150 /* 151 ** returns the index for 'key' if 'key' is an appropriate key to live in 152 ** the array part of the table, 0 otherwise. 153 */ 154 static unsigned int arrayindex (const TValue *key) { 155 if (ttisinteger(key)) { 156 lua_Integer k = ivalue(key); 157 if (0 < k && (lua_Unsigned)k <= MAXASIZE) 158 return cast(unsigned int, k); /* 'key' is an appropriate array index */ 159 } 160 return 0; /* 'key' did not match some condition */ 161 } 162 163 164 /* 165 ** returns the index of a 'key' for table traversals. First goes all 166 ** elements in the array part, then elements in the hash part. The 167 ** beginning of a traversal is signaled by 0. 168 */ 169 static unsigned int findindex (lua_State *L, Table *t, StkId key) { 170 unsigned int i; 171 if (ttisnil(key)) return 0; /* first iteration */ 172 i = arrayindex(key); 173 if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ 174 return i; /* yes; that's the index */ 175 else { 176 int nx; 177 Node *n = mainposition(t, key); 178 for (;;) { /* check whether 'key' is somewhere in the chain */ 179 /* key may be dead already, but it is ok to use it in 'next' */ 180 if (luaV_rawequalobj(gkey(n), key) || 181 (ttisdeadkey(gkey(n)) && iscollectable(key) && 182 deadvalue(gkey(n)) == gcvalue(key))) { 183 i = cast_int(n - gnode(t, 0)); /* key index in hash table */ 184 /* hash elements are numbered after array ones */ 185 return (i + 1) + t->sizearray; 186 } 187 nx = gnext(n); 188 if (nx == 0) 189 luaG_runerror(L, "invalid key to 'next'"); /* key not found */ 190 else n += nx; 191 } 192 } 193 } 194 195 196 int luaH_next (lua_State *L, Table *t, StkId key) { 197 unsigned int i = findindex(L, t, key); /* find original element */ 198 for (; i < t->sizearray; i++) { /* try first array part */ 199 if (!ttisnil(&t->array[i])) { /* a non-nil value? */ 200 setivalue(key, i + 1); 201 setobj2s(L, key+1, &t->array[i]); 202 return 1; 203 } 204 } 205 for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ 206 if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ 207 setobj2s(L, key, gkey(gnode(t, i))); 208 setobj2s(L, key+1, gval(gnode(t, i))); 209 return 1; 210 } 211 } 212 return 0; /* no more elements */ 213 } 214 215 216 /* 217 ** {============================================================= 218 ** Rehash 219 ** ============================================================== 220 */ 221 222 /* 223 ** Compute the optimal size for the array part of table 't'. 'nums' is a 224 ** "count array" where 'nums[i]' is the number of integers in the table 225 ** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of 226 ** integer keys in the table and leaves with the number of keys that 227 ** will go to the array part; return the optimal size. 228 */ 229 static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { 230 int i; 231 unsigned int twotoi; /* 2^i (candidate for optimal size) */ 232 unsigned int a = 0; /* number of elements smaller than 2^i */ 233 unsigned int na = 0; /* number of elements to go to array part */ 234 unsigned int optimal = 0; /* optimal size for array part */ 235 /* loop while keys can fill more than half of total size */ 236 for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) { 237 if (nums[i] > 0) { 238 a += nums[i]; 239 if (a > twotoi/2) { /* more than half elements present? */ 240 optimal = twotoi; /* optimal size (till now) */ 241 na = a; /* all elements up to 'optimal' will go to array part */ 242 } 243 } 244 } 245 lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); 246 *pna = na; 247 return optimal; 248 } 249 250 251 static int countint (const TValue *key, unsigned int *nums) { 252 unsigned int k = arrayindex(key); 253 if (k != 0) { /* is 'key' an appropriate array index? */ 254 nums[luaO_ceillog2(k)]++; /* count as such */ 255 return 1; 256 } 257 else 258 return 0; 259 } 260 261 262 /* 263 ** Count keys in array part of table 't': Fill 'nums[i]' with 264 ** number of keys that will go into corresponding slice and return 265 ** total number of non-nil keys. 266 */ 267 static unsigned int numusearray (const Table *t, unsigned int *nums) { 268 int lg; 269 unsigned int ttlg; /* 2^lg */ 270 unsigned int ause = 0; /* summation of 'nums' */ 271 unsigned int i = 1; /* count to traverse all array keys */ 272 /* traverse each slice */ 273 for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { 274 unsigned int lc = 0; /* counter */ 275 unsigned int lim = ttlg; 276 if (lim > t->sizearray) { 277 lim = t->sizearray; /* adjust upper limit */ 278 if (i > lim) 279 break; /* no more elements to count */ 280 } 281 /* count elements in range (2^(lg - 1), 2^lg] */ 282 for (; i <= lim; i++) { 283 if (!ttisnil(&t->array[i-1])) 284 lc++; 285 } 286 nums[lg] += lc; 287 ause += lc; 288 } 289 return ause; 290 } 291 292 293 static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { 294 int totaluse = 0; /* total number of elements */ 295 int ause = 0; /* elements added to 'nums' (can go to array part) */ 296 int i = sizenode(t); 297 while (i--) { 298 Node *n = &t->node[i]; 299 if (!ttisnil(gval(n))) { 300 ause += countint(gkey(n), nums); 301 totaluse++; 302 } 303 } 304 *pna += ause; 305 return totaluse; 306 } 307 308 309 static void setarrayvector (lua_State *L, Table *t, unsigned int size) { 310 unsigned int i; 311 luaM_reallocvector(L, t->array, t->sizearray, size, TValue); 312 for (i=t->sizearray; i<size; i++) 313 setnilvalue(&t->array[i]); 314 t->sizearray = size; 315 } 316 317 318 static void setnodevector (lua_State *L, Table *t, unsigned int size) { 319 int lsize; 320 if (size == 0) { /* no elements to hash part? */ 321 t->node = cast(Node *, dummynode); /* use common 'dummynode' */ 322 lsize = 0; 323 } 324 else { 325 int i; 326 lsize = luaO_ceillog2(size); 327 if (lsize > MAXHBITS) 328 luaG_runerror(L, "table overflow"); 329 size = twoto(lsize); 330 t->node = luaM_newvector(L, size, Node); 331 for (i = 0; i < (int)size; i++) { 332 Node *n = gnode(t, i); 333 gnext(n) = 0; 334 setnilvalue(wgkey(n)); 335 setnilvalue(gval(n)); 336 } 337 } 338 t->lsizenode = cast_byte(lsize); 339 t->lastfree = gnode(t, size); /* all positions are free */ 340 } 341 342 343 void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 344 unsigned int nhsize) { 345 unsigned int i; 346 int j; 347 unsigned int oldasize = t->sizearray; 348 int oldhsize = t->lsizenode; 349 Node *nold = t->node; /* save old hash ... */ 350 if (nasize > oldasize) /* array part must grow? */ 351 setarrayvector(L, t, nasize); 352 /* create new hash part with appropriate size */ 353 setnodevector(L, t, nhsize); 354 if (nasize < oldasize) { /* array part must shrink? */ 355 t->sizearray = nasize; 356 /* re-insert elements from vanishing slice */ 357 for (i=nasize; i<oldasize; i++) { 358 if (!ttisnil(&t->array[i])) 359 luaH_setint(L, t, i + 1, &t->array[i]); 360 } 361 /* shrink array */ 362 luaM_reallocvector(L, t->array, oldasize, nasize, TValue); 363 } 364 /* re-insert elements from hash part */ 365 for (j = twoto(oldhsize) - 1; j >= 0; j--) { 366 Node *old = nold + j; 367 if (!ttisnil(gval(old))) { 368 /* doesn't need barrier/invalidate cache, as entry was 369 already present in the table */ 370 setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); 371 } 372 } 373 if (!isdummy(nold)) 374 luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old hash */ 375 } 376 377 378 void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { 379 int nsize = isdummy(t->node) ? 0 : sizenode(t); 380 luaH_resize(L, t, nasize, nsize); 381 } 382 383 /* 384 ** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i 385 */ 386 static void rehash (lua_State *L, Table *t, const TValue *ek) { 387 unsigned int asize; /* optimal size for array part */ 388 unsigned int na; /* number of keys in the array part */ 389 unsigned int nums[MAXABITS + 1]; 390 int i; 391 int totaluse; 392 for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ 393 na = numusearray(t, nums); /* count keys in array part */ 394 totaluse = na; /* all those keys are integer keys */ 395 totaluse += numusehash(t, nums, &na); /* count keys in hash part */ 396 /* count extra key */ 397 na += countint(ek, nums); 398 totaluse++; 399 /* compute new size for array part */ 400 asize = computesizes(nums, &na); 401 /* resize the table to new computed sizes */ 402 luaH_resize(L, t, asize, totaluse - na); 403 } 404 405 406 407 /* 408 ** }============================================================= 409 */ 410 411 412 Table *luaH_new (lua_State *L) { 413 GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); 414 Table *t = gco2t(o); 415 t->metatable = NULL; 416 t->flags = cast_byte(~0); 417 t->array = NULL; 418 t->sizearray = 0; 419 setnodevector(L, t, 0); 420 return t; 421 } 422 423 424 void luaH_free (lua_State *L, Table *t) { 425 if (!isdummy(t->node)) 426 luaM_freearray(L, t->node, cast(size_t, sizenode(t))); 427 luaM_freearray(L, t->array, t->sizearray); 428 luaM_free(L, t); 429 } 430 431 432 static Node *getfreepos (Table *t) { 433 while (t->lastfree > t->node) { 434 t->lastfree--; 435 if (ttisnil(gkey(t->lastfree))) 436 return t->lastfree; 437 } 438 return NULL; /* could not find a free place */ 439 } 440 441 442 443 /* 444 ** inserts a new key into a hash table; first, check whether key's main 445 ** position is free. If not, check whether colliding node is in its main 446 ** position or not: if it is not, move colliding node to an empty place and 447 ** put new key in its main position; otherwise (colliding node is in its main 448 ** position), new key goes to an empty position. 449 */ 450 TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { 451 Node *mp; 452 #ifndef _KERNEL 453 TValue aux; 454 #endif /* _KERNEL */ 455 if (ttisnil(key)) luaG_runerror(L, "table index is nil"); 456 #ifndef _KERNEL 457 else if (ttisfloat(key)) { 458 lua_Integer k; 459 if (luaV_tointeger(key, &k, 0)) { /* index is int? */ 460 setivalue(&aux, k); 461 key = &aux; /* insert it as an integer */ 462 } 463 else if (luai_numisnan(fltvalue(key))) 464 luaG_runerror(L, "table index is NaN"); 465 } 466 #endif /* _KERNEL */ 467 mp = mainposition(t, key); 468 if (!ttisnil(gval(mp)) || isdummy(mp)) { /* main position is taken? */ 469 Node *othern; 470 Node *f = getfreepos(t); /* get a free place */ 471 if (f == NULL) { /* cannot find a free place? */ 472 rehash(L, t, key); /* grow table */ 473 /* whatever called 'newkey' takes care of TM cache */ 474 return luaH_set(L, t, key); /* insert key into grown table */ 475 } 476 lua_assert(!isdummy(f)); 477 othern = mainposition(t, gkey(mp)); 478 if (othern != mp) { /* is colliding node out of its main position? */ 479 /* yes; move colliding node into free position */ 480 while (othern + gnext(othern) != mp) /* find previous */ 481 othern += gnext(othern); 482 gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ 483 *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ 484 if (gnext(mp) != 0) { 485 gnext(f) += cast_int(mp - f); /* correct 'next' */ 486 gnext(mp) = 0; /* now 'mp' is free */ 487 } 488 setnilvalue(gval(mp)); 489 } 490 else { /* colliding node is in its own main position */ 491 /* new node will go into free position */ 492 if (gnext(mp) != 0) 493 gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ 494 else lua_assert(gnext(f) == 0); 495 gnext(mp) = cast_int(f - mp); 496 mp = f; 497 } 498 } 499 setnodekey(L, &mp->i_key, key); 500 luaC_barrierback(L, t, key); 501 lua_assert(ttisnil(gval(mp))); 502 return gval(mp); 503 } 504 505 506 /* 507 ** search function for integers 508 */ 509 const TValue *luaH_getint (Table *t, lua_Integer key) { 510 /* (1 <= key && key <= t->sizearray) */ 511 if (l_castS2U(key) - 1 < t->sizearray) 512 return &t->array[key - 1]; 513 else { 514 Node *n = hashint(t, key); 515 for (;;) { /* check whether 'key' is somewhere in the chain */ 516 if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) 517 return gval(n); /* that's it */ 518 else { 519 int nx = gnext(n); 520 if (nx == 0) break; 521 n += nx; 522 } 523 } 524 return luaO_nilobject; 525 } 526 } 527 528 529 /* 530 ** search function for short strings 531 */ 532 const TValue *luaH_getshortstr (Table *t, TString *key) { 533 Node *n = hashstr(t, key); 534 lua_assert(key->tt == LUA_TSHRSTR); 535 for (;;) { /* check whether 'key' is somewhere in the chain */ 536 const TValue *k = gkey(n); 537 if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) 538 return gval(n); /* that's it */ 539 else { 540 int nx = gnext(n); 541 if (nx == 0) 542 return luaO_nilobject; /* not found */ 543 n += nx; 544 } 545 } 546 } 547 548 549 /* 550 ** "Generic" get version. (Not that generic: not valid for integers, 551 ** which may be in array part, nor for floats with integral values.) 552 */ 553 static const TValue *getgeneric (Table *t, const TValue *key) { 554 Node *n = mainposition(t, key); 555 for (;;) { /* check whether 'key' is somewhere in the chain */ 556 if (luaV_rawequalobj(gkey(n), key)) 557 return gval(n); /* that's it */ 558 else { 559 int nx = gnext(n); 560 if (nx == 0) 561 return luaO_nilobject; /* not found */ 562 n += nx; 563 } 564 } 565 } 566 567 568 const TValue *luaH_getstr (Table *t, TString *key) { 569 if (key->tt == LUA_TSHRSTR) 570 return luaH_getshortstr(t, key); 571 else { /* for long strings, use generic case */ 572 TValue ko; 573 setsvalue(cast(lua_State *, NULL), &ko, key); 574 return getgeneric(t, &ko); 575 } 576 } 577 578 579 /* 580 ** main search function 581 */ 582 const TValue *luaH_get (Table *t, const TValue *key) { 583 switch (ttype(key)) { 584 case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); 585 case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); 586 case LUA_TNIL: return luaO_nilobject; 587 #ifndef _KERNEL 588 case LUA_TNUMFLT: { 589 lua_Integer k; 590 if (luaV_tointeger(key, &k, 0)) /* index is int? */ 591 return luaH_getint(t, k); /* use specialized version */ 592 /* else... */ 593 } /* FALLTHROUGH */ 594 #endif /* _KERNEL */ 595 default: 596 return getgeneric(t, key); 597 } 598 } 599 600 601 /* 602 ** beware: when using this function you probably need to check a GC 603 ** barrier and invalidate the TM cache. 604 */ 605 TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { 606 const TValue *p = luaH_get(t, key); 607 if (p != luaO_nilobject) 608 return cast(TValue *, p); 609 else return luaH_newkey(L, t, key); 610 } 611 612 613 void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { 614 const TValue *p = luaH_getint(t, key); 615 TValue *cell; 616 if (p != luaO_nilobject) 617 cell = cast(TValue *, p); 618 else { 619 TValue k; 620 setivalue(&k, key); 621 cell = luaH_newkey(L, t, &k); 622 } 623 setobj2t(L, cell, value); 624 } 625 626 627 static int unbound_search (Table *t, unsigned int j) { 628 unsigned int i = j; /* i is zero or a present index */ 629 j++; 630 /* find 'i' and 'j' such that i is present and j is not */ 631 while (!ttisnil(luaH_getint(t, j))) { 632 i = j; 633 if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ 634 /* table was built with bad purposes: resort to linear search */ 635 i = 1; 636 while (!ttisnil(luaH_getint(t, i))) i++; 637 return i - 1; 638 } 639 j *= 2; 640 } 641 /* now do a binary search between them */ 642 while (j - i > 1) { 643 unsigned int m = (i+j)/2; 644 if (ttisnil(luaH_getint(t, m))) j = m; 645 else i = m; 646 } 647 return i; 648 } 649 650 651 /* 652 ** Try to find a boundary in table 't'. A 'boundary' is an integer index 653 ** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). 654 */ 655 int luaH_getn (Table *t) { 656 unsigned int j = t->sizearray; 657 if (j > 0 && ttisnil(&t->array[j - 1])) { 658 /* there is a boundary in the array part: (binary) search for it */ 659 unsigned int i = 0; 660 while (j - i > 1) { 661 unsigned int m = (i+j)/2; 662 if (ttisnil(&t->array[m - 1])) j = m; 663 else i = m; 664 } 665 return i; 666 } 667 /* else must find a boundary in hash part */ 668 else if (isdummy(t->node)) /* hash part is empty? */ 669 return j; /* that is easy... */ 670 else return unbound_search(t, j); 671 } 672 673 674 675 #if defined(LUA_DEBUG) 676 677 Node *luaH_mainposition (const Table *t, const TValue *key) { 678 return mainposition(t, key); 679 } 680 681 int luaH_isdummy (Node *n) { return isdummy(n); } 682 683 #endif 684