src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 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  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import jdk.vm.ci.meta.JavaMethodProfile;
  26 import jdk.vm.ci.meta.JavaTypeProfile;
  27 import jdk.vm.ci.meta.ProfilingInfo;
  28 import jdk.vm.ci.meta.TriState;
  29 
  30 /**
  31  * Base class for accessing the different kinds of data in a HotSpot {@code MethodData}. This is
  32  * similar to {@link ProfilingInfo}, but most methods require a {@link HotSpotMethodData} and the
  33  * exact position within the method data.
  34  */
  35 abstract class HotSpotMethodDataAccessor {
  36 
  37     final int tag;
  38     final int staticSize;

  39     final HotSpotVMConfig config;
  40 
  41     protected HotSpotMethodDataAccessor(HotSpotVMConfig config, int tag, int staticSize) {
  42         this.config = config;

  43         this.tag = tag;
  44         this.staticSize = staticSize;
  45     }
  46 
  47     /**
  48      * Returns the tag stored in the LayoutData header.
  49      *
  50      * @return tag stored in the LayoutData header
  51      */
  52     int getTag() {
  53         return tag;
  54     }
  55 
  56     static int readTag(HotSpotVMConfig config, HotSpotMethodData data, int position) {
  57         final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
  58         assert tag >= config.dataLayoutNoTag && tag <= config.dataLayoutSpeculativeTrapDataTag : "profile data tag out of bounds: " + tag;
  59         return tag;
  60     }
  61 
  62     /**


   1 /*
   2  * Copyright (c) 2011, 2019, 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  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import jdk.vm.ci.meta.JavaMethodProfile;
  26 import jdk.vm.ci.meta.JavaTypeProfile;
  27 import jdk.vm.ci.meta.ProfilingInfo;
  28 import jdk.vm.ci.meta.TriState;
  29 
  30 /**
  31  * Base class for accessing the different kinds of data in a HotSpot {@code MethodData}. This is
  32  * similar to {@link ProfilingInfo}, but most methods require a {@link HotSpotMethodData} and the
  33  * exact position within the method data.
  34  */
  35 abstract class HotSpotMethodDataAccessor {
  36 
  37     final int tag;
  38     final int staticSize;
  39     final HotSpotMethodData.VMState state;
  40     final HotSpotVMConfig config;
  41 
  42     protected HotSpotMethodDataAccessor(HotSpotMethodData.VMState state, int tag, int staticSize) {
  43         this.state = state;
  44         this.config = state.config;
  45         this.tag = tag;
  46         this.staticSize = staticSize;
  47     }
  48 
  49     /**
  50      * Returns the tag stored in the LayoutData header.
  51      *
  52      * @return tag stored in the LayoutData header
  53      */
  54     int getTag() {
  55         return tag;
  56     }
  57 
  58     static int readTag(HotSpotVMConfig config, HotSpotMethodData data, int position) {
  59         final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
  60         assert tag >= config.dataLayoutNoTag && tag <= config.dataLayoutSpeculativeTrapDataTag : "profile data tag out of bounds: " + tag;
  61         return tag;
  62     }
  63 
  64     /**


src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File