1 /* 2 * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_buildOopMap.cpp.incl" 27 28 // The functions in this file builds OopMaps after all scheduling is done. 29 // 30 // OopMaps contain a list of all registers and stack-slots containing oops (so 31 // they can be updated by GC). OopMaps also contain a list of derived-pointer 32 // base-pointer pairs. When the base is moved, the derived pointer moves to 33 // follow it. Finally, any registers holding callee-save values are also 34 // recorded. These might contain oops, but only the caller knows. 35 // 36 // BuildOopMaps implements a simple forward reaching-defs solution. At each 37 // GC point we'll have the reaching-def Nodes. If the reaching Nodes are 38 // typed as pointers (no offset), then they are oops. Pointers+offsets are 39 // derived pointers, and bases can be found from them. Finally, we'll also 40 // track reaching callee-save values. Note that a copy of a callee-save value 41 // "kills" it's source, so that only 1 copy of a callee-save value is alive at 42 // a time. 43 // 44 // We run a simple bitvector liveness pass to help trim out dead oops. Due to 45 // irreducible loops, we can have a reaching def of an oop that only reaches 46 // along one path and no way to know if it's valid or not on the other path. | 1 /* 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "compiler/oopMap.hpp" 27 #include "opto/addnode.hpp" 28 #include "opto/callnode.hpp" 29 #include "opto/compile.hpp" 30 #include "opto/machnode.hpp" 31 #include "opto/matcher.hpp" 32 #include "opto/phase.hpp" 33 #include "opto/regalloc.hpp" 34 #include "opto/rootnode.hpp" 35 #ifdef TARGET_ARCH_x86 36 # include "vmreg_x86.inline.hpp" 37 #endif 38 #ifdef TARGET_ARCH_sparc 39 # include "vmreg_sparc.inline.hpp" 40 #endif 41 #ifdef TARGET_ARCH_zero 42 # include "vmreg_zero.inline.hpp" 43 #endif 44 45 // The functions in this file builds OopMaps after all scheduling is done. 46 // 47 // OopMaps contain a list of all registers and stack-slots containing oops (so 48 // they can be updated by GC). OopMaps also contain a list of derived-pointer 49 // base-pointer pairs. When the base is moved, the derived pointer moves to 50 // follow it. Finally, any registers holding callee-save values are also 51 // recorded. These might contain oops, but only the caller knows. 52 // 53 // BuildOopMaps implements a simple forward reaching-defs solution. At each 54 // GC point we'll have the reaching-def Nodes. If the reaching Nodes are 55 // typed as pointers (no offset), then they are oops. Pointers+offsets are 56 // derived pointers, and bases can be found from them. Finally, we'll also 57 // track reaching callee-save values. Note that a copy of a callee-save value 58 // "kills" it's source, so that only 1 copy of a callee-save value is alive at 59 // a time. 60 // 61 // We run a simple bitvector liveness pass to help trim out dead oops. Due to 62 // irreducible loops, we can have a reaching def of an oop that only reaches 63 // along one path and no way to know if it's valid or not on the other path. |