1 /*
   2  * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
   3  * Copyright 2007 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  21  * CA 95054 USA or visit www.sun.com if you need additional information or
  22  * have any questions.
  23  *
  24  */
  25 
  26 // We have interfaces for the following instructions:
  27 // - NativeInstruction
  28 // - - NativeCall
  29 // - - NativeMovConstReg
  30 // - - NativeMovConstRegPatching
  31 // - - NativeJump
  32 // - - NativeIllegalOpCode
  33 // - - NativeReturn
  34 // - - NativeReturnX (return with argument)
  35 // - - NativePushConst
  36 // - - NativeTstRegMem
  37 
  38 // The base class for different kinds of native instruction abstractions.
  39 // Provides the primitive operations to manipulate code relative to this.
  40 
  41 class NativeInstruction VALUE_OBJ_CLASS_SPEC {
  42  public:
  43   bool is_jump() {
  44     ShouldNotCallThis();
  45   }
  46 
  47   bool is_safepoint_poll() {
  48     ShouldNotCallThis();
  49   }
  50 };
  51 
  52 inline NativeInstruction* nativeInstruction_at(address address) {
  53   ShouldNotCallThis();
  54 }
  55 
  56 class NativeCall : public NativeInstruction {
  57  public:
  58   enum zero_specific_constants {
  59     instruction_size = 0 // not used within the interpreter
  60   };
  61 
  62   address instruction_address() const {
  63     ShouldNotCallThis();
  64   }
  65 
  66   address next_instruction_address() const {
  67     ShouldNotCallThis();
  68   }
  69 
  70   address return_address() const {
  71     ShouldNotCallThis();
  72   }
  73 
  74   address destination() const {
  75     ShouldNotCallThis();
  76   }
  77 
  78   void set_destination_mt_safe(address dest) {
  79     ShouldNotCallThis();
  80   }
  81 
  82   void verify_alignment() {
  83     ShouldNotCallThis();
  84   }
  85 
  86   void verify() {
  87     ShouldNotCallThis();
  88   }
  89 
  90   static bool is_call_before(address return_address) {
  91     ShouldNotCallThis();
  92   }
  93 };
  94 
  95 inline NativeCall* nativeCall_before(address return_address) {
  96   ShouldNotCallThis();
  97 }
  98 
  99 inline NativeCall* nativeCall_at(address address) {
 100   ShouldNotCallThis();
 101 }
 102 
 103 class NativeMovConstReg : public NativeInstruction {
 104  public:
 105   address next_instruction_address() const {
 106     ShouldNotCallThis();
 107   }
 108 
 109   intptr_t data() const {
 110     ShouldNotCallThis();
 111   }
 112 
 113   void set_data(intptr_t x) {
 114     ShouldNotCallThis();
 115   }
 116 };
 117 
 118 inline NativeMovConstReg* nativeMovConstReg_at(address address) {
 119   ShouldNotCallThis();
 120 }
 121 
 122 class NativeMovRegMem : public NativeInstruction {
 123  public:
 124   int offset() const {
 125     ShouldNotCallThis();
 126   }
 127 
 128   void set_offset(intptr_t x) {
 129     ShouldNotCallThis();
 130   }
 131 
 132   void add_offset_in_bytes(int add_offset) {
 133     ShouldNotCallThis();
 134   }
 135 };
 136 
 137 inline NativeMovRegMem* nativeMovRegMem_at(address address) {
 138   ShouldNotCallThis();
 139 }
 140 
 141 class NativeJump : public NativeInstruction {
 142  public:
 143   enum zero_specific_constants {
 144     instruction_size = 0 // not used within the interpreter
 145   };
 146 
 147   address jump_destination() const {
 148     ShouldNotCallThis();
 149   }
 150 
 151   void set_jump_destination(address dest) {
 152     ShouldNotCallThis();
 153   }
 154 
 155   static void check_verified_entry_alignment(address entry,
 156                                              address verified_entry) {
 157   }
 158 
 159   static void patch_verified_entry(address entry,
 160                                    address verified_entry,
 161                                    address dest);
 162 };
 163 
 164 inline NativeJump* nativeJump_at(address address) {
 165   ShouldNotCallThis();
 166 }
 167 
 168 class NativeGeneralJump : public NativeInstruction {
 169  public:
 170   address jump_destination() const {
 171     ShouldNotCallThis();
 172   }
 173 
 174   static void insert_unconditional(address code_pos, address entry) {
 175     ShouldNotCallThis();
 176   }
 177 
 178   static void replace_mt_safe(address instr_addr, address code_buffer) {
 179     ShouldNotCallThis();
 180   }
 181 };
 182 
 183 inline NativeGeneralJump* nativeGeneralJump_at(address address) {
 184   ShouldNotCallThis();
 185 }