Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/Common/include/Luau/BytecodeUtils.h
2727 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#pragma once
3
4
#include "Luau/Bytecode.h"
5
6
namespace Luau
7
{
8
9
inline int getOpLength(LuauOpcode op)
10
{
11
switch (op)
12
{
13
case LOP_GETGLOBAL:
14
case LOP_SETGLOBAL:
15
case LOP_GETIMPORT:
16
case LOP_GETTABLEKS:
17
case LOP_SETTABLEKS:
18
case LOP_NAMECALL:
19
case LOP_JUMPIFEQ:
20
case LOP_JUMPIFLE:
21
case LOP_JUMPIFLT:
22
case LOP_JUMPIFNOTEQ:
23
case LOP_JUMPIFNOTLE:
24
case LOP_JUMPIFNOTLT:
25
case LOP_NEWTABLE:
26
case LOP_SETLIST:
27
case LOP_FORGLOOP:
28
case LOP_LOADKX:
29
case LOP_FASTCALL2:
30
case LOP_FASTCALL2K:
31
case LOP_FASTCALL3:
32
case LOP_JUMPXEQKNIL:
33
case LOP_JUMPXEQKB:
34
case LOP_JUMPXEQKN:
35
case LOP_JUMPXEQKS:
36
return 2;
37
38
default:
39
return 1;
40
}
41
}
42
43
} // namespace Luau
44
45