src/share/vm/runtime/registerMap.hpp

Wed, 01 Dec 2010 15:04:06 +0100

author
stefank
date
Wed, 01 Dec 2010 15:04:06 +0100
changeset 2325
c760f78e0a53
parent 2314
f95d63e2154a
child 2508
b92c45f2bc75
permissions
-rw-r--r--

7003125: precompiled.hpp is included when precompiled headers are not used
Summary: Added an ifndef DONT_USE_PRECOMPILED_HEADER to precompiled.hpp. Set up DONT_USE_PRECOMPILED_HEADER when compiling with Sun Studio or when the user specifies USE_PRECOMPILED_HEADER=0. Fixed broken include dependencies.
Reviewed-by: coleenp, kvn

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_RUNTIME_REGISTERMAP_HPP
stefank@2314 26 #define SHARE_VM_RUNTIME_REGISTERMAP_HPP
stefank@2314 27
stefank@2314 28 #include "code/vmreg.hpp"
stefank@2314 29 #include "utilities/globalDefinitions.hpp"
stefank@2314 30 #ifdef TARGET_ARCH_x86
stefank@2314 31 # include "register_x86.hpp"
stefank@2314 32 #endif
stefank@2314 33 #ifdef TARGET_ARCH_sparc
stefank@2314 34 # include "register_sparc.hpp"
stefank@2314 35 #endif
stefank@2314 36 #ifdef TARGET_ARCH_zero
stefank@2314 37 # include "register_zero.hpp"
stefank@2314 38 #endif
stefank@2314 39
duke@435 40 class JavaThread;
duke@435 41
duke@435 42 //
duke@435 43 // RegisterMap
duke@435 44 //
duke@435 45 // A companion structure used for stack traversal. The RegisterMap contains
duke@435 46 // misc. information needed in order to do correct stack traversal of stack
duke@435 47 // frames. Hence, it must always be passed in as an argument to
duke@435 48 // frame::sender(RegisterMap*).
duke@435 49 //
duke@435 50 // In particular,
duke@435 51 // 1) It provides access to the thread for which the stack belongs. The
duke@435 52 // thread object is needed in order to get sender of a deoptimized frame.
duke@435 53 //
duke@435 54 // 2) It is used to pass information from a callee frame to its caller
duke@435 55 // frame about how the frame should be traversed. This is used to let
duke@435 56 // the caller frame take care of calling oops-do of out-going
duke@435 57 // arguments, when the callee frame is not instantiated yet. This
duke@435 58 // happens, e.g., when a compiled frame calls into
duke@435 59 // resolve_virtual_call. (Hence, it is critical that the same
duke@435 60 // RegisterMap object is used for the entire stack walk. Normally,
duke@435 61 // this is hidden by using the StackFrameStream.) This is used when
duke@435 62 // doing follow_oops and oops_do.
duke@435 63 //
duke@435 64 // 3) The RegisterMap keeps track of the values of callee-saved registers
duke@435 65 // from frame to frame (hence, the name). For some stack traversal the
duke@435 66 // values of the callee-saved registers does not matter, e.g., if you
duke@435 67 // only need the static properies such as frame type, pc, and such.
duke@435 68 // Updating of the RegisterMap can be turned off by instantiating the
duke@435 69 // register map as: RegisterMap map(thread, false);
duke@435 70
duke@435 71 class RegisterMap : public StackObj {
duke@435 72 public:
duke@435 73 typedef julong LocationValidType;
duke@435 74 enum {
duke@435 75 reg_count = ConcreteRegisterImpl::number_of_registers,
duke@435 76 location_valid_type_size = sizeof(LocationValidType)*8,
duke@435 77 location_valid_size = (reg_count+location_valid_type_size-1)/location_valid_type_size
duke@435 78 };
duke@435 79 private:
duke@435 80 intptr_t* _location[reg_count]; // Location of registers (intptr_t* looks better than address in the debugger)
duke@435 81 LocationValidType _location_valid[location_valid_size];
duke@435 82 bool _include_argument_oops; // Should include argument_oop marked locations for compiler
duke@435 83 JavaThread* _thread; // Reference to current thread
duke@435 84 bool _update_map; // Tells if the register map need to be
duke@435 85 // updated when traversing the stack
duke@435 86
duke@435 87 #ifdef ASSERT
duke@435 88 void check_location_valid();
duke@435 89 #else
duke@435 90 void check_location_valid() {}
duke@435 91 #endif
duke@435 92
duke@435 93 public:
duke@435 94 debug_only(intptr_t* _update_for_id;) // Assert that RegisterMap is not updated twice for same frame
duke@435 95 RegisterMap(JavaThread *thread, bool update_map = true);
duke@435 96 RegisterMap(const RegisterMap* map);
duke@435 97
duke@435 98 address location(VMReg reg) const {
duke@435 99 int index = reg->value() / location_valid_type_size;
duke@435 100 assert(0 <= reg->value() && reg->value() < reg_count, "range check");
duke@435 101 assert(0 <= index && index < location_valid_size, "range check");
duke@435 102 if (_location_valid[index] & ((LocationValidType)1 << (reg->value() % location_valid_type_size))) {
duke@435 103 return (address) _location[reg->value()];
duke@435 104 } else {
duke@435 105 return pd_location(reg);
duke@435 106 }
duke@435 107 }
duke@435 108
duke@435 109 void set_location(VMReg reg, address loc) {
duke@435 110 int index = reg->value() / location_valid_type_size;
duke@435 111 assert(0 <= reg->value() && reg->value() < reg_count, "range check");
duke@435 112 assert(0 <= index && index < location_valid_size, "range check");
duke@435 113 assert(_update_map, "updating map that does not need updating");
duke@435 114 _location[reg->value()] = (intptr_t*) loc;
duke@435 115 _location_valid[index] |= ((LocationValidType)1 << (reg->value() % location_valid_type_size));
duke@435 116 check_location_valid();
duke@435 117 }
duke@435 118
duke@435 119 // Called by an entry frame.
duke@435 120 void clear();
duke@435 121
duke@435 122 bool include_argument_oops() const { return _include_argument_oops; }
duke@435 123 void set_include_argument_oops(bool f) { _include_argument_oops = f; }
duke@435 124
duke@435 125 JavaThread *thread() const { return _thread; }
duke@435 126 bool update_map() const { return _update_map; }
duke@435 127
duke@435 128 void print_on(outputStream* st) const;
duke@435 129 void print() const;
duke@435 130
duke@435 131 // the following contains the definition of pd_xxx methods
stefank@2314 132 #ifdef TARGET_ARCH_x86
stefank@2314 133 # include "registerMap_x86.hpp"
stefank@2314 134 #endif
stefank@2314 135 #ifdef TARGET_ARCH_sparc
stefank@2314 136 # include "registerMap_sparc.hpp"
stefank@2314 137 #endif
stefank@2314 138 #ifdef TARGET_ARCH_zero
stefank@2314 139 # include "registerMap_zero.hpp"
stefank@2314 140 #endif
stefank@2314 141
duke@435 142 };
stefank@2314 143
stefank@2314 144 #endif // SHARE_VM_RUNTIME_REGISTERMAP_HPP

mercurial