Wed, 27 Nov 2013 16:16:21 -0800
8029015: PPC64 (part 216): opto: trap based null and range checks
Summary: On PPC64 use tdi instruction that does a compare and raises SIGTRAP for NULL and range checks.
Reviewed-by: kvn
goetz@6458 | 1 | /* |
goetz@6458 | 2 | * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
goetz@6458 | 3 | * Copyright 2012, 2013 SAP AG. All rights reserved. |
goetz@6458 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
goetz@6458 | 5 | * |
goetz@6458 | 6 | * This code is free software; you can redistribute it and/or modify it |
goetz@6458 | 7 | * under the terms of the GNU General Public License version 2 only, as |
goetz@6458 | 8 | * published by the Free Software Foundation. |
goetz@6458 | 9 | * |
goetz@6458 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
goetz@6458 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
goetz@6458 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
goetz@6458 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
goetz@6458 | 14 | * accompanied this code). |
goetz@6458 | 15 | * |
goetz@6458 | 16 | * You should have received a copy of the GNU General Public License version |
goetz@6458 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
goetz@6458 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
goetz@6458 | 19 | * |
goetz@6458 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
goetz@6458 | 21 | * or visit www.oracle.com if you need additional information or have any |
goetz@6458 | 22 | * questions. |
goetz@6458 | 23 | * |
goetz@6458 | 24 | */ |
goetz@6458 | 25 | |
goetz@6458 | 26 | #ifndef CPU_PPC_VM_JAVAFRAMEANCHOR_PPC_HPP |
goetz@6458 | 27 | #define CPU_PPC_VM_JAVAFRAMEANCHOR_PPC_HPP |
goetz@6458 | 28 | |
goetz@6458 | 29 | #ifndef CC_INTERP |
goetz@6458 | 30 | #error "CC_INTERP must be defined on PPC64" |
goetz@6458 | 31 | #endif |
goetz@6458 | 32 | |
goetz@6458 | 33 | public: |
goetz@6458 | 34 | // Each arch must define reset, save, restore |
goetz@6458 | 35 | // These are used by objects that only care about: |
goetz@6458 | 36 | // 1 - initializing a new state (thread creation, javaCalls) |
goetz@6458 | 37 | // 2 - saving a current state (javaCalls) |
goetz@6458 | 38 | // 3 - restoring an old state (javaCalls) |
goetz@6458 | 39 | |
goetz@6458 | 40 | inline void clear(void) { |
goetz@6458 | 41 | // clearing _last_Java_sp must be first |
goetz@6458 | 42 | _last_Java_sp = NULL; |
goetz@6458 | 43 | // fence? |
goetz@6458 | 44 | OrderAccess::release(); |
goetz@6458 | 45 | _last_Java_pc = NULL; |
goetz@6458 | 46 | } |
goetz@6458 | 47 | |
goetz@6458 | 48 | inline void set(intptr_t* sp, address pc) { |
goetz@6458 | 49 | _last_Java_pc = pc; |
goetz@6458 | 50 | OrderAccess::release(); |
goetz@6458 | 51 | _last_Java_sp = sp; |
goetz@6458 | 52 | } |
goetz@6458 | 53 | |
goetz@6458 | 54 | void copy(JavaFrameAnchor* src) { |
goetz@6458 | 55 | // In order to make sure the transition state is valid for "this". |
goetz@6458 | 56 | // We must clear _last_Java_sp before copying the rest of the new data. |
goetz@6458 | 57 | // |
goetz@6458 | 58 | // Hack Alert: Temporary bugfix for 4717480/4721647 |
goetz@6458 | 59 | // To act like previous version (pd_cache_state) don't NULL _last_Java_sp |
goetz@6458 | 60 | // unless the value is changing. |
goetz@6458 | 61 | if (_last_Java_sp != src->_last_Java_sp) { |
goetz@6458 | 62 | _last_Java_sp = NULL; |
goetz@6458 | 63 | OrderAccess::release(); |
goetz@6458 | 64 | } |
goetz@6458 | 65 | _last_Java_pc = src->_last_Java_pc; |
goetz@6458 | 66 | // Must be last so profiler will always see valid frame if has_last_frame() is true. |
goetz@6458 | 67 | OrderAccess::release(); |
goetz@6458 | 68 | _last_Java_sp = src->_last_Java_sp; |
goetz@6458 | 69 | } |
goetz@6458 | 70 | |
goetz@6458 | 71 | // Always walkable. |
goetz@6458 | 72 | bool walkable(void) { return true; } |
goetz@6458 | 73 | // Never any thing to do since we are always walkable and can find address of return addresses. |
goetz@6458 | 74 | void make_walkable(JavaThread* thread) { } |
goetz@6458 | 75 | |
goetz@6458 | 76 | intptr_t* last_Java_sp(void) const { return _last_Java_sp; } |
goetz@6458 | 77 | |
goetz@6458 | 78 | address last_Java_pc(void) { return _last_Java_pc; } |
goetz@6458 | 79 | |
goetz@6458 | 80 | void set_last_Java_sp(intptr_t* sp) { OrderAccess::release(); _last_Java_sp = sp; } |
goetz@6458 | 81 | |
goetz@6458 | 82 | #endif // CPU_PPC_VM_JAVAFRAMEANCHOR_PPC_HPP |