annotate src/cpu/zero/vm/stack_zero.inline.hpp @ 21947:9f70fc90169d

Truffle: remove expensive assertion
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 17 Jun 2015 04:09:30 +0200
parents f95d63e2154a
children
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 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2010, 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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #ifndef CPU_ZERO_VM_STACK_ZERO_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #define CPU_ZERO_VM_STACK_ZERO_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "runtime/thread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "stack_zero.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
32 // This function should match SharkStack::CreateStackOverflowCheck
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
33 inline void ZeroStack::overflow_check(int required_words, TRAPS) {
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
34 // Check the Zero stack
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
35 if (available_words() < required_words) {
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
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
40 // Check the ABI stack
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
41 if (abi_stack_available(THREAD) < 0) {
1383
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
42 handle_overflow(THREAD);
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
43 return;
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
44 }
aa9c266de52a 6944473: 6941224 misses new files
twisti
parents:
diff changeset
45 }
1511
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
46
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
47 // This method returns the amount of ABI stack available for us
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
48 // to use under normal circumstances. Note that the returned
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
49 // value can be negative.
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
50 inline int ZeroStack::abi_stack_available(Thread *thread) const {
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
51 int stack_used = thread->stack_base() - (address) &stack_used;
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
52 int stack_free = thread->stack_size() - stack_used;
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
53 return stack_free - shadow_pages_size();
348346af6676 6950178: Zero stack improvements
twisti
parents: 1383
diff changeset
54 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
55
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
56 #endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP