hotspot/src/cpu/zero/vm/nativeInst_zero.hpp
author jiangli
Wed, 06 Jun 2012 14:33:43 -0400
changeset 12937 0032fb2caff6
parent 7397 5b173b4ca846
child 19336 ddceb0657500
permissions -rw-r--r--
7172967: Eliminate constMethod's _method backpointer to methodOop. Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod. Reviewed-by: roland, bdelsart, kamg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     3
 * Copyright 2007 Red Hat, Inc.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#ifndef CPU_ZERO_VM_NATIVEINST_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#define CPU_ZERO_VM_NATIVEINST_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "asm/assembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "runtime/icache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "utilities/top.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    35
// We have interfaces for the following instructions:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    36
// - NativeInstruction
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    37
// - - NativeCall
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    38
// - - NativeMovConstReg
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    39
// - - NativeMovConstRegPatching
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    40
// - - NativeJump
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    41
// - - NativeIllegalOpCode
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    42
// - - NativeReturn
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    43
// - - NativeReturnX (return with argument)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    44
// - - NativePushConst
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    45
// - - NativeTstRegMem
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
// The base class for different kinds of native instruction abstractions.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
// Provides the primitive operations to manipulate code relative to this.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
class NativeInstruction VALUE_OBJ_CLASS_SPEC {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
  bool is_jump() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
  bool is_safepoint_poll() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
inline NativeInstruction* nativeInstruction_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
class NativeCall : public NativeInstruction {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
  enum zero_specific_constants {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
    instruction_size = 0 // not used within the interpreter
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
  };
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
  address instruction_address() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    72
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    75
  address next_instruction_address() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
  address return_address() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
  address destination() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    86
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    87
  void set_destination_mt_safe(address dest) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
  void verify_alignment() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
  void verify() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
  static bool is_call_before(address return_address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   101
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   102
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   104
inline NativeCall* nativeCall_before(address return_address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
inline NativeCall* nativeCall_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   109
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   110
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
class NativeMovConstReg : public NativeInstruction {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
  address next_instruction_address() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
  intptr_t data() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   120
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
  void set_data(intptr_t x) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
inline NativeMovConstReg* nativeMovConstReg_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
class NativeMovRegMem : public NativeInstruction {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
  int offset() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   135
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   136
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   137
  void set_offset(intptr_t x) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   138
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   139
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   140
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   141
  void add_offset_in_bytes(int add_offset) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   142
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   143
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   144
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   145
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   146
inline NativeMovRegMem* nativeMovRegMem_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   147
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   148
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   149
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   150
class NativeJump : public NativeInstruction {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   151
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   152
  enum zero_specific_constants {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   153
    instruction_size = 0 // not used within the interpreter
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   154
  };
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   155
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   156
  address jump_destination() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   157
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   158
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   159
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   160
  void set_jump_destination(address dest) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   161
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   162
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   163
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   164
  static void check_verified_entry_alignment(address entry,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   165
                                             address verified_entry) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   166
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   167
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   168
  static void patch_verified_entry(address entry,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   169
                                   address verified_entry,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   170
                                   address dest);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   171
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   172
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   173
inline NativeJump* nativeJump_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   174
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   175
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   176
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   177
class NativeGeneralJump : public NativeInstruction {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   178
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   179
  address jump_destination() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   180
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   181
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   182
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   183
  static void insert_unconditional(address code_pos, address entry) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   184
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   185
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   186
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   187
  static void replace_mt_safe(address instr_addr, address code_buffer) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   188
    ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   189
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   190
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   191
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   192
inline NativeGeneralJump* nativeGeneralJump_at(address address) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   193
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   194
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   195
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   196
#endif // CPU_ZERO_VM_NATIVEINST_ZERO_HPP