Lines Matching refs:buf
2430 buf: MachBuffer<I>, field
2439 let mut buf = MachBuffer::new(); in new() localVariable
2440 buf.reserve_labels_for_blocks(num_funcs); in new()
2442 buf, in new()
2460 if self.force_veneers == ForceVeneers::Yes || self.buf.island_needed(size) { in append()
2461 self.buf in append()
2465 self.buf.align_to(align); in append()
2466 let pos = self.buf.cur_offset(); in append()
2468 self.buf.bind_label( in append()
2474 self.buf.put_data(func); in append()
2486 self.buf.use_label_at_offset(offset, label, label_use); in resolve_reloc()
2498 self.buf.data[offset.try_into().unwrap()..][..data.len()].copy_from_slice(data); in write()
2503 assert_eq!(self.next_func, self.buf.label_offsets.len()); in finish()
2506 self.buf in finish()
2510 mem::take(&mut self.buf.data).into_vec() in finish()
2543 let mut buf = MachBuffer::new(); in test_elide_jump_to_next() localVariable
2547 buf.reserve_labels_for_blocks(2); in test_elide_jump_to_next()
2548 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_elide_jump_to_next()
2550 inst.emit(&mut buf, &info, &mut state); in test_elide_jump_to_next()
2551 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_elide_jump_to_next()
2552 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_elide_jump_to_next() localVariable
2553 assert_eq!(0, buf.total_size()); in test_elide_jump_to_next()
2559 let mut buf = MachBuffer::new(); in test_elide_trivial_jump_blocks() localVariable
2563 buf.reserve_labels_for_blocks(4); in test_elide_trivial_jump_blocks()
2565 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_elide_trivial_jump_blocks()
2571 inst.emit(&mut buf, &info, &mut state); in test_elide_trivial_jump_blocks()
2573 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_elide_trivial_jump_blocks()
2575 inst.emit(&mut buf, &info, &mut state); in test_elide_trivial_jump_blocks()
2577 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_elide_trivial_jump_blocks()
2579 inst.emit(&mut buf, &info, &mut state); in test_elide_trivial_jump_blocks()
2581 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_elide_trivial_jump_blocks()
2583 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_elide_trivial_jump_blocks() localVariable
2584 assert_eq!(0, buf.total_size()); in test_elide_trivial_jump_blocks()
2590 let mut buf = MachBuffer::new(); in test_flip_cond() localVariable
2594 buf.reserve_labels_for_blocks(4); in test_flip_cond()
2596 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_flip_cond()
2602 inst.emit(&mut buf, &info, &mut state); in test_flip_cond()
2604 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_flip_cond()
2606 inst.emit(&mut buf, &info, &mut state); in test_flip_cond()
2608 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_flip_cond()
2612 inst.emit(&mut buf, &info, &mut state); in test_flip_cond()
2614 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_flip_cond()
2616 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_flip_cond() localVariable
2630 assert_eq!(buf.data, buf2.data); in test_flip_cond()
2636 let mut buf = MachBuffer::new(); in test_island() localVariable
2640 buf.reserve_labels_for_blocks(4); in test_island()
2642 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_island()
2648 inst.emit(&mut buf, &info, &mut state); in test_island()
2650 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_island()
2651 while buf.cur_offset() < 2000000 { in test_island()
2652 if buf.island_needed(0) { in test_island()
2653 buf.emit_island(0, state.ctrl_plane_mut()); in test_island()
2656 inst.emit(&mut buf, &info, &mut state); in test_island()
2659 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_island()
2661 inst.emit(&mut buf, &info, &mut state); in test_island()
2663 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_island()
2665 inst.emit(&mut buf, &info, &mut state); in test_island()
2667 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_island() localVariable
2669 assert_eq!(2000000 + 8, buf.total_size()); in test_island()
2699 assert_eq!(&buf.data[0..8], &buf2.data[..]); in test_island()
2705 let mut buf = MachBuffer::new(); in test_island_backward() localVariable
2709 buf.reserve_labels_for_blocks(4); in test_island_backward()
2711 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_island_backward()
2713 inst.emit(&mut buf, &info, &mut state); in test_island_backward()
2715 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_island_backward()
2717 inst.emit(&mut buf, &info, &mut state); in test_island_backward()
2719 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_island_backward()
2720 while buf.cur_offset() < 2000000 { in test_island_backward()
2722 inst.emit(&mut buf, &info, &mut state); in test_island_backward()
2725 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_island_backward()
2731 inst.emit(&mut buf, &info, &mut state); in test_island_backward()
2733 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_island_backward() localVariable
2735 assert_eq!(2000000 + 12, buf.total_size()); in test_island_backward()
2752 assert_eq!(&buf.data[2000000..], &buf2.data[..]); in test_island_backward()
2791 let mut buf = MachBuffer::new(); in test_multiple_redirect() localVariable
2795 buf.reserve_labels_for_blocks(8); in test_multiple_redirect()
2797 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_multiple_redirect()
2803 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2805 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_multiple_redirect()
2807 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2809 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_multiple_redirect()
2811 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2812 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2814 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2816 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_multiple_redirect()
2818 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2820 buf.bind_label(label(4), state.ctrl_plane_mut()); in test_multiple_redirect()
2822 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2824 buf.bind_label(label(5), state.ctrl_plane_mut()); in test_multiple_redirect()
2826 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2828 buf.bind_label(label(6), state.ctrl_plane_mut()); in test_multiple_redirect()
2830 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2832 buf.bind_label(label(7), state.ctrl_plane_mut()); in test_multiple_redirect()
2834 inst.emit(&mut buf, &info, &mut state); in test_multiple_redirect()
2836 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_multiple_redirect() localVariable
2847 assert_eq!(&golden_data[..], &buf.data[..]); in test_multiple_redirect()
2868 let mut buf = MachBuffer::new(); in test_handle_branch_cycle() localVariable
2872 buf.reserve_labels_for_blocks(5); in test_handle_branch_cycle()
2874 buf.bind_label(label(0), state.ctrl_plane_mut()); in test_handle_branch_cycle()
2876 inst.emit(&mut buf, &info, &mut state); in test_handle_branch_cycle()
2878 buf.bind_label(label(1), state.ctrl_plane_mut()); in test_handle_branch_cycle()
2880 inst.emit(&mut buf, &info, &mut state); in test_handle_branch_cycle()
2882 buf.bind_label(label(2), state.ctrl_plane_mut()); in test_handle_branch_cycle()
2884 inst.emit(&mut buf, &info, &mut state); in test_handle_branch_cycle()
2886 buf.bind_label(label(3), state.ctrl_plane_mut()); in test_handle_branch_cycle()
2888 inst.emit(&mut buf, &info, &mut state); in test_handle_branch_cycle()
2890 buf.bind_label(label(4), state.ctrl_plane_mut()); in test_handle_branch_cycle()
2892 inst.emit(&mut buf, &info, &mut state); in test_handle_branch_cycle()
2894 let buf = buf.finish(&constants, state.ctrl_plane_mut()); in test_handle_branch_cycle() localVariable
2900 assert_eq!(&golden_data[..], &buf.data[..]); in test_handle_branch_cycle()
2905 let mut buf = MachBuffer::<Inst>::new(); in metadata_records() localVariable
2909 buf.reserve_labels_for_blocks(3); in metadata_records()
2911 buf.bind_label(label(0), ctrl_plane); in metadata_records()
2912 buf.put1(1); in metadata_records()
2913 buf.add_trap(TrapCode::HEAP_OUT_OF_BOUNDS); in metadata_records()
2914 buf.put1(2); in metadata_records()
2915 buf.add_trap(TrapCode::INTEGER_OVERFLOW); in metadata_records()
2916 buf.add_trap(TrapCode::INTEGER_DIVISION_BY_ZERO); in metadata_records()
2917 buf.add_try_call_site( in metadata_records()
2925 buf.add_reloc( in metadata_records()
2930 buf.put1(3); in metadata_records()
2931 buf.add_reloc( in metadata_records()
2936 buf.put1(4); in metadata_records()
2937 buf.bind_label(label(1), ctrl_plane); in metadata_records()
2938 buf.put1(0xff); in metadata_records()
2939 buf.bind_label(label(2), ctrl_plane); in metadata_records()
2940 buf.put1(0xff); in metadata_records()
2942 let buf = buf.finish(&constants, ctrl_plane); in metadata_records() localVariable
2944 assert_eq!(buf.data(), &[1, 2, 3, 4, 0xff, 0xff]); in metadata_records()
2946 buf.traps() in metadata_records()
2956 let call_sites: Vec<_> = buf.call_sites().collect(); in metadata_records()
2967 buf.relocs() in metadata_records()