@@ -376,19 +376,18 @@ impl JitMemory {
376376
377377 /// Bind the current location to `label`.
378378 pub fn bind_label ( & mut self , label : DestLabel ) {
379- let page = self . page ;
380- self . bind_label_with_page ( page , label) ;
379+ let src_page = self . page ;
380+ self . bind_label_with_page ( src_page , label) ;
381381 }
382382
383- pub fn bind_label_with_page ( & mut self , page : Page , label : DestLabel ) {
384- self . labels [ label] . loc = Some ( ( page, self [ page] . counter ) ) ;
383+ pub fn bind_label_with_page ( & mut self , src_page : Page , label : DestLabel ) {
384+ let src_pos = self [ src_page] . counter ;
385+ for target in std:: mem:: take ( & mut self . labels [ label] . target ) {
386+ self . write_reloc ( src_page, src_pos, target) ;
387+ }
388+ self . labels [ label] . loc = Some ( ( src_page, src_pos) ) ;
385389 }
386390
387- /*/// Bind the current location to `label`.
388- pub fn bind_label_to_pos(&mut self, label: DestLabel, pos: usize) {
389- self.reloc[label].loc = Some(Pos::from(pos));
390- }*/
391-
392391 /// Bind the current location to `label`.
393392 fn get_label_pos ( & self , label : DestLabel ) -> ( Page , Pos ) {
394393 self . labels [ label]
@@ -568,14 +567,6 @@ impl JitMemory {
568567 slice. iter ( ) . for_each ( |b| self . emitb ( * b) ) ;
569568 }
570569
571- ///
572- /// Apply patch for the displacement of the jmp instruction in *patch_point*.
573- ///
574- pub fn apply_jmp_patch ( & mut self , patch_point : DestLabel , jmp_dest : DestLabel ) {
575- let patch_point = self . get_label_address ( patch_point) ;
576- self . apply_jmp_patch_address ( patch_point, jmp_dest) ;
577- }
578-
579570 ///
580571 /// Apply patch for the displacement of the jmp instruction in *patch_point*.
581572 ///
0 commit comments