hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.hpp
author goetz
Mon, 29 Jun 2015 15:30:55 +0200
changeset 31590 427d073af867
parent 22849 b8670e920530
permissions -rw-r--r--
8086069: Adapt runtime calls to recent intrinsics to pass ints as long Summary: Remove CCallingConventionRequiresIntsAsLongs from shared code and push functionality to native wrapper. Less optimal but more flexible. Reviewed-by: jrose, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Platform specific for C++ based Interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
    interpreterState _self_link;          /*  Previous interpreter state  */ /* sometimes points to self??? */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
    address   _result_handler;            /* temp for saving native result handler */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
    intptr_t* _sender_sp;                 /* sender's sp before stack (locals) extension */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    address   _extra_junk1;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
    address   _extra_junk2;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    address   _extra_junk3;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    // address dummy_for_native2;         /* a native frame result handler would be here... */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    // address dummy_for_native1;         /* native result type stored here in a interpreter native frame */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    address   _extra_junk4;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    address   _extra_junk5;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    address   _extra_junk6;               /* temp to save on recompiles */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
                                                         // we have an interpreter frame...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
inline intptr_t* sender_sp() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  return _sender_sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// The interpreter always has the frame anchor fully setup so we don't
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// have to do anything going to vm from the interpreter. On return
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// we do have to clear the flags in case they we're modified to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// maintain the stack walking invariants.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
#define SET_LAST_JAVA_FRAME()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
#define RESET_LAST_JAVA_FRAME()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
 * Macros for accessing the stack.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#undef STACK_INT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
#undef STACK_FLOAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#undef STACK_ADDR
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
#undef STACK_OBJECT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
#undef STACK_DOUBLE
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
#undef STACK_LONG
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// JavaStack Implementation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#define GET_STACK_SLOT(offset)    (*((intptr_t*) &topOfStack[-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#define STACK_SLOT(offset)    ((address) &topOfStack[-(offset)])
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
#define STACK_ADDR(offset)    (*((address *) &topOfStack[-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#define STACK_INT(offset)     (*((jint*) &topOfStack[-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
#define STACK_FLOAT(offset)   (*((jfloat *) &topOfStack[-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
#define STACK_OBJECT(offset)  (*((oop *) &topOfStack [-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
#define STACK_DOUBLE(offset)  (((VMJavaVal64*) &topOfStack[-(offset)])->d)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#define STACK_LONG(offset)    (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
#define SET_STACK_SLOT(value, offset)   (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
#define SET_STACK_ADDR(value, offset)   (*((address *)&topOfStack[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define SET_STACK_INT(value, offset)    (*((jint *)&topOfStack[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
#define SET_STACK_FLOAT(value, offset)  (*((jfloat *)&topOfStack[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d =  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
                                                 ((VMJavaVal64*)(addr))->d)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
#define SET_STACK_LONG(value, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#define SET_STACK_LONG_FROM_ADDR(addr, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l =  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
                                                 ((VMJavaVal64*)(addr))->l)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// JavaLocals implementation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
#define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
#define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#define LOCALS_INT(offset)     ((jint)(locals[-(offset)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
#define LOCALS_FLOAT(offset)   (*((jfloat*)&locals[-(offset)]))
22849
b8670e920530 8028514: PPC64: Fix C++ Interpreter after '7195622: CheckUnhandledOops has limited usefulness now'
simonis
parents: 7397
diff changeset
    97
#define LOCALS_OBJECT(offset)  (cast_to_oop(locals[-(offset)]))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#define LOCALS_DOUBLE(offset)  (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
#define LOCALS_LONG(offset)    (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
#define SET_LOCALS_SLOT(value, offset)    (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
#define SET_LOCALS_ADDR(value, offset)    (*((address *)&locals[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
#define SET_LOCALS_INT(value, offset)     (*((jint *)&locals[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
#define SET_LOCALS_FLOAT(value, offset)   (*((jfloat *)&locals[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
#define SET_LOCALS_OBJECT(value, offset)  (*((oop *)&locals[-(offset)]) = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
#define SET_LOCALS_DOUBLE(value, offset)  (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
#define SET_LOCALS_LONG(value, offset)    (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
                                                  ((VMJavaVal64*)(addr))->d)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
                                                ((VMJavaVal64*)(addr))->l)
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   114
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   115
#endif // CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP