RESOLVED FIXED 237341
[libpas] Add missing PlayStation implementation.
https://bugs.webkit.org/show_bug.cgi?id=237341
Summary [libpas] Add missing PlayStation implementation.
Basuke Suzuki
Reported 2022-03-01 13:24:07 PST
Add pas_get_current_monotonic_time_nanoseconds
Attachments
PATCH (1.24 KB, patch)
2022-03-01 13:28 PST, Basuke Suzuki
no flags
PATCH (1.24 KB, patch)
2022-03-01 13:57 PST, Basuke Suzuki
ysuzuki: review+
PATCH (1.26 KB, patch)
2022-03-01 21:04 PST, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2022-03-01 13:28:42 PST
Yusuke Suzuki
Comment 2 2022-03-01 13:34:00 PST
Comment on attachment 453535 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=453535&action=review > Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:88 > + clock_gettime_np(CLOCK_MONOTONIC, &ts); Is it possible to use CLOCK_MONOTONIC_FAST in this playstation platform? (FreeBSD has this one). This function needs to be super fast, so full CLOCK_MONOTONIC is not ideal if the platform has an alternative.
Basuke Suzuki
Comment 3 2022-03-01 13:53:10 PST
(In reply to Yusuke Suzuki from comment #2) > Comment on attachment 453535 [details] > PATCH > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453535&action=review > > > Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:88 > > + clock_gettime_np(CLOCK_MONOTONIC, &ts); > > Is it possible to use CLOCK_MONOTONIC_FAST in this playstation platform? > (FreeBSD has this one). > This function needs to be super fast, so full CLOCK_MONOTONIC is not ideal > if the platform has an alternative. Sure. Sorry, I've forgotten your advice.
Basuke Suzuki
Comment 4 2022-03-01 13:57:14 PST
Darin Adler
Comment 5 2022-03-01 14:01:32 PST
Comment on attachment 453539 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=453539&action=review > Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:89 > + return ts.tv_sec * 1.0e9 + ts.tv_nsec; Do you really want to do floating point double precision multiplication here, and then convert back to integer? Maybe uint64_t multiplication would be better?
Basuke Suzuki
Comment 6 2022-03-01 14:08:10 PST
(In reply to Darin Adler from comment #5) > Comment on attachment 453539 [details] > PATCH > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453539&action=review > > > Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:89 > > + return ts.tv_sec * 1.0e9 + ts.tv_nsec; > > Do you really want to do floating point double precision multiplication > here, and then convert back to integer? Maybe uint64_t multiplication would > be better? Yusuke, what do you think? I think Darin's point is reasonable, but any reason to use float? I've followed Linux implementation.
Basuke Suzuki
Comment 7 2022-03-01 14:09:06 PST
We need to add special rule to check-webkit-style for libpas C files... https://ews-build.webkit.org/#/builders/6/builds/70223
Yusuke Suzuki
Comment 8 2022-03-01 14:11:49 PST
Comment on attachment 453539 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=453539&action=review >>> Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:89 >>> + return ts.tv_sec * 1.0e9 + ts.tv_nsec; >> >> Do you really want to do floating point double precision multiplication here, and then convert back to integer? Maybe uint64_t multiplication would be better? > > Yusuke, what do you think? I think Darin's point is reasonable, but any reason to use float? I've followed Linux implementation. I think either is fine.
Basuke Suzuki
Comment 9 2022-03-01 14:23:12 PST
https://godbolt.org/z/dq34fn6xz Quick code comparison seems compact and looks faster. I'm building this and comparing with JetStream2 result.
Basuke Suzuki
Comment 10 2022-03-01 19:06:00 PST
original: Total Score: 28.991 integer version: Total Score: 29.347 So the later is a bit faster. I'll go with this for PlayStation port. Thanks!
Basuke Suzuki
Comment 11 2022-03-01 21:04:11 PST
Created attachment 453568 [details] PATCH Thanks, Yusuke and Darin.
EWS
Comment 12 2022-03-01 22:06:48 PST
Committed r290719 (247966@main): <https://commits.webkit.org/247966@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453568 [details].
Radar WebKit Bug Importer
Comment 13 2022-03-01 22:07:17 PST
Darin Adler
Comment 14 2022-03-02 08:12:05 PST
Comment on attachment 453568 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=453568&action=review > Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c:89 > + return ts.tv_sec * 1000u * 1000u * 1000u + ts.tv_nsec; This looks wrong given C type promotion rules. The multiplication will not be done as uint64_t, since the things we are multiplying are unsigned (32 bit). So it may be truncated at 32 bits unless tv_sec already a has 64-bit type, then addition also done as 32-bit and only then put into 64-bit. Need to convert one of the integers being multiplied to uint64_t before multiplying. I suggest putting tv_sec into a uint64_t local.
Note You need to log in before you can comment on or make changes to this bug.