src/hotspot/share/runtime/vframe_hp.hpp
author dlong
Tue, 18 Dec 2018 12:36:27 -0800
changeset 53065 2f41e4935c34
parent 48607 7fc3d62481ba
child 53244 9807daeb47c4
permissions -rw-r--r--
8215205: javaVFrame much slower than vframeStream Reviewed-by: mchung, thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 13728
diff changeset
     2
 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_VFRAME_HP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_RUNTIME_VFRAME_HP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/vframe.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
class compiledVFrame: public javaVFrame {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  // JVM state
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    33
  Method*                      method()             const;
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 1
diff changeset
    34
  int                          bci()                const;
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 1
diff changeset
    35
  bool                         should_reexecute()   const;
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 1
diff changeset
    36
  StackValueCollection*        locals()             const;
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 1
diff changeset
    37
  StackValueCollection*        expressions()        const;
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 1
diff changeset
    38
  GrowableArray<MonitorInfo*>* monitors()           const;
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
    39
  int                          vframe_id()          const { return _vframe_id; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  void set_locals(StackValueCollection* values) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  // Virtuals defined in vframe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  bool is_compiled_frame() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  vframe* sender() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  bool is_top() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  // Casting
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  static compiledVFrame* cast(vframe* vf) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    return (compiledVFrame*) vf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    54
  void update_deferred_value(BasicType type, int index, jvalue value);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    55
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // Constructors
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 13728
diff changeset
    58
  compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Update a local in a compiled frame. Update happens when deopt occurs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  void update_local(BasicType type, int index, jvalue value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    63
  // Update an expression stack value in a compiled frame. Update happens when deopt occurs
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    64
  void update_stack(BasicType type, int index, jvalue value);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    65
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    66
  // Update a lock value in a compiled frame. Update happens when deopt occurs
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    67
  void update_monitor(int index, MonitorInfo* value);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
    68
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // Returns the active nmethod
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 13728
diff changeset
    70
  CompiledMethod*  code() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  // Returns the scopeDesc
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  ScopeDesc* scope() const { return _scope; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 48607
diff changeset
    75
  // Return the compiledVFrame for the desired scope
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 48607
diff changeset
    76
  compiledVFrame* at_scope(int decode_offset, int vframe_id);
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 48607
diff changeset
    77
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // Returns SynchronizationEntryBCI or bci() (used for synchronization)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  int raw_bci() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  ScopeDesc* _scope;
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
    83
  int _vframe_id;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  //StackValue resolve(ScopeValue* sv) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  BasicLock* resolve_monitor_lock(Location location) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  StackValue *create_stack_value(ScopeValue *sv) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
 private:
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
    90
  compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope, int vframe_id);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  void verify() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
// In order to implement set_locals for compiled vframes we must
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
// store updated locals in a data structure that contains enough
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// information to recognize equality with a vframe and to store
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// any updated locals.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
class jvmtiDeferredLocalVariable;
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 7397
diff changeset
   104
class jvmtiDeferredLocalVariableSet : public CHeapObj<mtCompiler> {
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   105
  friend class compiledVFrame;
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   106
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   109
  Method* _method;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  int       _bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  intptr_t* _id;
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
   112
  int _vframe_id;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  GrowableArray<jvmtiDeferredLocalVariable*>* _locals;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   115
  void                              update_value(StackValueCollection* locals, BasicType type, int index, jvalue value);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   116
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   117
  void                              set_value_at(int idx, BasicType typ, jvalue val);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   118
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // JVM state
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   121
  Method*                           method()         const  { return _method; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  int                               bci()            const  { return _bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  intptr_t*                         id()             const  { return _id; }
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
   124
  int                               vframe_id()      const  { return _vframe_id; }
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   125
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   126
  void                              update_locals(StackValueCollection* locals);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   127
  void                              update_stack(StackValueCollection* locals);
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   128
  void                              update_monitors(GrowableArray<MonitorInfo*>* monitors);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // Does the vframe match this jvmtiDeferredLocalVariableSet
48607
7fc3d62481ba 8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents: 47216
diff changeset
   131
  bool                              matches(const vframe* vf);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // GC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  void                              oops_do(OopClosure* f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // constructor
43484
9c95dd31d0da 8173309: jvmtiDeferredLocalVariableSet may update the wrong frame
never
parents: 38133
diff changeset
   136
  jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id, int vframe_id);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // destructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  ~jvmtiDeferredLocalVariableSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 7397
diff changeset
   144
class jvmtiDeferredLocalVariable : public CHeapObj<mtCompiler> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    BasicType type(void)                   { return _type; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    int index(void)                        { return _index; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    jvalue value(void)                     { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    // Only mutator is for value as only it can change
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    void set_value(jvalue value)           { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    // For gc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    oop* oop_addr(void)                    { return (oop*) &_value.l; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    BasicType         _type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    jvalue            _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    int               _index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   164
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   165
#endif // SHARE_VM_RUNTIME_VFRAME_HP_HPP