[vm] Bump minimum kernel version to 29.

This paves the way for removing the old constant evaluator from the VM,
by no longer supporting versions without front-end constant evaluation.

For the front-end test that tests old kernel versions on the newest VM,
the dill files for versions before 29 are deleted.

Version 29 is from 2019-08-16: eae781c73e

Change-Id: Icb472bffc764d6e37ed1349a0cb4ff281e0e1b21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123739
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
Aske Simon Christensen 2019-11-05 13:31:41 +00:00 committed by commit-bot@chromium.org
parent 75dc8483ab
commit 8bdca37e98
10 changed files with 34 additions and 96 deletions

2
DEPS
View file

@ -468,7 +468,7 @@ deps = {
"packages": [
{
"package": "dart/cfe/dart2js_dills",
"version": "binary_version:36",
"version": "binary_version:29_36",
}
],
"dep_type": "cipd",

View file

@ -173,9 +173,6 @@ RawInstance* ConstantEvaluator::EvaluateExpression(intptr_t offset,
helper_->SkipDartType();
result_ = EvaluateConstantExpression(helper_->ReadUInt());
break;
case kDeprecated_ConstantExpression:
result_ = EvaluateConstantExpression(helper_->ReadUInt());
break;
case kInvalidExpression: {
helper_->ReadPosition(); // Skip position.
const String& message = H.DartString(helper_->ReadStringReference());

View file

@ -1287,8 +1287,6 @@ Fragment StreamingFlowGraphBuilder::BuildExpression(TokenPosition* position) {
return BuildNullLiteral(position);
case kConstantExpression:
return BuildConstantExpression(position, tag);
case kDeprecated_ConstantExpression:
return BuildConstantExpression(position, tag);
case kInstantiation:
return BuildPartialTearoffInstantiation(position);
case kLoadLibrary:
@ -1376,10 +1374,7 @@ Tag KernelReaderHelper::PeekTag(uint8_t* payload) {
}
Nullability KernelReaderHelper::ReadNullability() {
if (translation_helper_.info().kernel_binary_version() >= 28) {
return reader_.ReadNullability();
}
return kLegacy;
return reader_.ReadNullability();
}
Variance KernelReaderHelper::ReadVariance() {

View file

@ -303,9 +303,7 @@ void KernelFingerprintHelper::CalculateFunctionTypeFingerprint(bool simple) {
// read string reference (i.e. named_parameters[i].name).
CalculateStringReferenceFingerprint();
CalculateDartTypeFingerprint(); // read named_parameters[i].type.
if (translation_helper_.info().kernel_binary_version() >= 29) {
BuildHash(ReadFlags()); // read flags.
}
BuildHash(ReadFlags()); // read flags.
}
}
@ -573,9 +571,6 @@ void KernelFingerprintHelper::CalculateExpressionFingerprint() {
SkipDartType();
SkipConstantReference();
return;
case kDeprecated_ConstantExpression:
SkipConstantReference();
return;
case kLoadLibrary:
case kCheckLibraryIsLoaded:
ReadUInt(); // skip library index

View file

@ -1009,11 +1009,7 @@ void FieldHelper::ReadUntilExcluding(Field field) {
if (++next_read_ == field) return;
FALL_THROUGH;
case kFlags:
if (helper_->translation_helper_.info().kernel_binary_version() >= 29) {
flags_ = helper_->ReadUInt();
} else {
flags_ = helper_->ReadFlags();
}
flags_ = helper_->ReadUInt();
if (++next_read_ == field) return;
FALL_THROUGH;
case kName:
@ -1081,11 +1077,7 @@ void ProcedureHelper::ReadUntilExcluding(Field field) {
if (++next_read_ == field) return;
FALL_THROUGH;
case kFlags:
if (helper_->translation_helper_.info().kernel_binary_version() >= 29) {
flags_ = helper_->ReadUInt();
} else {
flags_ = helper_->ReadFlags();
}
flags_ = helper_->ReadUInt();
if (++next_read_ == field) return;
FALL_THROUGH;
case kName:
@ -1317,10 +1309,8 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
FALL_THROUGH;
}
case kLanguageVersion: {
if (binary_version_ >= 27) {
helper_->ReadUInt(); // Read major language version.
helper_->ReadUInt(); // Read minor language version.
}
helper_->ReadUInt(); // Read major language version.
helper_->ReadUInt(); // Read minor language version.
if (++next_read_ == field) return;
FALL_THROUGH;
}
@ -2043,9 +2033,7 @@ void KernelReaderHelper::SkipFunctionType(bool simple) {
// read string reference (i.e. named_parameters[i].name).
SkipStringReference();
SkipDartType(); // read named_parameters[i].type.
if (translation_helper_.info().kernel_binary_version() >= 29) {
SkipBytes(1); // read flags
}
SkipBytes(1); // read flags
}
}
@ -2360,9 +2348,6 @@ void KernelReaderHelper::SkipExpression() {
SkipDartType(); // read type.
SkipConstantReference();
return;
case kDeprecated_ConstantExpression:
SkipConstantReference();
return;
case kLoadLibrary:
case kCheckLibraryIsLoaded:
ReadUInt(); // skip library index
@ -2929,10 +2914,8 @@ void TypeTranslator::BuildFunctionType(bool simple) {
// read string reference (i.e. named_parameters[i].name).
String& name = H.DartSymbolObfuscate(helper_->ReadStringReference());
BuildTypeInternal(); // read named_parameters[i].type.
if (translation_helper_.info().kernel_binary_version() >= 29) {
// TODO(markov): Store 'required' bit.
helper_->ReadFlags(); // read flags
}
// TODO(markov): Store 'required' bit.
helper_->ReadFlags(); // read flags
parameter_types.SetAt(pos, result_);
parameter_names.SetAt(pos, name);
}

View file

@ -917,10 +917,6 @@ void ScopeBuilder::VisitExpression() {
helper_.SkipDartType();
helper_.SkipConstantReference();
return;
case kDeprecated_ConstantExpression: {
helper_.SkipConstantReference();
return;
}
case kInstantiation: {
VisitExpression();
const intptr_t list_length =
@ -1369,9 +1365,7 @@ void ScopeBuilder::VisitFunctionType(bool simple) {
// read string reference (i.e. named_parameters[i].name).
helper_.SkipStringReference();
VisitDartType(); // read named_parameters[i].type.
if (helper_.translation_helper_.info().kernel_binary_version() >= 29) {
helper_.ReadByte(); // read flags
}
helper_.ReadByte(); // read flags
}
}

View file

@ -19,7 +19,7 @@ namespace kernel {
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
// Both version numbers are inclusive.
static const uint32_t kMinSupportedKernelFormatVersion = 18;
static const uint32_t kMinSupportedKernelFormatVersion = 29;
static const uint32_t kMaxSupportedKernelFormatVersion = 36;
// Keep in sync with package:kernel/lib/binary/tag.dart
@ -128,7 +128,6 @@ static const uint32_t kMaxSupportedKernelFormatVersion = 36;
V(SimpleInterfaceType, 96) \
V(SimpleFunctionType, 97) \
V(ConstantExpression, 106) \
V(Deprecated_ConstantExpression, 107) \
V(SpecializedVariableGet, 128) \
V(SpecializedVariableSet, 136) \
V(SpecializedIntLiteral, 144)

View file

@ -157,9 +157,7 @@ LibraryIndex::LibraryIndex(const ExternalTypedData& kernel_data,
class_index_offset_ = procedure_index_offset_ - 4 - (class_count_ + 1) * 4;
source_references_offset_ = -1;
if (binary_version >= 25) {
source_references_offset_ = reader_.ReadUInt32At(class_index_offset_ - 4);
}
source_references_offset_ = reader_.ReadUInt32At(class_index_offset_ - 4);
}
ClassIndex::ClassIndex(const uint8_t* buffer,
@ -526,15 +524,13 @@ void KernelLoader::AnnotateNativeProcedures() {
const intptr_t annotation_count = helper_.ReadListLength();
for (intptr_t j = 0; j < annotation_count; ++j) {
const intptr_t tag = helper_.PeekTag();
if (tag == kConstantExpression || tag == kDeprecated_ConstantExpression) {
if (tag == kConstantExpression) {
helper_.ReadByte(); // Skip the tag.
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
// We have a candidate. Let's look if it's an instance of the
// ExternalName class.
if (tag == kConstantExpression) {
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
}
const intptr_t constant_table_offset = helper_.ReadUInt();
if (constant_evaluator.IsInstanceConstant(constant_table_offset,
external_name_class_)) {
@ -661,16 +657,13 @@ void KernelLoader::LoadNativeExtensionLibraries() {
uri_path = String::null();
const intptr_t tag = helper_.PeekTag();
if (tag == kConstantExpression ||
tag == kDeprecated_ConstantExpression) {
if (tag == kConstantExpression) {
helper_.ReadByte(); // Skip the tag.
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
// We have a candidate. Let's look if it's an instance of the
// ExternalName class.
if (tag == kConstantExpression) {
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
}
const intptr_t constant_table_offset = helper_.ReadUInt();
if (constant_evaluator.IsInstanceConstant(constant_table_offset,
external_name_class_)) {
@ -1101,17 +1094,15 @@ RawLibrary* KernelLoader::LoadLibrary(intptr_t index) {
}
if (register_class) {
if (library_index.HasSourceReferences()) {
helper_.SetOffset(library_index.SourceReferencesOffset());
intptr_t count = helper_.ReadUInt();
const GrowableObjectArray& owned_scripts =
GrowableObjectArray::Handle(library.owned_scripts());
Script& script = Script::Handle(Z);
for (intptr_t i = 0; i < count; i++) {
intptr_t uri_index = helper_.ReadUInt();
script = ScriptAt(uri_index);
owned_scripts.Add(script);
}
helper_.SetOffset(library_index.SourceReferencesOffset());
intptr_t count = helper_.ReadUInt();
const GrowableObjectArray& owned_scripts =
GrowableObjectArray::Handle(library.owned_scripts());
Script& script = Script::Handle(Z);
for (intptr_t i = 0; i < count; i++) {
intptr_t uri_index = helper_.ReadUInt();
script = ScriptAt(uri_index);
owned_scripts.Add(script);
}
}
if (!library.Loaded()) library.SetLoaded();
@ -1785,8 +1776,7 @@ void KernelLoader::ReadVMAnnotations(const Library& library,
if (DetectPragmaCtor()) {
*has_pragma_annotation = true;
}
} else if (tag == kConstantExpression ||
tag == kDeprecated_ConstantExpression) {
} else if (tag == kConstantExpression) {
const Array& constant_table_array =
Array::Handle(kernel_program_info_.constants());
if (constant_table_array.IsNull()) {
@ -1807,11 +1797,8 @@ void KernelLoader::ReadVMAnnotations(const Library& library,
// and avoid the "potential natives" list.
helper_.ReadByte(); // Skip the tag.
if (tag == kConstantExpression) {
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
}
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
const intptr_t offset_in_constant_table = helper_.ReadUInt();
AlternativeReadingScopeWithNewData scope(

View file

@ -107,11 +107,6 @@ class LibraryIndex {
return -1;
}
bool HasSourceReferences() {
if (binary_version_ < 25) return false;
return true;
}
intptr_t SourceReferencesOffset() { return source_references_offset_; }
private:
@ -283,10 +278,8 @@ class KernelLoader : public ValueObject {
// Start reading library.
// Note that this needs to be keep in sync with LibraryHelper.
reader.ReadFlags();
if (program_->binary_version() >= 27) {
reader.ReadUInt(); // Read major language version.
reader.ReadUInt(); // Read minor language version.
}
reader.ReadUInt(); // Read major language version.
reader.ReadUInt(); // Read minor language version.
return reader.ReadCanonicalNameReference();
}

View file

@ -10684,14 +10684,9 @@ RawArray* Library::LoadedScripts() const {
// We compute the list of loaded scripts lazily. The result is
// cached in loaded_scripts_.
if (loaded_scripts() == Array::null()) {
#if !defined(DART_PRECOMPILED_RUNTIME)
// TODO(jensj): Once minimum kernel support is >= 25 this can be cleaned up.
// TODO(jensj): This can be cleaned up.
// It really should just return the content of `owned_scripts`, and there
// should be no need to do the O(n) call to `AddScriptIfUnique` per script.
static_assert(
kernel::kMinSupportedKernelFormatVersion < 25,
"Once minimum kernel support is >= 25 this can be cleaned up.");
#endif
// Iterate over the library dictionary and collect all scripts.
const GrowableObjectArray& scripts =