1280ddee8SMarshall Clow //===-------------------------- cxa_vector.cpp ---------------------------===// 2280ddee8SMarshall Clow // 3280ddee8SMarshall Clow // The LLVM Compiler Infrastructure 4280ddee8SMarshall Clow // 5280ddee8SMarshall Clow // This file is dual licensed under the MIT and the University of Illinois Open 6280ddee8SMarshall Clow // Source Licenses. See LICENSE.TXT for details. 7280ddee8SMarshall Clow // 8280ddee8SMarshall Clow // 9280ddee8SMarshall Clow // This file implements the "Array Construction and Destruction APIs" 10280ddee8SMarshall Clow // http://www.codesourcery.com/public/cxx-abi/abi.html#array-ctor 11280ddee8SMarshall Clow // 12280ddee8SMarshall Clow //===----------------------------------------------------------------------===// 13280ddee8SMarshall Clow 14280ddee8SMarshall Clow #include "cxxabi.h" 15280ddee8SMarshall Clow 16280ddee8SMarshall Clow #include <exception> // for std::terminate 17280ddee8SMarshall Clow 18280ddee8SMarshall Clow namespace __cxxabiv1 { 19280ddee8SMarshall Clow 20280ddee8SMarshall Clow #pragma mark --Helper routines and classes -- 21280ddee8SMarshall Clow 22280ddee8SMarshall Clow namespace { 23280ddee8SMarshall Clow inline static size_t __get_element_count ( void *p ) { 24280ddee8SMarshall Clow return static_cast <size_t *> (p)[-1]; 25280ddee8SMarshall Clow } 26280ddee8SMarshall Clow 27280ddee8SMarshall Clow inline static void __set_element_count ( void *p, size_t element_count ) { 28280ddee8SMarshall Clow static_cast <size_t *> (p)[-1] = element_count; 29280ddee8SMarshall Clow } 30280ddee8SMarshall Clow 31280ddee8SMarshall Clow 32280ddee8SMarshall Clow // A pair of classes to simplify exception handling and control flow. 33280ddee8SMarshall Clow // They get passed a block of memory in the constructor, and unless the 34280ddee8SMarshall Clow // 'release' method is called, they deallocate the memory in the destructor. 35*be2eced4SHoward Hinnant // Preferred usage is to allocate some memory, attach it to one of these objects, 36280ddee8SMarshall Clow // and then, when all the operations to set up the memory block have succeeded, 37280ddee8SMarshall Clow // call 'release'. If any of the setup operations fail, or an exception is 38280ddee8SMarshall Clow // thrown, then the block is automatically deallocated. 39280ddee8SMarshall Clow // 40280ddee8SMarshall Clow // The only difference between these two classes is the signature for the 41280ddee8SMarshall Clow // deallocation function (to match new2/new3 and delete2/delete3. 42280ddee8SMarshall Clow class st_heap_block2 { 43280ddee8SMarshall Clow public: 44280ddee8SMarshall Clow typedef void (*dealloc_f)(void *); 45280ddee8SMarshall Clow 46280ddee8SMarshall Clow st_heap_block2 ( dealloc_f dealloc, void *ptr ) 47280ddee8SMarshall Clow : dealloc_ ( dealloc ), ptr_ ( ptr ), enabled_ ( true ) {} 48280ddee8SMarshall Clow ~st_heap_block2 () { if ( enabled_ ) dealloc_ ( ptr_ ) ; } 49280ddee8SMarshall Clow void release () { enabled_ = false; } 50280ddee8SMarshall Clow 51280ddee8SMarshall Clow private: 52280ddee8SMarshall Clow dealloc_f dealloc_; 53280ddee8SMarshall Clow void *ptr_; 54280ddee8SMarshall Clow bool enabled_; 55280ddee8SMarshall Clow }; 56280ddee8SMarshall Clow 57280ddee8SMarshall Clow class st_heap_block3 { 58280ddee8SMarshall Clow public: 59280ddee8SMarshall Clow typedef void (*dealloc_f)(void *, size_t); 60280ddee8SMarshall Clow 61280ddee8SMarshall Clow st_heap_block3 ( dealloc_f dealloc, void *ptr, size_t size ) 62280ddee8SMarshall Clow : dealloc_ ( dealloc ), ptr_ ( ptr ), size_ ( size ), enabled_ ( true ) {} 63280ddee8SMarshall Clow ~st_heap_block3 () { if ( enabled_ ) dealloc_ ( ptr_, size_ ) ; } 64280ddee8SMarshall Clow void release () { enabled_ = false; } 65280ddee8SMarshall Clow 66280ddee8SMarshall Clow private: 67280ddee8SMarshall Clow dealloc_f dealloc_; 68280ddee8SMarshall Clow void *ptr_; 69280ddee8SMarshall Clow size_t size_; 70280ddee8SMarshall Clow bool enabled_; 71280ddee8SMarshall Clow }; 72280ddee8SMarshall Clow 73280ddee8SMarshall Clow class st_cxa_cleanup { 74280ddee8SMarshall Clow public: 75280ddee8SMarshall Clow typedef void (*destruct_f)(void *); 76280ddee8SMarshall Clow 77280ddee8SMarshall Clow st_cxa_cleanup ( void *ptr, size_t &idx, size_t element_size, destruct_f destructor ) 78280ddee8SMarshall Clow : ptr_ ( ptr ), idx_ ( idx ), element_size_ ( element_size ), 79280ddee8SMarshall Clow destructor_ ( destructor ), enabled_ ( true ) {} 80280ddee8SMarshall Clow ~st_cxa_cleanup () { 81280ddee8SMarshall Clow if ( enabled_ ) 82280ddee8SMarshall Clow __cxa_vec_cleanup ( ptr_, idx_, element_size_, destructor_ ); 83280ddee8SMarshall Clow } 84280ddee8SMarshall Clow 85280ddee8SMarshall Clow void release () { enabled_ = false; } 86280ddee8SMarshall Clow 87280ddee8SMarshall Clow private: 88280ddee8SMarshall Clow void *ptr_; 89280ddee8SMarshall Clow size_t &idx_; 90280ddee8SMarshall Clow size_t element_size_; 91280ddee8SMarshall Clow destruct_f destructor_; 92280ddee8SMarshall Clow bool enabled_; 93280ddee8SMarshall Clow }; 94280ddee8SMarshall Clow 95280ddee8SMarshall Clow class st_terminate { 96280ddee8SMarshall Clow public: 97280ddee8SMarshall Clow st_terminate ( bool enabled = true ) : enabled_ ( enabled ) {} 98280ddee8SMarshall Clow ~st_terminate () { if ( enabled_ ) std::terminate (); } 99280ddee8SMarshall Clow void release () { enabled_ = false; } 100280ddee8SMarshall Clow private: 101280ddee8SMarshall Clow bool enabled_ ; 102280ddee8SMarshall Clow }; 103280ddee8SMarshall Clow } 104280ddee8SMarshall Clow 105280ddee8SMarshall Clow #pragma mark --Externally visible routines-- 106280ddee8SMarshall Clow 107280ddee8SMarshall Clow extern "C" { 108280ddee8SMarshall Clow 109280ddee8SMarshall Clow // Equivalent to 110280ddee8SMarshall Clow // 111280ddee8SMarshall Clow // __cxa_vec_new2(element_count, element_size, padding_size, constructor, 112280ddee8SMarshall Clow // destructor, &::operator new[], &::operator delete[]) 113280ddee8SMarshall Clow void* __cxa_vec_new( 114280ddee8SMarshall Clow size_t element_count, size_t element_size, size_t padding_size, 115280ddee8SMarshall Clow void (*constructor)(void*), void (*destructor)(void*) ) { 116280ddee8SMarshall Clow 117280ddee8SMarshall Clow return __cxa_vec_new2 ( element_count, element_size, padding_size, 118280ddee8SMarshall Clow constructor, destructor, &::operator new [], &::operator delete [] ); 119280ddee8SMarshall Clow } 120280ddee8SMarshall Clow 121280ddee8SMarshall Clow 122280ddee8SMarshall Clow 123280ddee8SMarshall Clow // Given the number and size of elements for an array and the non-negative 124280ddee8SMarshall Clow // size of prefix padding for a cookie, allocate space (using alloc) for 125280ddee8SMarshall Clow // the array preceded by the specified padding, initialize the cookie if 126280ddee8SMarshall Clow // the padding is non-zero, and call the given constructor on each element. 127280ddee8SMarshall Clow // Return the address of the array proper, after the padding. 128280ddee8SMarshall Clow // 129280ddee8SMarshall Clow // If alloc throws an exception, rethrow the exception. If alloc returns 130280ddee8SMarshall Clow // NULL, return NULL. If the constructor throws an exception, call 131280ddee8SMarshall Clow // destructor for any already constructed elements, and rethrow the 132280ddee8SMarshall Clow // exception. If the destructor throws an exception, call std::terminate. 133280ddee8SMarshall Clow // 134280ddee8SMarshall Clow // The constructor may be NULL, in which case it must not be called. If the 135280ddee8SMarshall Clow // padding_size is zero, the destructor may be NULL; in that case it must 136280ddee8SMarshall Clow // not be called. 137280ddee8SMarshall Clow // 138280ddee8SMarshall Clow // Neither alloc nor dealloc may be NULL. 139280ddee8SMarshall Clow void* __cxa_vec_new2( 140280ddee8SMarshall Clow size_t element_count, size_t element_size, size_t padding_size, 141280ddee8SMarshall Clow void (*constructor)(void*), void (*destructor)(void*), 142280ddee8SMarshall Clow void* (*alloc)(size_t), void (*dealloc)(void*) ) { 143280ddee8SMarshall Clow 144280ddee8SMarshall Clow const size_t heap_size = element_count * element_size + padding_size; 145280ddee8SMarshall Clow char * const heap_block = static_cast<char *> ( alloc ( heap_size )); 146280ddee8SMarshall Clow char *vec_base = heap_block; 147280ddee8SMarshall Clow 148280ddee8SMarshall Clow if ( NULL != vec_base ) { 149280ddee8SMarshall Clow st_heap_block2 heap ( dealloc, heap_block ); 150280ddee8SMarshall Clow 151280ddee8SMarshall Clow // put the padding before the array elements 152280ddee8SMarshall Clow if ( 0 != padding_size ) { 153280ddee8SMarshall Clow vec_base += padding_size; 154280ddee8SMarshall Clow __set_element_count ( vec_base, element_count ); 155280ddee8SMarshall Clow } 156280ddee8SMarshall Clow 157280ddee8SMarshall Clow // Construct the elements 158280ddee8SMarshall Clow __cxa_vec_ctor ( vec_base, element_count, element_size, constructor, destructor ); 159280ddee8SMarshall Clow heap.release (); // We're good! 160280ddee8SMarshall Clow } 161280ddee8SMarshall Clow 162280ddee8SMarshall Clow return vec_base; 163280ddee8SMarshall Clow } 164280ddee8SMarshall Clow 165280ddee8SMarshall Clow 166280ddee8SMarshall Clow // Same as __cxa_vec_new2 except that the deallocation function takes both 167280ddee8SMarshall Clow // the object address and its size. 168280ddee8SMarshall Clow void* __cxa_vec_new3( 169280ddee8SMarshall Clow size_t element_count, size_t element_size, size_t padding_size, 170280ddee8SMarshall Clow void (*constructor)(void*), void (*destructor)(void*), 171280ddee8SMarshall Clow void* (*alloc)(size_t), void (*dealloc)(void*, size_t) ) { 172280ddee8SMarshall Clow 173280ddee8SMarshall Clow const size_t heap_size = element_count * element_size + padding_size; 174280ddee8SMarshall Clow char * const heap_block = static_cast<char *> ( alloc ( heap_size )); 175280ddee8SMarshall Clow char *vec_base = heap_block; 176280ddee8SMarshall Clow 177280ddee8SMarshall Clow if ( NULL != vec_base ) { 178280ddee8SMarshall Clow st_heap_block3 heap ( dealloc, heap_block, heap_size ); 179280ddee8SMarshall Clow 180280ddee8SMarshall Clow // put the padding before the array elements 181280ddee8SMarshall Clow if ( 0 != padding_size ) { 182280ddee8SMarshall Clow vec_base += padding_size; 183280ddee8SMarshall Clow __set_element_count ( vec_base, element_count ); 184280ddee8SMarshall Clow } 185280ddee8SMarshall Clow 186280ddee8SMarshall Clow // Construct the elements 187280ddee8SMarshall Clow __cxa_vec_ctor ( vec_base, element_count, element_size, constructor, destructor ); 188280ddee8SMarshall Clow heap.release (); // We're good! 189280ddee8SMarshall Clow } 190280ddee8SMarshall Clow 191280ddee8SMarshall Clow return vec_base; 192280ddee8SMarshall Clow } 193280ddee8SMarshall Clow 194280ddee8SMarshall Clow 195280ddee8SMarshall Clow // Given the (data) addresses of a destination and a source array, an 196280ddee8SMarshall Clow // element count and an element size, call the given copy constructor to 197280ddee8SMarshall Clow // copy each element from the source array to the destination array. The 198280ddee8SMarshall Clow // copy constructor's arguments are the destination address and source 199280ddee8SMarshall Clow // address, respectively. If an exception occurs, call the given destructor 200280ddee8SMarshall Clow // (if non-NULL) on each copied element and rethrow. If the destructor 201280ddee8SMarshall Clow // throws an exception, call terminate(). The constructor and or destructor 202280ddee8SMarshall Clow // pointers may be NULL. If either is NULL, no action is taken when it 203280ddee8SMarshall Clow // would have been called. 204280ddee8SMarshall Clow 205280ddee8SMarshall Clow void __cxa_vec_cctor( void* dest_array, void* src_array, 206280ddee8SMarshall Clow size_t element_count, size_t element_size, 207280ddee8SMarshall Clow void (*constructor) (void*, void*), void (*destructor)(void*) ) { 208280ddee8SMarshall Clow 209280ddee8SMarshall Clow if ( NULL != constructor ) { 210280ddee8SMarshall Clow size_t idx = 0; 211280ddee8SMarshall Clow char *src_ptr = static_cast<char *>(src_array); 212280ddee8SMarshall Clow char *dest_ptr = static_cast<char *>(dest_array); 213280ddee8SMarshall Clow st_cxa_cleanup cleanup ( dest_array, idx, element_size, destructor ); 214280ddee8SMarshall Clow 215280ddee8SMarshall Clow for ( idx = 0; idx < element_count; 216280ddee8SMarshall Clow ++idx, src_ptr += element_size, dest_ptr += element_size ) 217280ddee8SMarshall Clow constructor ( dest_ptr, src_ptr ); 218280ddee8SMarshall Clow cleanup.release (); // We're good! 219280ddee8SMarshall Clow } 220280ddee8SMarshall Clow } 221280ddee8SMarshall Clow 222280ddee8SMarshall Clow 223280ddee8SMarshall Clow // Given the (data) address of an array, not including any cookie padding, 224280ddee8SMarshall Clow // and the number and size of its elements, call the given constructor on 225280ddee8SMarshall Clow // each element. If the constructor throws an exception, call the given 226280ddee8SMarshall Clow // destructor for any already-constructed elements, and rethrow the 227280ddee8SMarshall Clow // exception. If the destructor throws an exception, call terminate(). The 228280ddee8SMarshall Clow // constructor and/or destructor pointers may be NULL. If either is NULL, 229280ddee8SMarshall Clow // no action is taken when it would have been called. 230280ddee8SMarshall Clow void __cxa_vec_ctor( 231280ddee8SMarshall Clow void* array_address, size_t element_count, size_t element_size, 232280ddee8SMarshall Clow void (*constructor)(void*), void (*destructor)(void*) ) { 233280ddee8SMarshall Clow 234280ddee8SMarshall Clow if ( NULL != constructor ) { 235280ddee8SMarshall Clow size_t idx; 236280ddee8SMarshall Clow char *ptr = static_cast <char *> ( array_address ); 237280ddee8SMarshall Clow st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); 238280ddee8SMarshall Clow 239280ddee8SMarshall Clow // Construct the elements 240280ddee8SMarshall Clow for ( idx = 0; idx < element_count; ++idx, ptr += element_size ) 241280ddee8SMarshall Clow constructor ( ptr ); 242280ddee8SMarshall Clow cleanup.release (); // We're good! 243280ddee8SMarshall Clow } 244280ddee8SMarshall Clow } 245280ddee8SMarshall Clow 246280ddee8SMarshall Clow // Given the (data) address of an array, the number of elements, and the 247280ddee8SMarshall Clow // size of its elements, call the given destructor on each element. If the 248280ddee8SMarshall Clow // destructor throws an exception, rethrow after destroying the remaining 249280ddee8SMarshall Clow // elements if possible. If the destructor throws a second exception, call 250280ddee8SMarshall Clow // terminate(). The destructor pointer may be NULL, in which case this 251280ddee8SMarshall Clow // routine does nothing. 252280ddee8SMarshall Clow void __cxa_vec_dtor( 253280ddee8SMarshall Clow void* array_address, size_t element_count, size_t element_size, 254280ddee8SMarshall Clow void (*destructor)(void*) ) { 255280ddee8SMarshall Clow 256280ddee8SMarshall Clow if ( NULL != destructor ) { 257280ddee8SMarshall Clow char *ptr = static_cast <char *> (array_address); 258280ddee8SMarshall Clow size_t idx = element_count; 259280ddee8SMarshall Clow st_cxa_cleanup cleanup ( array_address, idx, element_size, destructor ); 260280ddee8SMarshall Clow { 2617fdfd5d2SHoward Hinnant st_terminate exception_guard (__cxa_uncaught_exception ()); 262280ddee8SMarshall Clow ptr += element_count * element_size; // one past the last element 263280ddee8SMarshall Clow 264280ddee8SMarshall Clow while ( idx-- > 0 ) { 265280ddee8SMarshall Clow ptr -= element_size; 266280ddee8SMarshall Clow destructor ( ptr ); 267280ddee8SMarshall Clow } 268280ddee8SMarshall Clow exception_guard.release (); // We're good ! 269280ddee8SMarshall Clow } 270280ddee8SMarshall Clow cleanup.release (); // We're still good! 271280ddee8SMarshall Clow } 272280ddee8SMarshall Clow } 273280ddee8SMarshall Clow 274280ddee8SMarshall Clow // Given the (data) address of an array, the number of elements, and the 275280ddee8SMarshall Clow // size of its elements, call the given destructor on each element. If the 276280ddee8SMarshall Clow // destructor throws an exception, call terminate(). The destructor pointer 277280ddee8SMarshall Clow // may be NULL, in which case this routine does nothing. 278280ddee8SMarshall Clow void __cxa_vec_cleanup( void* array_address, size_t element_count, 279280ddee8SMarshall Clow size_t element_size, void (*destructor)(void*) ) { 280280ddee8SMarshall Clow 281280ddee8SMarshall Clow if ( NULL != destructor ) { 282280ddee8SMarshall Clow char *ptr = static_cast <char *> (array_address); 283280ddee8SMarshall Clow size_t idx = element_count; 284280ddee8SMarshall Clow st_terminate exception_guard; 285280ddee8SMarshall Clow 286280ddee8SMarshall Clow ptr += element_count * element_size; // one past the last element 287280ddee8SMarshall Clow while ( idx-- > 0 ) { 288280ddee8SMarshall Clow ptr -= element_size; 289280ddee8SMarshall Clow destructor ( ptr ); 290280ddee8SMarshall Clow } 291280ddee8SMarshall Clow exception_guard.release (); // We're done! 292280ddee8SMarshall Clow } 293280ddee8SMarshall Clow } 294280ddee8SMarshall Clow 295280ddee8SMarshall Clow 296280ddee8SMarshall Clow // If the array_address is NULL, return immediately. Otherwise, given the 297280ddee8SMarshall Clow // (data) address of an array, the non-negative size of prefix padding for 298280ddee8SMarshall Clow // the cookie, and the size of its elements, call the given destructor on 299280ddee8SMarshall Clow // each element, using the cookie to determine the number of elements, and 300280ddee8SMarshall Clow // then delete the space by calling ::operator delete[](void *). If the 301280ddee8SMarshall Clow // destructor throws an exception, rethrow after (a) destroying the 302280ddee8SMarshall Clow // remaining elements, and (b) deallocating the storage. If the destructor 303280ddee8SMarshall Clow // throws a second exception, call terminate(). If padding_size is 0, the 304280ddee8SMarshall Clow // destructor pointer must be NULL. If the destructor pointer is NULL, no 305280ddee8SMarshall Clow // destructor call is to be made. 306280ddee8SMarshall Clow // 307280ddee8SMarshall Clow // The intent of this function is to permit an implementation to call this 308280ddee8SMarshall Clow // function when confronted with an expression of the form delete[] p in 309280ddee8SMarshall Clow // the source code, provided that the default deallocation function can be 310280ddee8SMarshall Clow // used. Therefore, the semantics of this function are consistent with 311280ddee8SMarshall Clow // those required by the standard. The requirement that the deallocation 312280ddee8SMarshall Clow // function be called even if the destructor throws an exception derives 313280ddee8SMarshall Clow // from the resolution to DR 353 to the C++ standard, which was adopted in 314280ddee8SMarshall Clow // April, 2003. 315280ddee8SMarshall Clow void __cxa_vec_delete( void* array_address, 316280ddee8SMarshall Clow size_t element_size, size_t padding_size, void (*destructor)(void*) ) { 317280ddee8SMarshall Clow 318280ddee8SMarshall Clow __cxa_vec_delete2 ( array_address, element_size, padding_size, 319280ddee8SMarshall Clow destructor, &::operator delete [] ); 320280ddee8SMarshall Clow } 321280ddee8SMarshall Clow 322280ddee8SMarshall Clow 323280ddee8SMarshall Clow // Same as __cxa_vec_delete, except that the given function is used for 324280ddee8SMarshall Clow // deallocation instead of the default delete function. If dealloc throws 325280ddee8SMarshall Clow // an exception, the result is undefined. The dealloc pointer may not be 326280ddee8SMarshall Clow // NULL. 327280ddee8SMarshall Clow void __cxa_vec_delete2( void* array_address, 328280ddee8SMarshall Clow size_t element_size, size_t padding_size, 329280ddee8SMarshall Clow void (*destructor)(void*), void (*dealloc)(void*) ) { 330280ddee8SMarshall Clow 331280ddee8SMarshall Clow if ( NULL != array_address ) { 332280ddee8SMarshall Clow char *vec_base = static_cast <char *> (array_address); 333280ddee8SMarshall Clow char *heap_block = vec_base - padding_size; 334280ddee8SMarshall Clow st_heap_block2 heap ( dealloc, heap_block ); 335280ddee8SMarshall Clow 336280ddee8SMarshall Clow if ( 0 != padding_size && NULL != destructor ) // call the destructors 337280ddee8SMarshall Clow __cxa_vec_dtor ( array_address, __get_element_count ( vec_base ), 338280ddee8SMarshall Clow element_size, destructor ); 339280ddee8SMarshall Clow } 340280ddee8SMarshall Clow } 341280ddee8SMarshall Clow 342280ddee8SMarshall Clow 343280ddee8SMarshall Clow // Same as __cxa_vec_delete, except that the given function is used for 344280ddee8SMarshall Clow // deallocation instead of the default delete function. The deallocation 345280ddee8SMarshall Clow // function takes both the object address and its size. If dealloc throws 346280ddee8SMarshall Clow // an exception, the result is undefined. The dealloc pointer may not be 347280ddee8SMarshall Clow // NULL. 348280ddee8SMarshall Clow void __cxa_vec_delete3( void* array_address, 349280ddee8SMarshall Clow size_t element_size, size_t padding_size, 350280ddee8SMarshall Clow void (*destructor)(void*), void (*dealloc) (void*, size_t)) { 351280ddee8SMarshall Clow 352280ddee8SMarshall Clow if ( NULL != array_address ) { 353280ddee8SMarshall Clow char *vec_base = static_cast <char *> (array_address); 354280ddee8SMarshall Clow char *heap_block = vec_base - padding_size; 355280ddee8SMarshall Clow const size_t element_count = padding_size ? __get_element_count ( vec_base ) : 0; 356280ddee8SMarshall Clow const size_t heap_block_size = element_size * element_count + padding_size; 357280ddee8SMarshall Clow st_heap_block3 heap ( dealloc, heap_block, heap_block_size ); 358280ddee8SMarshall Clow 359280ddee8SMarshall Clow if ( 0 != padding_size && NULL != destructor ) // call the destructors 360280ddee8SMarshall Clow __cxa_vec_dtor ( array_address, element_count, element_size, destructor ); 361280ddee8SMarshall Clow } 362280ddee8SMarshall Clow } 363280ddee8SMarshall Clow 364280ddee8SMarshall Clow 365280ddee8SMarshall Clow } // extern "C" 366280ddee8SMarshall Clow 367280ddee8SMarshall Clow } // abi 368