src/share/vm/ci/ciInstanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8014013 Sdiff src/share/vm/ci

src/share/vm/ci/ciInstanceKlass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2012, 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  *


 505   InstanceKlass* k = get_instanceKlass();
 506   for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
 507     if (fs.access_flags().is_static())  continue;
 508     flen += 1;
 509   }
 510 
 511   // allocate the array:
 512   if (flen == 0) {
 513     return NULL;  // return nothing if none are locally declared
 514   }
 515   if (super_fields != NULL) {
 516     flen += super_fields->length();
 517   }
 518   fields = new (arena) GrowableArray<ciField*>(arena, flen, 0, NULL);
 519   if (super_fields != NULL) {
 520     fields->appendAll(super_fields);
 521   }
 522 
 523   for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
 524     if (fs.access_flags().is_static())  continue;
 525     fieldDescriptor fd;
 526     fd.initialize(k, fs.index());
 527     ciField* field = new (arena) ciField(&fd);
 528     fields->append(field);
 529   }
 530   assert(fields->length() == flen, "sanity");
 531   return fields;
 532 }
 533 
 534 // ------------------------------------------------------------------
 535 // ciInstanceKlass::find_method
 536 //
 537 // Find a method in this klass.
 538 ciMethod* ciInstanceKlass::find_method(ciSymbol* name, ciSymbol* signature) {
 539   VM_ENTRY_MARK;
 540   InstanceKlass* k = get_instanceKlass();
 541   Symbol* name_sym = name->get_symbol();
 542   Symbol* sig_sym= signature->get_symbol();
 543 
 544   Method* m = k->find_method(name_sym, sig_sym);
 545   if (m == NULL)  return NULL;
 546 


   1 /*
   2  * Copyright (c) 1999, 2013, 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  *


 505   InstanceKlass* k = get_instanceKlass();
 506   for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
 507     if (fs.access_flags().is_static())  continue;
 508     flen += 1;
 509   }
 510 
 511   // allocate the array:
 512   if (flen == 0) {
 513     return NULL;  // return nothing if none are locally declared
 514   }
 515   if (super_fields != NULL) {
 516     flen += super_fields->length();
 517   }
 518   fields = new (arena) GrowableArray<ciField*>(arena, flen, 0, NULL);
 519   if (super_fields != NULL) {
 520     fields->appendAll(super_fields);
 521   }
 522 
 523   for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
 524     if (fs.access_flags().is_static())  continue;
 525     fieldDescriptor& fd = fs.field_descriptor();

 526     ciField* field = new (arena) ciField(&fd);
 527     fields->append(field);
 528   }
 529   assert(fields->length() == flen, "sanity");
 530   return fields;
 531 }
 532 
 533 // ------------------------------------------------------------------
 534 // ciInstanceKlass::find_method
 535 //
 536 // Find a method in this klass.
 537 ciMethod* ciInstanceKlass::find_method(ciSymbol* name, ciSymbol* signature) {
 538   VM_ENTRY_MARK;
 539   InstanceKlass* k = get_instanceKlass();
 540   Symbol* name_sym = name->get_symbol();
 541   Symbol* sig_sym= signature->get_symbol();
 542 
 543   Method* m = k->find_method(name_sym, sig_sym);
 544   if (m == NULL)  return NULL;
 545 


src/share/vm/ci/ciInstanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File