changeset 40893:12787d18650e

8163150: SA: CLHSDB printmdo throws an exception with "java.lang.InternalError: missing reason for 22" Summary: Accounted for the new JVMCI related Deoptimization Reasons. Reviewed-by: dsamersoff, sla Contributed-by: jini.george@oracle.com
author dsamersoff
date Wed, 31 Aug 2016 11:47:14 +0300
parents 330a02d935ad
children 7d17619c0140
files hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodData.java hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java hotspot/src/share/vm/runtime/vmStructs.cpp
diffstat 4 files changed, 44 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue Aug 30 23:48:16 2016 -0400
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodData.java	Wed Aug 31 11:47:14 2016 +0300
@@ -36,6 +36,7 @@
 public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
   static int TypeProfileWidth = 2;
   static int BciProfileWidth = 2;
+  static int MethodProfileWidth = 0;
   static int CompileThreshold;
 
   static int Reason_many;                 // indicates presence of several reasons
@@ -142,6 +143,8 @@
         TypeProfileWidth = (int)flag.getIntx();
       } else if (flag.getName().equals("BciProfileWidth")) {
         BciProfileWidth = (int)flag.getIntx();
+      } else if (flag.getName().equals("MethodProfileWidth")) {
+        MethodProfileWidth = (int)flag.getIntx();
       } else if (flag.getName().equals("CompileThreshold")) {
         CompileThreshold = (int)flag.getIntx();
       }
@@ -154,7 +157,7 @@
 
     parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0);
 
-    sizeofMethodDataOopDesc = (int)type.getSize();;
+    sizeofMethodDataOopDesc = (int)type.getSize();
 
     Reason_many            = db.lookupIntConstant("Deoptimization::Reason_many").intValue();
     Reason_none            = db.lookupIntConstant("Deoptimization::Reason_none").intValue();
@@ -257,7 +260,7 @@
 
   ParametersTypeData<Klass,Method> parametersTypeData() {
     int di = (int)parametersTypeDataDi.getValue(getAddress());
-    if (di == -1) {
+    if (di == -1 || di == -2) {
       return null;
     }
     DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset());
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue Aug 30 23:48:16 2016 -0400
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Wed Aug 31 11:47:14 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,9 +38,21 @@
 // that the check is reached, and a series of (Klass, count) pairs
 // which are used to store a type profile for the receiver of the check.
 public class ReceiverTypeData<K,M> extends CounterData {
-  static final int   receiver0Offset = counterCellCount;
-  static final int     count0Offset = receiver0Offset + 1;
-  static final int     receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  static final int INCLUDE_JVMCI;
+  static final int nonProfiledCountOffset = counterCellCount;
+  static final int receiver0Offset;
+  static final int count0Offset;
+  static final int receiverTypeRowCellCount;
+  static {
+    INCLUDE_JVMCI = VM.getVM().getTypeDataBase().lookupIntConstant("INCLUDE_JVMCI");
+    if (INCLUDE_JVMCI == 1) {
+        receiver0Offset = nonProfiledCountOffset + 1;
+    } else {
+        receiver0Offset = counterCellCount;
+    }
+    count0Offset = receiver0Offset + 1;
+    receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  }
   final MethodDataInterface<K,M> methodData;
 
   public ReceiverTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
@@ -53,7 +65,11 @@
   boolean isReceivertypedata() { return true; }
 
   static int staticCellCount() {
-    return counterCellCount + MethodData.TypeProfileWidth * receiverTypeRowCellCount;
+    int cellCount = counterCellCount + MethodData.TypeProfileWidth * receiverTypeRowCellCount;
+    if (INCLUDE_JVMCI == 1) {
+      cellCount += 1;
+    }
+    return cellCount;
   }
 
   public int cellCount() {
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue Aug 30 23:48:16 2016 -0400
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Wed Aug 31 11:47:14 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,11 @@
   static int staticCellCount() {
     // At this point we could add more profile state, e.g., for arguments.
     // But for now it's the same size as the base record type.
-    return ReceiverTypeData.staticCellCount();
+    int cellCount = ReceiverTypeData.staticCellCount();
+    if (INCLUDE_JVMCI == 1) {
+      cellCount += MethodData.MethodProfileWidth * receiverTypeRowCellCount;
+    }
+    return cellCount;
   }
 
   public int cellCount() {
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Tue Aug 30 23:48:16 2016 -0400
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Aug 31 11:47:14 2016 +0300
@@ -2626,6 +2626,11 @@
   declare_constant(Deoptimization::Reason_rtm_state_change)               \
   declare_constant(Deoptimization::Reason_unstable_if)                    \
   declare_constant(Deoptimization::Reason_unstable_fused_if)              \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_aliasing)))                       \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_transfer_to_interpreter)))        \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_not_compiled_exception_handler))) \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_unresolved)))                     \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_jsr_mismatch)))                   \
   declare_constant(Deoptimization::Reason_tenured)                        \
   declare_constant(Deoptimization::Reason_LIMIT)                          \
   declare_constant(Deoptimization::Reason_RECORDED_LIMIT)                 \
@@ -2750,7 +2755,13 @@
   declare_constant(ConcreteRegisterImpl::number_of_registers)             \
   declare_preprocessor_constant("REG_COUNT", REG_COUNT)                \
   declare_c2_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT) \
-  declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT)
+  declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT) \
+                                                                          \
+  /****************/                                                      \
+  /* JVMCI */                                                             \
+  /****************/                                                      \
+                                                                          \
+  declare_preprocessor_constant("INCLUDE_JVMCI", INCLUDE_JVMCI)
 
 
 //--------------------------------------------------------------------------------