Package daikon.chicory
Class Runtime
- Object
-
- Runtime
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Runtime.BooleanWrap
wrapper used for boolean argumentsstatic class
Runtime.ByteWrap
wrapper used for int argumentsstatic class
Runtime.CharWrap
wrapper used for int argumentsstatic class
Runtime.DoubleWrap
wrapper used for double argumentsstatic class
Runtime.FloatWrap
wrapper used for int argumentsstatic class
Runtime.IntWrap
wrapper used for int argumentsstatic class
Runtime.LongWrap
wrapper used for int argumentsstatic interface
Runtime.PrimitiveWrapper
static class
Runtime.ShortWrap
wrapper used for int argumentsstatic class
Runtime.TerminationMessage
Thrown to indicate that main should not print a stack trace, but only print the message itself to the user.
-
Field Summary
Fields Modifier and Type Field Description static boolean
chicoryLoaderInstantiationError
True if ChicoryPremain was unable to load.static boolean
debug
debug flagstatic boolean
in_dtrace
Flag indicating that a dtrace record is currently being written used to prevent a call to instrumented code that occurs as part of generating a dtrace record (eg, toArray when processing lists or pure functions) from generating a nested dtrace record.static AtomicInteger
nonce
Unique id for method entry/exit (so they can be matched up)static List<Pattern>
ppt_omit_pattern
Ppts to omit (regular expression)static List<Pattern>
ppt_select_pattern
Ppts to include (regular expression)static int
sample_start
Sample count at a call site to begin sampling.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @BinaryName String
classGetNameToBinaryName(@ClassGetName String cgn)
static boolean
dontProcessPpts()
static void
endPure()
static void
enter(@Nullable Object obj, int nonce, int mi_index, Object[] args)
Called when a method is entered.static void
exit(@Nullable Object obj, int nonce, int mi_index, Object[] args, Object ret_val, int exitLineNum)
Called when a method is exited.static String
fieldDescriptorToBinaryName(@FieldDescriptor String classname)
Convert a classname from JVML format to Java format.static @Nullable ClassInfo
getClassInfoFromClass(Class<?> type)
Gets the ClassInfo structure corresponding to type.static void
incrementRecords()
Increment the number of records that have been printed.static void
initNotify(String className)
Called by classes when they have finished initialization (i.e., their static initializer has completed).static boolean
isInitialized(String className)
Return true iff the class with fully qualified name className has been initialized.static void
noMoreOutput()
Indicates that no more output should be printed to the dtrace file.static void
process_new_classes()
Writes out decl information for any new classes (those in the new_classes field) and removes them from that list.static String
quote(String orig)
Quote \, ", \n, and \r characters in the target; return a new string.static void
setDtrace(String filename, boolean append)
Specify the dtrace file to which to write.static void
setDtraceMaybe(String default_filename)
If the current data trace file is not yet set, then set it.static void
setDtraceOnlineMode(int port)
static void
startPure()
-
-
-
Field Detail
-
nonce
public static AtomicInteger nonce
Unique id for method entry/exit (so they can be matched up)
-
debug
public static boolean debug
debug flag
-
in_dtrace
public static boolean in_dtrace
Flag indicating that a dtrace record is currently being written used to prevent a call to instrumented code that occurs as part of generating a dtrace record (eg, toArray when processing lists or pure functions) from generating a nested dtrace record.
-
chicoryLoaderInstantiationError
public static boolean chicoryLoaderInstantiationError
True if ChicoryPremain was unable to load.
-
ppt_omit_pattern
public static List<Pattern> ppt_omit_pattern
Ppts to omit (regular expression)
-
ppt_select_pattern
public static List<Pattern> ppt_select_pattern
Ppts to include (regular expression)
-
sample_start
public static int sample_start
Sample count at a call site to begin sampling. All previous calls will be recorded. Sampling starts at 10% and decreases by a factor of 10 each time another sample_start samples have been recorded. If sample_start is 0, then all calls will be recorded.
-
-
Method Detail
-
dontProcessPpts
@Holding("Runtime.class") public static boolean dontProcessPpts()
-
startPure
@Holding("Runtime.class") public static void startPure()
-
endPure
@Holding("Runtime.class") public static void endPure()
-
enter
public static void enter(@Nullable Object obj, int nonce, int mi_index, Object[] args)
Called when a method is entered.- Parameters:
obj
- receiver of the method that was entered, or null if method is staticnonce
- nonce identifying which enter/exit pair this ismi_index
- index in methods of the MethodInfo for this methodargs
- array of arguments to method
-
exit
public static void exit(@Nullable Object obj, int nonce, int mi_index, Object[] args, Object ret_val, int exitLineNum)
Called when a method is exited.- Parameters:
obj
- receiver of the method that was entered, or null if method is staticnonce
- nonce identifying which enter/exit pair this ismi_index
- index in methods of the MethodInfo for this methodargs
- array of arguments to methodret_val
- return value of method, or null if method is voidexitLineNum
- the line number at which this method exited
-
initNotify
public static void initNotify(String className)
Called by classes when they have finished initialization (i.e., their static initializer has completed).This functionality must be enabled by the flag Chicory.checkStaticInit. When enabled, this method should only be called by the hooks created in the Instrument class.
- Parameters:
className
- fully qualified class name
-
isInitialized
public static boolean isInitialized(String className)
Return true iff the class with fully qualified name className has been initialized.- Parameters:
className
- fully qualified class name
-
process_new_classes
@Holding("Runtime.class") public static void process_new_classes()
Writes out decl information for any new classes (those in the new_classes field) and removes them from that list.
-
incrementRecords
public static void incrementRecords()
Increment the number of records that have been printed.
-
noMoreOutput
public static void noMoreOutput()
Indicates that no more output should be printed to the dtrace file. The file is closed and iff dtraceLimitTerminate is true the program is terminated.
-
setDtraceOnlineMode
@EnsuresNonNull("dtrace") public static void setDtraceOnlineMode(int port)
-
setDtrace
@EnsuresNonNull("dtrace") public static void setDtrace(String filename, boolean append)
Specify the dtrace file to which to write.- Parameters:
filename
- to use as the data trace fileappend
- whether to open dtrace file in append mode
-
setDtraceMaybe
public static void setDtraceMaybe(String default_filename)
If the current data trace file is not yet set, then set it. The value of the DTRACEFILE environment variable is used; if that environment variable is not set, then the argument to this method is used instead.- Parameters:
default_filename
- the file to maybe use as the data trace file
-
getClassInfoFromClass
public static @Nullable ClassInfo getClassInfoFromClass(Class<?> type)
Gets the ClassInfo structure corresponding to type. Returns null if the class was not instrumented.- Parameters:
type
- declaring class- Returns:
- ClassInfo structure corresponding to type
-
quote
public static String quote(String orig)
Quote \, ", \n, and \r characters in the target; return a new string.
-
fieldDescriptorToBinaryName
public static String fieldDescriptorToBinaryName(@FieldDescriptor String classname)
Convert a classname from JVML format to Java format. For example, convert "[Ljava/lang/Object;" to "java.lang.Object[]".If the argument is not a field descriptor, returns it as is. This enables this method to be used on the output of
Class.getName()
.
-
classGetNameToBinaryName
public static final @BinaryName String classGetNameToBinaryName(@ClassGetName String cgn)
-
-