src/cpu/zero/vm/stack_zero.cpp

Thu, 27 May 2010 19:08:38 -0700

author
trims
date
Thu, 27 May 2010 19:08:38 -0700
changeset 1907
c18cbe5936b8
parent 1866
348346af6676
child 2314
f95d63e2154a
permissions
-rw-r--r--

6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair

twisti@1818 1 /*
trims@1907 2 * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
twisti@1818 3 * Copyright 2010 Red Hat, Inc.
twisti@1818 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
twisti@1818 5 *
twisti@1818 6 * This code is free software; you can redistribute it and/or modify it
twisti@1818 7 * under the terms of the GNU General Public License version 2 only, as
twisti@1818 8 * published by the Free Software Foundation.
twisti@1818 9 *
twisti@1818 10 * This code is distributed in the hope that it will be useful, but WITHOUT
twisti@1818 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
twisti@1818 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
twisti@1818 13 * version 2 for more details (a copy is included in the LICENSE file that
twisti@1818 14 * accompanied this code).
twisti@1818 15 *
twisti@1818 16 * You should have received a copy of the GNU General Public License version
twisti@1818 17 * 2 along with this work; if not, write to the Free Software Foundation,
twisti@1818 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
twisti@1818 19 *
trims@1907 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 21 * or visit www.oracle.com if you need additional information or have any
trims@1907 22 * questions.
twisti@1818 23 *
twisti@1818 24 */
twisti@1818 25
twisti@1818 26 #include "incls/_precompiled.incl"
twisti@1818 27 #include "incls/_stack_zero.cpp.incl"
twisti@1818 28
twisti@1866 29 int ZeroStack::suggest_size(Thread *thread) const {
twisti@1866 30 assert(needs_setup(), "already set up");
twisti@1866 31 return align_size_down(abi_stack_available(thread) / 2, wordSize);
twisti@1866 32 }
twisti@1866 33
twisti@1818 34 void ZeroStack::handle_overflow(TRAPS) {
twisti@1818 35 JavaThread *thread = (JavaThread *) THREAD;
twisti@1818 36
twisti@1818 37 // Set up the frame anchor if it isn't already
twisti@1818 38 bool has_last_Java_frame = thread->has_last_Java_frame();
twisti@1818 39 if (!has_last_Java_frame) {
twisti@1860 40 intptr_t *sp = thread->zero_stack()->sp();
twisti@1818 41 ZeroFrame *frame = thread->top_zero_frame();
twisti@1818 42 while (frame) {
twisti@1818 43 if (frame->is_shark_frame())
twisti@1818 44 break;
twisti@1818 45
twisti@1818 46 if (frame->is_interpreter_frame()) {
twisti@1818 47 interpreterState istate =
twisti@1818 48 frame->as_interpreter_frame()->interpreter_state();
twisti@1818 49 if (istate->self_link() == istate)
twisti@1818 50 break;
twisti@1818 51 }
twisti@1818 52
twisti@1860 53 sp = ((intptr_t *) frame) + 1;
twisti@1818 54 frame = frame->next();
twisti@1818 55 }
twisti@1818 56
twisti@1818 57 if (frame == NULL)
twisti@1818 58 fatal("unrecoverable stack overflow");
twisti@1818 59
twisti@1860 60 thread->set_last_Java_frame(frame, sp);
twisti@1818 61 }
twisti@1818 62
twisti@1818 63 // Throw the exception
twisti@1818 64 switch (thread->thread_state()) {
twisti@1818 65 case _thread_in_Java:
twisti@1818 66 InterpreterRuntime::throw_StackOverflowError(thread);
twisti@1818 67 break;
twisti@1818 68
twisti@1818 69 case _thread_in_vm:
twisti@1818 70 Exceptions::throw_stack_overflow_exception(thread, __FILE__, __LINE__);
twisti@1818 71 break;
twisti@1818 72
twisti@1818 73 default:
twisti@1818 74 ShouldNotReachHere();
twisti@1818 75 }
twisti@1818 76
twisti@1818 77 // Reset the frame anchor if necessary
twisti@1818 78 if (!has_last_Java_frame)
twisti@1818 79 thread->reset_last_Java_frame();
twisti@1818 80 }
twisti@1860 81
twisti@1860 82 #ifndef PRODUCT
twisti@1860 83 void ZeroStack::zap(int c) {
twisti@1860 84 memset(_base, c, available_words() * wordSize);
twisti@1860 85 }
twisti@1860 86 #endif // PRODUCT

mercurial