task -> thread

This commit is contained in:
rohan.prinja 2015-11-14 05:07:55 +09:00 committed by Rohan Prinja
parent f00532bab0
commit 1f02c4ebbb
119 changed files with 1209 additions and 1207 deletions

View file

@ -7,8 +7,8 @@
use dom::bindings::trace::JSTraceable;
use js::jsapi::JSTracer;
use std::cell::{BorrowState, Ref, RefCell, RefMut};
use util::task_state;
use util::task_state::SCRIPT;
use util::thread_state;
use util::thread_state::SCRIPT;
/// A mutable field in the DOM.
///
@ -25,10 +25,10 @@ pub struct DOMRefCell<T> {
impl<T> DOMRefCell<T> {
/// Return a reference to the contents.
///
/// For use in the layout task only.
/// For use in the layout thread only.
#[allow(unsafe_code)]
pub unsafe fn borrow_for_layout(&self) -> &T {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
&*self.value.as_unsafe_cell().get()
}
@ -40,7 +40,7 @@ impl<T> DOMRefCell<T> {
pub unsafe fn borrow_for_gc_trace(&self) -> &T {
// FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs
// https://github.com/servo/servo/issues/6389
// debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
// debug_assert!(thread_state::get().contains(SCRIPT | IN_GC));
&*self.value.as_unsafe_cell().get()
}
@ -48,7 +48,7 @@ impl<T> DOMRefCell<T> {
///
#[allow(unsafe_code)]
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
debug_assert!(task_state::get().contains(SCRIPT));
debug_assert!(thread_state::get().contains(SCRIPT));
&mut *self.value.as_unsafe_cell().get()
}
@ -70,7 +70,7 @@ impl<T> DOMRefCell<T> {
///
/// Panics if this is called off the script thread.
pub fn try_borrow(&self) -> Option<Ref<T>> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
match self.value.borrow_state() {
BorrowState::Writing => None,
_ => Some(self.value.borrow()),
@ -88,17 +88,17 @@ impl<T> DOMRefCell<T> {
///
/// Panics if this is called off the script thread.
pub fn try_borrow_mut(&self) -> Option<RefMut<T>> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
match self.value.borrow_state() {
BorrowState::Unused => Some(self.value.borrow_mut()),
_ => None,
}
}
/// Version of the above that we use during restyle while the script task
/// Version of the above that we use during restyle while the script thread
/// is blocked.
pub fn borrow_mut_for_layout(&self) -> RefMut<T> {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
self.value.borrow_mut()
}
}

View file

@ -19,9 +19,9 @@ use js::jsapi::GetGlobalForObjectCrossCompartment;
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use msg::constellation_msg::{ConstellationChan, PipelineId};
use net_traits::ResourceTask;
use net_traits::ResourceThread;
use profile_traits::mem;
use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask};
use script_thread::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThread};
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest};
use timers::{ScheduledCallback, TimerHandle};
use url::Url;
@ -65,7 +65,7 @@ impl<'a> GlobalRef<'a> {
}
}
/// Extract a `Window`, causing task failure if the global object is not
/// Extract a `Window`, causing thread failure if the global object is not
/// a `Window`.
pub fn as_window(&self) -> &window::Window {
match *self {
@ -82,7 +82,7 @@ impl<'a> GlobalRef<'a> {
}
}
/// Get a `mem::ProfilerChan` to send messages to the memory profiler task.
/// Get a `mem::ProfilerChan` to send messages to the memory profiler thread.
pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
match *self {
GlobalRef::Window(window) => window.mem_profiler_chan(),
@ -107,7 +107,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get an `IpcSender<ScriptToDevtoolsControlMsg>` to send messages to Devtools
/// task when available.
/// thread when available.
pub fn devtools_chan(&self) -> Option<IpcSender<ScriptToDevtoolsControlMsg>> {
match *self {
GlobalRef::Window(window) => window.devtools_chan(),
@ -115,16 +115,16 @@ impl<'a> GlobalRef<'a> {
}
}
/// Get the `ResourceTask` for this global scope.
pub fn resource_task(&self) -> ResourceTask {
/// Get the `ResourceThread` for this global scope.
pub fn resource_thread(&self) -> ResourceThread {
match *self {
GlobalRef::Window(ref window) => {
let doc = window.Document();
let doc = doc.r();
let loader = doc.loader();
(*loader.resource_task).clone()
(*loader.resource_thread).clone()
}
GlobalRef::Worker(ref worker) => worker.resource_task().clone(),
GlobalRef::Worker(ref worker) => worker.resource_thread().clone(),
}
}
@ -154,45 +154,45 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn dom_manipulation_task_source(&self) -> Box<ScriptChan + Send> {
pub fn dom_manipulation_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) => window.dom_manipulation_task_source(),
GlobalRef::Window(ref window) => window.dom_manipulation_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn user_interaction_task_source(&self) -> Box<ScriptChan + Send> {
pub fn user_interaction_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) => window.user_interaction_task_source(),
GlobalRef::Window(ref window) => window.user_interaction_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {
pub fn networking_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) => window.networking_task_source(),
GlobalRef::Window(ref window) => window.networking_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> {
pub fn history_traversal_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) => window.history_traversal_task_source(),
GlobalRef::Window(ref window) => window.history_traversal_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn file_reading_task_source(&self) -> Box<ScriptChan + Send> {
pub fn file_reading_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) => window.file_reading_task_source(),
GlobalRef::Window(ref window) => window.file_reading_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
@ -207,11 +207,11 @@ impl<'a> GlobalRef<'a> {
}
}
/// Process a single event as if it were the next event in the task queue for
/// Process a single event as if it were the next event in the thread queue for
/// this global.
pub fn process_event(&self, msg: CommonScriptMsg) {
match *self {
GlobalRef::Window(_) => ScriptTask::process_event(msg),
GlobalRef::Window(_) => ScriptThread::process_event(msg),
GlobalRef::Worker(ref worker) => worker.process_event(msg),
}
}

View file

@ -33,7 +33,7 @@ use dom::node::Node;
use js::jsapi::{Heap, JSObject, JSTracer};
use js::jsval::JSVal;
use layout_interface::TrustedNodeAddress;
use script_task::STACK_ROOTS;
use script_thread::STACK_ROOTS;
use std::cell::UnsafeCell;
use std::default::Default;
use std::hash::{Hash, Hasher};
@ -41,7 +41,7 @@ use std::mem;
use std::ops::Deref;
use std::ptr;
use util::mem::HeapSizeOf;
use util::task_state;
use util::thread_state;
/// A traced reference to a DOM object
///
@ -66,7 +66,7 @@ impl<T> HeapSizeOf for JS<T> {
impl<T> JS<T> {
/// Returns `LayoutJS<T>` containing the same pointer.
pub unsafe fn to_layout(&self) -> LayoutJS<T> {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
LayoutJS {
ptr: self.ptr.clone(),
}
@ -78,7 +78,7 @@ impl<T: Reflectable> JS<T> {
/// XXX Not a great API. Should be a call on Root<T> instead
#[allow(unrooted_must_root)]
pub fn from_rooted(root: &Root<T>) -> JS<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
JS {
ptr: unsafe { NonZero::new(&**root) },
}
@ -86,7 +86,7 @@ impl<T: Reflectable> JS<T> {
/// Create a JS<T> from a &T
#[allow(unrooted_must_root)]
pub fn from_ref(obj: &T) -> JS<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
JS {
ptr: unsafe { NonZero::new(&*obj) },
}
@ -97,7 +97,7 @@ impl<T: Reflectable> Deref for JS<T> {
type Target = T;
fn deref(&self) -> &T {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
// We can only have &JS<T> from a rooted thing, so it's safe to deref
// it to &T.
unsafe { &**self.ptr }
@ -123,7 +123,7 @@ impl<T: Castable> LayoutJS<T> {
where U: Castable,
T: DerivedFrom<U>
{
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
unsafe { mem::transmute_copy(self) }
}
@ -131,7 +131,7 @@ impl<T: Castable> LayoutJS<T> {
pub fn downcast<U>(&self) -> Option<LayoutJS<U>>
where U: DerivedFrom<T>
{
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
unsafe {
if (*self.unsafe_get()).is::<U>() {
Some(mem::transmute_copy(self))
@ -145,7 +145,7 @@ impl<T: Castable> LayoutJS<T> {
impl<T: Reflectable> LayoutJS<T> {
/// Get the reflector.
pub unsafe fn get_jsobject(&self) -> *mut JSObject {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
(**self.ptr).reflector().get_jsobject().get()
}
}
@ -184,7 +184,7 @@ impl <T> Clone for JS<T> {
#[inline]
#[allow(unrooted_must_root)]
fn clone(&self) -> JS<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
JS {
ptr: self.ptr.clone(),
}
@ -194,7 +194,7 @@ impl <T> Clone for JS<T> {
impl <T> Clone for LayoutJS<T> {
#[inline]
fn clone(&self) -> LayoutJS<T> {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
LayoutJS {
ptr: self.ptr.clone(),
}
@ -205,7 +205,7 @@ impl LayoutJS<Node> {
/// Create a new JS-owned value wrapped from an address known to be a
/// `Node` pointer.
pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutJS<Node> {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
let TrustedNodeAddress(addr) = inner;
LayoutJS {
ptr: NonZero::new(addr as *const Node),
@ -240,7 +240,7 @@ pub struct MutHeapJSVal {
impl MutHeapJSVal {
/// Create a new `MutHeapJSVal`.
pub fn new() -> MutHeapJSVal {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
MutHeapJSVal {
val: UnsafeCell::new(Heap::default()),
}
@ -249,7 +249,7 @@ impl MutHeapJSVal {
/// Set this `MutHeapJSVal` to the given value, calling write barriers as
/// appropriate.
pub fn set(&self, val: JSVal) {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
let cell = self.val.get();
(*cell).set(val);
@ -258,7 +258,7 @@ impl MutHeapJSVal {
/// Get the value in this `MutHeapJSVal`, calling read barriers as appropriate.
pub fn get(&self) -> JSVal {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe { (*self.val.get()).get() }
}
}
@ -278,7 +278,7 @@ pub struct MutHeap<T: HeapGCValue> {
impl<T: Reflectable> MutHeap<JS<T>> {
/// Create a new `MutHeap`.
pub fn new(initial: &T) -> MutHeap<JS<T>> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
MutHeap {
val: UnsafeCell::new(JS::from_ref(initial)),
}
@ -286,7 +286,7 @@ impl<T: Reflectable> MutHeap<JS<T>> {
/// Set this `MutHeap` to the given value.
pub fn set(&self, val: &T) {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
*self.val.get() = JS::from_ref(val);
}
@ -294,7 +294,7 @@ impl<T: Reflectable> MutHeap<JS<T>> {
/// Get the value in this `MutHeap`.
pub fn get(&self) -> Root<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
Root::from_ref(&*ptr::read(self.val.get()))
}
@ -339,7 +339,7 @@ pub struct MutNullableHeap<T: HeapGCValue> {
impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// Create a new `MutNullableHeap`.
pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
MutNullableHeap {
ptr: UnsafeCell::new(initial.map(JS::from_ref)),
}
@ -350,7 +350,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
pub fn or_init<F>(&self, cb: F) -> Root<T>
where F: FnOnce() -> Root<T>
{
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
match self.get() {
Some(inner) => inner,
None => {
@ -365,14 +365,14 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// For use by layout, which can't use safe types like Temporary.
#[allow(unrooted_must_root)]
pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutJS<T>> {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
ptr::read(self.ptr.get()).map(|js| js.to_layout())
}
/// Get a rooted value out of this object
#[allow(unrooted_must_root)]
pub fn get(&self) -> Option<Root<T>> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
ptr::read(self.ptr.get()).map(|o| Root::from_ref(&*o))
}
@ -380,7 +380,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// Set this `MutNullableHeap` to the given value.
pub fn set(&self, val: Option<&T>) {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
*self.ptr.get() = val.map(|p| JS::from_ref(p));
}
@ -407,7 +407,7 @@ impl<'a, T: Reflectable> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
impl<T: HeapGCValue> Default for MutNullableHeap<T> {
#[allow(unrooted_must_root)]
fn default() -> MutNullableHeap<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
MutNullableHeap {
ptr: UnsafeCell::new(None),
}
@ -426,7 +426,7 @@ impl<T: Reflectable> LayoutJS<T> {
/// the only method that be safely accessed from layout. (The fact that
/// this is unsafe is what necessitates the layout wrappers.)
pub unsafe fn unsafe_get(&self) -> *const T {
debug_assert!(task_state::get().is_layout());
debug_assert!(thread_state::get().is_layout());
*self.ptr
}
}
@ -479,7 +479,7 @@ impl Clone for RootCollectionPtr {
impl RootCollection {
/// Create an empty collection of roots
pub fn new() -> RootCollection {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
RootCollection {
roots: UnsafeCell::new(vec![]),
}
@ -487,7 +487,7 @@ impl RootCollection {
/// Start tracking a stack-based root
fn root(&self, untracked_reflector: *const Reflector) {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
let mut roots = &mut *self.roots.get();
roots.push(untracked_reflector);
@ -497,7 +497,7 @@ impl RootCollection {
/// Stop tracking a stack-based root, asserting if the reflector isn't found
fn unroot<T: Reflectable>(&self, rooted: &Root<T>) {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe {
let mut roots = &mut *self.roots.get();
let old_reflector = &*rooted.reflector();
@ -562,7 +562,7 @@ impl<T: Reflectable> Root<T> {
/// It cannot not outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`.
pub fn new(unrooted: NonZero<*const T>) -> Root<T> {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
STACK_ROOTS.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
unsafe { (*collection).root(&*(**unrooted).reflector()) }
@ -588,7 +588,7 @@ impl<T: Reflectable> Root<T> {
impl<T: Reflectable> Deref for Root<T> {
type Target = T;
fn deref(&self) -> &T {
debug_assert!(task_state::get().is_script());
debug_assert!(thread_state::get().is_script());
unsafe { &**self.ptr.deref() }
}
}

View file

@ -3,21 +3,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task for asynchronous events). Akin to Gecko's
//! between threads (or intra-thread for asynchronous events). Akin to Gecko's
//! nsMainThreadPtrHandle, this uses thread-safe reference counting and ensures
//! that the actual SpiderMonkey GC integration occurs on the script task via
//! that the actual SpiderMonkey GC integration occurs on the script thread via
//! message passing. Ownership of a `Trusted<T>` object means the DOM object of
//! type T to which it points remains alive. Any other behaviour is undefined.
//! To guarantee the lifetime of a DOM object when performing asynchronous operations,
//! obtain a `Trusted<T>` from that object and pass it along with each operation.
//! A usable pointer to the original DOM object can be obtained on the script task
//! A usable pointer to the original DOM object can be obtained on the script thread
//! from a `Trusted<T>` via the `to_temporary` method.
//!
//! The implementation of Trusted<T> is as follows:
//! A hashtable resides in the script task, keyed on the pointer to the Rust DOM object.
//! A hashtable resides in the script thread, keyed on the pointer to the Rust DOM object.
//! The values in this hashtable are atomic reference counts. When a Trusted<T> object is
//! created or cloned, this count is increased. When a Trusted<T> is dropped, the count
//! decreases. If the count hits zero, a message is dispatched to the script task to remove
//! decreases. If the count hits zero, a message is dispatched to the script thread to remove
//! the entry from the hashmap if the count is still zero. The JS reflector for the DOM object
//! is rooted when a hashmap entry is first created, and unrooted when the hashmap entry
//! is removed.
@ -28,7 +28,7 @@ use dom::bindings::reflector::{Reflectable, Reflector};
use dom::bindings::trace::trace_reflector;
use js::jsapi::JSTracer;
use libc;
use script_task::{CommonScriptMsg, ScriptChan};
use script_thread::{CommonScriptMsg, ScriptChan};
use std::cell::RefCell;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::HashMap;
@ -52,13 +52,13 @@ pub struct TrustedReference(*const libc::c_void);
unsafe impl Send for TrustedReference {}
/// A safe wrapper around a raw pointer to a DOM object that can be
/// shared among tasks for use in asynchronous operations. The underlying
/// shared among threads for use in asynchronous operations. The underlying
/// DOM object is guaranteed to live at least as long as the last outstanding
/// `Trusted<T>` instance.
#[allow_unrooted_interior]
pub struct Trusted<T: Reflectable> {
/// A pointer to the Rust DOM object of type T, but void to allow
/// sending `Trusted<T>` between tasks, regardless of T's sendability.
/// sending `Trusted<T>` between threads, regardless of T's sendability.
ptr: *const libc::c_void,
refcount: Arc<Mutex<usize>>,
script_chan: Box<ScriptChan + Send>,
@ -125,7 +125,7 @@ impl<T: Reflectable> Drop for Trusted<T> {
assert!(*refcount > 0);
*refcount -= 1;
if *refcount == 0 {
// It's possible this send will fail if the script task
// It's possible this send will fail if the script thread
// has already exited. There's not much we can do at this
// point though.
let msg = CommonScriptMsg::RefcountCleanup(TrustedReference(self.ptr));
@ -142,7 +142,7 @@ pub struct LiveDOMReferences {
}
impl LiveDOMReferences {
/// Set up the task-local data required for storing the outstanding DOM references.
/// Set up the thread-local data required for storing the outstanding DOM references.
pub fn initialize() {
LIVE_REFERENCES.with(|ref r| {
*r.borrow_mut() = Some(LiveDOMReferences {

View file

@ -58,11 +58,11 @@ use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
use net_traits::Metadata;
use net_traits::image::base::Image;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask};
use net_traits::storage_task::StorageType;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::storage_thread::StorageType;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
use script_task::ScriptChan;
use script_thread::ScriptChan;
use script_traits::{LayoutMsg, ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress};
use selectors::parser::PseudoElement;
use selectors::states::*;
@ -262,7 +262,7 @@ no_jsmanaged_fields!(Receiver<T>);
no_jsmanaged_fields!(Rect<T>);
no_jsmanaged_fields!(Size2D<T>);
no_jsmanaged_fields!(Arc<T>);
no_jsmanaged_fields!(Image, ImageCacheChan, ImageCacheTask);
no_jsmanaged_fields!(Image, ImageCacheChan, ImageCacheThread);
no_jsmanaged_fields!(Metadata);
no_jsmanaged_fields!(Atom, Namespace, QualName);
no_jsmanaged_fields!(Trusted<T: Reflectable>);