< prev index next >

src/hotspot/os/windows/os_windows.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2525                  "should be caught by red zone code above.");
2526           return Handle_Exception(exceptionInfo,
2527                                   SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW));
2528         }
2529         // Check for safepoint polling and implicit null
2530         // We only expect null pointers in the stubs (vtable)
2531         // the rest are checked explicitly now.
2532         CodeBlob* cb = CodeCache::find_blob(pc);
2533         if (cb != NULL) {
2534           if (os::is_poll_address(addr)) {
2535             address stub = SharedRuntime::get_poll_stub(pc);
2536             return Handle_Exception(exceptionInfo, stub);
2537           }
2538         }
2539         {
2540 #ifdef _WIN64
2541           // If it's a legal stack address map the entire region in
2542           //
2543           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
2544           address addr = (address) exceptionRecord->ExceptionInformation[1];
2545           if (addr > thread->stack_reserved_zone_base() && addr < thread->stack_base()) {
2546             addr = (address)((uintptr_t)addr &
2547                              (~((uintptr_t)os::vm_page_size() - (uintptr_t)1)));
2548             os::commit_memory((char *)addr, thread->stack_base() - addr,
2549                               !ExecMem);
2550             return EXCEPTION_CONTINUE_EXECUTION;
2551           } else
2552 #endif
2553           {
2554             // Null pointer exception.
2555             if (MacroAssembler::uses_implicit_null_check((void*)addr)) {
2556               address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
2557               if (stub != NULL) return Handle_Exception(exceptionInfo, stub);
2558             }
2559             report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
2560                          exceptionInfo->ContextRecord);
2561             return EXCEPTION_CONTINUE_SEARCH;
2562           }
2563         }
2564       }
2565 


   1 /*
   2  * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2525                  "should be caught by red zone code above.");
2526           return Handle_Exception(exceptionInfo,
2527                                   SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW));
2528         }
2529         // Check for safepoint polling and implicit null
2530         // We only expect null pointers in the stubs (vtable)
2531         // the rest are checked explicitly now.
2532         CodeBlob* cb = CodeCache::find_blob(pc);
2533         if (cb != NULL) {
2534           if (os::is_poll_address(addr)) {
2535             address stub = SharedRuntime::get_poll_stub(pc);
2536             return Handle_Exception(exceptionInfo, stub);
2537           }
2538         }
2539         {
2540 #ifdef _WIN64
2541           // If it's a legal stack address map the entire region in
2542           //
2543           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
2544           address addr = (address) exceptionRecord->ExceptionInformation[1];
2545           if (thread->is_in_usable_stack(addr)) {
2546             addr = (address)((uintptr_t)addr &
2547                              (~((uintptr_t)os::vm_page_size() - (uintptr_t)1)));
2548             os::commit_memory((char *)addr, thread->stack_base() - addr,
2549                               !ExecMem);
2550             return EXCEPTION_CONTINUE_EXECUTION;
2551           } else
2552 #endif
2553           {
2554             // Null pointer exception.
2555             if (MacroAssembler::uses_implicit_null_check((void*)addr)) {
2556               address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
2557               if (stub != NULL) return Handle_Exception(exceptionInfo, stub);
2558             }
2559             report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
2560                          exceptionInfo->ContextRecord);
2561             return EXCEPTION_CONTINUE_SEARCH;
2562           }
2563         }
2564       }
2565 


< prev index next >