dart-sdk/tools/run_offsets_extractor.sh
Tess Strickland 72cfc5c638 [vm] Clean up handling of payload-containing objects.
This CL adds a new PAYLOAD_SIZEOF specification to
runtime_offsets_list.h which defines InstanceSize methods given an
method name to invoke to get the header size (i.e., the size of
the object portion before the payload).

It uses this new specification to create appropriate InstanceSize()
methods for objects written to read-only sections of snapshots,
instead of needing separate size calculations for SIMARM_X64.

It adds more methods to Instructions to avoid special casing for bare
instructions mode. It also removes the special casing for SIMARM_X64,
serializing all read-only objects in the same manner even when not
in a crossword situation.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie3e4009f4bc03688998c32281e42fa22a255731d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-10-06 07:59:33 +00:00

73 lines
2.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
set -e
FILE="runtime/vm/compiler/runtime_offsets_extracted.h"
# Make sure we're running in the SDK directory.
if ! test -f "$FILE"; then
echo "Couldn't find $FILE"
echo "Make sure to run this script from the Dart SDK directory."
exit 1
fi
TEMP="${FILE}.temp"
TEMP_HEADER="${FILE}.header.temp"
TEMP_JIT="${FILE}.jit.temp"
TEMP_AOT="${FILE}.aot.temp"
# Remove old temp files if the previous run was stopped prematurely.
rm -rf "${TEMP}" "${TEMP_HEADER}" "${TEMP_JIT}" "${TEMP_AOT}"
# We're regenerating the file, but we want to keep all the comments etc at the
# top of the file. So just delete everything after the first "#if defined".
LINE=$(grep "#if " "$FILE" -n | head -n 1 | sed "s/^\([0-9]*\):.*/\1/")
head -n $(expr $LINE - 1) "$FILE" >"$TEMP_HEADER"
# Run offsets_extractor for every architecture and append the results.
run() {
tools/build.py --mode=$1 --arch=$2 offsets_extractor offsets_extractor_precompiled_runtime
echo "" >>"$TEMP_JIT"
out/$3/offsets_extractor >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
out/$3/offsets_extractor_precompiled_runtime >>"$TEMP_AOT"
}
echo "" >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
echo "#if !defined(PRODUCT)" >>"$TEMP_JIT"
echo "#if !defined(PRODUCT)" >>"$TEMP_AOT"
run release simarm ReleaseSIMARM
run release x64 ReleaseX64
run release ia32 ReleaseIA32
run release simarm64 ReleaseSIMARM64
echo "" >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
echo "#else // !defined(PRODUCT)" >>"$TEMP_JIT"
echo "#else // !defined(PRODUCT)" >>"$TEMP_AOT"
run product simarm ProductSIMARM
run product x64 ProductX64
run product ia32 ProductIA32
run product simarm64 ProductSIMARM64
echo "" >>"$TEMP_JIT"
echo "" >>"$TEMP_AOT"
echo "#endif // !defined(PRODUCT)" >>"$TEMP_JIT"
echo "#endif // !defined(PRODUCT)" >>"$TEMP_AOT"
cat $TEMP_HEADER >>"$TEMP"
cat $TEMP_JIT >>"$TEMP"
cat $TEMP_AOT >>"$TEMP"
echo "" >>"$TEMP"
echo "#endif // RUNTIME_VM_COMPILER_RUNTIME_OFFSETS_EXTRACTED_H_" >>"$TEMP"
mv "$TEMP" "$FILE"
# Cleanup.
git cl format "$FILE"
rm "$TEMP_HEADER"
rm "$TEMP_JIT"
rm "$TEMP_AOT"
echo -e "\n\nSuccessfully generated $FILE :)"