Changeset dc80280
- Timestamp:
- Dec 13, 2023, 6:27:31 PM (12 months ago)
- Branches:
- master
- Children:
- 0fa0201d
- Parents:
- 21ce2c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/proposals/enum.tex
r21ce2c7 rdc80280 205 205 \end{lstlisting} 206 206 207 \section{Enumeration Characteristic}208 209 \subsection{Enumerat or Storage}207 \section{Enumeration Storage} 208 209 \subsection{Enumeration Variable} 210 210 211 211 Although \CFA enumeration captures three different attributes, an enumeration instance does not store all this information. … … 231 231 These generated functions are $Companion Functions$, they take an $companion$ object and the position as parameters. 232 232 233 \subsection{Enumeration Data} 234 It is a work in progress, outlined the idea but will update with more information later... 235 A \CFA enumeration is backed by data structures to store necessary data. Specifically, an enumeration has arrays to store its labels and values. 236 \begin{lstlisting}[label=lst:enumeration_back_data] 237 enum(T) E; 238 // backing data 239 T* E_values; 240 char** E_labels; 241 \end{lstlisting} 242 Depending on the use cases, the value and label array might not be necessary to the program. 243 244 \subsection{Weak Reference} 245 If the value and label need to be determined at the runtime, the data arrays are necessary. However, allocating the attribute arrays in every compilation unit can take up a lot of memory and it is not ideal. \CFA Optimized it by using GCC weak reference ( @__attribute(weak)__@ ). 246 247 \subsection{Aggressive Inline} 248 If the label and value can be determined during the compilation, \CFA can inline the attributes and no allocation is needed. 249 233 250 \section{Unification} 234 251
Note: See TracChangeset
for help on using the changeset viewer.