[vm] Remove gap from symbol list.
TEST=ci Change-Id: Ib4aa1a48fdcf47f6e27c21428628d06d4de9fd9e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490348 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
5ef56befcb
commit
8779faa131
@@ -7002,7 +7002,7 @@ class VMSerializationRoots : public SerializationRoots {
|
||||
}
|
||||
|
||||
void WriteRoots(Serializer* s) {
|
||||
for (intptr_t i = 1; i < Symbols::kMaxPredefinedId; i++) {
|
||||
for (intptr_t i = 0; i < Symbols::kMaxPredefinedId; i++) {
|
||||
s->WriteRootRef(Symbols::Symbol(i).ptr(), "<symbol>");
|
||||
}
|
||||
s->WriteRootRef(
|
||||
@@ -7099,7 +7099,7 @@ class VMDeserializationRoots : public DeserializationRoots {
|
||||
}
|
||||
|
||||
void ReadRoots(Deserializer* d) override {
|
||||
for (intptr_t i = 1; i < Symbols::kMaxPredefinedId; i++) {
|
||||
for (intptr_t i = 0; i < Symbols::kMaxPredefinedId; i++) {
|
||||
String* symbol = String::ReadOnlyHandle();
|
||||
*symbol ^= d->ReadRef();
|
||||
Symbols::InitSymbol(i, symbol);
|
||||
|
||||
@@ -314,7 +314,7 @@ static const struct {
|
||||
const uint32_t finger_print;
|
||||
const char* const name;
|
||||
} factory_recognizer_list[] = {RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY){
|
||||
Symbols::kIllegal, -1, 0, nullptr}};
|
||||
Symbols::kEmptyId, kIllegalCid, 0, nullptr}};
|
||||
|
||||
#undef RECOGNIZE_FACTORY
|
||||
|
||||
@@ -326,7 +326,7 @@ intptr_t FactoryRecognizer::ResultCid(const Function& factory) {
|
||||
(lib.ptr() == Library::TypedDataLibrary()));
|
||||
const String& factory_name = String::Handle(factory.name());
|
||||
for (intptr_t i = 0;
|
||||
factory_recognizer_list[i].symbol_id != Symbols::kIllegal; i++) {
|
||||
factory_recognizer_list[i].symbol_id != Symbols::kEmptyId; i++) {
|
||||
if (String::EqualsIgnoringPrivateKey(
|
||||
factory_name,
|
||||
Symbols::Symbol(factory_recognizer_list[i].symbol_id))) {
|
||||
|
||||
@@ -22,14 +22,13 @@ StringPtr Symbols::predefined_[Symbols::kNumberOfOneCharCodeSymbols];
|
||||
String* Symbols::symbol_handles_[Symbols::kMaxPredefinedId];
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
// clang-format off
|
||||
static const char* const names[] = {
|
||||
// clang-format off
|
||||
nullptr,
|
||||
#define DEFINE_SYMBOL_LITERAL(symbol, literal) literal,
|
||||
PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_LITERAL)
|
||||
#undef DEFINE_SYMBOL_LITERAL
|
||||
// clang-format on
|
||||
};
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
StringPtr StringFrom(const uint8_t* data, intptr_t len, Heap::Space space) {
|
||||
@@ -83,7 +82,7 @@ void Symbols::Init(IsolateGroup* vm_isolate_group) {
|
||||
// Create symbols for language keywords. Some keywords are equal to
|
||||
// symbols we already created, so use New() instead of Add() to ensure
|
||||
// that the symbols are canonicalized.
|
||||
for (intptr_t i = 1; i < Symbols::kNullCharId; i++) {
|
||||
for (intptr_t i = 0; i < Symbols::kNullCharId; i++) {
|
||||
String* str = String::ReadOnlyHandle();
|
||||
*str = OneByteString::New(names[i], Heap::kOld);
|
||||
str->Hash();
|
||||
|
||||
@@ -577,18 +577,15 @@ class Symbols : public AllStatic {
|
||||
enum { kMaxOneCharCodeSymbol = 0xFF };
|
||||
|
||||
// List of strings that are pre created in the vm isolate.
|
||||
// clang-format off
|
||||
enum SymbolId {
|
||||
// clang-format off
|
||||
kIllegal = 0,
|
||||
|
||||
#define DEFINE_SYMBOL_INDEX(symbol, literal) k##symbol##Id,
|
||||
PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX)
|
||||
PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX)
|
||||
#undef DEFINE_SYMBOL_INDEX
|
||||
|
||||
kNullCharId, // One char code symbol starts here and takes up 256 entries.
|
||||
kMaxPredefinedId = kNullCharId + kMaxOneCharCodeSymbol + 1,
|
||||
// clang-format on
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Number of one character symbols being predefined in the predefined_ array.
|
||||
static constexpr int kNumberOfOneCharCodeSymbols =
|
||||
@@ -598,11 +595,11 @@ class Symbols : public AllStatic {
|
||||
static constexpr int kNullCharCodeSymbolOffset = 0;
|
||||
|
||||
static const String& Symbol(intptr_t index) {
|
||||
ASSERT((index > kIllegal) && (index < kMaxPredefinedId));
|
||||
ASSERT((index >= 0) && (index < kMaxPredefinedId));
|
||||
return *(symbol_handles_[index]);
|
||||
}
|
||||
static void InitSymbol(intptr_t index, String* symbol) {
|
||||
ASSERT((index > kIllegal) && (index < kMaxPredefinedId));
|
||||
ASSERT((index >= 0) && (index < kMaxPredefinedId));
|
||||
symbol_handles_[index] = symbol;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user