Mercurial > hg > truffle
comparison src/cpu/x86/vm/cppInterpreter_x86.cpp @ 6123:2fe087c3e814
7172967: Eliminate constMethod's _method backpointer to methodOop.
Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod.
Reviewed-by: roland, bdelsart, kamg
author | jiangli |
---|---|
date | Wed, 06 Jun 2012 14:33:43 -0400 |
parents | 069ab3f976d3 |
children | 1d7922586cf6 |
comparison
equal
deleted
inserted
replaced
6115:6e2633440960 | 6123:2fe087c3e814 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
479 __ movptr(STATE(_bcp), rdx); // state->_bcp = codes() | 479 __ movptr(STATE(_bcp), rdx); // state->_bcp = codes() |
480 } | 480 } |
481 __ xorptr(rdx, rdx); | 481 __ xorptr(rdx, rdx); |
482 __ movptr(STATE(_oop_temp), rdx); // state->_oop_temp = NULL (only really needed for native) | 482 __ movptr(STATE(_oop_temp), rdx); // state->_oop_temp = NULL (only really needed for native) |
483 __ movptr(STATE(_mdx), rdx); // state->_mdx = NULL | 483 __ movptr(STATE(_mdx), rdx); // state->_mdx = NULL |
484 __ movptr(rdx, Address(rbx, methodOopDesc::constants_offset())); | 484 __ movptr(rdx, Address(rbx, methodOopDesc::const_offset())); |
485 __ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset())); | |
485 __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes())); | 486 __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes())); |
486 __ movptr(STATE(_constants), rdx); // state->_constants = constants() | 487 __ movptr(STATE(_constants), rdx); // state->_constants = constants() |
487 | 488 |
488 __ movptr(STATE(_method), rbx); // state->_method = method() | 489 __ movptr(STATE(_method), rbx); // state->_method = method() |
489 __ movl(STATE(_msg), (int32_t) BytecodeInterpreter::method_entry); // state->_msg = initial method entry | 490 __ movl(STATE(_msg), (int32_t) BytecodeInterpreter::method_entry); // state->_msg = initial method entry |
514 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); | 515 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
515 __ movl(rax, access_flags); | 516 __ movl(rax, access_flags); |
516 __ testl(rax, JVM_ACC_STATIC); | 517 __ testl(rax, JVM_ACC_STATIC); |
517 __ movptr(rax, Address(locals, 0)); // get receiver (assume this is frequent case) | 518 __ movptr(rax, Address(locals, 0)); // get receiver (assume this is frequent case) |
518 __ jcc(Assembler::zero, done); | 519 __ jcc(Assembler::zero, done); |
519 __ movptr(rax, Address(rbx, methodOopDesc::constants_offset())); | 520 __ movptr(rax, Address(rbx, methodOopDesc::const_offset())); |
521 __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset())); | |
520 __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes())); | 522 __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes())); |
521 __ movptr(rax, Address(rax, mirror_offset)); | 523 __ movptr(rax, Address(rax, mirror_offset)); |
522 __ bind(done); | 524 __ bind(done); |
523 // add space for monitor & lock | 525 // add space for monitor & lock |
524 __ subptr(rsp, entry_size); // add space for a monitor entry | 526 __ subptr(rsp, entry_size); // add space for a monitor entry |
767 __ movl(rax, access_flags); | 769 __ movl(rax, access_flags); |
768 __ movptr(rdi, STATE(_locals)); // prepare to get receiver (assume common case) | 770 __ movptr(rdi, STATE(_locals)); // prepare to get receiver (assume common case) |
769 __ testl(rax, JVM_ACC_STATIC); | 771 __ testl(rax, JVM_ACC_STATIC); |
770 __ movptr(rax, Address(rdi, 0)); // get receiver (assume this is frequent case) | 772 __ movptr(rax, Address(rdi, 0)); // get receiver (assume this is frequent case) |
771 __ jcc(Assembler::zero, done); | 773 __ jcc(Assembler::zero, done); |
772 __ movptr(rax, Address(rbx, methodOopDesc::constants_offset())); | 774 __ movptr(rax, Address(rbx, methodOopDesc::const_offset())); |
775 __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset())); | |
773 __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes())); | 776 __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes())); |
774 __ movptr(rax, Address(rax, mirror_offset)); | 777 __ movptr(rax, Address(rax, mirror_offset)); |
775 __ bind(done); | 778 __ bind(done); |
776 } | 779 } |
777 #ifdef ASSERT | 780 #ifdef ASSERT |
819 | 822 |
820 // check if local 0 != NULL and read field | 823 // check if local 0 != NULL and read field |
821 __ testptr(rax, rax); | 824 __ testptr(rax, rax); |
822 __ jcc(Assembler::zero, slow_path); | 825 __ jcc(Assembler::zero, slow_path); |
823 | 826 |
824 __ movptr(rdi, Address(rbx, methodOopDesc::constants_offset())); | |
825 // read first instruction word and extract bytecode @ 1 and index @ 2 | 827 // read first instruction word and extract bytecode @ 1 and index @ 2 |
826 __ movptr(rdx, Address(rbx, methodOopDesc::const_offset())); | 828 __ movptr(rdx, Address(rbx, methodOopDesc::const_offset())); |
829 __ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset())); | |
827 __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset())); | 830 __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset())); |
828 // Shift codes right to get the index on the right. | 831 // Shift codes right to get the index on the right. |
829 // The bytecode fetched looks like <index><0xb4><0x2a> | 832 // The bytecode fetched looks like <index><0xb4><0x2a> |
830 __ shrl(rdx, 2*BitsPerByte); | 833 __ shrl(rdx, 2*BitsPerByte); |
831 __ shll(rdx, exact_log2(in_words(ConstantPoolCacheEntry::size()))); | 834 __ shll(rdx, exact_log2(in_words(ConstantPoolCacheEntry::size()))); |
1183 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); | 1186 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
1184 __ movl(t, Address(method, methodOopDesc::access_flags_offset())); | 1187 __ movl(t, Address(method, methodOopDesc::access_flags_offset())); |
1185 __ testl(t, JVM_ACC_STATIC); | 1188 __ testl(t, JVM_ACC_STATIC); |
1186 __ jcc(Assembler::zero, L); | 1189 __ jcc(Assembler::zero, L); |
1187 // get mirror | 1190 // get mirror |
1188 __ movptr(t, Address(method, methodOopDesc:: constants_offset())); | 1191 __ movptr(t, Address(method, methodOopDesc:: const_offset())); |
1192 __ movptr(t, Address(t, constMethodOopDesc::constants_offset())); | |
1189 __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes())); | 1193 __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes())); |
1190 __ movptr(t, Address(t, mirror_offset)); | 1194 __ movptr(t, Address(t, mirror_offset)); |
1191 // copy mirror into activation object | 1195 // copy mirror into activation object |
1192 __ movptr(STATE(_oop_temp), t); | 1196 __ movptr(STATE(_oop_temp), t); |
1193 // pass handle to mirror | 1197 // pass handle to mirror |