VirtualBox

Ignore:
Timestamp:
Nov 3, 2023 12:36:45 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159818
Message:

VMM/IEM: Identify the different styles IEM_MC_CALL_XXX and mark these using new IEM_CIMPL_F_CALLS_XXX flags in the python scripts. This is necessary as IEM_MC_CALL_CIMPL_X, IEM_MC_CALL_FPU_AIMPL_X, IEM_MC_CALL_MMX_AIMPL_X, and IEM_MC_CALL_SSE_AIMPL_X all have hidden parameters that need to be accounted for when recompiling to native code (for more perfect register allocations for variables). Split up the different cmpxchg16b AIMPL/CIMPL variations into separate MC blocks, as we can't mix AIMPL and CIMPL calls in the same block (also, in the CIMPL case, there would be unused tail code after the call). bugref:10371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py

    r101704 r101722  
    419419        'IEM_CIMPL_F_END_TB':                       True,
    420420        'IEM_CIMPL_F_XCPT':                         True,
     421        'IEM_CIMPL_F_CALLS_CIMPL':                  False,
     422        'IEM_CIMPL_F_CALLS_AIMPL':                  False,
     423        'IEM_CIMPL_F_CALLS_AIMPL_WITH_FXSTATE':     False,
    421424    };
    422425
     
    13311334                    self.dsCImplFlags['IEM_CIMPL_F_BRANCH_CONDITIONAL'] = True;
    13321335
     1336            # Check for CIMPL and AIMPL calls.
     1337            if oStmt.sName.startswith('IEM_MC_CALL_'):
     1338                if oStmt.sName.startswith('IEM_MC_CALL_CIMPL_'):
     1339                    self.dsCImplFlags['IEM_CIMPL_F_CALLS_CIMPL'] = True;
     1340                elif (   oStmt.sName.startswith('IEM_MC_CALL_VOID_AIMPL_')
     1341                      or oStmt.sName.startswith('IEM_MC_CALL_AIMPL_')
     1342                      or oStmt.sName.startswith('IEM_MC_CALL_AVX_AIMPL_')):
     1343                    self.dsCImplFlags['IEM_CIMPL_F_CALLS_AIMPL'] = True;
     1344                elif (   oStmt.sName.startswith('IEM_MC_CALL_SSE_AIMPL_')
     1345                      or oStmt.sName.startswith('IEM_MC_CALL_MMX_AIMPL_')
     1346                      or oStmt.sName.startswith('IEM_MC_CALL_FPU_AIMPL_')):
     1347                    self.dsCImplFlags['IEM_CIMPL_F_CALLS_AIMPL_WITH_FXSTATE'] = True;
     1348                else:
     1349                    raise Exception('Unknown IEM_MC_CALL_* statement: %s' % (oStmt.sName,));
     1350
    13331351            # Process branches of conditionals recursively.
    13341352            if isinstance(oStmt, iai.McStmtCond):
     
    13611379        self.dsCImplFlags = self.oMcBlock.dsCImplFlags.copy();
    13621380        self.analyzeCodeOperation(aoStmts);
     1381        if (   ('IEM_CIMPL_F_CALLS_CIMPL' in self.dsCImplFlags)
     1382             + ('IEM_CIMPL_F_CALLS_AIMPL' in self.dsCImplFlags)
     1383             + ('IEM_CIMPL_F_CALLS_AIMPL_WITH_FXSTATE' in self.dsCImplFlags) > 1):
     1384            self.raiseProblem('Mixing CIMPL/AIMPL/AIMPL_WITH_FXSTATE calls');
    13631385
    13641386        # Create variations as needed.
     
    18241846            if ian.g_dUnsupportedMcStmtLastOneVarStats:
    18251847                asTopKeys = sorted(ian.g_dUnsupportedMcStmtLastOneVarStats, reverse = True,
    1826                                    key = lambda sSortKey: len(ian.g_dUnsupportedMcStmtLastOneVarStats[sSortKey]))[:10];
     1848                                   key = lambda sSortKey: len(ian.g_dUnsupportedMcStmtLastOneVarStats[sSortKey]))[:16];
    18271849                print('todo:', file = sys.stderr);
    1828                 print('todo: Top %s variations with variables and one unsupported statement dependency:' % (len(asTopKeys),),
     1850                print('todo: Top %s variations with variables and 1-2 unsupported statement dependency:' % (len(asTopKeys),),
    18291851                      file = sys.stderr);
    18301852                cchMaxKey = max([len(sKey) for sKey in asTopKeys]);
     
    18611883                cbVars = 0;
    18621884                for oVar in oThreadedFunction.oMcBlock.aoLocals:
    1863                      cbVars += (getTypeBitCount(oVar.sType) + 63) // 64 * 8;
     1885                    cbVars += (getTypeBitCount(oVar.sType) + 63) // 64 * 8;
    18641886                cbMaxVars        = max(cbMaxVars, cbVars);
    18651887                cbMaxArgs        = max(cbMaxArgs, cbArgs);
     
    23662388                #
    23672389                elif oThreadedFunction.oMcBlock.iBeginLine != oThreadedFunction.oMcBlock.iEndLine:
    2368                     assert sLine.count('IEM_MC_') - sLine.count('IEM_MC_F_') == 1, 'sLine="%s"' % (sLine,);
     2390                    assert (   (sLine.count('IEM_MC_') - sLine.count('IEM_MC_F_') == 1)
     2391                            or oThreadedFunction.oMcBlock.iMacroExp == iai.McBlock.kMacroExp_Partial), 'sLine="%s"' % (sLine,);
    23692392                    oOut.write(sLine[:oThreadedFunction.oMcBlock.offBeginLine]);
    23702393                    sModified = oThreadedFunction.generateInputCode().strip();
     
    23732396                    iLine = oThreadedFunction.oMcBlock.iEndLine;
    23742397                    sLine = oParser.asLines[iLine - 1];
    2375                     assert sLine.count('IEM_MC_') - sLine.count('IEM_MC_F_') == 1 or len(oThreadedFunction.oMcBlock.aoStmts) == 1;
     2398                    assert (   sLine.count('IEM_MC_') - sLine.count('IEM_MC_F_') == 1
     2399                            or len(oThreadedFunction.oMcBlock.aoStmts) == 1
     2400                            or oThreadedFunction.oMcBlock.iMacroExp == iai.McBlock.kMacroExp_Partial);
    23762401                    oOut.write(sLine[oThreadedFunction.oMcBlock.offAfterEnd : ]);
    23772402
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette