mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-29 11:17:28 +00:00
I think this is getting close on __dynamic_cast. There's been quite a bit of code rearrangement, renaming, and better commenting. This exercise has exposed and fixed a few more bugs. I've also added several more tests (there's definitely a need for more tests here).
llvm-svn: 148227
This commit is contained in:
parent
57935243bd
commit
77fb8ab9f2
File diff suppressed because it is too large
Load Diff
@ -48,7 +48,9 @@ enum
|
||||
{
|
||||
unknown = 0,
|
||||
public_path,
|
||||
not_public_path
|
||||
not_public_path,
|
||||
yes,
|
||||
no
|
||||
};
|
||||
|
||||
class __class_type_info;
|
||||
@ -80,11 +82,18 @@ struct __dynamic_cast_info
|
||||
int number_to_static_ptr;
|
||||
// Number of dst_types not below (static_ptr, static_type)
|
||||
int number_to_dst_ptr;
|
||||
// true when the search is above a dst_type, else false
|
||||
bool above_dst_ptr;
|
||||
//
|
||||
int is_dst_type_derived_from_static_type;
|
||||
// Number of dst_type in tree. If 0, then that means unknown.
|
||||
int number_of_dst_type;
|
||||
// communicates to a dst_type node that (static_ptr, static_type) was found
|
||||
// above it.
|
||||
bool found_static_ptr;
|
||||
bool found_our_static_ptr;
|
||||
// communicates to a dst_type node that a static_type was found
|
||||
// above it, but it wasn't (static_ptr, static_type)
|
||||
bool found_any_static_type;
|
||||
// Set whenever a search can be stopped
|
||||
bool search_done;
|
||||
};
|
||||
|
||||
// Has no base class
|
||||
@ -94,11 +103,10 @@ class __class_type_info
|
||||
public:
|
||||
virtual ~__class_type_info();
|
||||
|
||||
virtual int search1(__dynamic_cast_info*, const void*, int) const;
|
||||
virtual int search2(__dynamic_cast_info*, const void*, int) const;
|
||||
#ifdef DEBUG
|
||||
virtual void display(const void* obj) const;
|
||||
#endif
|
||||
void process_static_type_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
|
||||
void process_static_type_below_dst(__dynamic_cast_info*, const void*, int) const;
|
||||
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
|
||||
virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
|
||||
};
|
||||
|
||||
// Has one non-virtual public base class at offset zero
|
||||
@ -110,11 +118,8 @@ public:
|
||||
|
||||
virtual ~__si_class_type_info();
|
||||
|
||||
virtual int search1(__dynamic_cast_info*, const void*, int) const;
|
||||
virtual int search2(__dynamic_cast_info*, const void*, int) const;
|
||||
#ifdef DEBUG
|
||||
virtual void display(const void* obj) const;
|
||||
#endif
|
||||
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
|
||||
virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
|
||||
};
|
||||
|
||||
struct __base_class_type_info
|
||||
@ -130,11 +135,8 @@ public:
|
||||
__offset_shift = 8
|
||||
};
|
||||
|
||||
int search1(__dynamic_cast_info*, const void*, int) const;
|
||||
int search2(__dynamic_cast_info*, const void*, int) const;
|
||||
#ifdef DEBUG
|
||||
void display(const void* obj) const;
|
||||
#endif
|
||||
void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
|
||||
void search_below_dst(__dynamic_cast_info*, const void*, int) const;
|
||||
};
|
||||
|
||||
// Has one or more base classes
|
||||
@ -156,11 +158,8 @@ public:
|
||||
|
||||
virtual ~__vmi_class_type_info();
|
||||
|
||||
virtual int search1(__dynamic_cast_info*, const void*, int) const;
|
||||
virtual int search2(__dynamic_cast_info*, const void*, int) const;
|
||||
#ifdef DEBUG
|
||||
virtual void display(const void* obj) const;
|
||||
#endif
|
||||
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
|
||||
virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
|
||||
};
|
||||
|
||||
class __pbase_type_info
|
||||
|
2180
libcxxabi/test/dynamic_cast14.cpp
Normal file
2180
libcxxabi/test/dynamic_cast14.cpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -73,9 +73,9 @@ int main()
|
||||
Timing results I'm seeing (median of 3 microseconds):
|
||||
|
||||
libc++abi gcc's dynamic_cast
|
||||
B<Width/2, Depth> -O3 64.214 93.190 libc++abi 45% faster
|
||||
B<Width/2, Depth> -Os 79.520 94.103 libc++abi 18% faster
|
||||
A<Width, Depth> -O3 11.833 33.134 libc++abi 180% faster
|
||||
A<Width, Depth> -Os 14.663 31.553 libc++abi 115% faster
|
||||
B<Width/2, Depth> -O3 50.694 93.190 libc++abi 84% faster
|
||||
B<Width/2, Depth> -Os 55.235 94.103 libc++abi 70% faster
|
||||
A<Width, Depth> -O3 14.895 33.134 libc++abi 122% faster
|
||||
A<Width, Depth> -Os 16.515 31.553 libc++abi 91% faster
|
||||
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user