Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize x86log.h and x86log.cpp: #517

Merged
merged 1 commit into from
Dec 21, 2015
Merged

Conversation

vittorioromeo
Copy link
Contributor

  • Use variadic template functions instead of va_list
    • In x86log_mark_as_data and x86log_printf
  • Add noexcept where appropriate/safe
  • Use constexpr std::size_t instead of macros for constants
  • Nest nullptr check to prevent useless check, add assertion
    • In x86log_printf
  • Move definitions of log_comment, data_range_t, x86log_context to x86_log.h from x86_log.cpp
  • Adapt usages of x86log_printf in drcbex64.cpp and drcbex86.cpp

* Use variadic template functions instead of `va_list`
    * In `x86log_mark_as_data` and `x86log_printf`
* Add `noexcept` where appropriate/safe
* Use `constexpr std::size_t` instead of macros for constants
* Nest `nullptr` check to prevent useless check, add assertion
    * In `x86log_printf`
* Move definitions of `log_comment`, `data_range_t`, `x86log_context` to `x86_log.h` from `x86_log.cpp`
* Adapt usages of `x86log_printf` in `drcbex64.cpp` and `drcbex86.cpp`
@mmicko
Copy link
Member

mmicko commented Dec 21, 2015

passes gcc 5.2 and vs2015, will check clang now

mmicko added a commit that referenced this pull request Dec 21, 2015
Modernize x86log.h and x86log.cpp:
@mmicko mmicko merged commit d056b7b into mamedev:master Dec 21, 2015
@Tafoid
Copy link
Contributor

Tafoid commented Dec 23, 2015

I suspect this submission as being the cause for a crash/exception upon exit for most system which use DRC or DRC backend such as the following driver examples: (aleck64, coolridr, stv, deco_mlc, model3, taitotz, cps3, psikyosh, suprnova and many more). The MIPS core doesn't seem to be influenced by this, examples of such are (kinst, vegas)

#0 0x00000000008759ec in resource_pool::remove ()
at ../../../../../src/emu/emualloc.cpp:127
#1 0x000000000082eb99 in drcuml_state::~drcuml_state ()
at ../../../../../src/devices/cpu/drcuml.cpp:145
#2 0x0000000000cb223c in std::default_delete<drcuml_state>::operator() ()
at C:/buildtools/vendor/mingw64/x86_64-w64-mingw32/include/c++/bits/unique_ptr.h:76
#3 0x0000000000d0c4de in std::unique_ptr<drcuml_state, std::default_delete<drcuml_state> >::~unique_ptr ()
at C:/buildtools/vendor/mingw64/x86_64-w64-mingw32/include/c++/bits/unique_ptr.h:236
#4 0x0000000000ba8c9b in ppc_device::~ppc_device ()
at ../../../../../src/devices/cpu/powerpc/ppc.h:174
#5 0x0000000000bcced3 in mpc8240_device::~mpc8240_device ()
at ../../../../../src/devices/cpu/powerpc/ppc.h:732
#6 0x0000000000bcce4a in mpc8240_device::~mpc8240_device ()
at ../../../../../src/devices/cpu/powerpc/ppc.h:732
#7 0x0000000000bb0379 in simple_list<device_t>::remove ()
at ../../../../../src/lib/util/coretmpl.h:242
#8 0x0000000000bb01d0 in simple_list<device_t>::reset ()
at ../../../../../src/lib/util/coretmpl.h:89
#9 0x0000000000bb03da in simple_list<device_t>::~simple_list ()
at ../../../../../src/lib/util/coretmpl.h:78
#10 0x0000000000867ae3 in device_t::~device_t ()
at ../../../../../src/emu/device.cpp:72

@vittorioromeo
Copy link
Contributor Author

I'm still looking into any possible mistake - is it possible that simple_list was being used polymorphically somewhere?

It had a virtual destructor that I changed into a non-virtual destructor in aa6d4d0, because I could not find any polymorphically usage of simple_list in the codebase.

Assuming I missed such usages: could you try if reintroducing virtual in ~simple_list

virtual ~simple_list() noexcept { reset(); }

and check if the crash still occurs?

@mmicko
Copy link
Member

mmicko commented Dec 23, 2015

Thanks, but problem is not there. it is in DRC part, will take care of
that.
It is related to mixing unique_ptr with our auto_alloc system

On Wed, Dec 23, 2015 at 7:03 PM, Vittorio Romeo notifications@github.com
wrote:

I'm still looking into any possible mistake - is it possible that
simple_list was being used polymorphically somewhere?

It had a virtual destructor that I changed into a non-virtual destructor
in aa6d4d0
aa6d4d0,
because I could not find any polymorphically usage of simple_list in the
codebase.

Assuming I missed such usages: could you try if reintroducing virtual in
~simple_list

virtual ~simple_list() noexcept { reset(); }

and check if the crash still occurs?


Reply to this email directly or view it on GitHub
#517 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants