src/cpu/x86/vm/interpreterRT_x86_32.cpp

Fri, 25 Jan 2013 10:04:08 -0500

author
zgu
date
Fri, 25 Jan 2013 10:04:08 -0500
changeset 4492
8b46b0196eb0
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8000692: Remove old KERNEL code
Summary: Removed depreciated kernel VM source code from hotspot VM
Reviewed-by: dholmes, acorn

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "interpreter/interpreter.hpp"
stefank@2314 27 #include "interpreter/interpreterRuntime.hpp"
stefank@2314 28 #include "memory/allocation.inline.hpp"
stefank@2314 29 #include "memory/universe.inline.hpp"
coleenp@4037 30 #include "oops/method.hpp"
stefank@2314 31 #include "oops/oop.inline.hpp"
stefank@2314 32 #include "runtime/handles.inline.hpp"
stefank@2314 33 #include "runtime/icache.hpp"
stefank@2314 34 #include "runtime/interfaceSupport.hpp"
stefank@2314 35 #include "runtime/signature.hpp"
duke@435 36
duke@435 37
duke@435 38 #define __ _masm->
duke@435 39
duke@435 40
duke@435 41 // Implementation of SignatureHandlerGenerator
duke@435 42 void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
duke@435 43 move(offset(), jni_offset() + 1);
duke@435 44 }
duke@435 45
bobv@2036 46 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
bobv@2036 47 move(offset(), jni_offset() + 1);
bobv@2036 48 }
bobv@2036 49
duke@435 50 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
duke@435 51 move(offset(), jni_offset() + 2);
duke@435 52 move(offset() + 1, jni_offset() + 1);
duke@435 53 }
duke@435 54
duke@435 55 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
duke@435 56 box (offset(), jni_offset() + 1);
duke@435 57 }
duke@435 58
duke@435 59 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) {
duke@435 60 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
duke@435 61 __ movl(Address(to(), to_offset * wordSize), temp());
duke@435 62 }
duke@435 63
duke@435 64
duke@435 65 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) {
never@739 66 __ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
never@739 67 __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI
duke@435 68 Label L;
duke@435 69 __ jcc(Assembler::notZero, L);
xlu@947 70 __ movptr(temp(), NULL_WORD);
duke@435 71 __ bind(L);
never@739 72 __ movptr(Address(to(), to_offset * wordSize), temp());
duke@435 73 }
duke@435 74
duke@435 75
duke@435 76 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) {
duke@435 77 // generate code to handle arguments
duke@435 78 iterate(fingerprint);
duke@435 79 // return result handler
duke@435 80 __ lea(rax,
duke@435 81 ExternalAddress((address)Interpreter::result_handler(method()->result_type())));
duke@435 82 // return
duke@435 83 __ ret(0);
duke@435 84 __ flush();
duke@435 85 }
duke@435 86
duke@435 87
duke@435 88 Register InterpreterRuntime::SignatureHandlerGenerator::from() { return rdi; }
duke@435 89 Register InterpreterRuntime::SignatureHandlerGenerator::to() { return rsp; }
duke@435 90 Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rcx; }
duke@435 91
duke@435 92
duke@435 93 // Implementation of SignatureHandlerLibrary
duke@435 94
duke@435 95 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
duke@435 96
duke@435 97 class SlowSignatureHandler: public NativeSignatureIterator {
duke@435 98 private:
duke@435 99 address _from;
duke@435 100 intptr_t* _to;
duke@435 101
duke@435 102 virtual void pass_int() {
duke@435 103 *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
twisti@1861 104 _from -= Interpreter::stackElementSize;
duke@435 105 }
duke@435 106
bobv@2036 107 virtual void pass_float() {
bobv@2036 108 *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
bobv@2036 109 _from -= Interpreter::stackElementSize;
bobv@2036 110 }
bobv@2036 111
duke@435 112 virtual void pass_long() {
duke@435 113 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
duke@435 114 _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
duke@435 115 _to += 2;
twisti@1861 116 _from -= 2*Interpreter::stackElementSize;
duke@435 117 }
duke@435 118
duke@435 119 virtual void pass_object() {
duke@435 120 // pass address of from
duke@435 121 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0));
xlu@968 122 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr;
twisti@1861 123 _from -= Interpreter::stackElementSize;
duke@435 124 }
duke@435 125
duke@435 126 public:
duke@435 127 SlowSignatureHandler(methodHandle method, address from, intptr_t* to) :
duke@435 128 NativeSignatureIterator(method) {
duke@435 129 _from = from;
duke@435 130 _to = to + (is_static() ? 2 : 1);
duke@435 131 }
duke@435 132 };
duke@435 133
coleenp@4037 134 IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, Method* method, intptr_t* from, intptr_t* to))
coleenp@4037 135 methodHandle m(thread, (Method*)method);
duke@435 136 assert(m->is_native(), "sanity check");
duke@435 137 // handle arguments
duke@435 138 SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1));
duke@435 139 // return result handler
duke@435 140 return Interpreter::result_handler(m->result_type());
duke@435 141 IRT_END

mercurial