annotate src/cpu/zero/vm/stack_zero.inline.hpp @ 1673:6709c14587c2 jdk7-b105

Added tag jdk7-b104 for changeset b4acf10eb134
author cl
date Fri, 06 Aug 2010 12:51:54 -0700
parents c18cbe5936b8
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1511
diff changeset
2 * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
3 * Copyright 2010 Red Hat, Inc.
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
5 *
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
6 * This code is free software; you can redistribute it and/or modify it
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
7 * under the terms of the GNU General Public License version 2 only, as
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
8 * published by the Free Software Foundation.
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
9 *
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
10 * This code is distributed in the hope that it will be useful, but WITHOUT
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
13 * version 2 for more details (a copy is included in the LICENSE file that
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
14 * accompanied this code).
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
15 *
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License version
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
17 * 2 along with this work; if not, write to the Free Software Foundation,
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
19 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1511
diff changeset
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1511
diff changeset
21 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1511
diff changeset
22 * questions.
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
23 *
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
24 */
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
25
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
26 // This function should match SharkStack::CreateStackOverflowCheck
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
27 inline void ZeroStack::overflow_check(int required_words, TRAPS) {
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
28 // Check the Zero stack
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
29 if (available_words() < required_words) {
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
30 handle_overflow(THREAD);
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
31 return;
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
32 }
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
33
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
34 // Check the ABI stack
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
35 if (abi_stack_available(THREAD) < 0) {
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
36 handle_overflow(THREAD);
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
37 return;
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
38 }
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
39 }
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
40
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
41 // This method returns the amount of ABI stack available for us
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
42 // to use under normal circumstances. Note that the returned
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
43 // value can be negative.
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
44 inline int ZeroStack::abi_stack_available(Thread *thread) const {
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
45 int stack_used = thread->stack_base() - (address) &stack_used;
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
46 int stack_free = thread->stack_size() - stack_used;
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
47 return stack_free - shadow_pages_size();
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
48 }