Skip to content

Commit 2d7c7b0

Browse files
aamCommit Queue
authored andcommitted
[vm/usertag] Move usertags from Isolate to Thread.
This allows use of usertag api in isolategroup-bound context. BUG=#61325 TEST=ci Change-Id: I73d5631ba6eddcc06965b982bc199221ac021cd5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445967 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
1 parent 7f4393d commit 2d7c7b0

25 files changed

+435
-401
lines changed

runtime/include/dart_tools_api.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,14 +535,14 @@ Dart_IsolateGroupHeapNewExternalMetric(Dart_IsolateGroup group); // Byte
535535
*/
536536

537537
/*
538-
* Gets the current isolate's currently set UserTag instance.
538+
* Gets the current Dart thread's currently set UserTag instance.
539539
*
540540
* \return The currently set UserTag instance.
541541
*/
542542
DART_EXPORT Dart_Handle Dart_GetCurrentUserTag();
543543

544544
/*
545-
* Gets the current isolate's default UserTag instance.
545+
* Gets the current Dart thread's default UserTag instance.
546546
*
547547
* \return The default UserTag with label 'Default'
548548
*/
@@ -558,7 +558,7 @@ DART_EXPORT Dart_Handle Dart_GetDefaultUserTag();
558558
DART_EXPORT Dart_Handle Dart_NewUserTag(const char* label);
559559

