From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/6] target: [tcg] Add generic translation framework
Date: Mon, 16 Jan 2017 16:41:22 +0100 [thread overview]
Message-ID: <87inpff1wd.fsf@ac.upc.edu> (raw)
In-Reply-To: <5036a178-60eb-814a-5873-f82ed3453a82@twiddle.net> (Richard Henderson's message of "Tue, 10 Jan 2017 18:50:30 -0800")
Richard Henderson writes:
> On 12/28/2016 08:28 AM, Lluís Vilanova wrote:
>> +typedef enum DisasJumpType {
>> + DJ_NEXT,
>> + DJ_TOO_MANY,
>> + DJ_TARGET,
>> +} DisasJumpType;
> I wonder if enums like DJ_TARGET_{0..N} wouldn't be better, rather than doing
> addition in the target-specific names.
I'm not sure. ARM has 12 target-specific flags (while x86 only has 2), and
adding so many "unspecified" values to the generic enum does not seem right to
me.
I you feel strongly against the current state, I'll change it; re-defining
existing enum values could, for example, have benefits in switch/case ranges and
compiler warnings.
>> +typedef struct DisasContextBase {
>> + TranslationBlock *tb;
>> + bool singlestep_enabled;
>> + target_ulong pc_first;
>> + target_ulong pc_next;
>> + DisasJumpType jmp_type;
>> + unsigned int num_insns;
>> +} DisasContextBase;
> Sort the bool to the end to minimize padding.
Done.
>> +/* Get first breakpoint matching a PC */
>> +static inline CPUBreakpoint *cpu_breakpoint_get(CPUState *cpu, vaddr pc,
>> + CPUBreakpoint *bp)
>> +{
>> + if (likely(bp == NULL)) {
>> + if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
>> + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
>> + if (bp->pc == pc) {
>> + return bp;
>> + }
>> + }
>> + }
>> + } else {
>> + QTAILQ_FOREACH_CONTINUE(bp, entry) {
>> + if (bp->pc == pc) {
>> + return bp;
>> + }
>> + }
>> + }
>> + return NULL;
>> +}
> Any reason not to put the QTAILQ_FOREACH directly into gen_intermediate_code,
> rather than indirect it like this? I don't see this abstraction as an
> improvement.
I thought this belonged here to maintain encapsulation of how breakpoint lists
are implemented (just as we already have insert/remove/test functions right
above this one).
Having it as a separate function (wherever it is) also helps readability. Again,
if you feel strongly against it, I can move that function into the translate
template header.
Thanks,
Lluis
next prev parent reply other threads:[~2017-01-16 15:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 16:27 [Qemu-devel] [RFC PATCH v5 0/6] translate: [tcg] Generic translation framework Lluís Vilanova
2016-12-28 16:27 ` [Qemu-arm] [PATCH v5 1/6] Pass generic CPUState to gen_intermediate_code() Lluís Vilanova
2016-12-28 16:27 ` [Qemu-devel] " Lluís Vilanova
2017-01-11 2:25 ` [Qemu-arm] " Richard Henderson
2017-01-11 2:25 ` Richard Henderson
2016-12-28 16:27 ` [Qemu-devel] [PATCH v5 2/6] queue: Add macro for incremental traversal Lluís Vilanova
2016-12-28 16:28 ` [Qemu-devel] [PATCH v5 3/6] target: [tcg] Add generic translation framework Lluís Vilanova
2017-01-11 2:50 ` Richard Henderson
2017-01-16 15:41 ` Lluís Vilanova [this message]
2016-12-28 16:28 ` [Qemu-devel] [PATCH v5 4/6] target: [tcg] Redefine DISAS_* onto the generic translation framework (DJ_*) Lluís Vilanova
2016-12-28 16:28 ` Lluís Vilanova
2016-12-28 16:28 ` [Qemu-devel] [PATCH v5 5/6] target: [tcg, i386] Port to generic translation framework Lluís Vilanova
2016-12-28 16:28 ` [Qemu-devel] [PATCH v5 6/6] target: [tcg, arm] " Lluís Vilanova
2016-12-28 16:28 ` Lluís Vilanova
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=87inpff1wd.fsf@ac.upc.edu \
--to=vilanova@ac.upc.edu \
--cc=crosthwaite.peter@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.