Commit 60e2f11e by Corentin Wallez Committed by Commit Bot

Rename StaticType's kInstance to instance.

This is more than just a noop: when ANGLE is rolled in Chromium it is tested by the Android Binary Size trybot. This trybot runs an analysis pass that checks that any new variable names "kSomthing" is in .rodata or .data.rel.ro because it helps keep the binary size (and the size of each new Chromium process) small on Android. The analysis picks up new usages of StaticType::Helpers::kInstance as a new constant varaible that isn't in .data.rel.ro or .rodata. My understanding is that kInstances isn't put in those segments because it contains a TType that has a "mutable" field so it would be incorrect to put the variable in a read-only segment. BUG=chromium:981610 Change-Id: I36e550e066206df3404619f1d012b183cbb72fe4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1698202 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 1d672749
...@@ -53,7 +53,7 @@ constexpr StaticMangledName BuildStaticMangledName(TBasicType basicType, ...@@ -53,7 +53,7 @@ constexpr StaticMangledName BuildStaticMangledName(TBasicType basicType,
// This "variable" contains the mangled names for every constexpr-generated TType. // This "variable" contains the mangled names for every constexpr-generated TType.
// If kMangledNameInstance<B, P, Q, PS, SS> is used anywhere (specifally // If kMangledNameInstance<B, P, Q, PS, SS> is used anywhere (specifally
// in kInstance, below), this is where the appropriate type will be stored. // in instance, below), this is where the appropriate type will be stored.
template <TBasicType basicType, template <TBasicType basicType,
TPrecision precision, TPrecision precision,
TQualifier qualifier, TQualifier qualifier,
...@@ -67,14 +67,18 @@ static constexpr StaticMangledName kMangledNameInstance = ...@@ -67,14 +67,18 @@ static constexpr StaticMangledName kMangledNameInstance =
// //
// This "variable" contains every constexpr-generated TType. // This "variable" contains every constexpr-generated TType.
// If kInstance<B, P, Q, PS, SS> is used anywhere (specifally // If instance<B, P, Q, PS, SS> is used anywhere (specifally
// in Get, below), this is where the appropriate type will be stored. // in Get, below), this is where the appropriate type will be stored.
//
// TODO(crbug.com/981610): This is constexpr but doesn't follow the kConstant naming convention
// because TType has a mutable member that prevents it from being in .data.rel.ro and makes the
// Android Binary Size builder complain when ANGLE is rolled in Chromium.
template <TBasicType basicType, template <TBasicType basicType,
TPrecision precision, TPrecision precision,
TQualifier qualifier, TQualifier qualifier,
unsigned char primarySize, unsigned char primarySize,
unsigned char secondarySize> unsigned char secondarySize>
static constexpr TType kInstance = static constexpr TType instance =
TType(basicType, TType(basicType,
precision, precision,
qualifier, qualifier,
...@@ -97,7 +101,7 @@ constexpr const TType *Get() ...@@ -97,7 +101,7 @@ constexpr const TType *Get()
{ {
static_assert(1 <= primarySize && primarySize <= 4, "primarySize out of bounds"); static_assert(1 <= primarySize && primarySize <= 4, "primarySize out of bounds");
static_assert(1 <= secondarySize && secondarySize <= 4, "secondarySize out of bounds"); static_assert(1 <= secondarySize && secondarySize <= 4, "secondarySize out of bounds");
return &Helpers::kInstance<basicType, precision, qualifier, primarySize, secondarySize>; return &Helpers::instance<basicType, precision, qualifier, primarySize, secondarySize>;
} }
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment