[vm] Decouple growable_array.h and zone.h from thread.h

- Introduce a slimmed down version of thread.h, which just depends on the
Zone and StackResource.
- Introduce a layering check that would prevent the coupling in the future.

This is the first step towards decoupling compiler from runtime.

There are multiple reasons to introduce the decoupling but the main
reason currently is to introduce a controlled surface through which
compiler reaches into runtime to catch any places where runtime word size
might influence the compiler and then enable building compiler that
targets 32-bit runtime but is embedded into a 64-bit runtime.

Issue https://github.com/dart-lang/sdk/issues/31709

Change-Id: Id63ebbaddca55dd097298e51c90d957a73fa476e
Reviewed-on: https://dart-review.googlesource.com/c/87182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Vyacheslav Egorov
2019-01-11 20:47:10 +00:00
committed by commit-bot@chromium.org
parent d821a2ec96
commit a9ce969e53
54 changed files with 518 additions and 250 deletions
+27 -2
View File
@@ -168,15 +168,40 @@ def _CheckValidHostsInDEPS(input_api, output_api):
'DEPS file must have only dependencies from allowed hosts.',
long_text=error.output)]
def _CheckLayering(input_api, output_api):
"""Run VM layering check.
This check validates that sources from one layer do not reference sources
from another layer accidentally.
"""
# Run only if .cc or .h file was modified.
def is_cpp_file(path):
return path.endswith('.cc') or path.endswith('.h')
if all(not is_cpp_file(f.LocalPath()) for f in input_api.AffectedFiles()):
return []
local_root = input_api.change.RepositoryRoot()
layering_check = imp.load_source('layering_check',
os.path.join(local_root, 'runtime', 'tools', 'layering_check.py'))
errors = layering_check.DoCheck(local_root)
if errors:
return [output_api.PresubmitError(
'Layering check violation for C++ sources.',
long_text='\n'.join(errors))]
else:
return []
def CheckChangeOnCommit(input_api, output_api):
return (_CheckValidHostsInDEPS(input_api, output_api) +
_CheckBuildStatus(input_api, output_api) +
_CheckDartFormat(input_api, output_api) +
_CheckStatusFiles(input_api, output_api))
_CheckStatusFiles(input_api, output_api) +
_CheckLayering(input_api, output_api))
def CheckChangeOnUpload(input_api, output_api):
return (_CheckValidHostsInDEPS(input_api, output_api) +
_CheckDartFormat(input_api, output_api) +
_CheckStatusFiles(input_api, output_api))
_CheckStatusFiles(input_api, output_api) +
_CheckLayering(input_api, output_api))