This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Profile mode maintenance patch


On 23/09/2014 13:27, Jonathan Wakely wrote:
On 21/09/14 23:29 +0200, François Dumont wrote:
With all those modifications I have been able to run all testsuite in profile mode with success.

I've looked over the patch and it looks fine.

I don't know the details of the Profile Mode, so if you're happy that
these changes are an improvement and all tests pass then that's good
enough for me.

   Ok to commit ?

Yes, OK for trunk - thanks very much.



Ok but could you just let me know what you think of this method:

  template<typename __object_info, typename __stack_info>
    __object_info*
    __trace_base<__object_info, __stack_info>::
    __add_object(const __object_info& __info)
    {
      if (__max_mem() != 0 && __objects_byte_size >= __max_mem())
    {
      delete __info.__stack();
      return 0;
    }

      __object_info* __ret = new(std::nothrow) __object_info(__info);
      if (!__ret)
    {
      delete __info.__stack();
      return 0;
    }

      __gnu_cxx::__atomic_add(&__objects_byte_size, sizeof(__object_info));
      return __ret;
    }

This method can be called from several threads. I check condition accessing __object_byte_size and then update it with an atomic operation to make sure it stays consistent. Does it look ok to you too ?

François


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]