--- old/src/os/windows/vm/os_windows.cpp 2018-06-15 02:10:13.754546162 -0700 +++ new/src/os/windows/vm/os_windows.cpp 2018-06-15 02:10:13.662537912 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2187,13 +2187,6 @@ // Windows Vista/2008 heap corruption check #define EXCEPTION_HEAP_CORRUPTION 0xC0000374 -#define def_excpt(val) #val, val - -struct siglabel { - char *name; - int number; -}; - // All Visual C++ exceptions thrown from code generated by the Microsoft Visual // C++ compiler contain this error code. Because this is a compiler-generated // error, the code is not listed in the Win32 API header files. @@ -2203,8 +2196,9 @@ #define EXCEPTION_UNCAUGHT_CXX_EXCEPTION 0xE06D7363 +#define def_excpt(val) { #val, (val) } -struct siglabel exceptlabels[] = { +static const struct { char* name; uint number; } exceptlabels[] = { def_excpt(EXCEPTION_ACCESS_VIOLATION), def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT), def_excpt(EXCEPTION_BREAKPOINT), @@ -2229,16 +2223,16 @@ def_excpt(EXCEPTION_GUARD_PAGE), def_excpt(EXCEPTION_INVALID_HANDLE), def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION), - def_excpt(EXCEPTION_HEAP_CORRUPTION), + def_excpt(EXCEPTION_HEAP_CORRUPTION) #ifdef _M_IA64 - def_excpt(EXCEPTION_REG_NAT_CONSUMPTION), + , def_excpt(EXCEPTION_REG_NAT_CONSUMPTION), #endif - NULL, 0 }; const char* os::exception_name(int exception_code, char *buf, size_t size) { - for (int i = 0; exceptlabels[i].name != NULL; i++) { - if (exceptlabels[i].number == exception_code) { + uint code = static_cast(exception_code); + for (uint i = 0; i < ARRAY_SIZE(exceptlabels); ++i) { + if (exceptlabels[i].number == code) { jio_snprintf(buf, size, "%s", exceptlabels[i].name); return buf; }