< prev index next >

src/cpu/sparc/vm/interp_masm_sparc.cpp

Print this page
   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


 779               // and from word index to byte offset
 780   sll(tmp, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord), tmp);
 781               // skip past the header
 782   add(tmp, in_bytes(ConstantPoolCache::base_offset()), tmp);
 783               // construct pointer to cache entry
 784   add(LcpoolCache, tmp, cache);
 785 }
 786 
 787 
 788 // Load object from cpool->resolved_references(index)
 789 void InterpreterMacroAssembler::load_resolved_reference_at_index(
 790                                            Register result, Register index) {
 791   assert_different_registers(result, index);
 792   assert_not_delayed();
 793   // convert from field index to resolved_references() index and from
 794   // word index to byte offset. Since this is a java object, it can be compressed
 795   Register tmp = index;  // reuse
 796   sll(index, LogBytesPerHeapOop, tmp);
 797   get_constant_pool(result);
 798   // load pointer for resolved_references[] objArray
 799   ld_ptr(result, ConstantPool::resolved_references_offset_in_bytes(), result);

 800   // JNIHandles::resolve(result)
 801   ld_ptr(result, 0, result);
 802   // Add in the index
 803   add(result, tmp, result);
 804   load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result);


















 805 }
 806 
 807 
 808 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
 809 // a subtype of super_klass.  Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2.
 810 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 811                                                   Register Rsuper_klass,
 812                                                   Register Rtmp1,
 813                                                   Register Rtmp2,
 814                                                   Register Rtmp3,
 815                                                   Label &ok_is_subtype ) {
 816   Label not_subtype;
 817 
 818   // Profile the not-null value's klass.
 819   profile_typecheck(Rsub_klass, Rtmp1);
 820 
 821   check_klass_subtype_fast_path(Rsub_klass, Rsuper_klass,
 822                                 Rtmp1, Rtmp2,
 823                                 &ok_is_subtype, &not_subtype, NULL);
 824 


   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  *


 779               // and from word index to byte offset
 780   sll(tmp, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord), tmp);
 781               // skip past the header
 782   add(tmp, in_bytes(ConstantPoolCache::base_offset()), tmp);
 783               // construct pointer to cache entry
 784   add(LcpoolCache, tmp, cache);
 785 }
 786 
 787 
 788 // Load object from cpool->resolved_references(index)
 789 void InterpreterMacroAssembler::load_resolved_reference_at_index(
 790                                            Register result, Register index) {
 791   assert_different_registers(result, index);
 792   assert_not_delayed();
 793   // convert from field index to resolved_references() index and from
 794   // word index to byte offset. Since this is a java object, it can be compressed
 795   Register tmp = index;  // reuse
 796   sll(index, LogBytesPerHeapOop, tmp);
 797   get_constant_pool(result);
 798   // load pointer for resolved_references[] objArray
 799   ld_ptr(result, ConstantPool::cache_offset_in_bytes(), result);
 800   ld_ptr(result, ConstantPoolCache::resolved_references_offset_in_bytes(), result);
 801   // JNIHandles::resolve(result)
 802   ld_ptr(result, 0, result);
 803   // Add in the index
 804   add(result, tmp, result);
 805   load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result);
 806 }
 807 
 808 
 809 // load cpool->resolved_klass_at(index)
 810 void InterpreterMacroAssembler::load_resolved_klass_at_offset(Register Rcpool,
 811                                            Register Roffset, Register Rklass) {
 812   // int value = *this_cp->int_at_addr(which);
 813   // int resolved_klass_index = extract_low_short_from_int(value);
 814   //
 815   // Because SPARC is big-endian, the low_short is at (cpool->int_at_addr(which) + 2 bytes)
 816   add(Roffset, Rcpool, Roffset);
 817   lduh(Roffset, sizeof(ConstantPool) + 2, Roffset);  // Roffset = resolved_klass_index
 818 
 819   Register Rresolved_klasses = Rklass;
 820   ld_ptr(Rcpool, ConstantPool::resolved_klasses_offset_in_bytes(), Rresolved_klasses);
 821   sll(Roffset, LogBytesPerWord, Roffset); 
 822   add(Roffset, Array<Klass*>::base_offset_in_bytes(), Roffset);
 823   ld_ptr(Rresolved_klasses, Roffset, Rklass);
 824 }
 825 
 826 
 827 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
 828 // a subtype of super_klass.  Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2.
 829 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 830                                                   Register Rsuper_klass,
 831                                                   Register Rtmp1,
 832                                                   Register Rtmp2,
 833                                                   Register Rtmp3,
 834                                                   Label &ok_is_subtype ) {
 835   Label not_subtype;
 836 
 837   // Profile the not-null value's klass.
 838   profile_typecheck(Rsub_klass, Rtmp1);
 839 
 840   check_klass_subtype_fast_path(Rsub_klass, Rsuper_klass,
 841                                 Rtmp1, Rtmp2,
 842                                 &ok_is_subtype, &not_subtype, NULL);
 843 


< prev index next >