1.1 --- a/src/os/windows/vm/os_windows.cpp Mon Jun 18 14:39:46 2018 -0700 1.2 +++ b/src/os/windows/vm/os_windows.cpp Tue Jun 19 02:53:25 2018 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -2187,13 +2187,6 @@ 1.11 // Windows Vista/2008 heap corruption check 1.12 #define EXCEPTION_HEAP_CORRUPTION 0xC0000374 1.13 1.14 -#define def_excpt(val) #val, val 1.15 - 1.16 -struct siglabel { 1.17 - char *name; 1.18 - int number; 1.19 -}; 1.20 - 1.21 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual 1.22 // C++ compiler contain this error code. Because this is a compiler-generated 1.23 // error, the code is not listed in the Win32 API header files. 1.24 @@ -2203,8 +2196,9 @@ 1.25 1.26 #define EXCEPTION_UNCAUGHT_CXX_EXCEPTION 0xE06D7363 1.27 1.28 - 1.29 -struct siglabel exceptlabels[] = { 1.30 +#define def_excpt(val) { #val, (val) } 1.31 + 1.32 +static const struct { char* name; uint number; } exceptlabels[] = { 1.33 def_excpt(EXCEPTION_ACCESS_VIOLATION), 1.34 def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT), 1.35 def_excpt(EXCEPTION_BREAKPOINT), 1.36 @@ -2229,16 +2223,16 @@ 1.37 def_excpt(EXCEPTION_GUARD_PAGE), 1.38 def_excpt(EXCEPTION_INVALID_HANDLE), 1.39 def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION), 1.40 - def_excpt(EXCEPTION_HEAP_CORRUPTION), 1.41 + def_excpt(EXCEPTION_HEAP_CORRUPTION) 1.42 #ifdef _M_IA64 1.43 - def_excpt(EXCEPTION_REG_NAT_CONSUMPTION), 1.44 + , def_excpt(EXCEPTION_REG_NAT_CONSUMPTION) 1.45 #endif 1.46 - NULL, 0 1.47 }; 1.48 1.49 const char* os::exception_name(int exception_code, char *buf, size_t size) { 1.50 - for (int i = 0; exceptlabels[i].name != NULL; i++) { 1.51 - if (exceptlabels[i].number == exception_code) { 1.52 + uint code = static_cast<uint>(exception_code); 1.53 + for (uint i = 0; i < ARRAY_SIZE(exceptlabels); ++i) { 1.54 + if (exceptlabels[i].number == code) { 1.55 jio_snprintf(buf, size, "%s", exceptlabels[i].name); 1.56 return buf; 1.57 } 1.58 @@ -5782,7 +5776,7 @@ 1.59 char* result = os::reserve_memory_special(large_allocation_size, os::large_page_size(), NULL, false); 1.60 if (result == NULL) { 1.61 if (VerboseInternalVMTests) { 1.62 - gclog_or_tty->print("Failed to allocate control block with size " SIZE_FORMAT ". Skipping remainder of test.", 1.63 + gclog_or_tty->print("Failed to allocate control block with size "SIZE_FORMAT". Skipping remainder of test.", 1.64 large_allocation_size); 1.65 } 1.66 } else { 1.67 @@ -5795,7 +5789,7 @@ 1.68 char* actual_location = os::reserve_memory_special(expected_allocation_size, os::large_page_size(), expected_location, false); 1.69 if (actual_location == NULL) { 1.70 if (VerboseInternalVMTests) { 1.71 - gclog_or_tty->print("Failed to allocate any memory at " PTR_FORMAT " size " SIZE_FORMAT ". Skipping remainder of test.", 1.72 + gclog_or_tty->print("Failed to allocate any memory at "PTR_FORMAT" size "SIZE_FORMAT". Skipping remainder of test.", 1.73 expected_location, large_allocation_size); 1.74 } 1.75 } else { 1.76 @@ -5803,7 +5797,7 @@ 1.77 os::release_memory_special(actual_location, expected_allocation_size); 1.78 // only now check, after releasing any memory to avoid any leaks. 1.79 assert(actual_location == expected_location, 1.80 - err_msg("Failed to allocate memory at requested location " PTR_FORMAT " of size " SIZE_FORMAT ", is " PTR_FORMAT " instead", 1.81 + err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead", 1.82 expected_location, expected_allocation_size, actual_location)); 1.83 } 1.84 }