public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	 "Gao, Liming" <liming.gao@intel.com>,
	Evan Lloyd <evan.lloyd@arm.com>,
	 Alexei Fedorov <Alexei.Fedorov@arm.com>
Subject: Re: [PATCH] MdePkg/DebugLib; swap if conditions in ASSERT_[EFI|RETURN]_ERROR
Date: Thu, 7 Dec 2017 17:13:22 +0000	[thread overview]
Message-ID: <CAKv+Gu--kR7L=uHmxtrqe-h1VS=xuOvC0DQSkGfVu46SUtBLkA@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu8Jk=s-FHowLztoRYDaopWep+4wS9yJDxDP3Dsp2jmc2w@mail.gmail.com>

On 7 December 2017 at 17:09, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 7 December 2017 at 17:01, Kinney, Michael D
> <michael.d.kinney@intel.com> wrote:
>> Ard,
>>
>> The reason for the current ordering is for size optimization.
>>
>> The most common implementation of DebugAssertEnabled() uses
>> a FixedAtBuild PCD to determine if these are enabled.  The
>> check of status can be optimized away if they are disabled.
>> If you reverse them, then the status check is always performed.
>>
>
> DebugAssertEnabled() is a function call that gets resolved at link
> time, and is not annotated as being free of side effects. So I agree
> that the implementation of that function could be optimized into a
> 'return true' or 'return false' depending on the compile time values
> of those PCDs, but the way the macro is defined currently, it still
> requires the function call to be made, and the conditional compare
> with a constant that follows will still be present in the code.
>
> What I am suggesting is to replace it with a comparison with a
> constant, and a conditional function call instead. This will not
> affect code size, but will only remove needless function calls at
> runtime.

Please refer to these threads for details:
https://lists.01.org/pipermail/edk2-devel/2017-December/018790.html
https://lists.01.org/pipermail/edk2-devel/2017-December/018809.html


  reply	other threads:[~2017-12-07 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 15:12 [PATCH] MdePkg/DebugLib; swap if conditions in ASSERT_[EFI|RETURN]_ERROR Ard Biesheuvel
2017-12-07 15:26 ` Ard Biesheuvel
2017-12-07 17:01   ` Kinney, Michael D
2017-12-07 17:09     ` Ard Biesheuvel
2017-12-07 17:13       ` Ard Biesheuvel [this message]
2017-12-07 17:36         ` Kinney, Michael D
2017-12-07 17:43           ` Ard Biesheuvel
2017-12-07 19:49             ` Kinney, Michael D
2017-12-07 19:52               ` Ard Biesheuvel
2017-12-07 20:33                 ` Kinney, Michael D
2017-12-07 20:42                   ` Ard Biesheuvel

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-list 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='CAKv+Gu--kR7L=uHmxtrqe-h1VS=xuOvC0DQSkGfVu46SUtBLkA@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /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