From 7c1b1f30f3b1444f4af403641f9b9cb4abc31e1d Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 4 Nov 2008 20:22:22 +0000 Subject: [PATCH] 2008-11-04 Zoltan Varga * method-to-ir.c (mono_method_check_inlining): Avoid a getenv () call on every call. svn path=/trunk/mono/; revision=117923 --- mono/mini/ChangeLog | 5 +++++ mono/mini/method-to-ir.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index c53a6ac5a70..b6646787c67 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,8 @@ +2008-11-04 Zoltan Varga + + * method-to-ir.c (mono_method_check_inlining): Avoid a getenv () call + on every call. + 2008-11-04 Rodrigo Kumpera * cpu-x86.md: Add store nta ops. diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 3a1e88e5a5c..99ea91e5610 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -3307,6 +3307,9 @@ mono_emit_load_got_addr (MonoCompile *cfg) MONO_ADD_INS (cfg->bb_exit, dummy_use); } +static int inline_limit; +static gboolean inline_limit_inited; + static gboolean mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method) { @@ -3338,11 +3341,14 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method) /* also consider num_locals? */ /* Do the size check early to avoid creating vtables */ - if (getenv ("MONO_INLINELIMIT")) { - if (header->code_size >= atoi (getenv ("MONO_INLINELIMIT"))) { - return FALSE; - } - } else if (header->code_size >= INLINE_LENGTH_LIMIT) + if (!inline_limit_inited) { + if (getenv ("MONO_INLINELIMIT")) + inline_limit = atoi (getenv ("MONO_INLINELIMIT")); + else + inline_limit = INLINE_LENGTH_LIMIT; + inline_limit_inited = TRUE; + } + if (header->code_size >= inline_limit) return FALSE; /* -- 2.11.4.GIT