1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
6 // Common headers used both in smgen.exe and the JIT.
9 #ifndef __sm_common_h__
10 #define __sm_common_h__
14 #define NUM_SM_STATES 250
16 typedef BYTE SM_STATE_ID;
18 static_assert_no_msg(sizeof(SM_STATE_ID) == 1); // To conserve memory, we don't want to have more than 256 states.
20 #define SM_STATE_ID_START 1
22 static_assert_no_msg(SM_STATE_ID_START == 1); // Make sure nobody changes it. We rely on this to map the SM_OPCODE
23 // to single-opcode states. For example, in GetWeightForOpcode().
28 SM_STATE_ID destState;
33 bool term; // does this state terminate a code sequence?
34 BYTE length; // the length of currently matched opcodes
35 SM_STATE_ID longestTermState; // the ID of the longest matched terminate state
37 SM_STATE_ID prevState; // previous state
38 SM_OPCODE opc; // opcode that leads from the previous state to current state
40 unsigned short jumpTableByteOffset;
47 #define MAX_CODE_SEQUENCE_LENGTH 7
48 #define CODE_SEQUENCE_END ((SM_OPCODE)(SM_COUNT + 1))
50 #endif /* __sm_common_h__ */