[L] Change in dart/sdk[main]: [vm,dyn_modules] Recognize the vm:invisible pragma.

0 views
Skip to first unread message

Tess Strickland (Gerrit)

unread,
Mar 9, 2026, 10:00:55 AM (17 hours ago) Mar 9
to Alexander Markov, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Alexander Markov

Tess Strickland voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Markov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 1
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
Gerrit-Attention: Alexander Markov <alexm...@google.com>
Gerrit-Comment-Date: Mon, 09 Mar 2026 14:00:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Alexander Markov (Gerrit)

unread,
Mar 9, 2026, 10:41:57 AM (16 hours ago) Mar 9
to Tess Strickland, Alexander Markov, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Tess Strickland

Alexander Markov voted and added 1 comment

Votes added by Alexander Markov

Code-Review+1

1 comment

File pkg/dart2bytecode/lib/bytecode_generator.dart
Line 4653, Patchset 1 (Latest): final bool isInvisible;
Alexander Markov . unresolved

Nit: this is not the part of the annotations in the bytecode, so this flag doesn't really belong here. Consider calling `pragmaParser` directly where we need to determine the flag.

Open in Gerrit

Related details

Attention is currently required from:
  • Tess Strickland
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 1
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
Gerrit-Attention: Tess Strickland <sstr...@google.com>
Gerrit-Comment-Date: Mon, 09 Mar 2026 14:41:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Tess Strickland (Gerrit)

unread,
Mar 9, 2026, 12:39:27 PM (14 hours ago) Mar 9
to Alexander Markov, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org

Tess Strickland added 2 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Tess Strickland . resolved

Thanks, Alex!

File pkg/dart2bytecode/lib/bytecode_generator.dart
Line 4653, Patchset 1: final bool isInvisible;
Alexander Markov . resolved

Nit: this is not the part of the annotations in the bytecode, so this flag doesn't really belong here. Consider calling `pragmaParser` directly where we need to determine the flag.

Tess Strickland

Ah, makes sense. Doing that instead.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 2
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
Gerrit-Comment-Date: Mon, 09 Mar 2026 16:39:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Alexander Markov <alexm...@google.com>
satisfied_requirement
open
diffy

Tess Strickland (Gerrit)

unread,
Mar 9, 2026, 12:39:42 PM (14 hours ago) Mar 9
to Alexander Markov, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org

Tess Strickland voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 2
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
Gerrit-Comment-Date: Mon, 09 Mar 2026 16:39:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Tess Strickland (Gerrit)

unread,
Mar 9, 2026, 12:40:22 PM (14 hours ago) Mar 9
to Alexander Markov, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org

Tess Strickland voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 3
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
Gerrit-Comment-Date: Mon, 09 Mar 2026 16:40:18 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Mar 9, 2026, 1:16:06 PM (14 hours ago) Mar 9
to Tess Strickland, Alexander Markov, rev...@dartlang.org, vm-...@dartlang.org

Commit Queue submitted the change with unreviewed changes

Unreviewed changes

1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: pkg/dart2bytecode/lib/bytecode_generator.dart
Insertions: 17, Deletions: 21.

@@ -423,7 +423,7 @@

Annotations getAnnotations(List<Expression> nodes) {
if (nodes.isEmpty) {
- return const Annotations(null);
+ return const Annotations(null, false);
}
List<Constant> constants = nodes.map(_getConstant).toList();
bool hasPragma = constants.any(_isPragma);
@@ -431,14 +431,14 @@
if (hasPragma) {
constants = constants.where(_isPragma).toList();
} else {
- return const Annotations(null);
+ return const Annotations(null, false);
}
}
final object = objectTable
.getHandle(new ListConstant(const DynamicType(), constants))!;
final decl = new AnnotationsDeclaration(object);
bytecodeComponent.annotations.add(decl);
- return new Annotations(decl, hasPragma: hasPragma);
+ return new Annotations(decl, hasPragma);
}

// Insert annotations for the function and its parameters into the annotations
@@ -457,13 +457,13 @@

if (annotations.isEmpty &&
parameterNodeLists.every((nodes) => nodes.isEmpty)) {
- return const Annotations(null);
+ return const Annotations(null, false);
}

List<Constant> functionConstants = annotations.map(_getConstant).toList();
bool hasPragma = functionConstants.any(_isPragma);
if (!options.emitAnnotations && !hasPragma) {
- return const Annotations(null);
+ return const Annotations(null, false);
}

final functionObject = objectTable
@@ -480,13 +480,7 @@
bytecodeComponent.annotations.add(parameterDecl);
}

- final isInvisible = hasPragma &&
- pragmaParser
- .parsedPragmas<ParsedVmInvisiblePragma>(annotations)
- .isNotEmpty;
-
- return new Annotations(functionDecl,
- hasPragma: hasPragma, isInvisible: isInvisible);
+ return new Annotations(functionDecl, hasPragma);
}

FieldDeclaration getFieldDeclaration(Field field, Code? initializer) {
@@ -683,12 +677,14 @@
getFunctionAnnotations(member.annotations, function);
if (annotations.object != null) {
flags |= FunctionDeclaration.hasAnnotationsFlag;
- if (annotations.isInvisible) {
- flags |= FunctionDeclaration.isInvisibleFlag;
- }
if (annotations.hasPragma) {
flags |= FunctionDeclaration.hasPragmaFlag;
if (pragmaParser
+ .parsedPragmas<ParsedVmInvisiblePragma>(member.annotations)
+ .isNotEmpty) {
+ flags |= FunctionDeclaration.isInvisibleFlag;
+ }
+ if (pragmaParser
.parsedPragmas<ParsedDynModuleEntryPointPragma>(member.annotations)
.isNotEmpty) {
if (dynModuleEntryPoint != null) {
@@ -2639,9 +2635,11 @@
flags |= ClosureDeclaration.hasAnnotationsFlag;
if (annotations.hasPragma) {
flags |= ClosureDeclaration.hasPragmaFlag;
- }
- if (annotations.isInvisible) {
- flags |= ClosureDeclaration.isInvisibleFlag;
+ if (pragmaParser
+ .parsedPragmas<ParsedVmInvisiblePragma>(astAnnotations)
+ .isNotEmpty) {
+ flags |= ClosureDeclaration.isInvisibleFlag;
+ }
}
}

@@ -4650,8 +4648,6 @@
class Annotations {
final AnnotationsDeclaration? object;
final bool hasPragma;
- final bool isInvisible;

- const Annotations(this.object,
- {this.hasPragma = false, this.isInvisible = false});
+ const Annotations(this.object, this.hasPragma);
}
```

Change information

Commit message:
[vm,dyn_modules] Recognize the vm:invisible pragma.

Adds a new isInvisible flag for both FunctionDeclarations and
ClosureDeclarations and sets it if the function or closure declaration
is annotated with @pragma('vm:invisible'). This way, function visibility
is appropriately recorded even if options.emitAnnotations is false.

The bytecode reader checks for the isInvisible flag when reading
FunctionDeclarations and ClosureDeclarations and appropriately
sets the is_visible flag for the Function object accordingly.

TEST=pkg/dart2bytecode/test/bytecode_generator_test
vm/dart/invisible_function_pragma_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Commit-Queue: Tess Strickland <sstr...@google.com>
Reviewed-by: Alexander Markov <alexm...@google.com>
Files:
  • M pkg/dart2bytecode/docs/bytecode.md
  • M pkg/dart2bytecode/lib/bytecode_generator.dart
  • M pkg/dart2bytecode/lib/declarations.dart
  • M pkg/dart2bytecode/test/bytecode_generator_test.dart
  • A pkg/dart2bytecode/testcases/invisible.dart
  • A pkg/dart2bytecode/testcases/invisible.dart.expect
  • M pkg/vm/lib/transformations/pragma.dart
  • M runtime/vm/bytecode_reader.cc
Change size: L
Delta: 8 files changed, 337 insertions(+), 7 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Alexander Markov
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Gerrit-Change-Number: 486381
Gerrit-PatchSet: 4
Gerrit-Owner: Tess Strickland <sstr...@google.com>
Gerrit-Reviewer: Alexander Markov <alexm...@google.com>
Gerrit-Reviewer: Tess Strickland <sstr...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages