src/cpu/x86/vm/interpreterRT_x86_32.cpp

Mon, 09 Mar 2009 13:28:46 -0700

author
xdono
date
Mon, 09 Mar 2009 13:28:46 -0700
changeset 1014
0fbdb4381b99
parent 968
dc3ad84615cf
child 1861
2338d41fbd81
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

duke@435 1 /*
xdono@1014 2 * Copyright 1998-2009 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 #include "incls/_precompiled.incl"
duke@435 26 #include "incls/_interpreterRT_x86_32.cpp.incl"
duke@435 27
duke@435 28
duke@435 29 #define __ _masm->
duke@435 30
duke@435 31
duke@435 32 // Implementation of SignatureHandlerGenerator
duke@435 33 void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
duke@435 34 move(offset(), jni_offset() + 1);
duke@435 35 }
duke@435 36
duke@435 37 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
duke@435 38 move(offset(), jni_offset() + 2);
duke@435 39 move(offset() + 1, jni_offset() + 1);
duke@435 40 }
duke@435 41
duke@435 42 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
duke@435 43 box (offset(), jni_offset() + 1);
duke@435 44 }
duke@435 45
duke@435 46 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) {
duke@435 47 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
duke@435 48 __ movl(Address(to(), to_offset * wordSize), temp());
duke@435 49 }
duke@435 50
duke@435 51
duke@435 52 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) {
never@739 53 __ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
never@739 54 __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI
duke@435 55 Label L;
duke@435 56 __ jcc(Assembler::notZero, L);
xlu@947 57 __ movptr(temp(), NULL_WORD);
duke@435 58 __ bind(L);
never@739 59 __ movptr(Address(to(), to_offset * wordSize), temp());
duke@435 60 }
duke@435 61
duke@435 62
duke@435 63 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) {
duke@435 64 // generate code to handle arguments
duke@435 65 iterate(fingerprint);
duke@435 66 // return result handler
duke@435 67 __ lea(rax,
duke@435 68 ExternalAddress((address)Interpreter::result_handler(method()->result_type())));
duke@435 69 // return
duke@435 70 __ ret(0);
duke@435 71 __ flush();
duke@435 72 }
duke@435 73
duke@435 74
duke@435 75 Register InterpreterRuntime::SignatureHandlerGenerator::from() { return rdi; }
duke@435 76 Register InterpreterRuntime::SignatureHandlerGenerator::to() { return rsp; }
duke@435 77 Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rcx; }
duke@435 78
duke@435 79
duke@435 80 // Implementation of SignatureHandlerLibrary
duke@435 81
duke@435 82 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
duke@435 83
duke@435 84 class SlowSignatureHandler: public NativeSignatureIterator {
duke@435 85 private:
duke@435 86 address _from;
duke@435 87 intptr_t* _to;
duke@435 88
duke@435 89 #ifdef ASSERT
duke@435 90 void verify_tag(frame::Tag t) {
duke@435 91 assert(!TaggedStackInterpreter ||
duke@435 92 *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag");
duke@435 93 }
duke@435 94 #endif // ASSERT
duke@435 95
duke@435 96 virtual void pass_int() {
duke@435 97 *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
duke@435 98 debug_only(verify_tag(frame::TagValue));
duke@435 99 _from -= Interpreter::stackElementSize();
duke@435 100 }
duke@435 101
duke@435 102 virtual void pass_long() {
duke@435 103 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
duke@435 104 _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
duke@435 105 debug_only(verify_tag(frame::TagValue));
duke@435 106 _to += 2;
duke@435 107 _from -= 2*Interpreter::stackElementSize();
duke@435 108 }
duke@435 109
duke@435 110 virtual void pass_object() {
duke@435 111 // pass address of from
duke@435 112 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0));
xlu@968 113 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr;
duke@435 114 debug_only(verify_tag(frame::TagReference));
duke@435 115 _from -= Interpreter::stackElementSize();
duke@435 116 }
duke@435 117
duke@435 118 public:
duke@435 119 SlowSignatureHandler(methodHandle method, address from, intptr_t* to) :
duke@435 120 NativeSignatureIterator(method) {
duke@435 121 _from = from;
duke@435 122 _to = to + (is_static() ? 2 : 1);
duke@435 123 }
duke@435 124 };
duke@435 125
duke@435 126 IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, methodOopDesc* method, intptr_t* from, intptr_t* to))
duke@435 127 methodHandle m(thread, (methodOop)method);
duke@435 128 assert(m->is_native(), "sanity check");
duke@435 129 // handle arguments
duke@435 130 SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1));
duke@435 131 // return result handler
duke@435 132 return Interpreter::result_handler(m->result_type());
duke@435 133 IRT_END

mercurial