mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 13:30:40 +00:00
25cc75b096
* Add a missing recursion limiter in `Unifier::tryUnifyTables`. This was causing a crash in certain situations. * Luau heap graph enumeration improvements: * Weak references are not reported * Added tag as a fallback name of non-string table links * Included top Luau function information in thread name to understand where thread might be suspended * Constant folding for `math.pi` and `math.huge` at -O2 * Optimize `string.format` and `%*` * This change makes string interpolation 1.5x-2x faster depending on the number and type of formatted components, assuming a few are using primitive types, and reduces associated GC pressure. New solver * Initial work toward tracking the upper and lower bounds of types more accurately. JIT * Add IrCmd::CHECK_TRUTHY for improved assert fast-calls * Do not compute type map for modules without types * Capture metatable+readonly state for NEW_TABLE IR instructions * Replace JUMP_CMP_ANY with CMP_ANY and existing JUMP_EQ_INT * Add support for exits to VM with reentry lock in VmExit
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "ConstraintGraphBuilderFixture.h"
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
ConstraintGraphBuilderFixture::ConstraintGraphBuilderFixture()
|
|
: Fixture()
|
|
, mainModule(new Module)
|
|
, forceTheFlag{"DebugLuauDeferredConstraintResolution", true}
|
|
{
|
|
mainModule->name = "MainModule";
|
|
mainModule->humanReadableName = "MainModule";
|
|
|
|
BlockedType::DEPRECATED_nextIndex = 0;
|
|
BlockedTypePack::nextIndex = 0;
|
|
}
|
|
|
|
void ConstraintGraphBuilderFixture::generateConstraints(const std::string& code)
|
|
{
|
|
AstStatBlock* root = parse(code);
|
|
dfg = std::make_unique<DataFlowGraph>(DataFlowGraphBuilder::build(root, NotNull{&ice}));
|
|
cgb = std::make_unique<ConstraintGraphBuilder>(mainModule, NotNull{&normalizer}, NotNull(&moduleResolver), builtinTypes, NotNull(&ice),
|
|
frontend.globals.globalScope, /*prepareModuleScope*/ nullptr, &logger, NotNull{dfg.get()}, std::vector<RequireCycle>());
|
|
cgb->visit(root);
|
|
rootScope = cgb->rootScope;
|
|
constraints = Luau::borrowConstraints(cgb->constraints);
|
|
}
|
|
|
|
void ConstraintGraphBuilderFixture::solve(const std::string& code)
|
|
{
|
|
generateConstraints(code);
|
|
ConstraintSolver cs{NotNull{&normalizer}, NotNull{rootScope}, constraints, "MainModule", NotNull(&moduleResolver), {}, &logger, {}};
|
|
cs.run();
|
|
}
|
|
|
|
} // namespace Luau
|