Skip to content

Improve codegen for sized free. #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2020
Merged

Improve codegen for sized free. #115

merged 2 commits into from
Jan 22, 2020

Conversation

mjp41
Copy link
Member

@mjp41 mjp41 commented Jan 22, 2020

For languages like Verona or Rust, the deallocation calls know the
size of the object originally requested. This change optimises that
code path to create a much better fast path.

For languages like Verona or Rust, the deallocation calls know the
size of the object originally requested.  This change optimises that
code path to create a much better fast path.
@mjp41
Copy link
Member Author

mjp41 commented Jan 22, 2020

#109 motivated this PR.

@mjp41 mjp41 requested a review from plietar January 22, 2020 15:04
@mjp41
Copy link
Member Author

mjp41 commented Jan 22, 2020

With this change the rust_dealloc from #109 becomes:

0000000000000050 <rust_dealloc>:
  50:	48 89 f8             	mov    %rdi,%rax
  53:	64 48 8b 3c 25 00 00 	mov    %fs:0x0,%rdi
  5a:	00 00 
  5c:	48 83 c6 ff          	add    $0xffffffffffffffff,%rsi
  60:	48 83 c2 ff          	add    $0xffffffffffffffff,%rdx
  64:	48 09 f2             	or     %rsi,%rdx
  67:	48 81 fa ff ff 00 00 	cmp    $0xffff,%rdx
  6e:	77 49                	ja     b9 <rust_dealloc+0x69>
  70:	48 89 c6             	mov    %rax,%rsi
  73:	48 81 e6 00 00 00 ff 	and    $0xffffffffff000000,%rsi
  7a:	4c 8b 46 08          	mov    0x8(%rsi),%r8
  7e:	48 83 e2 f8          	and    $0xfffffffffffffff8,%rdx
  82:	48 8b 8a 00 00 00 00 	mov    0x0(%rdx),%rcx
  89:	48 8d 97 80 0c 00 00 	lea    0xc80(%rdi),%rdx
  90:	49 39 d0             	cmp    %rdx,%r8
  93:	75 30                	jne    c5 <rust_dealloc+0x75>
  95:	ba 10 08 00 00       	mov    $0x810,%edx
  9a:	c4 e2 68 f7 d0       	bextr  %edx,%eax,%edx
  9f:	48 c1 e2 04          	shl    $0x4,%rdx
  a3:	66 83 44 16 60 ff    	addw   $0xffff,0x60(%rsi,%rdx,1)
  a9:	74 25                	je     d0 <rust_dealloc+0x80>
  ab:	48 8b 4c 16 58       	mov    0x58(%rsi,%rdx,1),%rcx
  b0:	48 89 44 16 58       	mov    %rax,0x58(%rsi,%rdx,1)
  b5:	48 89 08             	mov    %rcx,(%rax)
  b8:	c3                   	retq   
  b9:	48 83 c2 01          	add    $0x1,%rdx
  bd:	48 89 c6             	mov    %rax,%rsi
  c0:	e9 00 00 00 00       	jmpq   c5 <rust_dealloc+0x75>
  c5:	4c 89 c6             	mov    %r8,%rsi
  c8:	48 89 c2             	mov    %rax,%rdx
  cb:	e9 00 00 00 00       	jmpq   d0 <rust_dealloc+0x80>
  d0:	48 89 c2             	mov    %rax,%rdx
  d3:	e9 00 00 00 00       	jmpq   d8 <rust_dealloc+0x88>
  d8:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
  df:	00 

@mjp41 mjp41 merged commit 4212ac8 into master Jan 22, 2020
@mjp41 mjp41 mentioned this pull request Jan 22, 2020
@mjp41 mjp41 deleted the size_dealloc branch January 24, 2020 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants