1 /* 2 * Copyright (c) 2010, 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 23 * questions. 24 */ 25 26 #ifndef SHARE_VM_CODE_JVMTICMLR_H 27 #define SHARE_VM_CODE_JVMTICMLR_H 28 29 /* 30 * This header file defines the data structures sent by the VM 31 * through the JVMTI CompiledMethodLoad callback function via the 32 * "void * compile_info" parameter. The memory pointed to by the 33 * compile_info parameter may not be referenced after returning from 34 * the CompiledMethodLoad callback. These are VM implementation 35 * specific data structures that may evolve in future releases. A 36 * JVMTI agent should interpret a non-NULL compile_info as a pointer 37 * to a region of memory containing a list of records. In a typical 38 * usage scenario, a JVMTI agent would cast each record to a 39 * jvmtiCompiledMethodLoadRecordHeader, a struct that represents 40 * arbitrary information. This struct contains a kind field to indicate 41 * the kind of information being passed, and a pointer to the next 42 * record. If the kind field indicates inlining information, then the 43 * agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord. 44 * This record contains an array of PCStackInfo structs, which indicate 45 * for every pc address what are the methods on the invocation stack. 46 * The "methods" and "bcis" fields in each PCStackInfo struct specify a 47 * 1-1 mapping between these inlined methods and their bytecode indices. 48 * This can be used to derive the proper source lines of the inlined 49 * methods. 50 */ 51 52 #ifndef _JVMTI_CMLR_H_ 53 #define _JVMTI_CMLR_H_ 54 55 enum { 56 JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001, 57 JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000, 58 59 JVMTI_CMLR_MAJOR_VERSION = 0x00000001, 60 JVMTI_CMLR_MINOR_VERSION = 0x00000000 61 62 /* 63 * This comment is for the "JDK import from HotSpot" sanity check: 64 * version: 1.0.0 65 */ 66 }; 67 68 typedef enum { 69 JVMTI_CMLR_DUMMY = 1, 70 JVMTI_CMLR_INLINE_INFO = 2 71 } jvmtiCMLRKind; 72 73 /* 74 * Record that represents arbitrary information passed through JVMTI 75 * CompiledMethodLoadEvent void pointer. 76 */ 77 typedef struct _jvmtiCompiledMethodLoadRecordHeader { 78 jvmtiCMLRKind kind; /* id for the kind of info passed in the record */ 79 jint majorinfoversion; /* major and minor info version values. Init'ed */ 80 jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */ 81 82 struct _jvmtiCompiledMethodLoadRecordHeader* next; 83 } jvmtiCompiledMethodLoadRecordHeader; 84 85 /* 86 * Record that gives information about the methods on the compile-time 87 * stack at a specific pc address of a compiled method. Each element in 88 * the methods array maps to same element in the bcis array. 89 */ 90 typedef struct _PCStackInfo { 91 void* pc; /* the pc address for this compiled method */ 92 jint numstackframes; /* number of methods on the stack */ 93 jmethodID* methods; /* array of numstackframes method ids */ 94 jint* bcis; /* array of numstackframes bytecode indices */ 95 } PCStackInfo; 96 97 /* 98 * Record that contains inlining information for each pc address of 99 * an nmethod. 100 */ 101 typedef struct _jvmtiCompiledMethodLoadInlineRecord { 102 jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */ 103 jint numpcs; /* number of pc descriptors in this nmethod */ 104 PCStackInfo* pcinfo; /* array of numpcs pc descriptors */ 105 } jvmtiCompiledMethodLoadInlineRecord; 106 107 /* 108 * Dummy record used to test that we can pass records with different 109 * information through the void pointer provided that they can be cast 110 * to a jvmtiCompiledMethodLoadRecordHeader. 111 */ 112 113 typedef struct _jvmtiCompiledMethodLoadDummyRecord { 114 jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */ 115 char message[50]; 116 } jvmtiCompiledMethodLoadDummyRecord; 117 118 #endif 119 120 #endif // SHARE_VM_CODE_JVMTICMLR_H