Returns the address and size of a finalized data object. The pointer remains valid until either [`JITModule::free_memory`] is called or in the future some way of deallocating this individual data object is used.
(&self, data_id: DataId)
| 278 | /// The pointer remains valid until either [`JITModule::free_memory`] is called or in the future |
| 279 | /// some way of deallocating this individual data object is used. |
| 280 | pub fn get_finalized_data(&self, data_id: DataId) -> (*const u8, usize) { |
| 281 | let info = &self.compiled_data_objects[data_id]; |
| 282 | assert!( |
| 283 | !self.data_objects_to_finalize.iter().any(|x| *x == data_id), |
| 284 | "data object not yet finalized" |
| 285 | ); |
| 286 | let compiled = info |
| 287 | .as_ref() |
| 288 | .expect("data object must be compiled before it can be finalized"); |
| 289 | |
| 290 | (compiled.ptr(), compiled.size()) |
| 291 | } |
| 292 | |
| 293 | fn record_function_for_perf(&self, ptr: *const u8, size: usize, name: &str) { |
| 294 | // The Linux perf tool supports JIT code via a /tmp/perf-$PID.map file, |