< prev index next >

src/jdk.pack/share/native/common-unpack/unpack.cpp

Print this page
rev 50999 : 8207233: Minor improvements of jdk C-coding
   1 /*
   2  * Copyright (c) 2001, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


2664   for (idx = 0; idx < ad.layouts.length(); idx++) {
2665     if (ad.getLayout(idx) == null)
2666       continue;  // none at this fixed index <32
2667     if (idx < (int)ad.flag_limit && ad.isPredefined(idx))
2668       continue;  // already handled
2669     if (ad.getCount(idx) == 0)
2670       continue;  // no attributes of this type (then why transmit layouts?)
2671     ad.readBandData(idx);
2672   }
2673 }
2674 
2675 void unpacker::attr_definitions::readBandData(int idx) {
2676   int j;
2677   uint count = getCount(idx);
2678   if (count == 0)  return;
2679   layout_definition* lo = getLayout(idx);
2680   if (lo != null) {
2681     PRINTCR((1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
2682             count, isRedefined(idx), isPredefined(idx),
2683             ATTR_CONTEXT_NAME[attrc], lo->name));



2684   }
2685   bool hasCallables = lo->hasCallables();
2686   band** bands = lo->bands();
2687   if (!hasCallables) {
2688     // Read through the rest of the bands in a regular way.
2689     readBandData(bands, count);
2690   } else {
2691     // Deal with the callables.
2692     // First set up the forward entry count for each callable.
2693     // This is stored on band::length of the callable.
2694     bands[0]->expectMoreLength(count);
2695     for (j = 0; bands[j] != null; j++) {
2696       band& j_cble = *bands[j];
2697       assert(j_cble.le_kind == EK_CBLE);
2698       if (j_cble.le_back) {
2699         // Add in the predicted effects of backward calls, too.
2700         int back_calls = xxx_attr_calls().getInt();
2701         j_cble.expectMoreLength(back_calls);
2702         // In a moment, more forward calls may increment j_cble.length.
2703       }


   1 /*
   2  * Copyright (c) 2001, 2018, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


2664   for (idx = 0; idx < ad.layouts.length(); idx++) {
2665     if (ad.getLayout(idx) == null)
2666       continue;  // none at this fixed index <32
2667     if (idx < (int)ad.flag_limit && ad.isPredefined(idx))
2668       continue;  // already handled
2669     if (ad.getCount(idx) == 0)
2670       continue;  // no attributes of this type (then why transmit layouts?)
2671     ad.readBandData(idx);
2672   }
2673 }
2674 
2675 void unpacker::attr_definitions::readBandData(int idx) {
2676   int j;
2677   uint count = getCount(idx);
2678   if (count == 0)  return;
2679   layout_definition* lo = getLayout(idx);
2680   if (lo != null) {
2681     PRINTCR((1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
2682             count, isRedefined(idx), isPredefined(idx),
2683             ATTR_CONTEXT_NAME[attrc], lo->name));
2684   } else {
2685     abort("layout_definition pointer must not be NULL");
2686     return;
2687   }
2688   bool hasCallables = lo->hasCallables();
2689   band** bands = lo->bands();
2690   if (!hasCallables) {
2691     // Read through the rest of the bands in a regular way.
2692     readBandData(bands, count);
2693   } else {
2694     // Deal with the callables.
2695     // First set up the forward entry count for each callable.
2696     // This is stored on band::length of the callable.
2697     bands[0]->expectMoreLength(count);
2698     for (j = 0; bands[j] != null; j++) {
2699       band& j_cble = *bands[j];
2700       assert(j_cble.le_kind == EK_CBLE);
2701       if (j_cble.le_back) {
2702         // Add in the predicted effects of backward calls, too.
2703         int back_calls = xxx_attr_calls().getInt();
2704         j_cble.expectMoreLength(back_calls);
2705         // In a moment, more forward calls may increment j_cble.length.
2706       }


< prev index next >