[libcxx-commits] [PATCH] D68617: partially inline copy constructor basic_string(const basic_string&[, allocator])

Martijn Vels via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 9 09:51:23 PDT 2019


mvels added a comment.

libc++.so code for std::string ctor (demangled / mixed source)

  00000000000b7be0 <std_string::basic_string(std_string const&)>:
  {
     b7be0:	55                   	push   %rbp
     b7be1:	48 89 e5             	mov    %rsp,%rbp
     b7be4:	41 57                	push   %r15
     b7be6:	41 56                	push   %r14
     b7be8:	41 55                	push   %r13
     b7bea:	41 54                	push   %r12
     b7bec:	53                   	push   %rbx
     b7bed:	50                   	push   %rax
     b7bee:	48 89 fb             	mov    %rdi,%rbx
          {return bool(__r_.first().__s.__size_ & __short_mask);}
     b7bf1:	80 7e 17 00          	cmpb   $0x0,0x17(%rsi)
      if (!__str.__is_long())
     b7bf5:	78 10                	js     b7c07 <std_string::basic_string(std_string const&)+0x27>
          __r_.first().__r = __str.__r_.first().__r;
     b7bf7:	48 8b 46 10          	mov    0x10(%rsi),%rax
     b7bfb:	48 89 43 10          	mov    %rax,0x10(%rbx)
     b7bff:	0f 10 06             	movups (%rsi),%xmm0
     b7c02:	0f 11 03             	movups %xmm0,(%rbx)
     b7c05:	eb 58                	jmp    b7c5f <std_string::basic_string(std_string const&)+0x7f>
          {return __r_.first().__l.__data_;}
     b7c07:	4c 8b 3e             	mov    (%rsi),%r15
          {return __r_.first().__l.__size_;}
     b7c0a:	4c 8b 76 08          	mov    0x8(%rsi),%r14
              {return (__s + (__a-1)) & ~(__a-1);}
     b7c0e:	49 8d 46 10          	lea    0x10(%r14),%rax
     b7c12:	48 83 e0 f0          	and    $0xfffffffffffffff0,%rax
    pointer __p = __alloc_traits::allocate(__alloc(), __cap + 1);
     b7c16:	49 83 fe 17          	cmp    $0x17,%r14
     b7c1a:	41 bd 17 00 00 00    	mov    $0x17,%r13d
     b7c20:	4c 0f 43 e8          	cmovae %rax,%r13
    return __builtin_operator_new(__size);
     b7c24:	4c 89 ef             	mov    %r13,%rdi
     b7c27:	e8 74 c0 00 00       	callq  c3ca0 <operator new(unsigned long)@plt>
     b7c2c:	49 89 c4             	mov    %rax,%r12
          {__r_.first().__l.__data_ = __p;}
     b7c2f:	48 89 03             	mov    %rax,(%rbx)
     b7c32:	48 b8 00 00 00 00 00 	movabs $0x8000000000000000,%rax
     b7c39:	00 00 80 
          {__r_.first().__l.__cap_  = __long_mask | __s;}
     b7c3c:	4c 09 e8             	or     %r13,%rax
     b7c3f:	48 89 43 10          	mov    %rax,0x10(%rbx)
          {__r_.first().__l.__size_ = __s;}
     b7c43:	4c 89 73 08          	mov    %r14,0x8(%rbx)
              return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
     b7c47:	4d 85 f6             	test   %r14,%r14
     b7c4a:	74 0e                	je     b7c5a <std_string::basic_string(std_string const&)+0x7a>
     b7c4c:	4c 89 e7             	mov    %r12,%rdi
     b7c4f:	4c 89 fe             	mov    %r15,%rsi
     b7c52:	4c 89 f2             	mov    %r14,%rdx
     b7c55:	e8 b6 c0 00 00       	callq  c3d10 <memcpy at plt>
      void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
     b7c5a:	43 c6 04 34 00       	movb   $0x0,(%r12,%r14,1)
  }
     b7c5f:	48 83 c4 08          	add    $0x8,%rsp
     b7c63:	5b                   	pop    %rbx
     b7c64:	41 5c                	pop    %r12
     b7c66:	41 5d                	pop    %r13
     b7c68:	41 5e                	pop    %r14
     b7c6a:	41 5f                	pop    %r15
     b7c6c:	5d                   	pop    %rbp
     b7c6d:	c3                   	retq   


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68617/new/

https://reviews.llvm.org/D68617





More information about the libcxx-commits mailing list