stop using the interpreter holders for the MachineInfo

Anywhere we have that, we also have the Environment object, which is
just wrapped by the Interpreter methods anyway. This avoids inderections
that are unnecessary.
pull/12617/merge
Dylan Baker 11 months ago
parent 35d89301a9
commit c37cd4fe9a
  1. 10
      mesonbuild/backend/vs2010backend.py
  2. 18
      mesonbuild/msetup.py

@ -225,10 +225,10 @@ class Vs2010Backend(backends.Backend):
# Check for (currently) unexpected capture arg use cases -
if capture:
raise MesonBugException('We do not expect any vs backend to generate with \'capture = True\'')
target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None)
target_machine = self.environment.machines.target.cpu_family
if target_machine in {'64', 'x86_64'}:
# amd64 or x86_64
target_system = self.interpreter.builtin['target_machine'].system_method(None, None)
target_system = self.environment.machines.target.system
if detect_microsoft_gdk(target_system):
self.platform = target_system
else:
@ -237,7 +237,7 @@ class Vs2010Backend(backends.Backend):
# x86
self.platform = 'Win32'
elif target_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['target_machine'].cpu_method(None, None)
target_cpu = self.environment.machines.target.cpu
if target_cpu == 'arm64ec':
self.platform = 'arm64ec'
else:
@ -247,7 +247,7 @@ class Vs2010Backend(backends.Backend):
else:
raise MesonException('Unsupported Visual Studio platform: ' + target_machine)
build_machine = self.interpreter.builtin['build_machine'].cpu_family_method(None, None)
build_machine = self.environment.machines.build.cpu_family
if build_machine in {'64', 'x86_64'}:
# amd64 or x86_64
self.build_platform = 'x64'
@ -255,7 +255,7 @@ class Vs2010Backend(backends.Backend):
# x86
self.build_platform = 'Win32'
elif build_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['build_machine'].cpu_method(None, None)
target_cpu = self.environment.machines.build.cpu
if target_cpu == 'arm64ec':
self.build_platform = 'arm64ec'
else:

@ -196,18 +196,12 @@ class MesonApp:
# even to write `T.Callable[[*mlog.TV_Loggable], None]`
logger_fun = T.cast('T.Callable[[mlog.TV_Loggable, mlog.TV_Loggable], None]',
(mlog.log if env.is_cross_build() else mlog.debug))
build_machine = intr.builtin['build_machine']
host_machine = intr.builtin['host_machine']
target_machine = intr.builtin['target_machine']
assert isinstance(build_machine, interpreter.MachineHolder)
assert isinstance(host_machine, interpreter.MachineHolder)
assert isinstance(target_machine, interpreter.MachineHolder)
logger_fun('Build machine cpu family:', mlog.bold(build_machine.cpu_family_method([], {})))
logger_fun('Build machine cpu:', mlog.bold(build_machine.cpu_method([], {})))
mlog.log('Host machine cpu family:', mlog.bold(host_machine.cpu_family_method([], {})))
mlog.log('Host machine cpu:', mlog.bold(host_machine.cpu_method([], {})))
logger_fun('Target machine cpu family:', mlog.bold(target_machine.cpu_family_method([], {})))
logger_fun('Target machine cpu:', mlog.bold(target_machine.cpu_method([], {})))
logger_fun('Build machine cpu family:', mlog.bold(env.machines.build.cpu_family))
logger_fun('Build machine cpu:', mlog.bold(env.machines.build.cpu))
mlog.log('Host machine cpu family:', mlog.bold(env.machines.host.cpu_family))
mlog.log('Host machine cpu:', mlog.bold(env.machines.host.cpu))
logger_fun('Target machine cpu family:', mlog.bold(env.machines.target.cpu_family))
logger_fun('Target machine cpu:', mlog.bold(env.machines.target.cpu))
try:
if self.options.profile:
fname = os.path.join(self.build_dir, 'meson-logs', 'profile-interpreter.log')

Loading…
Cancel
Save