hotspot/src/share/vm/code/jvmticmlr.h
author coleenp
Mon, 14 Jan 2013 11:01:39 -0500
changeset 15194 a35093d73168
parent 5547 f4b087cbb361
permissions -rw-r--r--
8006005: Fix constant pool index validation and alignment trap for method parameter reflection Summary: This patch addresses an alignment trap due to the storage format of method parameters data in constMethod. It also adds code to validate constant pool indexes for method parameters data. Reviewed-by: jrose, dholmes Contributed-by: eric.mccorkle@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4732
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4732
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     4
 *
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4732
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4732
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    10
 *
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    15
 * accompanied this code).
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    16
 *
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    20
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4732
diff changeset
    23
 * questions.
4732
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    24
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    25
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    26
/*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    27
 * This header file defines the data structures sent by the VM
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    28
 * through the JVMTI CompiledMethodLoad callback function via the
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    29
 * "void * compile_info" parameter. The memory pointed to by the
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    30
 * compile_info parameter may not be referenced after returning from
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    31
 * the CompiledMethodLoad callback. These are VM implementation
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    32
 * specific data structures that may evolve in future releases. A
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    33
 * JVMTI agent should interpret a non-NULL compile_info as a pointer
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    34
 * to a region of memory containing a list of records. In a typical
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    35
 * usage scenario, a JVMTI agent would cast each record to a
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    36
 * jvmtiCompiledMethodLoadRecordHeader, a struct that represents
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    37
 * arbitrary information. This struct contains a kind field to indicate
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    38
 * the kind of information being passed, and a pointer to the next
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    39
 * record. If the kind field indicates inlining information, then the
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    40
 * agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    41
 * This record contains an array of PCStackInfo structs, which indicate
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    42
 * for every pc address what are the methods on the invocation stack.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    43
 * The "methods" and "bcis" fields in each PCStackInfo struct specify a
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    44
 * 1-1 mapping between these inlined methods and their bytecode indices.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    45
 * This can be used to derive the proper source lines of the inlined
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    46
 * methods.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    47
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    48
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    49
#ifndef _JVMTI_CMLR_H_
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    50
#define _JVMTI_CMLR_H_
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    51
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    52
enum {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    53
    JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    54
    JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    55
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    56
    JVMTI_CMLR_MAJOR_VERSION   = 0x00000001,
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    57
    JVMTI_CMLR_MINOR_VERSION   = 0x00000000
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    58
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    59
    /*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    60
     * This comment is for the "JDK import from HotSpot" sanity check:
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    61
     * version: 1.0.0
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    62
     */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    63
};
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    64
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    65
typedef enum {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    66
    JVMTI_CMLR_DUMMY       = 1,
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    67
    JVMTI_CMLR_INLINE_INFO = 2
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    68
} jvmtiCMLRKind;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    69
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    70
/*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    71
 * Record that represents arbitrary information passed through JVMTI
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    72
 * CompiledMethodLoadEvent void pointer.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    73
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    74
typedef struct _jvmtiCompiledMethodLoadRecordHeader {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    75
  jvmtiCMLRKind kind;     /* id for the kind of info passed in the record */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    76
  jint majorinfoversion;  /* major and minor info version values. Init'ed */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    77
  jint minorinfoversion;  /* to current version value in jvmtiExport.cpp. */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    78
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    79
  struct _jvmtiCompiledMethodLoadRecordHeader* next;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    80
} jvmtiCompiledMethodLoadRecordHeader;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    81
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    82
/*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    83
 * Record that gives information about the methods on the compile-time
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    84
 * stack at a specific pc address of a compiled method. Each element in
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    85
 * the methods array maps to same element in the bcis array.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    86
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    87
typedef struct _PCStackInfo {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    88
  void* pc;             /* the pc address for this compiled method */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    89
  jint numstackframes;  /* number of methods on the stack */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    90
  jmethodID* methods;   /* array of numstackframes method ids */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    91
  jint* bcis;           /* array of numstackframes bytecode indices */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    92
} PCStackInfo;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    93
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    94
/*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    95
 * Record that contains inlining information for each pc address of
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    96
 * an nmethod.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    97
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    98
typedef struct _jvmtiCompiledMethodLoadInlineRecord {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
    99
  jvmtiCompiledMethodLoadRecordHeader header;  /* common header for casting */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   100
  jint numpcs;          /* number of pc descriptors in this nmethod */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   101
  PCStackInfo* pcinfo;  /* array of numpcs pc descriptors */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   102
} jvmtiCompiledMethodLoadInlineRecord;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   103
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   104
/*
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   105
 * Dummy record used to test that we can pass records with different
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   106
 * information through the void pointer provided that they can be cast
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   107
 * to a jvmtiCompiledMethodLoadRecordHeader.
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   108
 */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   109
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   110
typedef struct _jvmtiCompiledMethodLoadDummyRecord {
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   111
  jvmtiCompiledMethodLoadRecordHeader header;  /* common header for casting */
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   112
  char message[50];
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   113
} jvmtiCompiledMethodLoadDummyRecord;
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   114
a70548606f73 6580131: 3/4 CompiledMethodLoad events don't produce the expected extra notifications to describe inlining
dcubed
parents:
diff changeset
   115
#endif