[prev in list] [next in list] [prev in thread] [next in thread]
List: perl5-porters
Subject: Re: Inlining Perl_foldEQ_locale and Perl_foldEQ_latin1
From: Tomasz Konojacki <me () xenu ! pl>
Date: 2017-02-28 1:31:04
Message-ID: 20170228023102.1E5E.5C4F47F8 () xenu ! pl
[Download RAW message or body]
On Wed, 22 Feb 2017 23:12:35 -0600
Andy Lester <andy@petdance.com> wrote:
(...)
> they're only called via function pointers, so they can't be inlined.
Out of curiosity, I played with function inlining a bit. I simply
compiled following snippets with "gcc -S -O2" and inspected their
assembly outputs.
My gcc version is "gcc version 5.3.1 [DragonFly] Release/2015-12-04".
Here are my results:
=== CASE 1. foobar() was inlined ===
static __inline__ void foobar(void) {
puts("foo");
return;
}
int main() {
void (*foobar_ptr)(void) = foobar;
foobar_ptr();
return 0;
}
=== CASE 2. foobar() wasn't inlined ===
static __inline__ void foobar(void) {
puts("foo");
return;
}
int main() {
void (*foobar_ptr)(void) = NULL;
/* condition that can't be resolved at compile-time */
if (getc(stdin) == 'a')
foobar_ptr = foobar;
if (foobar_ptr)
foobar_ptr();
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic