hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp
author twisti
Wed, 12 May 2010 03:49:52 -0700
changeset 5427 08c6b2b940f7
parent 4013 b154310845de
child 5547 f4b087cbb361
permissions -rw-r--r--
6951784: Zero deoptimizer changes Summary: The way Zero currently handles deoptimization can lead to methods being freed while they are still being executed. Reviewed-by: twisti Contributed-by: Gary Benson <gbenson@redhat.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     2
 * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     3
 * Copyright 2007, 2008 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
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    20
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    21
 * CA 95054 USA or visit www.sun.com if you need additional information or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    22
 * have any questions.
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
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    26
// Platform specific for C++ based Interpreter
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    27
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    28
#if defined(PPC) || defined(SPARC) || defined(IA64)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    29
#define LOTS_OF_REGS   // Use plenty of registers
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    30
#else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    31
#undef LOTS_OF_REGS    // Loser platforms
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    32
#endif
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    33
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    34
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    35
  interpreterState _self_link;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    36
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    37
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    38
  inline void set_locals(intptr_t* new_locals) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    39
    _locals = new_locals;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    40
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    41
  inline void set_method(methodOop new_method) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    42
    _method = new_method;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    43
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    44
  inline interpreterState self_link() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    45
    return _self_link;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
  inline void set_self_link(interpreterState new_self_link) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
    _self_link = new_self_link;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
  inline interpreterState prev_link() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
    return _prev_link;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
  inline void set_prev_link(interpreterState new_prev_link) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
    _prev_link = new_prev_link;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
  inline void set_stack_limit(intptr_t* new_stack_limit) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
    _stack_limit = new_stack_limit;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
  inline void set_stack_base(intptr_t* new_stack_base) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
    _stack_base = new_stack_base;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
  inline void set_monitor_base(BasicObjectLock *new_monitor_base) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
    _monitor_base = new_monitor_base;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
  inline void set_thread(JavaThread* new_thread) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
    _thread = new_thread;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
  inline void set_constants(constantPoolCacheOop new_constants) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
    _constants = new_constants;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
  inline oop oop_temp() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    72
    return _oop_temp;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
  inline oop *oop_temp_addr() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    75
    return &_oop_temp;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
  inline void set_oop_temp(oop new_oop_temp) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
    _oop_temp = new_oop_temp;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
  inline address callee_entry_point() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
    return _result._to_call._callee_entry_point;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
  inline address osr_buf() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
    return _result._osr._osr_buf;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    86
  inline address osr_entry() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    87
    return _result._osr._osr_entry;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
  const char *name_of_field_at_address(address addr);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
// The frame manager handles this
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
#define SET_LAST_JAVA_FRAME()
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
#define RESET_LAST_JAVA_FRAME()
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
// ZeroStack Implementation
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
#undef STACK_INT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
#undef STACK_FLOAT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   101
#undef STACK_ADDR
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   102
#undef STACK_OBJECT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
#undef STACK_DOUBLE
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   104
#undef STACK_LONG
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
#define GET_STACK_SLOT(offset)    (*((intptr_t*) &topOfStack[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
#define STACK_SLOT(offset)    ((address) &topOfStack[-(offset)])
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
#define STACK_ADDR(offset)    (*((address *) &topOfStack[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   109
#define STACK_INT(offset)     (*((jint*) &topOfStack[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   110
#define STACK_FLOAT(offset)   (*((jfloat *) &topOfStack[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
#define STACK_OBJECT(offset)  (*((oop *) &topOfStack [-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
#define STACK_DOUBLE(offset)  (((VMJavaVal64*) &topOfStack[-(offset)])->d)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
#define STACK_LONG(offset)    (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
#define SET_STACK_SLOT(value, offset)   (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
#define SET_STACK_ADDR(value, offset)   (*((address *)&topOfStack[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
#define SET_STACK_INT(value, offset)    (*((jint *)&topOfStack[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
#define SET_STACK_FLOAT(value, offset)  (*((jfloat *)&topOfStack[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   120
#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d =  \
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
                                                 ((VMJavaVal64*)(addr))->d)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
#define SET_STACK_LONG(value, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
#define SET_STACK_LONG_FROM_ADDR(addr, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l =  \
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
                                                 ((VMJavaVal64*)(addr))->l)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
// JavaLocals implementation
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
#define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
#define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
#define LOCALS_INT(offset)     (*((jint*)&locals[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
#define LOCALS_FLOAT(offset)   (*((jfloat*)&locals[-(offset)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
#define LOCALS_OBJECT(offset)  ((oop)locals[-(offset)])
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
#define LOCALS_DOUBLE(offset)  (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
#define LOCALS_LONG(offset)    (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   135
#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   136
#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   137
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   138
#define SET_LOCALS_SLOT(value, offset)    (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   139
#define SET_LOCALS_ADDR(value, offset)    (*((address *)&locals[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   140
#define SET_LOCALS_INT(value, offset)     (*((jint *)&locals[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   141
#define SET_LOCALS_FLOAT(value, offset)   (*((jfloat *)&locals[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   142
#define SET_LOCALS_OBJECT(value, offset)  (*((oop *)&locals[-(offset)]) = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   143
#define SET_LOCALS_DOUBLE(value, offset)  (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   144
#define SET_LOCALS_LONG(value, offset)    (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   145
#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   146
                                                  ((VMJavaVal64*)(addr))->d)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   147
#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   148
                                                ((VMJavaVal64*)(addr))->l)