luau/CodeGen/src/EmitCommon.h

39 lines
977 B
C
Raw Normal View History

2023-03-03 13:45:38 +00:00
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
#pragma once
#include "Luau/Label.h"
namespace Luau
{
namespace CodeGen
{
constexpr unsigned kTValueSizeLog2 = 4;
constexpr unsigned kLuaNodeSizeLog2 = 5;
2023-05-19 19:59:59 +01:00
// TKey.tt and TKey.next are packed together in a bitfield
constexpr unsigned kOffsetOfTKeyTagNext = 12; // offsetof cannot be used on a bit field
constexpr unsigned kTKeyTagBits = 4;
constexpr unsigned kTKeyTagMask = (1 << kTKeyTagBits) - 1;
2023-03-03 13:45:38 +00:00
constexpr unsigned kOffsetOfInstructionC = 3;
// Leaf functions that are placed in every module to perform common instruction sequences
struct ModuleHelpers
{
2023-03-31 13:21:14 +01:00
// A64/X64
2023-03-03 13:45:38 +00:00
Label exitContinueVm;
Label exitNoContinueVm;
2023-06-09 13:20:36 +01:00
Label return_;
2023-03-31 13:21:14 +01:00
// X64
2023-03-03 13:45:38 +00:00
Label continueCallInVm;
2023-03-31 13:21:14 +01:00
// A64
Label reentry; // x0: closure
Label interrupt; // x0: pc offset, x1: return address, x2: interrupt
2023-03-03 13:45:38 +00:00
};
} // namespace CodeGen
} // namespace Luau