Changeset 2765 for trunk/src/kmk/function.c
- Timestamp:
- Jan 30, 2015, 1:27:51 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/function.c
r2758 r2765 43 43 # include <limits.h> 44 44 # endif 45 #endif 46 #ifdef CONFIG_WITH_COMPILER 47 # include "kmk_cc_exec.h" 45 48 #endif 46 49 #include <assert.h> /* bird */ … … 2043 2046 size_t off; 2044 2047 const struct floc *reading_file_saved = reading_file; 2045 # ifdef CONFIG_WITH_MAKE_STATS2048 # ifdef CONFIG_WITH_MAKE_STATS 2046 2049 unsigned long long uStartTick = CURRENT_CLOCK_TICK(); 2047 MAKE_STATS_2(v->cEvalVals++); 2048 #endif 2049 2050 /* Make a copy of the value to the variable buffer since 2051 eval_buffer will make changes to its input. */ 2052 2053 off = o - variable_buffer; 2054 variable_buffer_output (o, v->value, v->value_length + 1); 2055 o = variable_buffer + off; 2056 2057 /* Eval the value. Pop the current variable buffer setting so that the 2058 eval'd code can use its own without conflicting. (really necessary?) */ 2059 2060 install_variable_buffer (&buf, &len); 2050 # ifndef CONFIG_WITH_COMPILER 2051 MAKE_STATS_2(v->evalval_count++); 2052 # endif 2053 # endif 2054 2061 2055 var_ctx = !strcmp (funcname, "evalvalctx"); 2062 2056 if (var_ctx) … … 2065 2059 reading_file = &v->fileinfo; 2066 2060 2067 assert (!o[v->value_length]); 2068 eval_buffer (o, o + v->value_length); 2061 # ifdef CONFIG_WITH_COMPILER 2062 /* If this variable has been evaluated more than a few times, it make 2063 sense to compile it to speed up the processing. */ 2064 2065 v->evalval_count++; 2066 if ( v->evalprog 2067 || (v->evalval_count == 3 && kmk_cc_compile_variable_for_eval (v))) 2068 { 2069 install_variable_buffer (&buf, &len); /* Really necessary? */ 2070 kmk_exec_evalval (v); 2071 restore_variable_buffer (buf, len); 2072 } 2073 else 2074 # endif 2075 { 2076 /* Make a copy of the value to the variable buffer first since 2077 eval_buffer will make changes to its input. */ 2078 2079 off = o - variable_buffer; 2080 variable_buffer_output (o, v->value, v->value_length + 1); 2081 o = variable_buffer + off; 2082 assert (!o[v->value_length]); 2083 2084 install_variable_buffer (&buf, &len); /* Really necessary? */ 2085 eval_buffer (o, o + v->value_length); 2086 restore_variable_buffer (buf, len); 2087 } 2069 2088 2070 2089 reading_file = reading_file_saved; 2071 2090 if (var_ctx) 2072 2091 pop_variable_scope (); 2073 restore_variable_buffer (buf, len);2074 2092 2075 2093 MAKE_STATS_2(v->cTicksEvalVal += CURRENT_CLOCK_TICK() - uStartTick); … … 2142 2160 v->value_length = dst - v->value; 2143 2161 } 2162 2163 # ifdef CONFIG_WITH_COMPILER 2164 /* Compile the variable for evalval, evalctx and expansion. */ 2165 2166 if (!v->evalprog) 2167 kmk_cc_compile_variable_for_eval (v); 2168 if (!v->expandprog) 2169 kmk_cc_compile_variable_for_expand (v); 2170 # endif 2144 2171 } 2145 2172 else if (v)
Note:
See TracChangeset
for help on using the changeset viewer.