hotspot/src/cpu/ppc/vm/bytecodeInterpreter_ppc.hpp
author duke
Wed, 05 Jul 2017 20:10:48 +0200
changeset 27963 88d7c7c376e9
parent 22861 f5c393d456fc
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     1
/*
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     2
 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     3
 * Copyright 2012, 2013 SAP AG. All rights reserved.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     5
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     9
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    14
 * accompanied this code).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    15
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    19
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    22
 * questions.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    23
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    24
 */
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    25
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    26
#ifndef CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    27
#define CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    28
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    29
// Platform specific for C++ based Interpreter
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    30
#define LOTS_OF_REGS    /* Lets interpreter use plenty of registers */
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    31
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    32
private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    33
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    34
    // Save the bottom of the stack after frame manager setup. For ease of restoration after return
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    35
    // from recursive interpreter call.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    36
    intptr_t* _frame_bottom;              // Saved bottom of frame manager frame.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    37
    address   _last_Java_pc;              // Pc to return to in frame manager.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    38
    intptr_t* _last_Java_fp;              // frame pointer
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    39
    intptr_t* _last_Java_sp;              // stack pointer
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    40
    interpreterState _self_link;          // Previous interpreter state  // sometimes points to self???
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    41
    double    _native_fresult;            // Save result of native calls that might return floats.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    42
    intptr_t  _native_lresult;            // Save result of native calls that might return handle/longs.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    43
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    44
public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    45
    address last_Java_pc(void)            { return _last_Java_pc; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    46
    intptr_t* last_Java_fp(void)          { return _last_Java_fp; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    47
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    48
    static ByteSize native_lresult_offset() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    49
      return byte_offset_of(BytecodeInterpreter, _native_lresult);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    50
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    51
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    52
    static ByteSize native_fresult_offset() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    53
      return byte_offset_of(BytecodeInterpreter, _native_fresult);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    54
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    55
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    56
    static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    57
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    58
#define SET_LAST_JAVA_FRAME()   THREAD->frame_anchor()->set(istate->_last_Java_sp, istate->_last_Java_pc);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    59
#define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->clear();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    60
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    61
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    62
// Macros for accessing the stack.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    63
#undef STACK_INT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    64
#undef STACK_FLOAT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    65
#undef STACK_ADDR
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    66
#undef STACK_OBJECT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    67
#undef STACK_DOUBLE
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    68
#undef STACK_LONG
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    69
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    70
// JavaStack Implementation
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    71
#define STACK_SLOT(offset)    ((address) &topOfStack[-(offset)])
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    72
#define STACK_INT(offset)     (*((jint*) &topOfStack[-(offset)]))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    73
#define STACK_FLOAT(offset)   (*((jfloat *) &topOfStack[-(offset)]))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    74
#define STACK_OBJECT(offset)  (*((oop *) &topOfStack [-(offset)]))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    75
#define STACK_DOUBLE(offset)  (((VMJavaVal64*) &topOfStack[-(offset)])->d)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    76
#define STACK_LONG(offset)    (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    77
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    78
#define SET_STACK_SLOT(value, offset)   (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    79
#define SET_STACK_ADDR(value, offset)   (*((address *)&topOfStack[-(offset)]) = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    80
#define SET_STACK_INT(value, offset)    (*((jint *)&topOfStack[-(offset)]) = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    81
#define SET_STACK_FLOAT(value, offset)  (*((jfloat *)&topOfStack[-(offset)]) = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    82
#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    83
#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    84
#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d =  \
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    85
                                                 ((VMJavaVal64*)(addr))->d)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    86
#define SET_STACK_LONG(value, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    87
#define SET_STACK_LONG_FROM_ADDR(addr, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l =  \
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    88
                                                 ((VMJavaVal64*)(addr))->l)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    89
// JavaLocals implementation
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    90
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    91
#define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    92
#define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    93
#define LOCALS_INT(offset)     (*(jint*)&(locals[-(offset)]))
22849
b8670e920530 8028514: PPC64: Fix C++ Interpreter after '7195622: CheckUnhandledOops has limited usefulness now'
simonis
parents: 22824
diff changeset
    94
#define LOCALS_OBJECT(offset)  (cast_to_oop(locals[-(offset)]))
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    95
#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    96
#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    97
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    98
#define SET_LOCALS_SLOT(value, offset)    (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    99
#define SET_LOCALS_INT(value, offset)     (*((jint *)&locals[-(offset)]) = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   100
#define SET_LOCALS_DOUBLE(value, offset)  (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   101
#define SET_LOCALS_LONG(value, offset)    (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   102
#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22849
diff changeset
   103
                                                  ((VMJavaVal64*)(addr))->d)
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   104
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   105
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   106
#endif // CPU_PPC_VM_BYTECODEINTERPRETER_PPC_PP