From: rubini-list@gnudd.com (Alessandro Rubini)
To: linux-arm-kernel@lists.infradead.org
Subject: some quesion about assembly when calling fork
Date: Wed, 16 Sep 2009 16:38:10 +0200 [thread overview]
Message-ID: <20090916143810.GA24967@mail.gnudd.com> (raw)
In-Reply-To: <3a665c760909160723g75823427t46639d1ae737e483@mail.gmail.com>
> if ((pid = fork()) < 0) {
> 84b4: ebffffb5 bl 8390 <.text-0x48>
> 84b8: e1a03000 mov r3, r0
> 84bc: e50b3010 str r3, [fp, #-16] xx1
> 84c0: e51b3010 ldr r3, [fp, #-16] xx2
> 84c4: e3530000 cmp r3, #0 ; 0x0
You are not optimizing. So the compiler follows the statements
literally: first it stores the result of fork in pid. Then loads pid to
compare with zero.
If you optimize, I'm sure it won't even copy r0 to r3 before comparing.
/alessandro
prev parent reply other threads:[~2009-09-16 14:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 14:23 some quesion about assembly when calling fork loody
2009-09-16 14:30 ` Ben Dooks
2009-09-16 14:38 ` Alessandro Rubini [this message]
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=20090916143810.GA24967@mail.gnudd.com \
--to=rubini-list@gnudd.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).