avm2: Annotate all object *Data structs with `#[repr(C)]`
This ensures that the ScriptObjectData common to every *Data is always at the same offset, which results in better codegen for TObject methods
This commit is contained in:
parent
c54de07382
commit
6c233ed859
|
@ -49,6 +49,7 @@ impl fmt::Debug for ArrayObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ArrayObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -54,6 +54,7 @@ impl fmt::Debug for BitmapDataObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct BitmapDataObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -69,6 +69,7 @@ impl fmt::Debug for ByteArrayObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ByteArrayObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -38,6 +38,7 @@ pub struct ClassObjectWeak<'gc>(pub GcWeak<'gc, ClassObjectData<'gc>>);
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ClassObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -482,6 +482,7 @@ impl<'gc> Context3DObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct Context3DData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -74,6 +74,7 @@ impl<'gc> DateObject<'gc> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct DateObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -49,6 +49,7 @@ impl fmt::Debug for DictionaryObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct DictionaryObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -54,6 +54,7 @@ impl fmt::Debug for DispatchObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct DispatchObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -50,6 +50,7 @@ impl fmt::Debug for DomainObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct DomainObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -51,6 +51,7 @@ impl fmt::Debug for ErrorObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ErrorObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -43,6 +43,7 @@ pub struct EventObjectWeak<'gc>(pub GcWeak<'gc, EventObjectData<'gc>>);
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct EventObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -83,6 +83,7 @@ pub enum FileReference {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct FileReferenceObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -88,6 +88,7 @@ impl<'gc> TObject<'gc> for FontObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct FontObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -80,6 +80,7 @@ impl fmt::Debug for FunctionObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct FunctionObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -65,6 +65,7 @@ impl<'gc> IndexBuffer3DObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct IndexBuffer3DObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -90,6 +90,7 @@ impl fmt::Debug for LoaderInfoObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct LoaderInfoObjectData<'gc> {
|
||||
/// All normal script data.
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -48,6 +48,7 @@ impl fmt::Debug for LocalConnectionObject<'_> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct LocalConnectionObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -57,6 +57,7 @@ impl fmt::Debug for NamespaceObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct NamespaceObjectData<'gc> {
|
||||
/// All normal script data.
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -40,6 +40,7 @@ pub struct NetConnectionObjectWeak<'gc>(pub GcWeak<'gc, NetConnectionObjectData<
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct NetConnectionObjectData<'gc> {
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
#[collect(require_static)]
|
||||
|
|
|
@ -41,6 +41,7 @@ pub struct NetStreamObjectWeak<'gc>(pub GcWeak<'gc, NetStreamObjectData<'gc>>);
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct NetStreamObjectData<'gc> {
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
ns: NetStream<'gc>,
|
||||
|
|
|
@ -48,6 +48,7 @@ impl fmt::Debug for PrimitiveObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct PrimitiveObjectData<'gc> {
|
||||
/// All normal script data.
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -57,6 +57,7 @@ impl<'gc> Program3DObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct Program3DObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -44,6 +44,7 @@ impl fmt::Debug for ProxyObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ProxyObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -49,6 +49,7 @@ impl fmt::Debug for QNameObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct QNameObjectData<'gc> {
|
||||
/// All normal script data.
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -47,6 +47,7 @@ impl fmt::Debug for RegExpObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct RegExpObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -104,6 +104,7 @@ impl<'gc> ResponderObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ResponderObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -57,6 +57,7 @@ impl<'gc> ShaderDataObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct ShaderDataObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -199,6 +199,7 @@ impl_read!(read_float 4; f32, read_double 8; f64, read_int 4; i32, read_unsigned
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct SocketObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -62,6 +62,7 @@ impl fmt::Debug for SoundObject<'_> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct SoundObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -52,6 +52,7 @@ impl fmt::Debug for SoundChannelObject<'_> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct SoundChannelObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -63,6 +63,7 @@ impl<'gc> Stage3DObject<'gc> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct Stage3DObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -21,6 +21,7 @@ pub struct StageObjectWeak<'gc>(pub GcWeak<'gc, StageObjectData<'gc>>);
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct StageObjectData<'gc> {
|
||||
/// The base data common to all AVM2 objects.
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -48,6 +48,7 @@ impl fmt::Debug for TextFormatObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct TextFormatObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -62,6 +62,7 @@ impl<'gc> TextureObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct TextureObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -53,6 +53,7 @@ impl fmt::Debug for VectorObject<'_> {
|
|||
|
||||
#[derive(Collect, Clone)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct VectorObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -63,6 +63,7 @@ impl<'gc> VertexBuffer3DObject<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct VertexBuffer3DObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -345,6 +345,7 @@ impl<'gc> XmlListObject<'gc> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct XmlListObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
|
@ -58,6 +58,7 @@ impl fmt::Debug for XmlObject<'_> {
|
|||
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
#[repr(C)]
|
||||
pub struct XmlObjectData<'gc> {
|
||||
/// Base script object
|
||||
base: RefLock<ScriptObjectData<'gc>>,
|
||||
|
|
Loading…
Reference in New Issue