From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/9] Change jit.c to use type-safe registry
Date: Wed, 10 Jul 2019 17:02:00 -0000 [thread overview]
Message-ID: <1e4013e9-2673-681f-1dba-a2dcf693cb3a@simark.ca> (raw)
In-Reply-To: <20190710153947.25721-4-tromey@adacore.com>
> diff --git a/gdb/jit.c b/gdb/jit.c
> index 62942fc7ab0..fba2482ff13 100644
> --- a/gdb/jit.c
> +++ b/gdb/jit.c
> @@ -50,8 +50,6 @@ static const char *const jit_break_name = "__jit_debug_register_code";
>
> static const char *const jit_descriptor_name = "__jit_debug_descriptor";
>
> -static const struct program_space_data *jit_program_space_data = NULL;
> -
> static void jit_inferior_init (struct gdbarch *gdbarch);
> static void jit_inferior_exit_hook (struct inferior *inf);
>
> @@ -263,6 +261,8 @@ struct jit_program_space_data
> struct breakpoint *jit_breakpoint;
> };
>
> +static program_space_key<jit_program_space_data> jit_program_space_key;
> +
> /* Per-objfile structure recording the addresses in the program space.
> This object serves two purposes: for ordinary objfiles, it may
> cache some symbols related to the JIT interface; and for
> @@ -316,29 +316,16 @@ add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
> if not already present. */
>
> static struct jit_program_space_data *
> -get_jit_program_space_data (void)
> +get_jit_program_space_data ()
> {
> struct jit_program_space_data *ps_data;
>
> - ps_data
> - = ((struct jit_program_space_data *)
> - program_space_data (current_program_space, jit_program_space_data));
> + ps_data = jit_program_space_key.get (current_program_space);
> if (ps_data == NULL)
> - {
> - ps_data = XCNEW (struct jit_program_space_data);
> - set_program_space_data (current_program_space, jit_program_space_data,
> - ps_data);
> - }
> -
> + ps_data = jit_program_space_key.emplace (current_program_space);
> return ps_data;
> }
Do the fields of jit_program_space_data need to be initialized? The previous code used
XCNEW, initializing them to 0.
Simon
next prev parent reply other threads:[~2019-07-10 17:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 15:39 [PATCH 0/9] Use the type-safe registry in more cases Tom Tromey
2019-07-10 15:39 ` [PATCH 6/9] Change solib-dsbt.c to use type-safe registry Tom Tromey
2019-07-10 15:39 ` [PATCH 2/9] Change solib-darwin.c " Tom Tromey
2019-07-10 15:39 ` [PATCH 7/9] Change solib-aix.c " Tom Tromey
2019-07-10 18:55 ` Simon Marchi
2019-07-10 20:34 ` Tom Tromey
2019-07-10 20:38 ` Simon Marchi
2019-07-10 15:39 ` [PATCH 3/9] Change jit.c " Tom Tromey
2019-07-10 17:02 ` Simon Marchi [this message]
2019-07-10 18:44 ` Tom Tromey
2019-07-10 15:39 ` [PATCH 1/9] Change remote-sim.c " Tom Tromey
2019-07-10 16:59 ` Simon Marchi
2019-07-10 17:03 ` Tom Tromey
2019-07-10 15:39 ` [PATCH 8/9] Change solib-spu.c " Tom Tromey
2019-07-10 15:49 ` [PATCH 9/9] Change arm-tdep.c " Tom Tromey
2019-07-10 15:49 ` [PATCH 4/9] Change dbxread.c " Tom Tromey
2019-07-10 19:03 ` [PATCH 0/9] Use the type-safe registry in more cases Simon Marchi
2019-07-10 20:34 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e4013e9-2673-681f-1dba-a2dcf693cb3a@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox