Mercurial > octave-nkf
comparison src/symtab.h @ 9413:5cd879a0d8c4
speed-up function call by caching its name lookup
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 01 Jul 2009 10:42:58 +0200 |
parents | ed392e13c117 |
children | 2d73b19c5507 |
comparison
equal
deleted
inserted
replaced
9412:ddcc0da700b8 | 9413:5cd879a0d8c4 |
---|---|
153 | 153 |
154 return retval; | 154 return retval; |
155 } | 155 } |
156 }; | 156 }; |
157 | 157 |
158 class fcn_info; | |
159 | |
158 class | 160 class |
159 symbol_record | 161 symbol_record |
160 { | 162 { |
161 public: | 163 public: |
162 | 164 |
192 { | 194 { |
193 public: | 195 public: |
194 | 196 |
195 symbol_record_rep (const std::string& nm, const octave_value& v, | 197 symbol_record_rep (const std::string& nm, const octave_value& v, |
196 unsigned int sc) | 198 unsigned int sc) |
197 : name (nm), value_stack (), storage_class (sc), count (1) | 199 : name (nm), value_stack (), storage_class (sc), finfo (), count (1) |
198 { | 200 { |
199 value_stack.push_back (v); | 201 value_stack.push_back (v); |
200 } | 202 } |
201 | 203 |
202 void force_variable (context_id context) | 204 void force_variable (context_id context) |
370 | 372 |
371 std::deque<octave_value> value_stack; | 373 std::deque<octave_value> value_stack; |
372 | 374 |
373 unsigned int storage_class; | 375 unsigned int storage_class; |
374 | 376 |
377 fcn_info *finfo; | |
378 | |
375 size_t count; | 379 size_t count; |
376 | 380 |
377 private: | 381 private: |
378 | 382 |
379 // No copying! | 383 // No copying! |
1986 } | 1990 } |
1987 } | 1991 } |
1988 } | 1992 } |
1989 } | 1993 } |
1990 | 1994 |
1995 static fcn_info *get_fcn_info (const std::string& name) | |
1996 { | |
1997 fcn_table_iterator p = fcn_table.find (name); | |
1998 return p != fcn_table.end () ? &p->second : 0; | |
1999 } | |
2000 | |
1991 octave_value | 2001 octave_value |
1992 do_find (const std::string& name, tree_argument_list *args, | 2002 do_find (const std::string& name, tree_argument_list *args, |
1993 const string_vector& arg_names, | 2003 const string_vector& arg_names, |
1994 octave_value_list& evaluated_args, bool& args_evaluated, | 2004 octave_value_list& evaluated_args, bool& args_evaluated, |
1995 bool skip_variables); | 2005 bool skip_variables); |