@@ -3,12 +3,13 @@ use crate::plan::{AllocationSemantics, CopyContext};
3
3
use crate :: policy:: space:: SpaceOptions ;
4
4
use crate :: policy:: space:: { CommonSpace , Space , SFT } ;
5
5
use crate :: util:: constants:: CARD_META_PAGES_PER_REGION ;
6
- use crate :: util:: forwarding_word as ForwardingWord ;
7
6
use crate :: util:: heap:: layout:: heap_layout:: { Mmapper , VMMap } ;
8
7
use crate :: util:: heap:: HeapMeta ;
9
8
use crate :: util:: heap:: VMRequest ;
10
9
use crate :: util:: heap:: { MonotonePageResource , PageResource } ;
11
- use crate :: util:: side_metadata:: { SideMetadataContext , SideMetadataSpec } ;
10
+ use crate :: util:: metadata:: extract_side_metadata;
11
+ use crate :: util:: metadata:: side_metadata:: { SideMetadataContext , SideMetadataSpec } ;
12
+ use crate :: util:: object_forwarding;
12
13
use crate :: util:: { Address , ObjectReference } ;
13
14
use crate :: vm:: * ;
14
15
use libc:: { mprotect, PROT_EXEC , PROT_NONE , PROT_READ , PROT_WRITE } ;
@@ -28,7 +29,7 @@ impl<VM: VMBinding> SFT for CopySpace<VM> {
28
29
self . get_name ( )
29
30
}
30
31
fn is_live ( & self , object : ObjectReference ) -> bool {
31
- !self . from_space ( ) || ForwardingWord :: is_forwarded :: < VM > ( object)
32
+ !self . from_space ( ) || object_forwarding :: is_forwarded :: < VM > ( object)
32
33
}
33
34
fn is_movable ( & self ) -> bool {
34
35
true
@@ -75,6 +76,10 @@ impl<VM: VMBinding> CopySpace<VM> {
75
76
mmapper : & ' static Mmapper ,
76
77
heap : & mut HeapMeta ,
77
78
) -> Self {
79
+ let local_specs = extract_side_metadata ( & [
80
+ VM :: VMObjectModel :: LOCAL_FORWARDING_BITS_SPEC ,
81
+ VM :: VMObjectModel :: LOCAL_FORWARDING_POINTER_SPEC ,
82
+ ] ) ;
78
83
let common = CommonSpace :: new (
79
84
SpaceOptions {
80
85
name,
@@ -84,7 +89,7 @@ impl<VM: VMBinding> CopySpace<VM> {
84
89
vmrequest,
85
90
side_metadata_specs : SideMetadataContext {
86
91
global : global_side_metadata_specs,
87
- local : vec ! [ ] ,
92
+ local : local_specs ,
88
93
} ,
89
94
} ,
90
95
vm_map,
@@ -136,21 +141,21 @@ impl<VM: VMBinding> CopySpace<VM> {
136
141
return object;
137
142
}
138
143
trace ! ( "attempting to forward" ) ;
139
- let forwarding_status = ForwardingWord :: attempt_to_forward :: < VM > ( object) ;
144
+ let forwarding_status = object_forwarding :: attempt_to_forward :: < VM > ( object) ;
140
145
trace ! ( "checking if object is being forwarded" ) ;
141
- if ForwardingWord :: state_is_forwarded_or_being_forwarded ( forwarding_status) {
146
+ if object_forwarding :: state_is_forwarded_or_being_forwarded ( forwarding_status) {
142
147
trace ! ( "... yes it is" ) ;
143
148
let new_object =
144
- ForwardingWord :: spin_and_get_forwarded_object :: < VM > ( object, forwarding_status) ;
149
+ object_forwarding :: spin_and_get_forwarded_object :: < VM > ( object, forwarding_status) ;
145
150
trace ! ( "Returning" ) ;
146
151
new_object
147
152
} else {
148
153
trace ! ( "... no it isn't. Copying" ) ;
149
154
let new_object =
150
- ForwardingWord :: forward_object :: < VM , _ > ( object, semantics, copy_context) ;
155
+ object_forwarding :: forward_object :: < VM , _ > ( object, semantics, copy_context) ;
151
156
trace ! ( "Forwarding pointer" ) ;
152
157
trace. process_node ( new_object) ;
153
- trace ! ( "Copying [{:?} -> {:?}]" , object, new_object) ;
158
+ trace ! ( "Copied [{:?} -> {:?}]" , object, new_object) ;
154
159
new_object
155
160
}
156
161
}
0 commit comments