3. op_write_native_code

Write information about compiled code to a JIT dump file.
#include <opagent.h>
int op_write_native_code(hdl,  
 symbol_name,  
 vma,  
 code,  
 code_size); 
op_agent_thdl;
char const *symbol_name;
uint64_tvma;
void const *code;
const unsigned intcode_size;
 

Description

Signal the dynamic generation of native code from a virtual machine. Writes a JIT dump record to the open JIT dump file using the passed information.

Parameters

hdl : Handle returned from an earlier call to op_open_agent()

symbol_name : The name of the symbol being dynamically compiled. This name can (and should) contain all necessary information to disambiguate it from symbols of the same name; e.g., class, method signature.

vma : Virtual memory address of the executable code

code : Pointer to the location of the compiled code. Theoretically, this may be a different location from that given by the vma argument. For some JIT compilers, obtaining the code may be impractical. For this (or any other) reason, the agent can choose to pass NULL for this paraemter. If NULL is passed, no code will be copied into the JIT dump file.

code_size : Size of the compiled code

Return value

Returns 0 on success; -1 otherwise. If -1 is returned, errno is set to indicate the nature of the error. errno is set to EINVAL if an invalid op_agent_t handle is passed. For a list of other possible errno values, see the man pages for:

gettimeofday, fwrite