Mercurial > hg > octave-terminal
changeset 14910:a8f1e08de8fc
Simplified llvm::GenericValue creation
author | Max Brister <max@2bass.com> |
---|---|
date | Fri, 18 May 2012 08:09:03 -0600 |
parents | a1d2f6300391 |
children | 1e2196d0bea4 |
files | src/pt-jit.cc src/pt-jit.h |
diffstat | 2 files changed, 16 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pt-jit.cc +++ b/src/pt-jit.cc @@ -497,18 +497,18 @@ { octave_base_value *obv = ov.internal_rep (); obv->grab (); - ov_out[ov_idx] = obv; - gv.PointerVal = &ov_out[ov_idx++]; + ov_out.push_back (obv); + gv.PointerVal = &ov_out.back (); } else if (type == scalar) { - scalar_out[scalar_idx] = ov.double_value (); - gv.PointerVal = &scalar_out[scalar_idx++]; + scalar_out.push_back (ov.double_value ()); + gv.PointerVal = &scalar_out.back (); } else if (type == range) { - range_out[range_idx] = ov.range_value (); - gv.PointerVal = &range_out[range_idx++]; + range_out.push_back (ov.range_value ()); + gv.PointerVal = &range_out.back (); } else assert (false && "Type not supported yet"); @@ -538,20 +538,11 @@ } void -jit_typeinfo::reset_generic (size_t nargs) +jit_typeinfo::reset_generic (void) { - scalar_idx = 0; - ov_idx = 0; - range_idx = 0; - - if (scalar_out.size () < nargs) - scalar_out.resize (nargs); - - if (ov_out.size () < nargs) - ov_out.resize (nargs); - - if (range_out.size () < nargs) - range_out.resize (nargs); + scalar_out.clear (); + ov_out.clear (); + range_out.clear (); } jit_type* @@ -1645,8 +1636,6 @@ if (! function) return false; - tinfo->reset_generic (types.size ()); - std::vector<llvm::GenericValue> args (types.size ()); size_t idx; type_map::const_iterator iter; @@ -1674,6 +1663,8 @@ symbol_table::varref (iter->first) = result; } + tinfo->reset_generic (); + return true; }
--- a/src/pt-jit.h +++ b/src/pt-jit.h @@ -293,7 +293,7 @@ octave_value to_octave_value (jit_type *type, llvm::GenericValue& gv); - void reset_generic (size_t nargs); + void reset_generic (void); private: typedef std::map<std::string, jit_type *> type_map; @@ -324,14 +324,9 @@ jit_function simple_for_incr; jit_function simple_for_index; - size_t scalar_idx; - std::vector<double> scalar_out; - - size_t ov_idx; - std::vector<octave_base_value*> ov_out; - - size_t range_idx; - std::vector<jit_range> range_out; + std::list<double> scalar_out; + std::list<octave_base_value *> ov_out; + std::list<jit_range> range_out; }; class