Commit graph

7 commits

Author SHA1 Message Date
Corey Tabaka db0fa84d59 [vm] Optimize get current thread id in Fuchsia.
OSThread::GetCurrentThreadId() is used in many places throughout
the vm, particularly in facilities that are used heavily, such as
SafepointRwLock. The high frequency of invocations means that the
runtime overhead of getting the current thread id has a significant
impact on the overall performance of the vm.

The current Fuchsia implemention of OSThread::GetCurrentThreadId()
makes a syscall to get the koid of the current thread's handle,
resulting in hundreds of nanoseconds of unnecessary overhead per
invocation.

This patch changes to using the thread's handle as the id, which is
guaranteed to be unique for the lifetime of the thread, unless it
is closed prematurely (nothing in the vm does this). This approach
is similar to what MUSL libc (the libc used by Fuchsia) does for
the same purpose and has significant mileage.

Bug: b/182183059
TEST=existing ci test suite; manually deployed into Fuchsia build.

Change-Id: I274a793a823a717c8dd206b396001c6acb897b9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193643
Reviewed-by: Chase Latta <chaselatta@google.com>
Commit-Queue: Chase Latta <chaselatta@google.com>
2021-03-31 20:51:32 +00:00
George Kulakowski 5923ff4900 Reorder Fuchsia file headers and gn format
These were left out of order by the mechanical changes that were part
of Fuchsia's Magenta->Zircon rename.

Change-Id: I41c81eb889c6076ffe82102018721e5abc74e7ac
Reviewed-on: https://dart-review.googlesource.com/6165
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-15 20:28:49 +00:00
George Kulakowski 7800d2a995 Rename Magenta to Zircon, along with related abbreviations
Change-Id: Ic4215ceb00f5a60d21ec1398fd398a9f78a9eb94
Reviewed-on: https://dart-review.googlesource.com/6100
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-15 14:54:18 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Zachary Anderson 904aefe6e3 [Fuchsia] Implements the thread interrupter for CPU profiling.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2796143002 .
2017-05-23 10:22:07 -07:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Zachary Anderson a503570e3a Fuchsia: Initial check-in.
Instructions to build and run are in README.fuchsia.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00