VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8vePython.py@ 101376

最後變更 在這個檔案從101376是 101370,由 vboxsync 提交於 18 月 前

Reverted commit r159372, committed too much.

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.0 KB
 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: IEMAllN8vePython.py 101370 2023-10-06 01:23:09Z vboxsync $
4# pylint: disable=invalid-name
5
6"""
7Native recompiler side-kick for IEMAllThrdPython.py.
8
9Analyzes the each threaded function variant to see if we can we're able to
10recompile it, then provides modifies MC block code for doing so.
11"""
12
13from __future__ import print_function;
14
15__copyright__ = \
16"""
17Copyright (C) 2023 Oracle and/or its affiliates.
18
19This file is part of VirtualBox base platform packages, as
20available from https://www.alldomusa.eu.org.
21
22This program is free software; you can redistribute it and/or
23modify it under the terms of the GNU General Public License
24as published by the Free Software Foundation, in version 3 of the
25License.
26
27This program is distributed in the hope that it will be useful, but
28WITHOUT ANY WARRANTY; without even the implied warranty of
29MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30General Public License for more details.
31
32You should have received a copy of the GNU General Public License
33along with this program; if not, see <https://www.gnu.org/licenses>.
34
35SPDX-License-Identifier: GPL-3.0-only
36"""
37__version__ = "$Revision: 101370 $"
38
39# Standard python imports:
40#import sys;
41
42# Out python imports:
43import IEMAllInstPython as iai;
44
45
46class NativeRecompFunctionVariation(object):
47 """
48 Class that deals with transforming a threaded function variation into a
49 native recompiler function.
50
51 This base class doesn't do any transforming and just renders the same
52 code as for the threaded function.
53 """
54
55 def __init__(self, oVariation, sHostArch):
56 self.oVariation = oVariation # type: ThreadedFunctionVariation
57 self.sHostArch = sHostArch;
58
59 def isRecompilable(self):
60 """
61 Predicate that returns whether the variant can be recompiled natively
62 (for the selected host architecture).
63 """
64 return True;
65
66 def renderCode(self, cchIndent):
67 """
68 Returns the native recompiler function body for this threaded variant.
69 """
70 aoStmts = self.oVariation.aoStmtsForThreadedFunction # type: list(McStmt)
71 return iai.McStmt.renderCodeForList(aoStmts, cchIndent);
72
73
74
75def analyzeVariantForNativeRecomp(oVariation,
76 sHostArch): # type: (ThreadedFunctionVariation, str) -> NativeRecompFunctionVariation
77 """
78 This function analyzes the threaded function variant and returns an
79 NativeRecompFunctionVariation instance for it, unless it's not
80 possible to recompile at present.
81
82 Returns NativeRecompFunctionVariation or None.
83 """
84
85 #
86 # Analyze the statements.
87 #
88 aoStmts = oVariation.aoStmtsForThreadedFunction # type: list(McStmt)
89
90 # The simplest case are the IEM_MC_DEFER_TO_CIMPL_*_RET_THREADED ones, just pass them thru:
91 if ( len(aoStmts) == 1
92 and aoStmts[0].sName.startswith('IEM_MC_DEFER_TO_CIMPL_')
93 and aoStmts[0].sName.endswith('_RET_THREADED')):
94 return NativeRecompFunctionVariation(oVariation, sHostArch);
95
96 return None;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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