APIdia Launch Partner
Top Description Constructors Methods
jdk.jfr.internal

pack-priv final Class JVMUpcalls

extends Object
Class Inheritance
Imports
java.lang.reflect.Modifier, jdk.jfr.internal.event.EventConfiguration, jdk.jfr.internal.util.Bytecode, .Utils, jdk.jfr.internal.tracing.PlatformTracer

All upcalls from the JVM should go through this class.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static byte[]

Returns:

byte code to use
bytesForEagerInstrumentation
(long
Id of the class
traceId
,
boolean
add instrumentation regardless if event is enabled or not.
forceInstrumentation
,
boolean bootClassLoader, Class<?>
the super class of the class being processed
superClass
,
byte[]
byte code
oldBytes
)

Called by the JVM when requested to do an "eager" instrumentation.

pack-priv static Thread

Returns:

a new thread
createRecorderThread
(ThreadGroup
the system thread group
systemThreadGroup
,
ClassLoader
the context class loader.
contextClassLoader
)

Called by the JVM to create the recorder thread.

public static byte[]

Returns:

the instrumented bytecode, or null if the class can't or shouldn't be modified.
onMethodTrace
(Module
the module the class belongs to
module
,
ClassLoader
the class loader the class is being loaded for
classLoader
,
String
the internal class name, i.e. java/lang/String.
className
,
byte[]
the bytecode to modify
bytecode
,
long[]
the method IDs
methodIds
,
String[]
constant pool indices of method names
names
,
String[]
constant pool indices of method signatures
signatures
,
int[]
integer mask describing the modification
modifications
)

Called by the JVM to update method tracing instrumentation.

pack-priv static byte[]

Returns:

byte code to use
onRetransform
(long
Id of the class
traceId
,
boolean
not used, but act as padding so bytesForEagerInstrumentation and onRetransform can have identical method signatures, which simplifies the invoke machinery in native
dummy1
,
boolean
not used, but act as padding so bytesForEagerInstrumentation and onRetransform can have identical method signatures, which simplifies the invoke machinery in native
dummy2
,
Class<?>
class being retransformed
clazz
,
byte[]
byte code
oldBytes
)

Called by the JVM when a retransform happens on a tagged class

public static void
publishMethodTimersForClass(long
the methods to be published
classId
)

Called by the JVM to publish a class ID that can safely be used by the Method Timing event.

pack-priv static void
unhideInternalTypes()

Called by the JVM to ensure metadata for internal events/types become public.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JVMUpcallsback to summary
pack-priv JVMUpcalls()

Method Detail

bytesForEagerInstrumentationback to summary
pack-priv static byte[] bytesForEagerInstrumentation(long traceId, boolean forceInstrumentation, boolean bootClassLoader, Class<?> superClass, byte[] oldBytes) throws Throwable

Called by the JVM when requested to do an "eager" instrumentation. Would normally happen when JVMTI retransform capabilities are not available.

Parameters
traceId:long

Id of the class

forceInstrumentation:boolean

add instrumentation regardless if event is enabled or not.

superClass:Class<?>

the super class of the class being processed

oldBytes:byte[]

byte code

Returns:byte[]

byte code to use

createRecorderThreadback to summary
pack-priv static Thread createRecorderThread(ThreadGroup systemThreadGroup, ClassLoader contextClassLoader)

Called by the JVM to create the recorder thread.

Parameters
systemThreadGroup:ThreadGroup

the system thread group

contextClassLoader:ClassLoader

the context class loader.

Returns:Thread

a new thread

onMethodTraceback to summary
public static byte[] onMethodTrace(Module module, ClassLoader classLoader, String className, byte[] bytecode, long[] methodIds, String[] names, String[] signatures, int[] modifications)

Called by the JVM to update method tracing instrumentation.

Parameters
module:Module

the module the class belongs to

classLoader:ClassLoader

the class loader the class is being loaded for

className:String

the internal class name, i.e. java/lang/String.

bytecode:byte[]

the bytecode to modify

methodIds:long[]

the method IDs

names:String[]

constant pool indices of method names

signatures:String[]

constant pool indices of method signatures

modifications:int[]

integer mask describing the modification

Returns:byte[]

the instrumented bytecode, or null if the class can't or shouldn't be modified.

onRetransformback to summary
pack-priv static byte[] onRetransform(long traceId, boolean dummy1, boolean dummy2, Class<?> clazz, byte[] oldBytes) throws Throwable

Called by the JVM when a retransform happens on a tagged class

Parameters
traceId:long

Id of the class

dummy1:boolean

not used, but act as padding so bytesForEagerInstrumentation and onRetransform can have identical method signatures, which simplifies the invoke machinery in native

dummy2:boolean

not used, but act as padding so bytesForEagerInstrumentation and onRetransform can have identical method signatures, which simplifies the invoke machinery in native

clazz:Class<?>

class being retransformed

oldBytes:byte[]

byte code

Returns:byte[]

byte code to use

publishMethodTimersForClassback to summary
public static void publishMethodTimersForClass(long classId)

Called by the JVM to publish a class ID that can safely be used by the Method Timing event.

Parameters
classId:long

the methods to be published

unhideInternalTypesback to summary
pack-priv static void unhideInternalTypes()

Called by the JVM to ensure metadata for internal events/types become public. Must be called after metadata repository has been initialized (JFR created).