Mercurial > hg > octave-lyh
diff src/pt-jit.cc @ 14910:a8f1e08de8fc
Simplified llvm::GenericValue creation
author | Max Brister <max@2bass.com> |
---|---|
date | Fri, 18 May 2012 08:09:03 -0600 |
parents | 3f81e8b42955 |
children | 1e2196d0bea4 |
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; }