| OLD | NEW |
| 1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // how much space a node in the freelist needs so that SizeMap can | 36 // how much space a node in the freelist needs so that SizeMap can |
| 37 // create large enough size classes. | 37 // create large enough size classes. |
| 38 | 38 |
| 39 #ifndef TCMALLOC_FREE_LIST_H_ | 39 #ifndef TCMALLOC_FREE_LIST_H_ |
| 40 #define TCMALLOC_FREE_LIST_H_ | 40 #define TCMALLOC_FREE_LIST_H_ |
| 41 | 41 |
| 42 #include <stddef.h> | 42 #include <stddef.h> |
| 43 #include "internal_logging.h" // For CRASH() macro. | 43 #include "internal_logging.h" // For CRASH() macro. |
| 44 #include "linked_list.h" | 44 #include "linked_list.h" |
| 45 | 45 |
| 46 // Remove to enable singly linked lists (the default for open source tcmalloc). |
| 47 #define TCMALLOC_USE_DOUBLYLINKED_FREELIST |
| 48 |
| 46 namespace tcmalloc { | 49 namespace tcmalloc { |
| 47 | 50 |
| 48 #ifdef TCMALLOC_USE_DOUBLYLINKED_FREELIST | 51 #if defined(TCMALLOC_USE_DOUBLYLINKED_FREELIST) |
| 49 | 52 |
| 50 // size class information for common.h. | 53 // size class information for common.h. |
| 51 static const bool kSupportsDoublyLinkedList = true; | 54 static const bool kSupportsDoublyLinkedList = true; |
| 52 | 55 |
| 53 void *FL_Next(void *t); | 56 void *FL_Next(void *t); |
| 54 void FL_Init(void *t); | 57 void FL_Init(void *t); |
| 55 void FL_Push(void **list, void *element); | 58 void FL_Push(void **list, void *element); |
| 56 void *FL_Pop(void **list); | 59 void *FL_Pop(void **list); |
| 57 void FL_PopRange(void **head, int n, void **start, void **end); | 60 void FL_PopRange(void **head, int n, void **start, void **end); |
| 58 void FL_PushRange(void **head, void *start, void *end); | 61 void FL_PushRange(void **head, void *start, void *end); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 98 |
| 96 inline size_t FL_Size(void *head) { | 99 inline size_t FL_Size(void *head) { |
| 97 return SLL_Size(head); | 100 return SLL_Size(head); |
| 98 } | 101 } |
| 99 | 102 |
| 100 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST | 103 #endif // TCMALLOC_USE_DOUBLYLINKED_FREELIST |
| 101 | 104 |
| 102 } // namespace tcmalloc | 105 } // namespace tcmalloc |
| 103 | 106 |
| 104 #endif // TCMALLOC_FREE_LIST_H_ | 107 #endif // TCMALLOC_FREE_LIST_H_ |
| OLD | NEW |