mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 06:00:39 +00:00
61766a692c
* Adds a currently unused x86-64 assembler as a prerequisite for possible future JIT compilation * Fix a bug in table iteration (closes Possible table iteration bug #504) * Improved warning method when function is used as a type * Fix a bug with unsandboxed iteration with pairs() * Type of coroutine.status() is now a union of value types * Bytecode output for tests/debugging now has labels * Improvements to loop unrolling cost estimation * Report errors when the key obviously doesn't exist in the table
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "Luau/DenseHash.h"
|
|
#include "Luau/Error.h"
|
|
#include "Luau/TypeVar.h"
|
|
#include "Luau/TypePack.h"
|
|
|
|
#include <utility>
|
|
|
|
namespace Luau
|
|
{
|
|
struct InternalErrorReporter;
|
|
|
|
struct TypeIdPairHash
|
|
{
|
|
size_t hashOne(Luau::TypeId key) const
|
|
{
|
|
return (uintptr_t(key) >> 4) ^ (uintptr_t(key) >> 9);
|
|
}
|
|
|
|
size_t operator()(const std::pair<Luau::TypeId, Luau::TypeId>& x) const
|
|
{
|
|
return hashOne(x.first) ^ (hashOne(x.second) << 1);
|
|
}
|
|
};
|
|
|
|
struct UnifierCounters
|
|
{
|
|
int recursionCount = 0;
|
|
int recursionLimit = 0;
|
|
int iterationCount = 0;
|
|
int iterationLimit = 0;
|
|
};
|
|
|
|
struct UnifierSharedState
|
|
{
|
|
UnifierSharedState(InternalErrorReporter* iceHandler)
|
|
: iceHandler(iceHandler)
|
|
{
|
|
}
|
|
|
|
InternalErrorReporter* iceHandler;
|
|
|
|
DenseHashMap<TypeId, bool> skipCacheForType{nullptr};
|
|
DenseHashSet<std::pair<TypeId, TypeId>, TypeIdPairHash> cachedUnify{{nullptr, nullptr}};
|
|
DenseHashMap<std::pair<TypeId, TypeId>, TypeErrorData, TypeIdPairHash> cachedUnifyError{{nullptr, nullptr}};
|
|
|
|
DenseHashSet<TypeId> tempSeenTy{nullptr};
|
|
DenseHashSet<TypePackId> tempSeenTp{nullptr};
|
|
|
|
UnifierCounters counters;
|
|
};
|
|
|
|
} // namespace Luau
|