Changeset 103622 in vbox for trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
- Timestamp:
- Mar 1, 2024 12:42:36 AM (14 months ago)
- svn:sync-xref-src-repo-rev:
- 161981
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r103614 r103622 794 794 /** The argument number if argument, UINT8_MAX if regular variable. */ 795 795 uint8_t uArgNo; 796 /** If referenced, the index of the variable referencing this one, otherwise797 * UINT8_MAX. A referenced variable must only be placed on the stack and798 * must be either kIemNativeVarKind_Stack or kIemNativeVarKind_Immediate. */796 /** If referenced, the index (unpacked) of the variable referencing this one, 797 * otherwise UINT8_MAX. A referenced variable must only be placed on the stack 798 * and must be either kIemNativeVarKind_Stack or kIemNativeVarKind_Immediate. */ 799 799 uint8_t idxReferrerVar; 800 800 /** Guest register being shadowed here, kIemNativeGstReg_End(/UINT8_MAX) if not. … … 809 809 /** kIemNativeVarKind_Immediate: The immediate value. */ 810 810 uint64_t uValue; 811 /** kIemNativeVarKind_VarRef: The index of the variable being referenced. */811 /** kIemNativeVarKind_VarRef: The index (unpacked) of the variable being referenced. */ 812 812 uint8_t idxRefVar; 813 813 /** kIemNativeVarKind_GstRegRef: The guest register being referrenced. */ … … 821 821 } u; 822 822 } IEMNATIVEVAR; 823 /** Pointer to a variable or argument. */ 824 typedef IEMNATIVEVAR *PIEMNATIVEVAR; 825 /** Pointer to a const variable or argument. */ 826 typedef IEMNATIVEVAR const *PCIEMNATIVEVAR; 823 827 824 828 /** What is being kept in a host register. */ … … 878 882 /** What is being kept in this register. */ 879 883 IEMNATIVEWHAT enmWhat; 880 /** Variable index if holding a variable, otherwise UINT8_MAX. */884 /** Variable index (packed) if holding a variable, otherwise UINT8_MAX. */ 881 885 uint8_t idxVar; 882 886 /** Stack slot assigned by iemNativeVarSaveVolatileRegsPreHlpCall and freed … … 906 910 union 907 911 { 908 /** Index of variable arguments, UINT8_MAX if not valid. */912 /** Index of variable (unpacked) arguments, UINT8_MAX if not valid. */ 909 913 uint8_t aidxArgVars[8]; 910 914 /** For more efficient resetting. */ … … 933 937 /** Pointer to const core state. */ 934 938 typedef IEMNATIVECORESTATE const *PCIEMNATIVECORESTATE; 939 940 /** @def IEMNATIVE_VAR_IDX_UNPACK 941 * @returns Index into IEMNATIVECORESTATE::aVars. 942 * @param a_idxVar Variable index w/ magic (in strict builds). 943 */ 944 /** @def IEMNATIVE_VAR_IDX_PACK 945 * @returns Variable index w/ magic (in strict builds). 946 * @param a_idxVar Index into IEMNATIVECORESTATE::aVars. 947 */ 948 #ifdef VBOX_STRICT 949 # define IEMNATIVE_VAR_IDX_UNPACK(a_idxVar) ((a_idxVar) & IEMNATIVE_VAR_IDX_MASK) 950 # define IEMNATIVE_VAR_IDX_PACK(a_idxVar) ((a_idxVar) | IEMNATIVE_VAR_IDX_MAGIC) 951 # define IEMNATIVE_VAR_IDX_MAGIC UINT8_C(0xd0) 952 # define IEMNATIVE_VAR_IDX_MAGIC_MASK UINT8_C(0xf0) 953 # define IEMNATIVE_VAR_IDX_MASK UINT8_C(0x0f) 954 #else 955 # define IEMNATIVE_VAR_IDX_UNPACK(a_idxVar) (a_idxVar) 956 # define IEMNATIVE_VAR_IDX_PACK(a_idxVar) (a_idxVar) 957 #endif 935 958 936 959 … … 1181 1204 IEMNATIVEGSTREG enmGstReg); 1182 1205 1183 DECL_HIDDEN_THROW(uint8_t) iemNativeRegAllocVar(PIEMRECOMPILERSTATE pReNative, uint32_t *poff, uint8_t idxVar);1184 1206 DECL_HIDDEN_THROW(uint32_t) iemNativeRegAllocArgs(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t cArgs); 1185 1207 DECL_HIDDEN_THROW(uint8_t) iemNativeRegAssignRc(PIEMRECOMPILERSTATE pReNative, uint8_t idxHstReg); … … 1260 1282 * Checks that a variable index is valid. 1261 1283 */ 1262 #define IEMNATIVE_ASSERT_VAR_IDX(a_pReNative, a_idxVar) \ 1284 #ifdef IEMNATIVE_VAR_IDX_MAGIC 1285 # define IEMNATIVE_ASSERT_VAR_IDX(a_pReNative, a_idxVar) \ 1286 AssertMsg( ((a_idxVar) & IEMNATIVE_VAR_IDX_MAGIC_MASK) == IEMNATIVE_VAR_IDX_MAGIC \ 1287 && (unsigned)IEMNATIVE_VAR_IDX_UNPACK(a_idxVar) < RT_ELEMENTS((a_pReNative)->Core.aVars) \ 1288 && ((a_pReNative)->Core.bmVars & RT_BIT_32(IEMNATIVE_VAR_IDX_UNPACK(a_idxVar))), \ 1289 ("%s=%#x\n", #a_idxVar, a_idxVar)) 1290 #else 1291 # define IEMNATIVE_ASSERT_VAR_IDX(a_pReNative, a_idxVar) \ 1263 1292 AssertMsg( (unsigned)(a_idxVar) < RT_ELEMENTS((a_pReNative)->Core.aVars) \ 1264 1293 && ((a_pReNative)->Core.bmVars & RT_BIT_32(a_idxVar)), ("%s=%d\n", #a_idxVar, a_idxVar)) 1294 #endif 1265 1295 1266 1296 /** … … 1269 1299 * This also adds a RT_NOREF of a_idxVar. 1270 1300 */ 1271 #define IEMNATIVE_ASSERT_ARG_VAR_IDX(a_pReNative, a_idxVar, a_uArgNo) do { \ 1301 #ifdef IEMNATIVE_VAR_IDX_MAGIC 1302 # define IEMNATIVE_ASSERT_ARG_VAR_IDX(a_pReNative, a_idxVar, a_uArgNo) do { \ 1303 RT_NOREF_PV(a_idxVar); \ 1304 AssertMsg( ((a_idxVar) & IEMNATIVE_VAR_IDX_MAGIC_MASK) == IEMNATIVE_VAR_IDX_MAGIC \ 1305 && (unsigned)IEMNATIVE_VAR_IDX_UNPACK(a_idxVar) < RT_ELEMENTS((a_pReNative)->Core.aVars) \ 1306 && ((a_pReNative)->Core.bmVars & RT_BIT_32(IEMNATIVE_VAR_IDX_UNPACK(a_idxVar))) \ 1307 && (a_pReNative)->Core.aVars[IEMNATIVE_VAR_IDX_UNPACK(a_idxVar)].uArgNo == (a_uArgNo), \ 1308 ("%s=%d; uArgNo=%d, expected %u\n", #a_idxVar, a_idxVar, \ 1309 (a_pReNative)->Core.aVars[RT_MIN(IEMNATIVE_VAR_IDX_UNPACK(a_idxVar), \ 1310 RT_ELEMENTS((a_pReNative)->Core.aVars)) - 1].uArgNo, \ 1311 a_uArgNo)); \ 1312 } while (0) 1313 #else 1314 # define IEMNATIVE_ASSERT_ARG_VAR_IDX(a_pReNative, a_idxVar, a_uArgNo) do { \ 1272 1315 RT_NOREF_PV(a_idxVar); \ 1273 1316 AssertMsg( (unsigned)(a_idxVar) < RT_ELEMENTS((a_pReNative)->Core.aVars) \ … … 1275 1318 && (a_pReNative)->Core.aVars[a_idxVar].uArgNo == (a_uArgNo) \ 1276 1319 , ("%s=%d; uArgNo=%d, expected %u\n", #a_idxVar, a_idxVar, \ 1277 (a_pReNative)->Core.aVars[RT_M AX(a_idxVar, RT_ELEMENTS((a_pReNative)->Core.aVars)) - 1].uArgNo, a_uArgNo)); \1320 (a_pReNative)->Core.aVars[RT_MIN(a_idxVar, RT_ELEMENTS((a_pReNative)->Core.aVars)) - 1].uArgNo, a_uArgNo)); \ 1278 1321 } while (0) 1322 #endif 1323 1324 1325 /** 1326 * Checks that a variable has the expected size. 1327 */ 1328 #define IEMNATIVE_ASSERT_VAR_SIZE(a_pReNative, a_idxVar, a_cbVar) \ 1329 AssertMsg((a_pReNative)->Core.aVars[IEMNATIVE_VAR_IDX_UNPACK(a_idxVar)].cbVar == (a_cbVar), \ 1330 ("%s=%#x: cbVar=%#x, expected %#x!\n", #a_idxVar, a_idxVar, \ 1331 (a_pReNative)->Core.aVars[IEMNATIVE_VAR_IDX_UNPACK(a_idxVar)].cbVar == (a_cbVar))) 1332 1279 1333 1280 1334 /** … … 1299 1353 { 1300 1354 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 1301 Assert(pReNative->Core.aVars[ idxVar].fRegAcquired);1302 pReNative->Core.aVars[ idxVar].fRegAcquired = false;1355 Assert(pReNative->Core.aVars[IEMNATIVE_VAR_IDX_UNPACK(idxVar)].fRegAcquired); 1356 pReNative->Core.aVars[IEMNATIVE_VAR_IDX_UNPACK(idxVar)].fRegAcquired = false; 1303 1357 } 1304 1358
Note:
See TracChangeset
for help on using the changeset viewer.