mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-05 19:09:11 +00:00
8fe95c9963
- TableOperations lint now includes a warning for table.create(N, {}) (which is likely a mistake since the table is shared by all entries) - Type checker now type checks #v when v is a union - Parser now rejects sources that consists of a single unfinished long comment - Work around significant MSVC 2022 performance regression, bringing it more or less in line with MSVC 2019 - Compiler now predicts array size for newly allocated tables when the table is filled in a short loop - Small improvements in compilation throughput (~2% faster) - Implement paged sweeper for GC which improves sweep throughput 2-3x and reduces memory consumption by 8 bytes per object (once it is stabilized we will see additional 8 bytes per object of savings) - Improve Repl Tab completion - Repl now supports -i (interactive mode to run code in context of a script's environment) and -On (to control optimization flags)
26 lines
983 B
C
26 lines
983 B
C
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
// This code is based on Lua 5.x implementation licensed under MIT License; see lua_LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "lobject.h"
|
|
#include "lstate.h"
|
|
|
|
/* string size limit */
|
|
#define MAXSSIZE (1 << 30)
|
|
|
|
#define sizestring(len) (offsetof(TString, data) + len + 1)
|
|
|
|
#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
|
|
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, (sizeof(s) / sizeof(char)) - 1))
|
|
|
|
#define luaS_fix(s) l_setbit((s)->marked, FIXEDBIT)
|
|
|
|
LUAI_FUNC unsigned int luaS_hash(const char* str, size_t len);
|
|
|
|
LUAI_FUNC void luaS_resize(lua_State* L, int newsize);
|
|
|
|
LUAI_FUNC TString* luaS_newlstr(lua_State* L, const char* str, size_t l);
|
|
LUAI_FUNC void luaS_free(lua_State* L, TString* ts, struct lua_Page* page);
|
|
|
|
LUAI_FUNC TString* luaS_bufstart(lua_State* L, size_t size);
|
|
LUAI_FUNC TString* luaS_buffinish(lua_State* L, TString* ts);
|