1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
492 // and from word offset to byte offset
493 assert(exact_log2(in_bytes(ConstantPoolCacheEntry::size_in_bytes())) == 2 + LogBytesPerWord, "else change next line");
494 shll(tmp, 2 + LogBytesPerWord);
495 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
496 // skip past the header
497 addptr(cache, in_bytes(ConstantPoolCache::base_offset()));
498 addptr(cache, tmp); // construct pointer to cache entry
499 }
500
501 // Load object from cpool->resolved_references(index)
502 void InterpreterMacroAssembler::load_resolved_reference_at_index(
503 Register result, Register index) {
504 assert_different_registers(result, index);
505 // convert from field index to resolved_references() index and from
506 // word index to byte offset. Since this is a java object, it can be compressed
507 Register tmp = index; // reuse
508 shll(tmp, LogBytesPerHeapOop);
509
510 get_constant_pool(result);
511 // load pointer for resolved_references[] objArray
512 movptr(result, Address(result, ConstantPool::resolved_references_offset_in_bytes()));
513 // JNIHandles::resolve(obj);
514 movptr(result, Address(result, 0));
515 // Add in the index
516 addptr(result, tmp);
517 load_heap_oop(result, Address(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
518 }
519
520
521 // Generate a subtype check: branch to ok_is_subtype if sub_klass is a
522 // subtype of super_klass.
523 //
524 // Args:
525 // rax: superklass
526 // Rsub_klass: subklass
527 //
528 // Kills:
529 // rcx, rdi
530 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
531 Label& ok_is_subtype) {
532 assert(Rsub_klass != rax, "rax holds superklass");
533 LP64_ONLY(assert(Rsub_klass != r14, "r14 holds locals");)
534 LP64_ONLY(assert(Rsub_klass != r13, "r13 holds bcp");)
535 assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
536 assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr");
537
538 // Profile the not-null value's klass.
539 profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
492 // and from word offset to byte offset
493 assert(exact_log2(in_bytes(ConstantPoolCacheEntry::size_in_bytes())) == 2 + LogBytesPerWord, "else change next line");
494 shll(tmp, 2 + LogBytesPerWord);
495 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
496 // skip past the header
497 addptr(cache, in_bytes(ConstantPoolCache::base_offset()));
498 addptr(cache, tmp); // construct pointer to cache entry
499 }
500
501 // Load object from cpool->resolved_references(index)
502 void InterpreterMacroAssembler::load_resolved_reference_at_index(
503 Register result, Register index) {
504 assert_different_registers(result, index);
505 // convert from field index to resolved_references() index and from
506 // word index to byte offset. Since this is a java object, it can be compressed
507 Register tmp = index; // reuse
508 shll(tmp, LogBytesPerHeapOop);
509
510 get_constant_pool(result);
511 // load pointer for resolved_references[] objArray
512 movptr(result, Address(result, ConstantPool::cache_offset_in_bytes()));
513 movptr(result, Address(result, ConstantPoolCache::resolved_references_offset_in_bytes()));
514 // JNIHandles::resolve(obj);
515 movptr(result, Address(result, 0));
516 // Add in the index
517 addptr(result, tmp);
518 load_heap_oop(result, Address(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
519 }
520
521 // load cpool->resolved_klass_at(index)
522 void InterpreterMacroAssembler::load_resolved_klass_at_index(Register cpool,
523 Register index, Register klass) {
524 movw(index, Address(cpool, index, Address::times_ptr, sizeof(ConstantPool)));
525 Register resolved_klasses = cpool;
526 movptr(resolved_klasses, Address(cpool, ConstantPool::resolved_klasses_offset_in_bytes()));
527 movptr(klass, Address(resolved_klasses, index, Address::times_ptr, Array<Klass*>::base_offset_in_bytes()));
528 }
529
530 // Generate a subtype check: branch to ok_is_subtype if sub_klass is a
531 // subtype of super_klass.
532 //
533 // Args:
534 // rax: superklass
535 // Rsub_klass: subklass
536 //
537 // Kills:
538 // rcx, rdi
539 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
540 Label& ok_is_subtype) {
541 assert(Rsub_klass != rax, "rax holds superklass");
542 LP64_ONLY(assert(Rsub_klass != r14, "r14 holds locals");)
543 LP64_ONLY(assert(Rsub_klass != r13, "r13 holds bcp");)
544 assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
545 assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr");
546
547 // Profile the not-null value's klass.
548 profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi
|