src/cpu/x86/vm/bytecodeInterpreter_x86.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/cpu/x86/vm/bytecodeInterpreter_x86.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,115 @@
     1.4 +/*
     1.5 + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
    1.29 +#define CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
    1.30 +
    1.31 +// Platform specific for C++ based Interpreter
    1.32 +
    1.33 +private:
    1.34 +
    1.35 +    interpreterState _self_link;          /*  Previous interpreter state  */ /* sometimes points to self??? */
    1.36 +    address   _result_handler;            /* temp for saving native result handler */
    1.37 +    intptr_t* _sender_sp;                 /* sender's sp before stack (locals) extension */
    1.38 +
    1.39 +    address   _extra_junk1;               /* temp to save on recompiles */
    1.40 +    address   _extra_junk2;               /* temp to save on recompiles */
    1.41 +    address   _extra_junk3;               /* temp to save on recompiles */
    1.42 +    // address dummy_for_native2;         /* a native frame result handler would be here... */
    1.43 +    // address dummy_for_native1;         /* native result type stored here in a interpreter native frame */
    1.44 +    address   _extra_junk4;               /* temp to save on recompiles */
    1.45 +    address   _extra_junk5;               /* temp to save on recompiles */
    1.46 +    address   _extra_junk6;               /* temp to save on recompiles */
    1.47 +public:
    1.48 +                                                         // we have an interpreter frame...
    1.49 +inline intptr_t* sender_sp() {
    1.50 +  return _sender_sp;
    1.51 +}
    1.52 +
    1.53 +// The interpreter always has the frame anchor fully setup so we don't
    1.54 +// have to do anything going to vm from the interpreter. On return
    1.55 +// we do have to clear the flags in case they we're modified to
    1.56 +// maintain the stack walking invariants.
    1.57 +//
    1.58 +#define SET_LAST_JAVA_FRAME()
    1.59 +
    1.60 +#define RESET_LAST_JAVA_FRAME()
    1.61 +
    1.62 +/*
    1.63 + * Macros for accessing the stack.
    1.64 + */
    1.65 +#undef STACK_INT
    1.66 +#undef STACK_FLOAT
    1.67 +#undef STACK_ADDR
    1.68 +#undef STACK_OBJECT
    1.69 +#undef STACK_DOUBLE
    1.70 +#undef STACK_LONG
    1.71 +
    1.72 +// JavaStack Implementation
    1.73 +
    1.74 +#define GET_STACK_SLOT(offset)    (*((intptr_t*) &topOfStack[-(offset)]))
    1.75 +#define STACK_SLOT(offset)    ((address) &topOfStack[-(offset)])
    1.76 +#define STACK_ADDR(offset)    (*((address *) &topOfStack[-(offset)]))
    1.77 +#define STACK_INT(offset)     (*((jint*) &topOfStack[-(offset)]))
    1.78 +#define STACK_FLOAT(offset)   (*((jfloat *) &topOfStack[-(offset)]))
    1.79 +#define STACK_OBJECT(offset)  (*((oop *) &topOfStack [-(offset)]))
    1.80 +#define STACK_DOUBLE(offset)  (((VMJavaVal64*) &topOfStack[-(offset)])->d)
    1.81 +#define STACK_LONG(offset)    (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
    1.82 +
    1.83 +#define SET_STACK_SLOT(value, offset)   (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
    1.84 +#define SET_STACK_ADDR(value, offset)   (*((address *)&topOfStack[-(offset)]) = (value))
    1.85 +#define SET_STACK_INT(value, offset)    (*((jint *)&topOfStack[-(offset)]) = (value))
    1.86 +#define SET_STACK_FLOAT(value, offset)  (*((jfloat *)&topOfStack[-(offset)]) = (value))
    1.87 +#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
    1.88 +#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
    1.89 +#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d =  \
    1.90 +                                                 ((VMJavaVal64*)(addr))->d)
    1.91 +#define SET_STACK_LONG(value, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
    1.92 +#define SET_STACK_LONG_FROM_ADDR(addr, offset)   (((VMJavaVal64*)&topOfStack[-(offset)])->l =  \
    1.93 +                                                 ((VMJavaVal64*)(addr))->l)
    1.94 +// JavaLocals implementation
    1.95 +
    1.96 +#define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
    1.97 +#define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
    1.98 +#define LOCALS_INT(offset)     ((jint)(locals[-(offset)]))
    1.99 +#define LOCALS_FLOAT(offset)   (*((jfloat*)&locals[-(offset)]))
   1.100 +#define LOCALS_OBJECT(offset)  (cast_to_oop(locals[-(offset)]))
   1.101 +#define LOCALS_DOUBLE(offset)  (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
   1.102 +#define LOCALS_LONG(offset)    (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
   1.103 +#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
   1.104 +#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
   1.105 +
   1.106 +#define SET_LOCALS_SLOT(value, offset)    (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
   1.107 +#define SET_LOCALS_ADDR(value, offset)    (*((address *)&locals[-(offset)]) = (value))
   1.108 +#define SET_LOCALS_INT(value, offset)     (*((jint *)&locals[-(offset)]) = (value))
   1.109 +#define SET_LOCALS_FLOAT(value, offset)   (*((jfloat *)&locals[-(offset)]) = (value))
   1.110 +#define SET_LOCALS_OBJECT(value, offset)  (*((oop *)&locals[-(offset)]) = (value))
   1.111 +#define SET_LOCALS_DOUBLE(value, offset)  (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
   1.112 +#define SET_LOCALS_LONG(value, offset)    (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
   1.113 +#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
   1.114 +                                                  ((VMJavaVal64*)(addr))->d)
   1.115 +#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
   1.116 +                                                ((VMJavaVal64*)(addr))->l)
   1.117 +
   1.118 +#endif // CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP

mercurial