560560
/*
561-
* Updates the current isolate's UserTag to a new value.
561+
* Updates the current Dart thread's UserTag to a new value.
562562
*
563563
* \param user_tag The UserTag to be set as the current UserTag.
564564
*

runtime/lib/profiler.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DEFINE_NATIVE_ENTRY(UserTag_new, 0, 2) {
1919
ASSERT(
2020
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
2121
GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(1));
22-
return UserTag::New(tag_label);
22+
return UserTag::New(thread, tag_label);
2323
}
2424

2525
DEFINE_NATIVE_ENTRY(UserTag_label, 0, 1) {
@@ -36,14 +36,14 @@ DEFINE_NATIVE_ENTRY(UserTag_defaultTag, 0, 0) {
3636
if (FLAG_trace_intrinsified_natives) {
3737
OS::PrintErr("UserTag_defaultTag\n");
3838
}
39-
return isolate->default_tag();
39+
return thread->default_tag();
4040
}
4141

4242
DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0, 0) {
4343
if (FLAG_trace_intrinsified_natives) {
4444
OS::PrintErr("Profiler_getCurrentTag\n");
4545
}
46-
return isolate->current_tag();
46+
return thread->current_tag();
4747
}
4848

4949
} // namespace dart

runtime/vm/compiler/asm_intrinsifier_arm.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,15 +1740,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
17401740

17411741
void AsmIntrinsifier::UserTag_defaultTag(Assembler* assembler,
17421742
Label* normal_ir_body) {
1743-
__ LoadIsolate(R0);
1744-
__ ldr(R0, Address(R0, target::Isolate::default_tag_offset()));
1743+
__ ldr(R0, Address(THR, target::Thread::default_tag_offset()));
17451744
__ Ret();
17461745
}
17471746

17481747
void AsmIntrinsifier::Profiler_getCurrentTag(Assembler* assembler,
17491748
Label* normal_ir_body) {
1750-
__ LoadIsolate(R0);
1751-
__ ldr(R0, Address(R0, target::Isolate::current_tag_offset()));
1749+
__ ldr(R0, Address(THR, target::Thread::current_tag_offset()));
17521750
__ Ret();
17531751
}
17541752

runtime/vm/compiler/asm_intrinsifier_arm64.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,15 +1981,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
19811981

19821982
void AsmIntrinsifier::UserTag_defaultTag(Assembler* assembler,
19831983
Label* normal_ir_body) {
1984-
__ LoadIsolate(R0);
1985-
__ ldr(R0, Address(R0, target::Isolate::default_tag_offset()));
1984+
__ ldr(R0, Address(THR, target::Thread::default_tag_offset()));
19861985
__ ret();
19871986
}
19881987

19891988
void AsmIntrinsifier::Profiler_getCurrentTag(Assembler* assembler,
19901989
Label* normal_ir_body) {
1991-
__ LoadIsolate(R0);
1992-
__ ldr(R0, Address(R0, target::Isolate::current_tag_offset()));
1990+
__ ldr(R0, Address(THR, target::Thread::current_tag_offset()));
19931991
__ ret();
19941992
}
19951993

runtime/vm/compiler/asm_intrinsifier_ia32.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,15 +1777,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
17771777

17781778
void AsmIntrinsifier::UserTag_defaultTag(Assembler* assembler,
17791779
Label* normal_ir_body) {
1780-
__ LoadIsolate(EAX);
1781-
__ movl(EAX, Address(EAX, target::Isolate::default_tag_offset()));
1780+
__ movl(EAX, Address(THR, target::Thread::default_tag_offset()));
17821781
__ ret();
17831782
}
17841783

17851784
void AsmIntrinsifier::Profiler_getCurrentTag(Assembler* assembler,
17861785
Label* normal_ir_body) {
1787-
__ LoadIsolate(EAX);
1788-
__ movl(EAX, Address(EAX, target::Isolate::current_tag_offset()));
1786+
__ movl(EAX, Address(THR, target::Thread::current_tag_offset()));
17891787
__ ret();
17901788
}
17911789

runtime/vm/compiler/asm_intrinsifier_riscv.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,15 +1997,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
19971997

19981998
void AsmIntrinsifier::UserTag_defaultTag(Assembler* assembler,
19991999
Label* normal_ir_body) {
2000-
__ LoadIsolate(A0);
2001-
__ lx(A0, Address(A0, target::Isolate::default_tag_offset()));
2000+
__ lx(A0, Address(THR, target::Thread::default_tag_offset()));
20022001
__ ret();
20032002
}
20042003

20052004
void AsmIntrinsifier::Profiler_getCurrentTag(Assembler* assembler,
20062005
Label* normal_ir_body) {
2007-
__ LoadIsolate(A0);
2008-
__ lx(A0, Address(A0, target::Isolate::current_tag_offset()));
2006+
__ lx(A0, Address(THR, target::Thread::current_tag_offset()));
20092007
__ ret();
20102008
}
20112009

runtime/vm/compiler/asm_intrinsifier_x64.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,15 +1877,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
18771877

18781878
void AsmIntrinsifier::UserTag_defaultTag(Assembler* assembler,
18791879
Label* normal_ir_body) {
1880-
__ LoadIsolate(RAX);
1881-
__ movq(RAX, Address(RAX, target::Isolate::default_tag_offset()));
1880+
__ movq(RAX, Address(THR, target::Thread::default_tag_offset()));
18821881
__ ret();
18831882
}
18841883

18851884
void AsmIntrinsifier::Profiler_getCurrentTag(Assembler* assembler,
18861885
Label* normal_ir_body) {
1887-
__ LoadIsolate(RAX);
1888-
__ movq(RAX, Address(RAX, target::Isolate::current_tag_offset()));
1886+
__ movq(RAX, Address(THR, target::Thread::current_tag_offset()));
18891887
__ ret();
18901888
}
18911889

runtime/vm/compiler/runtime_api.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,10 @@ class Thread : public AllStatic {
13021302
static word single_step_offset();
13031303
#endif // !defined(PRODUCT)
13041304

1305+
static word default_tag_offset();
1306+
static word current_tag_offset();
1307+
static word user_tag_offset();
1308+
13051309
static word OffsetFromThread(const dart::Object& object);
13061310
static intptr_t OffsetFromThread(const dart::RuntimeEntry* runtime_entry);
13071311
};
@@ -1345,9 +1349,6 @@ class ObjectStore : public AllStatic {
13451349

13461350
class Isolate : public AllStatic {
13471351
public:
1348-
static word default_tag_offset();
1349-
static word current_tag_offset();
1350-
static word user_tag_offset();
13511352
static word finalizers_offset();
13521353
#if !defined(PRODUCT)
13531354
static word has_resumption_breakpoints_offset();

0 commit comments

Comments
 (0)