RFR: 8261710: SA DSO objects have sizes that are too large [v4]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Thu Feb 18 03:01:39 UTC 2021
On Wed, 17 Feb 2021 21:55:57 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Use p_filesz instead of p_memsz
>
> Hi Yasumasa,
>
> Just some comments.
>
> src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c
> +static inline uintptr_t align_down(uintptr_t ptr, size_t size) {
> + return (ptr & ~(size - 1));
> +}
> +
> +static inline uintptr_t align_up(uintptr_t ptr, size_t size) {
> + return ((ptr + size - 1) & ~(size - 1));
> +}
>
> The name of 'size' parameter is confusing. Should it be renamed to something like page_size of psize?
>
> + lib->end = (uintptr_t)-1L;
> . . .
> + if ((lib->end == (uintptr_t)-1L) || (lib->end < aligned_end)) {
> + lib->end = aligned_end;
> }
>
> The condition `(lib->end == (uintptr_t)-1L)` is a subset of `(lib->end < aligned_end)`, and so, can be removed. The same is true for the condition:
> + if ((lib->exec_end == (uintptr_t)-1L) || (lib->exec_end < aligned_end)) {
> + lib->exec_end = aligned_end;
> + }
>
> `+ print_debug("%s [%d] 0x%lx-0x%lx: base = 0x%lx, vaddr = 0x%lx, memsz = 0x%lx, filesz = 0x%lx\n", lib->name, cnt, aligned_start, aligned_end, lib->base, ph->p_vaddr, ph->p_memsz, ph->p_filesz);`
>
> It is better to split this long line.
>
> Thanks,
> Serguei
Thanks @sspitsyn for the comment!
I fixed almost of your comment in new commit.
> The condition `(lib->end == (uintptr_t)-1L)` is a subset of `(lib->end < aligned_end)`, and so, can be removed. The same is true for the condition:
`lib->end` is declared as unsigned (`uintptr_t`), so we can't use `(lib->end < aligned_end)` when `lib->end` is set to -1.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2563
More information about the serviceability-dev
mailing list