Changeset 3352


Ignore:
Timestamp:
Sep 23, 2014 6:34:44 AM (6 years ago)
Author:
bradbell
Message:

recorder.hpp: Add argument variable indices to operation sequence.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cache/cppad/local/recorder.hpp

    r3232 r3352  
    3838
    3939        /// Number of variables in the recording.
    40         size_t    num_var_rec_;
     40        size_t num_var_rec_;
    4141
    4242        /// Number vecad load operations (LdpOp or LdvOp) currently in recording.
     
    5151        /// The argument indices in the recording
    5252        pod_vector<addr_t> op_arg_rec_;
     53
     54        /// The variables corresponding to the argument indices in recording
     55        ///(only used when there is cache )
     56        pod_vector<addr_t> op_var_rec_;
    5357
    5458        /// The parameters in the recording.
     
    6872        vecad_ind_rec_( std::numeric_limits<addr_t>::max() ) ,
    6973        op_arg_rec_( std::numeric_limits<addr_t>::max() )    ,
     74        op_var_rec_( std::numeric_limits<addr_t>::max() )    ,
    7075        par_rec_( std::numeric_limits<addr_t>::max() )       ,
    7176        text_rec_( std::numeric_limits<addr_t>::max() )
     
    9095                vecad_ind_rec_.free();
    9196                op_arg_rec_.free();
     97                op_var_rec_.free();
    9298                par_rec_.free();
    9399                text_rec_.free();
     
    95101        /// Put next operator in the operation sequence.
    96102        inline size_t PutOp(OpCode op);
     103
    97104        /// Put a vecad load operator in the operation sequence (special case)
    98105        inline size_t PutLoadOp(OpCode op);
     106
    99107        /// Add a value to the end of the current vector of VecAD indices.
    100108        inline size_t PutVecInd(size_t vec_ind);
     109
    101110        /// Find or add a parameter to the current vector of parameters.
    102111        inline size_t PutPar(const Base &par);
     112
    103113        /// Put one operation argument index in the recording
    104114        inline void PutArg(addr_t arg0);
     
    116126                addr_t arg4, addr_t arg5);
    117127
     128        /// Put variable indices, corresponding to arguments, in the recording
     129        /// (only defined when NDEBUG not defined, only used when there is cache)
     130        inline void PutVar(addr_t var);
     131
    118132        // Reserve space for a specified number of arguments
    119133        inline size_t ReserveArg(size_t n_arg);
     
    142156                     + vecad_ind_rec_.capacity() * sizeof(size_t)
    143157                     + op_arg_rec_.capacity()    * sizeof(addr_t)
     158                     + op_var_rec_.capacity()    * sizeof(addr_t)
    144159                     + par_rec_.capacity()       * sizeof(Base)
    145160                     + text_rec_.capacity()      * sizeof(char);
     
    308323        return i;
    309324}
    310 // -------------------------- PutArg --------------------------------------
     325// ========================== PutArg ======================================
    311326/*!
    312327Prototype for putting operation argument indices in the recording.
     
    492507        CPPAD_ASSERT_UNKNOWN( op_arg_rec_.size() == i + 1 );
    493508}
     509// ==========================================================================
     510# ifndef NDEBUG
     511/*!
     512Put on variable indices corresponding to arguments in recording
     513(only defined when NDEBUG not defined, only used when there is cache)
     514
     515\param var
     516is the variable indicex to put in the recording
     517*/
     518template <class Base>
     519inline void recorder<Base>::PutVar(addr_t var)
     520{       size_t i       = op_var_rec_.extend(1);
     521        op_var_rec_[i] = var;
     522}
     523# endif
    494524// --------------------------------------------------------------------------
    495525/*!
Note: See TracChangeset for help on using the changeset viewer.