src/cpu/x86/vm/nativeInst_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2008, 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/_nativeInst_x86.cpp.incl"










  27 
  28 void NativeInstruction::wrote(int offset) {
  29   ICache::invalidate_word(addr_at(offset));
  30 }
  31 
  32 
  33 void NativeCall::verify() {
  34   // Make sure code pattern is actually a call imm32 instruction.
  35   int inst = ubyte_at(0);
  36   if (inst != instruction_code) {
  37     tty->print_cr("Addr: " INTPTR_FORMAT " Code: 0x%x", instruction_address(),
  38                                                         inst);
  39     fatal("not a call disp32");
  40   }
  41 }
  42 
  43 address NativeCall::destination() const {
  44   // Getting the destination of a call isn't safe because that call can
  45   // be getting patched while you're calling this.  There's only special
  46   // places where this can be called but not automatically verifiable by


   1 /*
   2  * Copyright (c) 1997, 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 "assembler_x86.inline.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "nativeInst_x86.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/sharedRuntime.hpp"
  32 #include "runtime/stubRoutines.hpp"
  33 #include "utilities/ostream.hpp"
  34 #ifdef COMPILER1
  35 #include "c1/c1_Runtime1.hpp"
  36 #endif
  37 
  38 void NativeInstruction::wrote(int offset) {
  39   ICache::invalidate_word(addr_at(offset));
  40 }
  41 
  42 
  43 void NativeCall::verify() {
  44   // Make sure code pattern is actually a call imm32 instruction.
  45   int inst = ubyte_at(0);
  46   if (inst != instruction_code) {
  47     tty->print_cr("Addr: " INTPTR_FORMAT " Code: 0x%x", instruction_address(),
  48                                                         inst);
  49     fatal("not a call disp32");
  50   }
  51 }
  52 
  53 address NativeCall::destination() const {
  54   // Getting the destination of a call isn't safe because that call can
  55   // be getting patched while you're calling this.  There's only special
  56   // places where this can be called but not automatically verifiable by