Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Implemented
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Component/s: Clownfish
    • Labels:
      None

      Description

      If an upstream parcel adds, removes or rearranges member variables,
      downstream extensions that build on the affected classes will break.

      1. member_offset_constant.c
        0.2 kB
        Marvin Humphrey
      2. member_offset_variable.c
        0.4 kB
        Marvin Humphrey
      3. struct_abi_demo.patch
        33 kB
        Marvin Humphrey

        Activity

        Hide
        Marvin Humphrey added a comment -

        The files member_offset_constant.c and member_offset_variable.c illustrate one
        approach: accessing member vars via variable offsets at runtime.

        When those files are compiled to assembler with optimization enabled
        (cc -Wall -Wextra -c -S -O2), here are the only differences:

        $ diff -u member_offset_constant.s member_offset_variable.s
        --- member_offset_constant.s	2012-09-07 11:16:10.000000000 -0700
        +++ member_offset_variable.s	2012-09-07 11:16:05.000000000 -0700
        @@ -12,7 +12,8 @@
         	movq	%rsp, %rbp
         Ltmp4:
         	.cfi_def_cfa_register %rbp
        -	movl	%esi, 8(%rdi)
        +	movq	_Foo_num_OFFSET(%rip), %rax
        +	movl	%esi, (%rdi,%rax)
         	popq	%rbp
         	ret
         	.cfi_endproc
        @@ -30,7 +31,8 @@
         	movq	%rsp, %rbp
         Ltmp9:
         	.cfi_def_cfa_register %rbp
        -	movl	8(%rdi), %eax
        +	movq	_Foo_num_OFFSET(%rip), %rax
        +	movl	(%rdi,%rax), %eax
         	popq	%rbp
         	ret
         	.cfi_endproc
        $
        
        Show
        Marvin Humphrey added a comment - The files member_offset_constant.c and member_offset_variable.c illustrate one approach: accessing member vars via variable offsets at runtime. When those files are compiled to assembler with optimization enabled ( cc -Wall -Wextra -c -S -O2 ), here are the only differences: $ diff -u member_offset_constant.s member_offset_variable.s --- member_offset_constant.s 2012-09-07 11:16:10.000000000 -0700 +++ member_offset_variable.s 2012-09-07 11:16:05.000000000 -0700 @@ -12,7 +12,8 @@ movq %rsp, %rbp Ltmp4: .cfi_def_cfa_register %rbp - movl %esi, 8(%rdi) + movq _Foo_num_OFFSET(%rip), %rax + movl %esi, (%rdi,%rax) popq %rbp ret .cfi_endproc @@ -30,7 +31,8 @@ movq %rsp, %rbp Ltmp9: .cfi_def_cfa_register %rbp - movl 8(%rdi), %eax + movq _Foo_num_OFFSET(%rip), %rax + movl (%rdi,%rax), %eax popq %rbp ret .cfi_endproc $
        Hide
        Marvin Humphrey added a comment -

        Attach proof of concept patch.

        This patch was committed in SVN on an experimental branch. I plan
        to delete that branch from our Git repo for the sake of tidiness so I'm
        archiving the changes here.

        Show
        Marvin Humphrey added a comment - Attach proof of concept patch. This patch was committed in SVN on an experimental branch. I plan to delete that branch from our Git repo for the sake of tidiness so I'm archiving the changes here.

          People

          • Assignee:
            Unassigned
            Reporter:
            Marvin Humphrey
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development