A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.cs.washington.edu/homes/djg/slides/grossman_cyclone_jpl_05.ppt below:

ÐÏࡱá����������������>��þÿ ���������������Þ����������5�����þÿÿÿ����Ü���Ý��������ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ�èΊ���é(���€��à��8��Ø����� ������–���������òú��/�È ���0�Ò�������Õ0����·D���T�i�m�e�s� �N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0����·D���A�r�i�a�l���N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�" �·D���C�o�u�r�i�e�r� �N�e�w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�10�·D���W�i�n�g�d�i�n�g�s���w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��¤ ���€�`���ÿÿÿÿ��¥ ������.�������© ������� ��@�£n����ÿý?���" ��d�������d���������@�������ÿÿï�����ÿÿÿÿÿÿ���������  �������@@�������``�������€€�����  ����ðü����ð€��@���~��6�������/������������� ������ �������������/����������������������������������������������������������������������������������������������������������������������7�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Z�������M������������������������������������������������������������������������������������������)�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@�������“����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2������������������������������������������������������������������†��������������8�������0�������c��������������������� ������� ���������������������������� ������� �������������� ������� ���������������������������������������������������������������/�������/��������������2������� ������������������������������������������ ����������������0�������������/��������������������,������+������*������)������(���$���3������'���)���&������%������������������� ������ ���������������:���4������������"������$�������������������������3�������������������������������������������#���������������������������������������!������������������������������������.������2������-������ ������ ������������� ������������ ������������������ƒ� ð0�����ƒ���†A����¿��À��ÅA����ÿ����p�ñ���ÿ3���™���Ìf�Ì�f�ÿ™ÿ�ÿf™�ÿ™��@�ñ���������÷���ð8�����ó���������������€������ó���������������€�����ÐÑ�����������ððn�ʚ;­”Ç�ʚ;���úg�����þ�������ý4���X���d���X���d���ì 0�������¨Õ���������”ÿÿÿ¦ÿÿÿ���p�û�������p��p�û������@ ���<�����ý4���!���d���!���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���d���d���d���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���B���d���B���d���® 0dÙ�����ˆªÑ���������������������ÿ����� ���������������ˆN���Š0�����º���_�_�_�P�P�T�1�0���‹����� ����À���À���Š����º���_�_�_�P�P�T�9���‹ð����®è����¯����������¬`�����������������€ÿÿ�����������������������€ÿÿ�����������������������€ÿÿ����������������������¯����������¬X�����������������������������€ÿÿ����������������������������������������������������������?�Ùd�����Ú�����-���º���1�1� �J�a�n�u�a�r�y� �2�0�0�5� �º*���D�a�n� �G�r�o�s�s�m�a�n�:� �C�y�c�l�o�n�e�O�Ù �����Ú�����=��ðßz����ó����������������������Ÿ��������¨4���Cyclone: A Memory-Safe C-Level Programming Language ��¡"���5���������3������ �Ì�fþ��������Ÿ��������¨¬���Dan Grossman University of Washington Joint work with: Trevor Jim AT&T Research Greg Morrisett Harvard University Michael Hicks University of Maryland��¡:���'���������†������(������&�������Ì�fþ�������†���������ó���Â������������������Ÿ���������¨���A safe C-level language�Ÿ��������¨ �� Cyclone is a programming language and compiler aimed at safe systems programming C is not memory safe: void f(int* p, int i, int v) { p[i] = v; } Address p+i might hold important data or code Memory safety is crucial for reasoning about programs ��¡Š��S�������������������9�������������������h���������:�����������������ÿ3�þ�����������������ÿ3�þ������ � ������� �������������������� ��������������™�þ�������������™�þ�������������™�þ�������������™�þ����������� � �������������$������������� �6����������������ó���Ã������������������Ÿ��������� "���C�a�l�l�e�r� s� �p�r�o�b�l�e�m�?���ª�������������������Ÿ��������¨Ã��� void g(void**, void*); int y = 0; int *z = &y; g(&z,0xBAD); *z = 123; Might be safe, but not if g does *x=y Type of g enough for code generation Type of g not enough for safety checking��¡$��N����� ������v������ ���������������������™�þ���������������������������������™�þ �����������������™�þ!�����������������������������������������������������%��������������������������������������ª>��� ������� ��������s���������������&��������������� ���������ó���ë����������'��������Ÿ���������¨���Safe low-level systems�Ÿ��������¨8��For a safety guarantee today, use YFHLL Your Favorite High Level Language YFHLL provides safety in part via: hidden data fields and run-time checks automatic memory management Data representation and resource management are essential aspects of low-level systems There are strong reasons for C-like languages��¡Œ��(���������#����������#���������D����$�������Y���������.����������(��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������#��������������ÿ3�þ!������� �������ÿ3�þ��������������0������� �������ÿ3�þ���������������������-�����������������ó���ì����������(��������Ÿ���������¨���Some insufficient approaches�Ÿ�������� ®��C�o�m�p�i�l�e� �C� �w�i�t�h� �e�x�t�r�a� �i�n�f�o�r�m�a�t�i�o�n� �t�y�p�e� �f�i�e�l�d�s�,� �s�i�z�e� �f�i�e�l�d�s�,� �l�i�v�e�-�p�o�i�n�t�e�r� �t�a�b�l�e�,� �& �t�r�e�a�t�s� �C� �a�s� �a� �h�i�g�h�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e� � �U�s�e� �s�t�a�t�i�c� �a�n�a�l�y�s�i�s� �v�e�r�y� �d�i�f�f�i�c�u�l�t� �l�e�s�s� �m�o�d�u�l�a�r� � �B�a�n� �u�n�s�a�f�e� �f�e�a�t�u�r�e�s� �t�h�e�r�e� �a�r�e� �m�a�n�y� �y�o�u� �n�e�e�d� �t�h�e�m���¡–���!���������U������������������������������������������!�������T������������� ��������������������� ������������ �� ���ó���Ç������������������Ÿ���������¨���Cyclone in brief�Ÿ�������� *��A� �s�a�f�e�,� �c�o�n�v�e�n�i�e�n�t�,� �a�n�d� �m�o�d�e�r�n� �l�a�n�g�u�a�g�e� � �a�t� �t�h�e� �C� �l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� �S�a�f�e�:� �m�e�m�o�r�y� �s�a�f�e�t�y�,� �a�b�s�t�r�a�c�t� �t�y�p�e�s�,� �n�o� �c�o�r�e� �d�u�m�p�s� � �C�-�l�e�v�e�l�:� �u�s�e�r�-�c�o�n�t�r�o�l�l�e�d� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �a�n�d� �r�e�s�o�u�r�c�e� �m�a�n�a�g�e�m�e�n�t�,� �e�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y�,� � m�a�n�i�f�e�s�t� �c�o�s�t� � �C�o�n�v�e�n�i�e�n�t�:� �m�a�y� �n�e�e�d� �m�o�r�e� �t�y�p�e� �a�n�n�o�t�a�t�i�o�n�s�,� �b�u�t� �w�o�r�k� �h�a�r�d� �t�o� �a�v�o�i�d� �i�t� � �M�o�d�e�r�n�:� �a�d�d� �f�e�a�t�u�r�e�s� �t�o� �c�a�p�t�u�r�e� �c�o�m�m�o�n� �i�d�i�o�m�s� � � N�e�w� �c�o�d�e� �f�o�r� �l�e�g�a�c�y� �o�r� �i�n�h�e�r�e�n�t�l�y� �l�o�w�-�l�e�v�e�l� �s�y�s�t�e�m�s� ���¡ô���G����������Z��������Z�6����������Z���������Z�F�������ÿ��þ�������ÿ��þ����������.������������� �����������e������������� � ����������;������������� �����������'��������������6����������������ó���È������������������Ÿ���������¨���The plan from here�Ÿ�������� ê��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �B�e�n�c�h�m�a�r�k�s�,� �p�o�r�t�s�,� �s�y�s�t�e�m�s�,� �c�o�m�p�i�l�e�r�,� �& �A�l�l� �o�n� �E�a�r�t�h� �s�o� �f�a�r� �Jð �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� � �R�e�a�l�l�y� � j�u�s�t� �a� �t�a�s�t�e� �o�f� �C�y�c�l�o�n�e���¡Â�����������Z�>�������Z�)��������Z�(�������Z�-��������Z�"����������Z��������<������������‚����������������������� ��������(�������-�������"����������ó���É������������������Ÿ���������¨���Status�Ÿ�������� ®�� �C�y�c�l�o�n�e� �r�e�a�l�l�y� �e�x�i�s�t�s� �(�e�x�c�e�p�t� �m�e�m�o�r�y�-�s�a�f�e� �t�h�r�e�a�d�s�)� � �>�1�5�0�K� �l�i�n�e�s� �o�f� �C�y�c�l�o�n�e� �c�o�d�e�,� �i�n�c�l�u�d�i�n�g� �t�h�e� �c�o�m�p�i�l�e�r� � �g�c�c� �b�a�c�k�-�e�n�d� �(�L�i�n�u�x�,� �C�y�g�w�i�n�,� �O�S�X�,� �M�i�n�d�s�t�o�r�m�,� �& )� � �U�s�e�r� s� �m�a�n�u�a�l�,� �m�a�i�l�i�n�g� �l�i�s�t�s�,� �& � �S�t�i�l�l� �a� �r�e�s�e�a�r�c�h� �v�e�h�i�c�l�e� � � ���¡À���4������������������¢������������������������3��������������4������������� �0������������� � ������������� �������������� �����������������ª���Œ������� �������?���������ó���Ê������������������Ÿ���������¨ ���Evaluation�Ÿ��������¨æ��� Is Cyclone like C? port code, measure source differences interface with C code (extend systems) What is the performance cost? port code, measure slowdown Is Cyclone good for low-level systems? write systems, ensure scalability ��¡Ê������������������’����" ��N�������������’����" ����������'�����’����" ��"�������������������������������N����������� �� ��������'�������"�����������������ó���Ë��������� ��������Ÿ���������¨���Code differences�Ÿ��������¨‹���Porting not automatic, but quite similar Many changes identify arrays and lengths Some changes incidental (absent prototypes, new keywords)��¡���Œ���������Œ���������ó���Ì��������� ��������Ÿ���������¨���Run-time performance�Ÿ��������¨Ð���RHLinux 7.1 (2.4.9), 1.0GHz PIII, 512MRAM, gcc2.96 -O3, glibc 2.2.4 Comparable to other safe languages to start C level provides important optimization opportunities Understanding the applications could help��¡L���E����������Œ���������D��������������,�������6����������*���������ó���Í���������� ��������Ÿ���������¨���Larger program: the compiler�Ÿ��������¨Ö��� Scalable compiler + libraries (80K lines) build in < 30secs Generic libraries (e.g., lists, hashtables) clients have no syntactic/performance cost Static safety helps exploit the C-level I use &x more than in C ��¡¼��� ���������4��������,���������,��������(����������������� �������3������������� �,�������+������������� �(����������� �� ���� � ������ �� ����� �� ���ó���Î���������� ��������Ÿ���������¨���Other projects�Ÿ��������¨o��Open Kernel Environment [Bos/Samwel, OPENARCH 02] MediaNet [Hicks et al, OPENARCH 03]: RBClick [Patel/Lepreau, OPENARCH 03] STP [Patel et al., SOSP 03] FPGA synthesis [Teifel/Manohar, ISACS 04] Maryland undergrad O/S course (geekOS) [2004] Windows device driver (6K lines) Only 100 lines left in C But unrecoverable failures & other kernel corruptions remain ��¡���������P�W�������P���������P��������������������� � ��������������������������� ��������������������� ��������������������� ��������������������� �'�������������������� �!����������W����������������ªt���������� �������������������������������������������������=��������������,��������������ƒ���������ó���Ò������������������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡z���A��������–�(�������–�-��������–�����������–�������������������������(�������-�������������������ó���Ó�����������������Ÿ���������¨���Not-null pointers�Ÿ��������ª �������������ó���Ô�����������������Ÿ���������¨���Example�Ÿ�������� Ì��F�I�L�E�*� �f�o�p�e�n�(�c�o�n�s�t� �c�h�a�r�@�,� �c�o�n�s�t� �c�h�a�r�@�)�;� �i�n�t� �f�g�e�t�c�(�F�I�L�E�@�)�;� �i�n�t� �f�c�l�o�s�e�(�F�I�L�E�@�)�;� �v�o�i�d� �g�(�)� �{� � � �F�I�L�E�*� �f� �=� �f�o�p�e�n�(� f�o�o� ,� � r� )�;� � � �w�h�i�l�e�(�f�g�e�t�c�(�f�)� �!�=� �E�O�F�)� �{�& }� � � �f�c�l�o�s�e�(�f�)�;� �}� � �G�i�v�e�s� �w�a�r�n�i�n�g� �a�n�d� �i�n�s�e�r�t�s� �o�n�e� �n�u�l�l�-�c�h�e�c�k� �E�n�c�o�u�r�a�g�e�s� �a� �h�o�i�s�t�e�d� �c�h�e�c�k���¡Ü���¢���������Z�E��������Z������������������™�þ �����������������™�þ �����������������™�þ�����������������™�þ �����������������™�þB���������������D���������ªP���������� ������� ��������������� ���������������������� �������z���������ó���Õ�����������������Ÿ���������¨���A classic moral�Ÿ��������¨L���FILE* fopen(const char@, const char@); int fgetc(FILE@); int fclose(FILE@); ��¡„���M���������������������������™�þ �����������������™�þ �����������������™�þ �������������� ���ª,���1��������������� ������������������������ó���Ö����������!��������Ÿ���������¨���Key Design Principles in Action�Ÿ��������¨S��Use types to express invariants Preconditions for arguments Properties of values in memory Use flow analysis where helpful Lets users control explicit checks Soundness + aliasing limits usefulness Users control data representation Pointers are addresses unless user allows otherwise Often can interoperate with C more safely just via types��¡°��� ��������Z�;�������Z� ��������Z�J�������Z�"��������Z�4�������Z�9��������Z� �������;������� �������#�������'�����"�������4�������9���������ó���ò���������.��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ó���������/��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ñ����������-��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�*�����������������(�������-�������������������ó���Ø�����������������Ÿ��������� (��� C�h�a�n�g�e� �v�o�i�d�*� �t�o� �`�a� ��¡:������������������������������������������������Ÿ��������¨•���struct Lst { void* hd; struct Lst* tl; }; struct Lst* map( void* f(void*), struct Lst*); struct Lst* append( struct Lst*, struct Lst*);��¡\���–����� ������;�����������������™�þ1�����������������™�þ!����������ó���Ù������������������Ÿ���������¨���Not much new here�Ÿ��������¨��Closer to C than C++, Java generics, ML, etc. Unlike functional languages, data representation may restrict `a to pointers, int why not structs? why not float? why int? Unlike templates, no code duplication or leaking implementations Unlike objects, no need to tag data��¡Ú���/����������S���������)�����������������f���������/�����"���N����"�������c���������"��������"�������c���������"�������c���������"�������� "�� ��f����"������ª���¦��������������i���������ó���Ú������������������Ÿ���������¨���Existential types�Ÿ�������� ��P�r�o�g�r�a�m�s� �n�e�e�d� �a� �w�a�y� �f�o�r� � c�a�l�l�-�b�a�c�k� �t�y�p�e�s�:� � � � � � �s�t�r�u�c�t� �T� �{� � � � � � �v�o�i�d� �(�*�f�)�(�v�o�i�d�*�,� �i�n�t�)�;� � � � � � �v�o�i�d�*� �e�n�v�;� � � �}�;� � �W�e� �u�s�e� �a�n� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e� �(�s�i�m�p�l�i�f�i�e�d�)�:� � � � � � � �s�t�r�u�c�t� �T� �{� �<�`�a�>� � � � � � �v�o�i�d� �(�@�f�)�(�`�a�,� �i�n�t�)�;� � � � � � �`�a� �e�n�v�;� � � �}�;� � �m�o�r�e� �C�-�l�e�v�e�l� �t�h�a�n� �b�a�k�e�d�-�i�n� �c�l�o�s�u�r�e�s�/�o�b�j�e�c�t�s� ���¡Œ��+��������Z�A����0����Z�����������Z�*��������Z�A����0����Z���,����8�����Z�����������Z�+�������������>�����������������������"���������� ������������ÿ��þ���g�����ÿ��þ���G����ÿ��þ���������g�����ÿ3�þ ���������g�����ÿ3�þ ������������,��� � �������"�����ó���Û�����������������Ÿ���������¨���Regions�Ÿ��������  ��a�.�k�.�a�.� �z�o�n�e�s�,� �a�r�e�n�a�s�,� �& � �E�v�e�r�y� �o�b�j�e�c�t� �i�s� �i�n� �e�x�a�c�t�l�y� �o�n�e� �r�e�g�i�o�n� � �A�l�l�o�c�a�t�i�o�n� �v�i�a� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �D�e�a�l�l�o�c�a�t�e� �a�n� �e�n�t�i�r�e� �r�e�g�i�o�n� � �s�i�m�u�l�t�a�n�e�o�u�s�l�y� � � �(�c�a�n�n�o�t� �f�r�e�e� �a�n� �o�b�j�e�c�t�)� � �O�l�d� �i�d�e�a� �w�i�t�h� �r�e�c�e�n�t� �s�u�p�p�o�r�t� �i�n� �l�a�n�g�u�a�g�e�s� �(�e�.�g�.�,� �R�C�,� �R�T�S�J�)� � �a�n�d� �i�m�p�l�e�m�e�n�t�a�t�i�o�n�s� �(�e�.�g�.�,� �M�L� �K�i�t�)���¡²���|��������Z�*���������Z���������Z�_����������Z���������������&����������������������������7��������������� ��������������_������������ª>���`�������F�����������������������.������� ��������%���������ó���Ü������������������Ÿ���������¨���Cyclone regions [PLDI 02]��¡������������������� ��������Ÿ�������� œ��h�e�a�p� �r�e�g�i�o�n�:� �o�n�e�,� �l�i�v�e�s� �f�o�r�e�v�e�r�,� �c�o�n�s�e�r�v�a�t�i�v�e�l�y� �G�C� d� �s�t�a�c�k� �r�e�g�i�o�n�s�:� �c�o�r�r�e�s�p�o�n�d� �t�o� �l�o�c�a�l�-�d�e�c�l�a�r�a�t�i�o�n� �b�l�o�c�k�s�:� � �{�i�n�t� �x�;� �i�n�t� �y�;� �s�}� �g�r�o�w�a�b�l�e� �r�e�g�i�o�n�s�:� �s�c�o�p�e�d� �l�i�f�e�t�i�m�e�,� �b�u�t� �g�r�o�w�a�b�l�e�:� � � � �{�r�e�g�i�o�n� �r�;� �s�}� � �a�l�l�o�c�a�t�i�o�n� �r�o�u�t�i�n�e�s� �t�a�k�e� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �h�a�n�d�l�e�s� �a�r�e� �f�i�r�s�t�-�c�l�a�s�s� �c�a�l�l�e�r� �d�e�c�i�d�e�s� �w�h�e�r�e�,� �c�a�l�l�e�e� �d�e�c�i�d�e�s� �h�o�w� �m�u�c�h� �n�o� �h�a�n�d�l�e�s� �f�o�r� �s�t�a�c�k� �r�e�g�i�o�n�s���¡Ž��m�������������������4����������������������������B������ ����K�������� ����������(�����������������*������������������������™�þ�����������������™�þ����������������������������������#������������������������™�þ������������������������"�������������������.�������ÿ3�þ���������ªb������������������,����������������������������������������������������1��������\���������ó���Ý�����������������Ÿ��������� (���T�h�a�t� s� �t�h�e� �e�a�s�y� �p�a�r�t��Ÿ��������¨c���The implementation is really simple because the type system statically prevents dangling pointers ��¡h���d���������������������������������������� ���������������������������ÿ��þ��ó���Þ������������������Ÿ���������¨���The big restriction�Ÿ�������� Î��A�n�n�o�t�a�t�e� �a�l�l� �p�o�i�n�t�e�r� �t�y�p�e�s� �w�i�t�h� �a� �r�e�g�i�o�n� �n�a�m�e� �(�a� �t�y�p�e� �v�a�r�i�a�b�l�e� �o�f� �r�e�g�i�o�n� �k�i�n�d�)� � �i�n�t�@�`�r� �m�e�a�n�s� � p�o�i�n�t�e�r� �i�n�t�o� �t�h�e� �r�e�g�i�o�n� �c�r�e�a�t�e�d� �b�y� �t�h�e� �c�o�n�s�t�r�u�c�t� �t�h�a�t� �i�n�t�r�o�d�u�c�e�s� �`�r� �h�e�a�p� �i�n�t�r�o�d�u�c�e�s� �`�H� � �L�:�& �i�n�t�r�o�d�u�c�e�s� �`�L� �{�r�e�g�i�o�n� �r�;� �s�}� �i�n�t�r�o�d�u�c�e�s� �`�r� � �r� �h�a�s� �t�y�p�e� �r�e�g�i�o�n�_�t�<�`�r�>� � �c�o�m�p�i�l�e�-�t�i�m�e� �c�h�e�c�k�:� �o�n�l�y� �l�i�v�e� �r�e�g�i�o�n�s� �a�r�e� �a�c�c�e�s�s�e�d� �b�y� �d�e�f�a�u�l�t�,� �f�u�n�c�t�i�o�n� �a�r�g�u�m�e�n�t�s� �p�o�i�n�t� �t�o� �l�i�v�e� �r�e�g�i�o�n�s� ���¡��P���������S�����$�������B����²���� �������������3���������5�����������������"������� ����������"������������� ����G����������g��������I����"�������c���������"��������b��������c���������"�������c����� ����"���� ���c��������g������™�þ���c����� ����"�������c���������"�������� "�� ����� c� ���� ���� "�� �� ��� c� ������� c� ��� �3����b�����5����b��������c�������ªP���¡���������������'������������������������������'�������j�����������������ó���ß������������������Ÿ���������¨���Region polymorphism�Ÿ�������� ø��A�p�p�l�y� �w�h�a�t� �w�e� �d�i�d� �f�o�r� �t�y�p�e� �v�a�r�i�a�b�l�e�s� �t�o� �r�e�g�i�o�n� �n�a�m�e�s� �(�o�n�l�y� �i�t� s� �m�o�r�e� �i�m�p�o�r�t�a�n�t� �a�n�d� �c�o�u�l�d� �b�e� �m�o�r�e� �o�n�e�r�o�u�s�)� � �v�o�i�d� �s�w�a�p�(�i�n�t� �@�`�r�1� �x�,� �i�n�t� �@�`�r�2� �y�)�{� � � �i�n�t� �t�m�p� �=� �*�x�;� � � �*�x� �=� �*�y�;� � � �*�y� �=� �t�m�p�;� �}� � �i�n�t�@�`�r� �s�u�m�p�t�r�(�r�e�g�i�o�n�_�t�<�`�r�>� �r�,�i�n�t� �x�,�i�n�t� �y�)�{� � � �r�e�t�u�r�n� �r�n�e�w�(�r�)� �(�x�+�y�)�;� �}���¡B��k����������M����� ������E����������k��������������C���������G������™�þ����C��������g�����������c��������g������™�þ���c��������g�����������c��������g������™�þ ���c��������g������™�þ ���c��������C�������C������� g� ����ÿ��þ��� c� ������� g� �����™�þ ��� c� ������� g� ����ÿ��þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������ª,���Ó�������������������������������������ó���à�����������������Ÿ���������¨���Type definitions�Ÿ��������¨K���struct ILst<`r1,`r2> { int@`r1 hd; struct ILst<`r1,`r2> *`r2 tl; }; ��¡ ��L���������� ����C��������g�����ÿ��þ���C������� g� ����ÿ��þ ���C�������g�����ÿ��þ���C�������g�����ÿ��þ��� C� ������$g�$����ÿ��þ���(C�(������,g�,����ÿ��þ ���0C�0�������0���0��ó���á���������� ��������Ÿ���������¨���Region subtyping�Ÿ�������� Ò��I�f� �p� �p�o�i�n�t�s� �t�o� �a�n� �i�n�t� �i�n� �a� �r�e�g�i�o�n� �w�i�t�h� �n�a�m�e� �`�r�1�,� �i�s� �i�t� �e�v�e�r� �s�o�u�n�d� �t�o� �g�i�v�e� �p� �t�y�p�e� �i�n�t�*�`�r�2�?� � �I�f� �s�o�,� �l�e�t� � �i�n�t�*�`�r�1� �<� �i�n�t�*�`�r�2� � �R�e�g�i�o�n� �s�u�b�t�y�p�i�n�g� �i�s� �t�h�e� �o�u�t�l�i�v�e�s� �r�e�l�a�t�i�o�n�s�h�i�p� � � �{�r�e�g�i�o�n� �r�1�;� �& �{�r�e�g�i�o�n� �r�2�;� �& }� �& �}� � �L�I�F�O� �m�a�k�e�s� �s�u�b�t�y�p�i�n�g� �c�o�m�m�o�n� � ���¡$��[����������M�������������������!����������������������������������������������������������������������������������������g�����ÿ��þ������������������������� g� ����ÿ��þ����� ����������C�������g�����ÿ��þ���o�����ÿ��þçÿ���G����������C�������g�����ÿ��þ���n����ÿ��þçÿ���o�����ÿ��þçÿ���� B�� ������ F�� ��������� B�� ��$��� C� ������� B�� ����� C� ������ � ���ª>���ª���������������������� ��������������� �������� ���������ó���â����������"��������Ÿ���������¨���Regions evaluation��ª���������� ����������������Ÿ�������� Æ��L�I�F�O� �r�e�g�i�o�n�s� �g�o�o�d� �f�o�r� �s�o�m�e� �i�d�i�o�m�s� �a�w�k�w�a�r�d� �i�n� �C� �R�e�g�i�o�n�s� �g�e�n�e�r�a�l�i�z�e� �s�t�a�c�k� �v�a�r�i�a�b�l�e�s� �a�n�d� �t�h�e� �h�e�a�p� �D�e�f�a�u�l�t�s� �a�n�d� �i�n�f�e�r�e�n�c�e� �m�a�k�e� �i�t� �s�u�r�p�r�i�s�i�n�g�l�y� �p�a�l�a�t�a�b�l�e� �W�o�r�s�t� �p�a�r�t�:� �d�e�f�i�n�i�n�g� �r�e�g�i�o�n�-�a�l�l�o�c�a�t�e�d� �d�a�t�a� �s�t�r�u�c�t�u�r�e�s� �C�y�c�l�o�n�e� �a�c�t�u�a�l�l�y� �h�a�s� �m�u�c�h� �m�o�r�e� �[�I�S�M�M� �0�4�]� �N�o�n�-�L�I�F�O� �r�e�g�i�o�n�s� � U�n�i�q�u�e� �p�o�i�n�t�e�r�s� �E�x�p�l�i�c�i�t�l�y� �r�e�f�e�r�e�n�c�e�-�c�o�u�n�t�e�d� �p�o�i�n�t�e�r�s� �A� � u�n�i�f�i�e�d� �s�y�s�t�e�m� ,� �n�o�t� �n� �s�u�b�l�a�n�g�a�g�e�s� ���¡’���/��������x�f���������6��������)���������p��������/�������f�������6�������������� �������a���� �� ���� � ����� �� ���ª���W������ ����������������ó���ã����������#��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�A�������(������� ���������� �������������������ó���ä����������$��������Ÿ���������¨���Other safety holes�Ÿ�������� J��A�r�r�a�y�s� �(�w�h�a�t� �o�r� �w�h�e�r�e� �i�s� �t�h�e� �s�i�z�e�)� �O�p�t�i�o�n�s�:� �d�y�n�a�m�i�c� �b�o�u�n�d�,� �i�n� �a� �f�i�e�l�d�/�v�a�r�i�a�b�l�e�,� �c�o�m�p�i�l�e�-�t�i�m�e� �b�o�u�n�d�,� �s�p�e�c�i�a�l� �s�t�r�i�n�g� �s�u�p�p�o�r�t� �T�h�r�e�a�d�s� �(�a�v�o�i�d�i�n�g� �r�a�c�e�s�)� �v�a�p�o�r�w�a�r�e� �t�y�p�e� �s�y�s�t�e�m� �t�o� �e�n�f�o�r�c�e� �l�o�c�k�-�b�a�s�e�d� �m�u�t�u�a�l� �e�x�c�l�u�s�i�o�n� �C�a�s�t�s� �A�l�l�o�w� �o�n�l�y� � u�p� �c�a�s�t�s� �a�n�d� �c�a�s�t�s� �t�o� �n�u�m�b�e�r�s� �U�n�i�o�n�s� �C�h�e�c�k�e�d� �t�a�g�s� �o�r� �b�i�t�s�-�o�n�l�y� �f�i�e�l�d�s� �U�n�i�n�i�t�i�a�l�i�z�e�d� �d�a�t�a� �F�l�o�w� �a�n�a�l�y�s�i�s� �(�s�a�f�e�r� �a�n�d� �e�a�s�i�e�r� �t�h�a�n� �d�e�f�a�u�l�t� �i�n�i�t�i�a�l�i�z�e�r�s�)� �V�a�r�a�r�g�s� �(�s�a�f�e� �v�i�a� �c�h�a�n�g�e�d� �c�a�l�l�i�n�g� �c�o�n�v�e�n�t�i�o�n�)���¡î���#���������X�����������������=�����������������+�����������������!�����������������;��������.���������#�������X��������������=��������������+����������� �� �!���� �� ��������;�������.���������ª>��� ��������������������� �������A��������������'���������ó���å����������%��������Ÿ���������¨���And modern conveniences�Ÿ�������� æ��3�0� �y�e�a�r�s� �a�f�t�e�r� �C�,� �s�o�m�e� �t�h�i�n�g�s� �a�r�e� �w�o�r�t�h� �a�d�d�i�n�g�& � �T�a�g�g�e�d� �u�n�i�o�n�s� �a�n�d� �p�a�t�t�e�r�n� �m�a�t�c�h�i�n�g� �o�n� �t�h�e�m� �I�n�t�r�a�p�r�o�c�e�d�u�r�a�l� �t�y�p�e� �i�n�f�e�r�e�n�c�e� �T�u�p�l�e�s� �(�l�i�k�e� �a�n�o�n�y�m�o�u�s� �s�t�r�u�c�t�s�)� �E�x�c�e�p�t�i�o�n�s� �S�t�r�u�c�t� �a�n�d� �a�r�r�a�y� �i�n�i�t�i�a�l�i�z�e�r�s� �N�a�m�e�s�p�a�c�e�s� �n�e�w� �f�o�r� �a�l�l�o�c�a�t�i�o�n� �+� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� ���¡Z���0�������������������x�Ã���������0������������� �ž���������������"���������ª>���{���������������������������� ��������������H���������ó���ê����������&��������Ÿ���������¨���Plenty of work remains�Ÿ��������¨Ó���Common limitations: Aliasing Arithmetic Unportable assumptions (But interoperating with C is much simpler than in a HLL) Big challenge for next generation: guarantees beyond fail-safe (i.e., graceful abort)��¡X�������������,���������:�������������������Y����������^��������������r���������ª���(������� �������¢���������ó���Ï������������������Ÿ���������¨���Related work: making C safer�Ÿ�������� Ê��C�o�m�p�i�l�e� �t�o� �m�a�k�e� �d�y�n�a�m�i�c� �c�h�e�c�k�s� �p�o�s�s�i�b�l�e� �S�a�f�e�-�C� �[�A�u�s�t�i�n� �e�t� �a�l�.�]�,� �R�T�C� �[�Y�o�n�g�/�H�o�r�w�i�t�z�]�,� �.�.�.� �P�u�r�i�f�y�,� �S�t�a�c�k�g�u�a�r�d�,� �E�l�e�c�t�r�i�c� �F�e�n�c�e�,� �& �C�C�u�r�e�d� �[�N�e�c�u�l�a� �e�t� �a�l�.�]� �p�e�r�f�o�r�m�a�n�c�e� �v�i�a� �w�h�o�l�e�-�p�r�o�g�r�a�m� �a�n�a�l�y�s�i�s� �l�e�s�s� �u�s�e�r� �b�u�r�d�e�n� �l�e�s�s� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t�,� �s�i�n�g�l�e�-�t�h�r�e�a�d�e�d� � �C�o�n�t�r�o�l�-�C� �[�A�d�v�e� �e�t� �a�l�.�]� �w�e�a�k�e�r� �g�u�a�r�a�n�t�y�,� �l�e�s�s� �b�u�r�d�e�n� � �S�F�I� �[�W�a�h�b�e�,� �S�m�a�l�l�,� �.�.�.�]�:� �s�a�n�d�b�o�x�i�n�g� �v�i�a� �b�i�n�a�r�y� �r�e�w�r�i�t�i�n�g� ���¡ð���(��������Z�m�������Z�`�������Z�p��������Z����������Z�(�����������������������������������1��������������`������� ���� �� ����� �� ����� �� ����� �� ����� �� ����� �� �#���� �� ���ª>���@���������������ž�����������������������������a���������ó���í����������*��������Ÿ���������¨���Related Work: Checking C code�Ÿ�������� f��M�o�d�e�l�-�c�h�e�c�k�i�n�g� �C� �c�o�d�e� �(�S�L�A�M�,� �B�L�A�S�T�,� �& )� �L�e�v�e�r�a�g�e�s� �s�c�a�l�a�b�i�l�i�t�y� �o�f� �M�C� �K�e�y� �i�s� �a�u�t�o�m�a�t�i�c� �b�u�i�l�d�i�n�g� �a�n�d� �r�e�f�i�n�i�n�g� �o�f� �m�o�d�e�l� �T�h�e�y� �a�s�s�u�m�e� �(�w�e�a�k�)� �m�e�m�o�r�y� �s�a�f�e�t�y� �L�i�n�t�-�l�i�k�e� �t�o�o�l�s� �(�S�p�l�i�n�t�,� �M�e�t�a�l�,� �P�r�e�F�I�X�,� �& )� �G�o�o�d� �a�t� �r�e�d�u�c�i�n�g� �f�a�l�s�e� �p�o�s�i�t�i�v�e�s� �C�a�n�n�o�t� �e�n�s�u�r�e� �a�b�s�e�n�c�e� �o�f� �b�u�g�s� �M�e�t�a�l� �p�a�r�t�i�c�u�l�a�r�l�y� �g�o�o�d� �f�o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� �C�q�u�a�l� �(�u�s�e�r�-�d�e�f�i�n�e�d� �q�u�a�l�i�f�i�e�r�s�,� �l�o�t�s� �o�f� �i�n�f�e�r�e�n�c�e�)� �B�e�t�t�e�r� �f�o�r� �u�n�c�h�a�n�g�e�a�b�l�e� �c�o�d�e� �o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� � �(�i�.�e�.�,� �t�h�e�y� r�e� �c�o�m�p�l�e�m�e�n�t�a�r�y�)���¡Â���'���������m��������+���������o��������3���������S����������'�������Q���������������������+�������!������������H�������2������������� �S����������ª,���´��������������t�����������������������ó���ð����������,��������Ÿ���������¨���Related work: higher and lower�Ÿ�������� ¸��A�d�a�p�t�e�d�/�e�x�t�e�n�d�e�d� �i�d�e�a�s�:� �p�o�l�y�m�o�r�p�h�i�s�m� �[�M�L�,� �H�a�s�k�e�l�l�,� �& ]� �r�e�g�i�o�n�s� �[�T�o�f�t�e�/�T�a�l�p�i�n�,� �W�a�l�k�e�r� �e�t� �a�l�.�,� �& ]� �s�a�f�e�t�y� �v�i�a� �d�a�t�a�f�l�o�w� �[�J�a�v�a�,� �& ]� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e�s� �[�M�i�t�c�h�e�l�l�/�P�l�o�t�k�i�n�,� �& ]� �c�o�n�t�r�o�l�l�i�n�g� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �[�A�d�a�,� �M�o�d�u�l�a�-�3�,� �& ]� � �S�a�f�e� �l�o�w�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e�s� �[�T�A�L�,� �P�C�C�,� �& ]� �e�n�g�i�n�e�e�r�e�d� �f�o�r� �m�a�c�h�i�n�e�-�g�e�n�e�r�a�t�e�d� �c�o�d�e� � �V�a�u�l�t�:� �s�t�r�o�n�g�e�r� �p�r�o�p�e�r�t�i�e�s� �v�i�a� �r�e�s�t�r�i�c�t�e�d� �a�l�i�a�s�i�n�g� ���¡€������������Á��������)���������'��������4����������������À��������������)�������&��������������4���������ó���Ñ������������������Ÿ���������¨���Summary�Ÿ�������� ò��C�y�c�l�o�n�e�:� �a� �s�a�f�e� �l�a�n�g�u�a�g�e� �a�t� �t�h�e� �C�-�l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� � �S�y�n�e�r�g�i�s�t�i�c� �c�o�m�b�i�n�a�t�i�o�n� �o�f� �t�y�p�e�s�,� �f�l�o�w� �a�n�a�l�y�s�i�s�,� �a�n�d� �r�u�n�-�t�i�m�e� �c�h�e�c�k�s� � �A� �r�e�a�l� �c�o�m�p�i�l�e�r� �a�n�d� �p�r�o�t�o�t�y�p�e� �a�p�p�l�i�c�a�t�i�o�n�s� � �P�r�o�p�e�r�t�i�e�s� �l�i�k�e� � n�o�t� �N�U�L�L� ,� � h�a�s� �l�o�n�g�e�r� �l�i�f�e�t�i�m�e� ,� � h�a�s� �a�r�r�a�y� �l�e�n�g�t�h� & �n�o�w� �i�n� �t�h�e� �l�a�n�g�u�a�g�e� �a�n�d� �c�h�e�c�k�e�d� � �E�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y� �w�i�t�h� �C� �a�l�l�o�w� �s�m�o�o�t�h� �a�n�d� �i�n�c�r�e�m�e�n�t�a�l� �m�o�v�e� �t�o�w�a�r�d� �m�e�m�o�r�y� �s�a�f�e�t�y� � �i�n� �t�h�e�o�r�y� �a�t� �l�e�a�s�t���¡z���g����������������7������������� �E������������� �+������������� �g������������� �U����������������ó���î����������)��������Ÿ���������¨ ���Availability�Ÿ��������  ��L�i�k�e� �a�n�y� �l�a�n�g�u�a�g�e�,� �y�o�u� �h�a�v�e� �t�o� � k�i�c�k� �t�h�e� �t�i�r�e�s� :� �w�w�w�.�r�e�s�e�a�r�c�h�.�a�t�t�.�c�o�m�/�p�r�o�j�e�c�t�s�/�c�y�c�l�o�n�e� � �A�l�s�o� �s�e�e�:� �J�a�n�.� �2�0�0�5� �C�/�C�+�+� �U�s�e�r� s� �J�o�u�r�n�a�l� �U�S�E�N�I�X� �2�0�0�2� � �C�o�n�v�e�r�s�e�l�y�,� �I� �w�a�n�t� �t�o� �k�n�o�w� �N�A�S�A� s� �C�-�l�e�v�e�l� �c�o�d�e� �n�e�e�d�s� �M�a�y�b�e� �i�d�e�a�s� �f�r�o�m� �C�y�c�l�o�n�e� �w�i�l�l� �h�e�l�p� �M�a�y�b�e� �n�o�t� �E�i�t�h�e�r� �w�a�y� �w�o�u�l�d� �b�e� �f�a�s�c�i�n�a�t�i�n�g� ���¡¢���1����������'���������� ����������+�����������������5����������-���������!����������1�������%�������Ì�fþ������� �������+�������„���������ª���1��������������Ì���������ó���æ������������������Ÿ���������¨��� �Ÿ�������� r���[�P�r�e�s�e�n�t�a�t�i�o�n� �e�n�d�s� �h�e�r�e� � � � �s�o�m�e� �a�u�x�i�l�i�a�r�y� �s�l�i�d�e�s� �f�o�l�l�o�w�]���¡���:����������:���������ó���ç������������������Ÿ���������¨���Example in Cyclone�Ÿ��������¨Ž���void f(int@{`j} p, tag_t<`i> i, int v ; `i < `j){ p[i] = v; } Note: regions and locks use implicit defaults (live and accessible)��¡Ì���I�������������������E���������������������������™�þ���������������������������ÿ3�þ ����������������ÿ3�þ�������� ��������ÿ3�þ��������F���������ª,�����������������"��������������R���������ó���ô����������0��������Ÿ���������¨���Some other problems�Ÿ�������� \��O�n�e� �s�a�f�e�t�y� �v�i�o�l�a�t�i�o�n� �t�y�p�i�c�a�l�l�y� �r�e�n�d�e�r�s� �a�l�l� �p�r�o�g�r�a�m� �p�r�o�p�e�r�t�i�e�s� �p�o�t�e�n�t�i�a�l�l�y� �i�r�r�e�l�e�v�a�n�t� � �S�o� �p�r�o�h�i�b�i�t�:� � � � �i�n�c�o�r�r�e�c�t� �c�a�s�t�s�,� �a�r�r�a�y�-�b�o�u�n�d�s� �v�i�o�l�a�t�i�o�n�s�,� �m�i�s�u�s�e�d� �u�n�i�o�n�s�,� �u�n�i�n�i�t�i�a�l�i�z�e�d� �p�o�i�n�t�e�r�s�,� �d�a�n�g�l�i�n�g� �p�o�i�n�t�e�r�s�,� �n�u�l�l�-�p�o�i�n�t�e�r� �d�e�r�e�f�e�r�e�n�c�e�s�,� �d�a�n�g�l�i�n�g� �l�o�n�g�j�m�p�,� �v�a�r�a�r�g� �m�i�s�m�a�t�c�h�,� �n�o�t� �r�e�t�u�r�n�i�n�g� �p�o�i�n�t�e�r�s�,� �d�a�t�a� �r�a�c�e�s�,� �& ��¡,���d��������Z�Ë��������Z�d�������Ë�������/�ð¨�����ó���^�������������������ó���Å�����������%��������ó���Ð�����������&��������ó���è�����������'��������ó���é�����������(��������ó���ï�����������)�������P������ÿÿÿ�������������������������������������������������������������������������ê�����øÈ ���ï������ ���������������`�ð �����ÿ�ÿÿÿ�����ÿÿ��ÿ™���ÿÿ�ÿ���–––�`�ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²�`�ð ���ÿÿÿ�����333�����ÝÝÝ�€€€�MMM�êêê�`�ð ���ÿÿÌ�����ff3�€€��3™3�€����3Ì�ÿÌf�`�ð ���ÿÿÿ�����€€€�����ÿÌf���ÿ�Ì�Ì�ÀÀÀ�`�ð ���ÿÿÿ�����€€€�����ÀÀÀ��fÿ�ÿ����™��`�ð ���ÿÿÿ�����€€€�����3™ÿ�™ÿÌ�Ì�Ì�²²²���£>����ÿý?���" ��d�������d���������@�������ÿÿï����ÿÿÿÿÿÿ$�������£z����ÿý?��" ��d�������d����Ø���@�������ÿÿï����ÿÿÿÿÿÿ������€�� Ô ����€��" Ð@����€�� ð`����€��»�€���� �£n����ÿý?���" ��d�������d��������@�������ÿÿï�����ÿÿÿÿÿÿ ���������  �������@@�������``�������€€����P�£V������ �������������� ����� ����� �����@����� �����`����� �����€����`�£ ��������������p�£>��������������������������������������������������€�£>����������������������������������������������������ù���P��������„ 0� Þ���ðÖ���ð������ ���ðn���ð(���� ð�������������������� ð���� ������ðà���� ð��� ��� ��“� ð6������€�PäÑ�‡������ƒ���¿��À��ÿ� ����"ñ���¿�����ð���À�°Ð�ð�����à ��������Ñ�� ðT�����Ÿ���������¨ ���Click to edit Master title style��¢���!�������ª ���!���������ð$��� ð��� ��� ��ƒ� ð0������€��çÑ���ƒ���¿��À��ÿ� ����"ñ���¿�����ð���ð°Ð��ð�����à �������Ñ�� ðž�����Ÿ��������¨R���Click to edit Master text styles Second level Third level Fourth level Fifth level��¢���!����� ���� ���� ���� ������ª ���S���������ðâ���� ð��� ��� ��ƒ� ð0������€�ÜëÑ���ƒ���¿��À��ÿ� ����"ñ���¿�����ð���À°`à�ð�����à ������Ñ�� ð\�����Ÿ�������� ���*���¡������������������������ø���������ª�������������������ðä���� ð��� ��� ��ƒ� ð0������€�€ñÑ���ƒ���¿��À��ÿ� ����"ñ���¿�����ð���À� @à�ð�����à ������ Ñ�� ð^�����Ÿ�������� ���*� ���¡������������������������ú���������ª�������������������ð`���B ð��� ��� ��s� ð*���D������¿���À��ËԔ��ÿ�����"ñ���¿�����ð���0àp0�ðä���� ð��� ��� ��ƒ� ð0������€�$õÑ���ƒ���¿��À��ÿ� ����"ñ���¿�����ð���´Ðà�ð�����à ������Ñ�� ð^�����Ÿ�������� ���*���¡������������������������Ø���������ª�������������������ðH���� ð��� ��� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²� �º&���d�a�n�_�d�e�s�i�g�n�_�t�e�m�p�l�a�t�e��î[���ï������ �����€����������ù���P��������Ø�� ó���ðë��@�ð���������ðƒ���ð(���� ð�������������������� ð����������ðà���� ð������ ��“� ð6������€�tár‡������ƒ���¿��À��ÿ� ����"ñ���¿�����ð��� °Ðp�ð�����à ��������r� ðT�����Ÿ��������¨ ���Click to edit Master title style��¢���!�������ª ���!���������ðÝ���� ð������ ��ƒ� ð0������€�”Ýr��ƒ���¿��À��ÿ� ����"ñ���¿�����ð��� ` à �ð�����à �������r� ðW�����Ÿ��������¨#���Click to edit Master subtitle style��¢���$�������ª ���$���������ðÞ���� ð������ ��ƒ� ð0������€�œ s��ƒ���¿��À��ÿ� ����"ñ���¿�����ð���`°`€�ð�����à ������r� ðX�����Ÿ�������� ���*���¡���������������������ø���������ª�������������������ðà���� ð������ ��ƒ� ð0������€�0%s��ƒ���¿��À��ÿ� ����"ñ���¿�����ð���`°Ð€�ð�����à ������ s� ðZ�����Ÿ�������� ���*���¡���������������������ú���������ª�������������������ðà���� ð������ ��ƒ� ð0������€�¸(s��ƒ���¿��À��ÿ� ����"ñ���¿�����ð���` Ѐ�ð�����à ������s� ðZ�����Ÿ�������� ���*���¡���������������������Ø���������ª�������������������ð`���B ð������ ��s� ð*���D������¿���À��ËԔ��ÿ�����"ñ���¿�����ð���0àp0�ð`���B ð������ ��s� ð*���D������¿���À��ËԔ��ÿ�����"ñ���¿�����ð���@àp@�ðH���� ð������ ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ð���ñ�����€�� 0� ˆ���ð€��`�ð������0���ð���ð(���� ð�������������������� ð����0������ð��� ð���0��� ��Ó� ðN������€�x„s�gk�‚�´µ��ƒ�gk�„�´µ��¿�����ƒ���¿��À��ÿ� �����ð�������v$�ð�����à ������� s� ðn�����Ÿ�������� ���*���¡������������������ ���ù���������ª �������������¦���ñ��J%%JJoo””�ð��� ð���0��� ��Ó� ðN������€�ü…s�gk�‚�´µ��ƒ�gk�„�´µ��¿�����ƒ���¿��À��ÿ� �����ð����� 8$�ð�����à �������s� ðp�����Ÿ�������� ���*���¡������������������ ���ø���������ª �������������¦���ñ��J%%JJoo””�ðd���� ð���0��� ��c� ð$������‡�������¿��ÿ� �?����ð���·æRH �ð�����à �������s�ð4��� ð���0��� ��Ó� ðN������€�`—s�gk�‚�´µ��ƒ�gk�„�´µ��¿�����ƒ���¿��À��ÿ� �����ð���Ú Lì!�ð�����à ������s� ðž�����Ÿ��������¨R���Click to edit Master text styles Second level Third level Fourth level Fifth level��¢���!����� ���� ���� ���� ������ª ���S���������ð ��� ð���0��� ��ã� ðT������€� ¢s�gk�‚�´µ��ƒ�gk�„�´µ��‡����¿�����ƒ���¿��À��ÿ� �����ð���´��vØ�ð�����à ������ s� ðn�����Ÿ�������� ���*���¡������������������ ���ú���������ª �������������¦���ñ��J%%JJoo””�ð ��� ð���0��� ��ã� ðT������€�p¢s�gk�‚�´µ��ƒ�gk�„�´µ��‡����¿�����ƒ���¿��À��ÿ� �����ð���´ 8Ø�ð�����à ������s� ðp�����Ÿ�������� ���*���¡������������������ ���Ø���������ª �������������¦���ñ��J%%JJoo””�ðH���� ð���0��� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���ÚñÄPÿc_�Ép��� ����ðø��@ð������œ��ð���ð(���� ð�������������������� ð����œ�����ð ��� ð���œ�� ��Ó� ðN������€�(g˜�gk�‚�´µ��ƒ�gk�„�´µ��¿�����ƒ���¿��À��ÿ� �����ð�������v$�ð�����à ������� {� ðv�����Ÿ�������� ���*���¡������������������ ���ù���������ª��������������������¦���ñ��J%%JJoo””�ð��� ð���œ�� ��Ó� ðN������€�Th˜�gk�‚�´µ��ƒ�gk�„�´µ��¿�����ƒ���¿��À��ÿ� �����ð����� 8$�ð�����à ������{� ðx�����Ÿ�������� ���*���¡������������������ ���ø���������ª��������������������¦���ñ��J%%JJoo””�ð��� ð���œ�� ��ã� ðT������€�˜]˜�gk�‚�´µ��ƒ�gk�„�´µ��‡����¿�����ƒ���¿��À��ÿ� �����ð���´��vØ�ð�����à ������ {� ðv�����Ÿ�������� ���*���¡������������������ ���ú���������ª��������������������¦���ñ��J%%JJoo””�ð��� ð���œ�� ��ã� ðT������€�øE˜�gk�‚�´µ��ƒ�gk�„�´µ��‡����¿�����ƒ���¿��À��ÿ� �����ð���´ 8Ø�ð�����à ������{� ðx�����Ÿ�������� ���*���¡������������������ ���Ø���������ª��������������������¦���ñ��J%%JJoo””�ðH���� ð���œ�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���ÚñÄܱ`�î���ï���������������€�������ù���P��������ç��  ���ð˜��0�ð���������ð0���ð(���� ð�������������������� ð����������ðx���� ð����� ��c� ð$�������€�”2s¿���ÿ�����ˆ������ð���ð°ÐÀ�ð�����à ��������s� ð �����ž��������ðx���� ð����� ��c� ð$�������€�P3s¿���ÿ�����ˆ������ð���PPР �ð�����à �������s� ð �����ž�������ðH���� ð������ ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€%�������ù���P��������ÿÿÿ� ®���ð¦���ð������T��ð>���ð(���� ð�������������������� ð����T�����ðx���� ð���T� ��c� ð$�������€�(˜¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �˜� ð �����ž��������ð†���� ð���T� ��c� ð$�������€�ԗ¿���ÿ��� ��ˆ������ð���ð°0��ð�����à �������˜� ð�����ž��������¦������Š�ðH���� ð���T�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ç��  ���ð˜��ðð������`��ð0���ð(���� ð�������������������� ð����`�����ðx���� ð���`� ��c� ð$�������€�˜˜¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �˜� ð �����ž��������ðx���� ð���`� ��c� ð$�������€�T˜¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������˜� ð �����ž�������ðH���� ð���`�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€)�������ù���P��������ÿÿÿ�  ���ð˜��àð��������ð0���ð(���� ð�������������������� ð���������ðx���� ð���� ��c� ð$�������€�œ ˜¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �˜� ð �����ž��������ðx���� ð���� ��c� ð$�������€�X˜¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������˜� ð �����ž�������ðH���� ð����� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜��Ðð��������ð0���ð(���� ð�������������������� ð���������ðx���� ð���� ��c� ð$�������€�ð˜¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �˜� ð �����ž��������ðx���� ð���� ��c� ð$�������€�x˜¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������˜� ð �����ž�������ðH���� ð����� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ�  ���ð˜��Àð������l��ð0���ð(���� ð�������������������� ð����l�����ðx���� ð���l� ��c� ð$�������€�èܗ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �—� ð �����ž��������ðx���� ð���l� ��c� ð$�������€�¤Ý—¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������—� ð �����ž�������ðH���� ð���l�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ�  ���ð˜��°ð������p��ð0���ð(���� ð�������������������� ð����p�����ðx���� ð���p� ��c� ð$�������€�Ðɗ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �—� ð �����ž��������ðx���� ð���p� ��c� ð$�������€�ŒÊ—¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������—� ð �����ž�������ðH���� ð���p�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜�� ð������t��ð0���ð(���� ð�������������������� ð����t�����ðx���� ð���t� ��c� ð$�������€�¨Á—¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �—� ð �����ž��������ðx���� ð���t� ��c� ð$�������€�d—¿���ÿ��� ��ˆ������ð���°` �ð�����à �������—� ð �����ž�������ðH���� ð���t�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ÿÿÿ� ¶���ð®��ð������x��ðF���ð(���� ð�������������������� ð����x�����ðx���� ð���x� ��c� ð$�������€�lo—¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �—� ð �����ž��������ðŽ���� ð���x� ��c� ð$�������€�Dô–¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������—� ð"�����ž��������¦���ø��� @08X�ðH���� ð���x�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��îõ���ï������ ��������€&�������ù���P��������ÿÿÿ� ���ð…��€ð���#���#|��ð���ð(���� ð�������������������� ð����|�����ðx���� ð���|� ��c� ð$�������€�¸=–¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �—� ð �����ž��������ðx���� ð���|� ��c� ð$�������€�t>–¿���ÿ��� ��ˆ������ð���� Ð�ð�����à �������–� ð �����ž�������ðå���ðv���� ð���p���� ��‚ ��� ð���|���#� ð ������ˆ����#�"ñ"���Ÿ��� Ã������ ��à��à��p����ð���@‚ �ð¿���� ð���|� ��£� ð<�������€�4ˆ–¿������ƒ���¿��À��ÿ�����?�����ð���@�� �� ��‚ ��� ðK�����Ÿ��������¨���0��¡�������� ���������������¦���ø����� @`€�ðÍ���� ð���|� ��£� ð<�������€� ˜–¿������ƒ���¿��À��ÿ�����?�����ð���` �� ��@��‚ ��� ðY�����Ÿ��������¨��� 2 (32=5.5%)��¡�������� ���������������¦���ø����� @`€�ð���� ð���|� ��£� ð<�������€� —¿������ƒ���¿��À��ÿ�����?�����ð����� ��` ��‚ ��� ðŒ�����Ÿ�������� (���+� � � �3�4� �(�5�.�8�%�)� � � � �2�9���¡2�������� �����������������"�������������¦���ø����� @`€�ðÃ���� ð���|� ��£� ð<�������€�è—¿������ƒ���¿��À��ÿ�����?�����ð���ã�� ����‚ ��� ðO�����Ÿ��������¨��� 584��¡�������� ���������������¦���ø����� @`€�ð×���� ð��� |� ��£� ð<�������€�¸—¿������ƒ���¿��À��ÿ�����?�����ð���p�� ��ã��‚ ��� ðc�����Ÿ��������¨���ccured-olden-mst (1 of 4)��¡�������� ���������������¦���ø����� @`€�ðÎ���� ð��� |� ��£� ð<�������€�D)—¿������ƒ���¿��À��ÿ�����?�����ð���@��)�� �� ��� ðZ�����Ÿ��������¨���1 ��¡&�������� �������������ÿ3�þ���������¦���ø����� @`€�ðË���� ð��� |� ��£� ð<�������€�´1—¿������ƒ���¿��À��ÿ�����?�����ð���` ��)��@�� ��� ðW�����Ÿ��������¨ ���12 (261=8.7%)��¡�������� ���������������¦���ø����� @`€�ðü���� ð��� |� ��£� ð<�������€�43—¿������ƒ���¿��À��ÿ�����?�����ð�����)��` �� ��� ðˆ�����Ÿ�������� $���+� �2�7�3� �(�9�.�1�%�)� � �2�4�5���¡2�������� ������ �����������"�������������¦���ø����� @`€�ðÂ���� ð��� |� ��£� ð<�������€�À5—¿������ƒ���¿��À��ÿ�����?�����ð���ã��)���� ��� ðN�����Ÿ��������¨���3005��¡�������� ���������������¦���ø����� @`€�ðÑ���� ð���|� ��£� ð<�������€�àJ—¿������ƒ���¿��À��ÿ�����?�����ð���p��)��ã�� ��� ð]�����Ÿ��������¨���mini-httpd (1 of 6)��¡�������� ���������������¦���ø����� @`€�ðî���� ð���|� ��£� ð<�������€�pT—¿������ƒ���¿��À��ÿ�����?�����ð���@��I�� ��)��� ðz�����Ÿ��������¨���1 (half of examples)��¡4�������� �������������ÿ3�þ��������������ÿ3�þ��¦���ø����� @`€�ðË���� ð���|� ��£� ð<�������€�\—¿������ƒ���¿��À��ÿ�����?�����ð���` ��I��@��)��� ðW�����Ÿ��������¨ ���41 (216=6.6%)��¡�������� ���������������¦���ø����� @`€�ðü���� ð���|� ��£� ð<�������€�f—¿������ƒ���¿��À��ÿ�����?�����ð�����I��` ��)��� ðˆ�����Ÿ�������� $���+� �2�5�7� �(�7�.�9�%�)� � �1�9�0���¡2�������� ������ �����������"�������������¦���ø����� @`€�ðÂ���� ð���|� ��£� ð<�������€�Pn—¿������ƒ���¿��À��ÿ�����?�����ð���ã��I����)��� ðN�����Ÿ��������¨���3260��¡�������� ���������������¦���ø����� @`€�ðÏ���� ð���|� ��£� ð<�������€� v—¿������ƒ���¿��À��ÿ�����?�����ð���p��I��ã��)��� ð[�����Ÿ��������¨���grobner (1 of 4)��¡�������� ���������������¦���ø����� @`€�ðÈ���� ð���|� ��£� ð<�������€�x—¿������ƒ���¿��À��ÿ�����?�����ð���@���� ��I��� ðT�����Ÿ��������¨ ���bugs found��¡��� ����� ������ ���������¦���ø����� @`€�ðÈ���� ð���|� ��£� ð<�������€�܆—¿������ƒ���¿��À��ÿ�����?�����ð���` ����@��I��� ðT�����Ÿ��������¨ ���incidental��¡��� ����� ������ ���������¦���ø����� @`€�ðÈ���� ð���|� ��£� ð<�������€� —¿������ƒ���¿��À��ÿ�����?�����ð�������` ��I��� ðT�����Ÿ��������¨ ���diff total��¡��� ����� ������ ���������¦���ø����� @`€�ðÈ���� ð���|� ��£� ð<�������€�ø–—¿������ƒ���¿��À��ÿ�����?�����ð���ã������I��� ðT�����Ÿ��������¨ ���Lines of C��¡��� ����� ������ ���������¦���ø����� @`€�ðÅ���� ð���|� ��£� ð<�������€�x˜—¿������ƒ���¿��À��ÿ�����?�����ð���p����ã��I��� ðQ�����Ÿ��������¨���Example��¡�������� ���������������¦���ø����� @`€�ð`���B ð���|� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���p���� �����ðZ���B ð���|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���p��I�� ��I���ðZ���B ð���|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���p��)�� ��)���ðZ���B ð���|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���p�� �� �� ���ð`���B ð���|� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���p��‚ �� ��‚ ���ð`���B ð���|� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���p����p��‚ ���ðZ���B ð���|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���ã����ã��‚ ���ðZ���B ð��� |� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���������‚ ���ðZ���B ð���!|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���` ����` ��‚ ���ðZ���B ð���"|� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���@����@��‚ ���ð`���B ð���#|� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð��� ���� ��‚ ���ðH���� ð���|�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î¬���ï������ ��������€���������ù���P��������ç�� D���ð<��pð���(���(„��ðÔ���ð(���� ð�������������������� ð����„�����ðx���� ð���„� ��c� ð$�������€�–¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �–� ð �����ž��������ðx���� ð���„� ��c� ð$�������€�Ô–¿���ÿ��� ��ˆ������ð���p 0ð�ð�����à �������–� ð �����ž�������ðœ���ðv���� ð�������°��ƒ ��� ð���„���#� ð ������ˆ����#�"ñ"���Ÿ��� Ã������°��á��à��p����ð���p€ƒ �ðü���� ð���„� ��£� ð<�������€�¨ –¿������ƒ���¿��À��ÿ�����?�����ð���€ �� ��À��ƒ ��� ðˆ�����Ÿ�������� $���+� � � �3�5� � � � �3�0� �n�o�g�c���¡2�������� �����������������"�������������¦���ø����� @`€�ðß���� ð���„� ��£� ð<�������€�¬+–¿������ƒ���¿��À��ÿ�����?�����ð���€ ��*��À�� ��� ðk�����Ÿ��������¨��� ��¡2�������� �����������"�� ������"������������¦���ø����� @`€�ðî���� ð���„� ��£� ð<�������€�h3–¿������ƒ���¿��À��ÿ�����?�����ð���€ ��I��À��*��� ðz�����Ÿ�������� ���+� �3�3�6� � �1�9�6���¡2��� ����� �����������������"�������������¦���ø����� @`€�ðÄ���� ð���„� ��£� ð<�������€�h=–¿������ƒ���¿��À��ÿ�����?�����ð���€ ����À��I��� ðP�����Ÿ��������¨���faster��¡�������� ���������������¦���ø����� @`€�ðÃ���� ð��� „� ��£� ð<�������€�¸C–¿������ƒ���¿��À��ÿ�����?�����ð���À�� ��°��ƒ ��� ðO�����Ÿ��������¨���1.39x��¡�������� ���������������¦���ø����� @`€�ðÃ���� ð��� „� ��£� ð<�������€�ÈF–¿������ƒ���¿��À��ÿ�����?�����ð���ð �� ��€ ��ƒ ��� ðO�����Ÿ��������¨���1.93x��¡�������� ���������������¦���ø����� @`€�ðò���� ð��� „� ��£� ð<�������€�`U–¿������ƒ���¿��À��ÿ�����?�����ð���°�� ��ð ��ƒ ��� ð~�����Ÿ�������� ���+� � � �3�4� � � � �2�9���¡2�������� �����������������"�������������¦���ø����� @`€�ðÃ���� ð��� „� ��£� ð<�������€�HP–¿������ƒ���¿��À��ÿ�����?�����ð��� �� ��°��ƒ ��� ðO�����Ÿ��������¨��� 584��¡�������� ���������������¦���ø����� @`€�ð×���� ð��� „� ��£� ð<�������€�0e–¿������ƒ���¿��À��ÿ�����?�����ð����� �� ��ƒ ��� ðc�����Ÿ��������¨���ccured-olden-mst (1 of 4)��¡�������� ���������������¦���ø����� @`€�ðÕ���� ð���„� ��£� ð<�������€�Hón¿������ƒ���¿��À��ÿ�����?�����ð���À��*��°�� ��� ða�����Ÿ��������¨ ��� ��¡&��� ����� �����������"�� � �����"�����¦���ø����� @`€�ðÇ���� ð���„� ��£� ð<�������€� h–¿������ƒ���¿��À��ÿ�����?�����ð���ð ��*��€ �� ��� ðS�����Ÿ��������¨���1.02x��¡�������� �������������ÿ3�þ��¦���ø����� @`€�ðî���� ð���„� ��£� ð<�������€�Ð~–¿������ƒ���¿��À��ÿ�����?�����ð���°��*��ð �� ��� ðz�����Ÿ�������� ���+� �2�7�3� � �2�4�5���¡2��� ����� �����������������"�������������¦���ø����� @`€�ðÂ���� ð���„� ��£� ð<�������€�‡–¿������ƒ���¿��À��ÿ�����?�����ð��� ��*��°�� ��� ðN�����Ÿ��������¨���3005��¡�������� ���������������¦���ø����� @`€�ðÑ���� ð���„� ��£� ð<�������€�؎–¿������ƒ���¿��À��ÿ�����?�����ð�����*�� �� ��� ð]�����Ÿ��������¨���mini-httpd (1 of 6)��¡�������� ���������������¦���ø����� @`€�ðÃ���� ð���„� ��£� ð<�������€�—–¿������ƒ���¿��À��ÿ�����?�����ð���À��I��°��*��� ðO�����Ÿ��������¨���1.51x��¡�������� ���������������¦���ø����� @`€�ðÃ���� ð���„� ��£� ð<�������€�Xž–¿������ƒ���¿��À��ÿ�����?�����ð���ð ��I��€ ��*��� ðO�����Ÿ��������¨���1.94x��¡�������� ���������������¦���ø����� @`€�ðî���� ð���„� ��£� ð<�������€�� –¿������ƒ���¿��À��ÿ�����?�����ð���°��I��ð ��*��� ðz�����Ÿ�������� ���+� �2�5�7� � �1�9�0���¡2��� ����� �����������������"�������������¦���ø����� @`€�ðÂ���� ð���„� ��£� ð<�������€�À¯–¿������ƒ���¿��À��ÿ�����?�����ð��� ��I��°��*��� ðN�����Ÿ��������¨���3260��¡�������� ���������������¦���ø����� @`€�ðÏ���� ð���„� ��£� ð<�������€�ð·–¿������ƒ���¿��À��ÿ�����?�����ð�����I�� ��*��� ð[�����Ÿ��������¨���grobner (1 of 4)��¡�������� ���������������¦���ø����� @`€�ðÌ���� ð���„� ��£� ð<�������€�äÀ–¿������ƒ���¿��À��ÿ�����?�����ð���À����°��I��� ðX�����Ÿ��������¨���execution time��¡�������� ���������������¦���ø����� @`€�ðÌ���� ð���„� ��£� ð<�������€�dɖ¿������ƒ���¿��À��ÿ�����?�����ð���ð ����€ ��I��� ðX�����Ÿ��������¨���execution time��¡�������� ���������������¦���ø����� @`€�ðÈ���� ð���„� ��£� ð<�������€�äʖ¿������ƒ���¿��À��ÿ�����?�����ð���°����ð ��I��� ðT�����Ÿ��������¨ ���diff total��¡��� ����� ������ ���������¦���ø����� @`€�ðÈ���� ð���„� ��£� ð<�������€�øÙ–¿������ƒ���¿��À��ÿ�����?�����ð��� ����°��I��� ðT�����Ÿ��������¨ ���Lines of C��¡��� ����� ������ ���������¦���ø����� @`€�ðÅ���� ð���„� ��£� ð<�������€�¬á–¿������ƒ���¿��À��ÿ�����?�����ð������� ��I��� ðQ�����Ÿ��������¨���Example��¡�������� ���������������¦���ø����� @`€�ð`���B ð���„� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð�������°�����ðZ���B ð���„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð�����I��°��I���ðZ���B ð���„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð�����*��°��*���ðZ���B ð��� „� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð����� ��°�� ���ð`���B ð���!„� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð�����ƒ ��°��ƒ ���ð`���B ð���"„� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���������ƒ ���ðZ���B ð���#„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð��� ���� ��ƒ ���ðZ���B ð���$„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���°����°��ƒ ���ðZ���B ð���%„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���ð ����ð ��ƒ ���ðZ���B ð���&„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���À����À��ƒ ���ð`���B ð���'„� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���°����°��ƒ ���ðZ���B ð���(„� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð���€ ����€ ��ƒ ���ðH���� ð���„�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ç��  ���ð˜��`ð������ˆ��ð0���ð(���� ð�������������������� ð����ˆ�����ðx���� ð���ˆ� ��c� ð$�������€�`–¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �–� ð �����ž��������ðx���� ð���ˆ� ��c� ð$�������€�–¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������–� ð �����ž�������ðH���� ð���ˆ�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜��Pð������Œ��ð0���ð(���� ð�������������������� ð����Œ�����ðx���� ð���Œ� ��c� ð$�������€�ð–¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �–� ð �����ž��������ðx���� ð���Œ� ��c� ð$�������€�¬–¿���ÿ��� ��ˆ������ð��� °�0�ð�����à �������–� ð �����ž�������ðH���� ð���Œ�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ�  ���ð˜��@ð������´��ð0���ð(���� ð�������������������� ð����´�����ðx���� ð���´� ��c� ð$�������€�ð–¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �–� ð �����ž��������ðx���� ð���´� ��c� ð$�������€�¬–¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������–� ð �����ž�������ðH���� ð���´�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î‰���ï������ ��������€'�������ù���P��������ÿÿÿ� !���ð�� �ð���&���9¤��ð±���ð(���� ð�������������������� ð����¤�����ðÍ��� ð���¤�� ��ƒ� ð0�������€�lÊr��ƒ���¿���À��ÿ�� �����ð���°°Ð0 � ðm����Ÿ��������¨c���Subtyping: t@ < t* but t@@ < t*@ but Downcast via run-time check, often avoided via flow analysis��¡¶���!����� ���2������� ��2�������(���2������� ��2�=�����! ������2� �������������������������������������� ��������������������������=����������ª������������������>���������¦���ø���Ø�ÔÐð�ð~���� ð���¤� ��s� ð*������������€�(Ër¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �r� ð �����ž��������ð‚���ðn���� ð��� ��€��@��P ��� ð���¤���#� ð ������ˆ����#�"ñ���Ÿ��� Ã������Q������ð���ð @À�ðä���� ð���¤� ��£� ð<�������€�€Ôr¿������ƒ���¿��À��ÿ�����?�����ð������Ñ��@��P ��� ðp�����Ÿ��������¨���pointer to a t value��¡*������������� ������������������������¦���ø����� @`€�ðÖ���� ð���¤� ��£� ð<�������€�ØÛr¿������ƒ���¿��À��ÿ�����?�����ð��� ��Ñ�����P ��� ðb�����Ÿ��������¨���t@��¡.������������������������������������¦���ø����� @`€�ðø���� ð���¤� ��£� ð<�������€�äàr¿������ƒ���¿��À��ÿ�����?�����ð������€��@��Ñ��� ð„�����Ÿ��������¨���pointer to a t value or NULL��¡6������������� ��������������� ����������������¦���ø����� @`€�ðÖ���� ð���¤� ��£� ð<�������€�0ër¿������ƒ���¿��À��ÿ�����?�����ð��� ��€�����Ñ��� ðb�����Ÿ��������¨���t*��¡.������������������������������������¦���ø����� @`€�ð`���B ð��� ¤� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð��� ��€��@��€���ðZ���B ð��� ¤� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð��� ��Ñ��@��Ñ���ð`���B ð��� ¤� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð��� ��P ��@��P ���ð`���B ð��� ¤� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð��� ��€�� ��P ���ðZ���B ð��� ¤� ��s� ð*���¿���À��Ëœ1��ÿ� ���?���¿�����ð������€�����P ���ð`���B ð���¤� ��ƒ� ð0���¿���À��ËŸo��×���ÿ� ���?���¿�����ð���@��€��@��P ���ð±���� ð���¤�� ��“� ð6���€�4îr…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���0 à` ð � ðK�����Ÿ��������¨���<��¡������������������������ª ������������ð^���� ð���¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���À p`€ �ðX���B ð���¤�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð��� �à �ð^���� ð���¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���À àЀ �ð‘���¢ ð���¤�� ��ƒ� ð0���€�ðr¿�����ƒ���¿���À��ÿ�������ð��� àа � ð1�����Ÿ��������¨���v��¡��������� ��2���������ð^���� ð���¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���Ð p` �ð^���B ð��� ¤�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���0 �à0 �ð^���� ð���!¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���Ð àА �ð‘���¢ ð���"¤�� ��ƒ� ð0���€�\ôr¿�����ƒ���¿���À��ÿ�������ð���  àÐÀ � ð1�����Ÿ��������¨���v��¡��������� ��2���������ð·���¢ ð���$¤�� ��£� ð<���€�ô÷r…����‡����¿�����ƒ���¿���À��ÿ�������ð���X ×� ðK�����Ÿ��������¨���/��¡������������������������ª ������������ð±���� ð���%¤�� ��“� ð6���€�¬ûr…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���0  Pð � ðK�����Ÿ��������¨���<��¡������������������������ª ������������ð^���� ð���&¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���À `P€ �ð^���� ð���(¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���À ÐÀ€ �ð‘���¢ ð���)¤�� ��ƒ� ð0���€�ð�s¿�����ƒ���¿���À��ÿ�������ð��� ÐÀ° � ð1�����Ÿ��������¨���v��¡��������� ��2���������ð^���� ð���.¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���À € �ðX���B ð���/¤�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð��� € ` �ðX���B ð���2¤�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð��� ðÐ �ð·���¢ ð���3¤�� ��£� ð<���€�\s…����‡����¿�����ƒ���¿���À��ÿ�������ð���u ¡S¼ � ðK�����Ÿ��������¨���/��¡������������������������ª ������������ð^���� ð���4¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���  `P` �ð^���� ð���5¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���  ÐÀ` �ð‘���¢ ð���6¤�� ��ƒ� ð0���€�4 s¿�����ƒ���¿���À��ÿ�������ð���p ÐÀ � ð1�����Ÿ��������¨���v��¡��������� ��2���������ð^���� ð���7¤�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���  ` �ðX���B ð���8¤�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð���� € ` �ð^���B ð���9¤�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���� ðÐ �ðH���� ð���¤�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ît���ï������ ��������€���������ù���P��������ç��  ���ð��0ð������¬��ðœ���ð(���� ð�������������������� ð����¬�����ð~���� ð���¬� ��s� ð*������������€�ä”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���¬� ��s� ð*������������€�T딿���ÿ��� ��ˆ������ð���ð@`��ð�����à �������”� ð �����ž�������ðX���� ð���¬�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���`@°Ð �ðH���� ð���¬�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� Ô���ðÌ�� ð������°��ðd���ð(���� ð�������������������� ð����°�����ð~���� ð���°� ��s� ð*������������€�ôՔ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð���� ð���°� ��£� ð<������������€�°Ö”¿���À��Ä����Ëœ1��ÿ� � ��ˆ������ð���ðààb�ð�����à �������”� ð �����ž�������ð��¢ ð���°�� ��ƒ� ð0���€�@ܔ¿�����ƒ���¿���À��ÿ�������ð���p°Ð› � ð®����Ÿ�������� z�� �R�i�c�h�e�r� �t�y�p�e�s� �m�a�k�e� �i�n�t�e�r�f�a�c�e� �s�t�r�i�c�t�e�r� � �S�t�r�i�c�t�e�r� �i�n�t�e�r�f�a�c�e� �m�a�k�e� �i�m�p�l�e�m�e�n�t�a�t�i�o�n� �e�a�s�i�e�r�/�f�a�s�t�e�r� � �E�x�p�o�s�i�n�g� �c�h�e�c�k�s� �t�o� �u�s�e�r� �l�e�t�s� �t�h�e�m� �o�p�t�i�m�i�z�e� � �C�a�n� t� �c�h�e�c�k� �e�v�e�r�y�t�h�i�n�g� �s�t�a�t�i�c�a�l�l�y� �(�e�.�g�.�,� �c�l�o�s�e�-�o�n�c�e�)���¡���¾����� ���2�¾��������ðH���� ð���°�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��ð������ø��ð$���ð(���� ð�������������������� ð����ø�����ðr���� ð���ø� ��S� ð�������€�4Ô¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðr���� ð���ø� ��S� ð�������€�ðÔ¿���ÿ��� ����ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���ø�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���âñÄ0¼A#�î®���ï������ ��������€���������ù���P��������ÿÿÿ� ���ðþ���ð��� ���0��ð–���ð(���� ð�������������������� ð����0�����ðr���� ð���0� ��S� ð�������€�¤¤”¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð7��� ð���0�� ��“� ð6�������€�Ø¥”¿�����ƒ���¿���À��ÿ�������ð���ðàÐŽ � ðÑ�����Ÿ��������¨W���void f(int*@p) { if(*p != NULL) { g(); **p = 42;//inserted check even w/o g() } }��¡2���X������������������������™�þR���������ª$�������������������������K��������ð���� ð���0� ��£� ð<������€�´«”��ƒ���¿���À��ÿ�� ��� ��ˆ������ð��� Ppð�ð�����à �������”� ð �����ž�������ð¨���� ð��� 0�� ��“� ð6���€�˜¯”…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���ð� À`� ðB�����Ÿ��������¡������������������������ª ������������ð^���� ð��� 0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€ÐÀ@�ð^���� ð��� 0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€@0@�ð®���¢ ð��� 0�� ��ƒ� ð0���€�D¹”¿�����ƒ���¿���À��ÿ�������ð���P@`J� ðN�����Ÿ��������¨���37��¡��������� ��2����������ª�������������������ð^���� ð���0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€ € @�ðX���B ð���0�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð���àð Ðà�ð^���B ð���0�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���à`@à�ð¯���¢ ð���0�� ��£� ð<���€�4.q…����‡����¿�����ƒ���¿���À��ÿ�������ð���` 4 0� ðC�����Ÿ��������¨���p��¡���������������������ª ������������ðH���� ð���0�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���õÄ€S¼S�îh ���ï������ ��������€���������ù���P��������ç�� À���ð¸��ðð������4��ðP���ð(���� ð�������������������� ð����4�����ðx���� ð���4� ��c� ð$�������€�”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðh��� ð���4�� ��“� ð6�������€�„‡”¿�����ƒ���¿���À��ÿ�������ð���ðàÐt � ð����Ÿ��������¨R���void f(int**p) { int* x = *p; if(x != NULL) { g(); *x = 42;//no check } }��¡N���S������������������������™�þ���������������™�þ;���������ª>������������������������������� ��������������/��������ð���� ð���4� ��£� ð<������€�°‘”��ƒ���¿���À��ÿ�� ��� ��ˆ������ð��� Ppð�ð�����à �������”� ð �����ž�������ð¨���� ð���4�� ��“� ð6���€�ô–”…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���P� Àp� ðB�����Ÿ��������¡������������������������ª ������������ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���àÐÀ �ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���à@0 �ð®���¢ ð��� 4�� ��ƒ� ð0���€�Pæq¿�����ƒ���¿���À��ÿ�������ð���°@`ª� ðN�����Ÿ��������¨���37��¡��������� ��2����������ª�������������������ð^���� ð��� 4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���à €  �ðX���B ð��� 4�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð���@ð ÐA�ð^���B ð��� 4�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���@`@A�ð¯���¢ ð��� 4�� ��£� ð<���€�¬Cq…����‡����¿�����ƒ���¿���À��ÿ�������ð���p` 4 � ðC�����Ÿ��������¨���p��¡���������������������ª ������������ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���ÐÀP�ð^���B ð���4�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���Ð`@ñ�ð¯���¢ ð���4�� ��£� ð<���€�€7q…����‡����¿�����ƒ���¿���À��ÿ�������ð��� pD@� ðC�����Ÿ��������¨���x��¡���������������������ª ������������ðH���� ð���4�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���õÄ€S¼S�î���ï������ ��������€���������ù���@��������ÿÿÿ�  ���ð˜��àð������,��ð0���ð(���� ð�������������������� ð����,�����ðx���� ð���,� ��c� ð$�������€�du”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðx���� ð���,� ��c� ð$�������€� v”¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���,�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��îK���ï������ ��������€���������ù���@��������ÿÿÿ� ã���ðÛ��Ðð������¼��ðs���ð(���� ð�������������������� ð����¼�����ð~���� ð���¼� ��s� ð*������������€�°a”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðx���� ð���¼� ��c� ð$�������€�lb”¿���ÿ��� ��ˆ������ð��� P ��ð�����à �������”� ð �����ž�������ðR���B ð���¼�� ��s� ð*���D������¿���À��ËԔ��ÿ������ð��� p�ðš���¢ ð���¼�� ��ƒ� ð0���€�Te”¿�����ƒ���¿���À��ÿ�������ð���À Pà� ð:�����Ÿ��������¡��������� ��2����������ª ������������ðš���¢ ð���¼�� ��ƒ� ð0���€�€h”¿�����ƒ���¿���À��ÿ�������ð���À °à� ð:�����Ÿ��������¡��������� ��2����������ª ������������ð—��¢ ð���¼�� ��£� ð<���€�°Qq…����‡����¿�����ƒ���¿���À��ÿ�������ð���P ’� ð+����Ÿ��������¨©���struct Lst<`a> { `a hd; struct Lst<`a>* tl; }; struct Lst<`b>* map( `b f(`a), struct Lst<`a> *); struct Lst<`a>* append( struct Lst<`a>*, struct Lst<`a>*);��¡f��ª��������� ��������������ÿ3�þ��������������ÿ3�þ��������������ÿ3�þ��������������ÿ3�þ���������������™�þ��������������ÿ3�þ��������������ÿ3�þ��������������ÿ3�þ��������������ÿ3�þ���������������™�þ��������������ÿ3�þ��������������ÿ3�þ��������ðH���� ð���¼�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î$���ï������ ��������€(�������ù���@��������ç�� ¼���ð´��Àð������À��ðL���ð(���� ð�������������������� ð����À�����ð~���� ð���À� ��s� ð*������������€�_”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðŽ���� ð���À� ��c� ð$�������€�pNq¿���ÿ��� ��ˆ������ð���°à��ð�����à �������”� ð"�����ž��������¦���8��¹�+s�ðH���� ð���À�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ� ¬���ð¤��°ð������È��ð<���ð(���� ð�������������������� ð����È�����ð~���� ð���È� ��s� ð*������������€�,3”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���È� ��s� ð*������������€�Ô3”¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���È�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î"���ï������ ��������€���������ù���@��������ÿÿÿ� º���ð²�� ð���"���"Ü��ð���ð(���� ð�������������������� ð����Ü�����ð~���� ð���Ü� ��s� ð*������������€�¬8”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���Ü� ��s� ð*������������€�h9”¿���ÿ��� ��ˆ������ð���ðP��ð�����à �������”� ð �����ž�������ðX���� ð���Ü�� ��ƒ� ð0���…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���ÐpP �ð^���2� ð���Ü�� ��“� ð6���…����‡������ƒ���¿���À��ËÑV��ÿ������ð���ÀPP�ðR���� ð���Ü�� ��s� ð*���…����‡������¿��À��ÿ������ð���P°p�ðÒ���� ð���Ü�� ��ã� ðª���B(��C8��D���EÁ4���FÁ�������ƒ���¿���À��ËjJ��ÿ����ˆ���� � �ðÿ(È�à��˜�8h�(8���˜��h��8�p��˜��À���è�0�ø�8� � ���@�­ �­ �­ �­ �¬�€��ð���xX€°�ðR���B ð���Ü�� ��s� ð*���D������¿���À��Ñ���ÿ������ð���°P€à�ðX���� ð��� Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���°p�ðX���� ð��� Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���p@ Ð�ðX���� ð��� Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���à0@�ð^���2� ð��� Ü�� ��“� ð6���…����‡������ƒ���¿���À��ËÑV��ÿ������ð���ðPPÀ �ðR���� ð��� Ü�� ��s� ð*���…����‡������¿��À��ÿ������ð���@P° �ðÒ���� ð���Ü�� ��ã� ðª���B(��C8��D���EÁ4���FÁ�������ƒ���¿���À��ËjJ��ÿ����ˆ���� � �ðÿ(È�à��˜�8h�(8���˜��h��8�p��˜��À���è�0�ø�8� � ���@�­ �­ �­ �­ �¬�€��ð���¨X€à�ðR���B ð���Ü�� ��s� ð*���D������¿���À��Ñ���ÿ������ð���àP€�ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���àp@�ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð��� @ � �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���p0Ð�ð^���2� ð���Ü�� ��“� ð6���…����‡������ƒ���¿���À��ËÑV��ÿ������ð��� PPð �ðR���� ð���Ü�� ��s� ð*���…����‡������¿��À��ÿ������ð���p P°Ð �ðÒ���� ð���Ü�� ��ã� ðª���B(��C8��D���EÁ4���FÁ�������ƒ���¿���À��ËjJ��ÿ����ˆ���� � �ðÿ(È�à��˜�8h�(8���˜��h��8�p��˜��À���è�0�ø�8� � ���@�­ �­ �­ �­ �¬�€��ð���Ø X€ �ðR���B ð���Ü�� ��s� ð*���D������¿���À��Ñ���ÿ������ð��� P€@ �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð��� pp �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���Ð @ 0 �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���@  �  �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð��� Ð0��ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���° `À �ðX���� ð���Ü�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���� ð` �ð¾���� ð���Ü�� �� ð–���Bð���C@��D���EÁ���FÁ�������ƒ���¿���À��ËjJ��Ð���Ñ���ÿ����ˆ������ðÿ��@x�Hð�Pð�pð�(�h���������@�­ �­ �¬�€��ð���Ððà �ð^���B ð���Ü�� ��“� ð6���D������¿���À��ËjJ��Ð���Ñ���ÿ������ð���0``€�ð^���B ð���Ü�� ��“� ð6���D������¿���À��ËjJ��Ð���Ñ���ÿ������ð���0 ``€ �ðÐ���2 ð��� Ü�@ �� ð¨���…����‡����BÀ¨��CÀ¨��EÁ$���H•>lÿI`T��QÁ�����ƒ���¿���À��ËjJ��Ñ���ÿ���� � �ðÿ����À¨À¨`T�� \'����À¨À¨`T�� \'`T`T���`T������ ��\'��`T��`T����ð���ðp!˜�ðÐ���2 ð���!Ü�@ �� ð¨���…����‡����BÀ¨��CÀ¨��EÁ$���H•>lÿI`T��QÁ�����ƒ���¿���À��ËjJ��Ñ���ÿ���� � �ðÿ����À¨À¨`T�� \'����À¨À¨`T�� \'`T`T���`T������ ��\'��`T��`T����ð��� p!È�ðÐ���2 ð���"Ü�@ �� ð¨���…����‡����BÀ¨��CÀ¨��EÁ$���H•>lÿI`T��QÁ�����ƒ���¿���À��ËjJ��Ñ���ÿ���� � �ðÿ����À¨À¨`T�� \'����À¨À¨`T�� \'`T`T���`T������ ��\'��`T��`T����ð���P p!ø �ðH���� ð���Ü�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?��?�ð0�����ð������ Ü���ð������!Ü���ð������"Ü��ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ç�� ¬���ð¤��ð������à��ð<���ð(���� ð�������������������� ð����à�����ð~���� ð���à� ��s� ð*������������€�l+”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���à� ��s� ð*������������€�¸”¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���à�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��îÃ���ï������ ��������€���������ù���@��������ÿÿÿ� [���ðS��€ð������ä��ðë���ð(���� ð�������������������� ð����ä�����ð~���� ð���ä� ��s� ð*������������€� ”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���ä� ��s� ð*������������€�È”¿���ÿ��� ��ˆ������ð���œà�T�ð�����à �������”� ð �����ž�������ð§��¢ ð���ä�� ��ƒ� ð0���€�Ü”¿�����ƒ���¿���À��ÿ�������ð��� ððà� ðG����Ÿ��������¨‰���void f() { int* x; { int y = 0; x = &y; // x not dangling } // x dangling { int* z = NULL; *x = 123; ... } } ��¡ˆ���‰��������Z����������5����������������������������������&�������������������������������������ª���‰����������������ðH���� ð���ä�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ� ¦���ðž��pð������è��ð6���ð(���� ð�������������������� ð����è�����ð~���� ð���è� ��s� ð*������������€�ð”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðx���� ð���è� ��c� ð$�������€�¬”¿���ÿ��� ��ˆ������ð���°`��ð�����à �������”� ð �����ž�������ðH���� ð���è�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ� ¦���ðž��`ð������ì��ð6���ð(���� ð�������������������� ð����ì�����ð~���� ð���ì� ��s� ð*������������€�pጿ���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð���ì� ��c� ð$�������€�,⌿���ÿ��� ��ˆ������ð���ð€�`�ð�����à �������Œ� ð �����ž�������ðH���� ð���ì�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î/���ï������ ��������€���������ù���@��������ÿÿÿ� Ç���ð¿��Pð������ð��ðW���ð(���� ð�������������������� ð����ð�����ðX���� ð���ð�� ��ƒ� ð0���…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���@P�ð~���� ð���ð� ��s� ð*������������€�üˌ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ð~���� ð���ð� ��s� ð*������������€�¸ÌŒ¿���ÿ��� ��ˆ������ð���ð°Ð0 �ð�����à �������Œ� ð �����ž�������ðx���2� ð���ð�� ��³� ðB���…����‡����¿�����ƒ���¿ ��À��ÿ����?�������"ñ���¿�‚�‚��ð���À `P �ðŠ���2� ð���ð�� ��ã� ðT������€�…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���?�������"ñ���¿�‚�‚��ð���Ñm] a�ð~���2� ð���ð�� ��Ã� ðH���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?�������"ñ���¿�‚�‚��ð��� à Ð0�ðŠ���� ð���ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���ð � °  �ðŠ���� ð���ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���ð ° ` �ðŠ���� ð��� ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð��� P �@�ðŠ���� ð��� ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð��� �°@�ðŠ���� ð��� ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���   @À �ðŠ���� ð��� ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���  @ðÀ �ðŠ���� ð��� ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð��� Àp@ �ðÌ���¢ ð���ð�� ��ó� ðZ���€�Àӌ…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���0 ðJP � ð4�����Ÿ��������¨���10��¡��������������������ðŠ���� ð���ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���@ À`�ðÌ���¢ ð���ð�� ��ó� ðZ���€�¸×Œ…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���P @šp� ð4�����Ÿ��������¨���81��¡��������������������ðŠ���� ð���ð�� ��ã� ðT���…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���À Ðà �ðÌ���¢ ð���ð�� ��ó� ðZ���€�˜ÛŒ…����‡����¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���Ð Pªð � ð4�����Ÿ��������¨���11��¡��������������������ð„���B ð���ð�@ ��Ó� ðN���¿���D������¿���À��ËjJ��Ñ���ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���€ pÀ  �ð„���B ð���ð�@ ��Ó� ðN���¿���D������¿���À��ËjJ��Ñ���ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���€ €  Ð �ð„���B ð���ð�@ ��Ó� ðN���¿���D������¿���À��ËjJ��Ñ���ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���0 0 �ðÁ���¢ ð���ð�� ��Ó� ðN���€�Ì)r¿�����ƒ���¿ ��À��ËjJ��ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð��� `°@� ð5�����Ÿ��������¨���0��¡��������� ��2���������ð„���B ð���ð�@ ��Ó� ðN���¿���D������¿���À��ËjJ��Ñ���ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���0 ÐP 1 �ð„���B ð���ð�@ ��Ó� ðN���¿���D������¿���À��ËjJ��Ñ���ÿ����?���¿��ÿ������"ñ���¿�‚�‚��ð���° Àà à �ðH���� ð���ð�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î ���ï������ ��������€���������ù���@��������ç�� ¸���ð°��@ð������ô��ðH���ð(���� ð�������������������� ð����ô�����ð~���� ð���ô� ��s� ð*������������€�³Œ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðŠ���� ð���ô� ��“� ð6������������€�ø¿Œ¿���À��Ä����ÿ�� � ��ˆ������ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð���ô�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��0ð������ü��ð$���ð(���� ð�������������������� ð����ü�����ðr���� ð���ü� ��S� ð�������€�¨Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð���ü� ��S� ð�������€�|®Œ¿���ÿ��� ����ð���°Ð �ð�����à �������Œ� ð �����ž�������ðH���� ð���ü�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���âñİ’4�î���ï������ ��������€���������ù���@��������ÿÿÿ�  ���ð˜�� ð���������ð0���ð(���� ð�������������������� ð����������ðx���� ð����� ��c� ð$�������€�Œ Œ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð����� ��c� ð$�������€�H¡Œ¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð������ ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��ð��������ð$���ð(���� ð�������������������� ð���������ðr���� ð���� ��S� ð�������€�䚌¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð���� ��S� ð�������€� ›Œ¿���ÿ��� ����ð���ð°`��ð�����à �������Œ� ð �����ž�������ðH���� ð����� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���âñÄ0ÖjS�î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ���ð��������ð$���ð(���� ð�������������������� ð���������ðr���� ð���� ��S� ð�������€�T…Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð���� ��S� ð�������€�†Œ¿���ÿ��� ����ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð����� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���âñÄ虇�î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��ð�ð������ ��ð$���ð(���� ð�������������������� ð���� �����ðr���� ð��� � ��S� ð�������€�¬}Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð��� � ��S� ð�������€�h~Œ¿���ÿ��� ����ð���ð°0��ð�����à �������Œ� ð �����ž�������ðH���� ð��� �� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���ãñļ™!�î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜��à�ð������”��ð0���ð(���� ð�������������������� ð����”�����ðx���� ð���”� ��c� ð$�������€�ÔkŒ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð���”� ��c� ð$�������€�lŒ¿���ÿ��� ��ˆ������ð���ð°`��ð�����à �������Œ� ð �����ž�������ðH���� ð���”�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��Ð�ð������ ��ð$���ð(���� ð�������������������� ð���� �����ðr���� ð��� � ��S� ð�������€�´\Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð��� � ��S� ð�������€�p]Œ¿���ÿ��� ����ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð��� �� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���óñÄ`Ö¦Á�î���ï������ ��������€���������ù���@��������ç��  ���ð˜��À�ð������(��ð0���ð(���� ð�������������������� ð����(�����ðx���� ð���(� ��c� ð$�������€�ÄHŒ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð���(� ��c� ð$�������€�€IŒ¿���ÿ��� ��ˆ������ð���ð°0��ð�����à �������Œ� ð �����ž�������ðH���� ð���(�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��°�ð������˜��ð$���ð(���� ð�������������������� ð����˜�����ðr���� ð���˜� ��S� ð�������€�àBŒ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð���˜� ��S� ð�������€�œCŒ¿���ÿ��� ����ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð���˜�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���áñ݆Ӄ�îN���ï������ ��������€���������ù���P��������ÿÿÿ� ¦���ðž�� �ð��������ð6���ð(���� ð�������������������� ð���������ðr���� ð���� ��S� ð�������€�À,Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ð„���� ð���� ��S� ð�������€�¤9Œ¿���ÿ��� ����ð���ð°Ð��ð�����à �������Œ� ð�����ž��������¦ �����Ù�Õ!�ðH���� ð����� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���óñÄP©_P�î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜���ð������œ��ð0���ð(���� ð�������������������� ð����œ�����ðx���� ð���œ� ��c� ð$�������€�\'Œ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð���œ� ��c� ð$�������€�(Œ¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð���œ�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���P��������ÿÿÿ�  ���ð˜��€�ð������ ��ð0���ð(���� ð�������������������� ð���� �����ðx���� ð��� � ��c� ð$�������€�Œ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðx���� ð��� � ��c� ð$�������€�ÀŒ¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð��� �� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î���ï������ ��������€���������ù���@��������ÿÿÿ� ®���ð¦��p�ð������8��ð>���ð(���� ð�������������������� ð����8�����ðx���� ð���8� ��c� ð$�������€� Œ¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ð†���� ð���8� ��c� ð$�������€�ŒŒ¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������Œ� ð�����ž��������¦������ �ðH���� ð���8�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ðØ���ñ������� 0� ˜���ð��P�ð������x��ð(���ð(���� ð�������������������� ð����x�����ð^���� ð���x� ��S� ð�����������¿��ÿ��0����ð���·æRH �ð�����à ������� �s�ðŠ���� ð���x� ��c� ð$������������€�µs¿��ÿ��0����ð���Ú Lì!�ð�����à ������ �s� ð�����Ÿ��������ª ������������ðH���� ð���x�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ðä���ñ������ 0� ¤���ðœ��ð������X��ð4���ð(���� ð�������������������� ð����X�����ðd���� ð���X� ��c� ð$�����������¿��ÿ��0��ˆ������ð���·æRH �ð�����à ������� �{�ð���� ð���X� ��s� ð*������������€� 7{¿��ÿ��0��ˆ������ð���Ú Lì!�ð�����à ������ �{� ð�����Ÿ��������ª ������������ðH���� ð���X�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ðä���ñ��� ��� 0� ¤���ðœ��0ð������€��ð4���ð(���� ð�������������������� ð����€�����ðd���� ð���€� ��c� ð$�����������¿��ÿ��0��ˆ������ð���·æRH �ð�����à ������� �{�ð���� ð���€� ��s� ð*������������€�ì {¿��ÿ��0��ˆ������ð���Ú Lì!�ð�����à ������ �{� ð�����Ÿ��������ª ������������ðH���� ð���€�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ðF���ñ������ 0� ���ðþ��Pð������¨��ð–���ð(���� ð�������������������� ð����¨�����ðd���� ð���¨� ��c� ð$�����������¿��ÿ��0��ˆ������ð���·æRH �ð�����à ������� �˜�ðò���� ð���¨� ��3 ðr������������€�¬Ö˜�²e�‚�Ù²��ƒ�²e�„�Ù²��…�����†�����‡�����ˆ�����‰�����Š�����‹�����¿���¿���ÿ���0��ˆ������ð���Ú Lì!�ð�����à ������ �˜� ð8�����Ÿ��������¨$���EXAMPLE OF SUBTYPING AS BACKUP SLIDE�ðH���� ð���¨�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ð,���ñ������ 0� ì���ðä��`ð������Ä��ð|���ð(���� ð�������������������� ð����Ä�����ðd���� ð���Ä� ��c� ð$�����������¿��ÿ��0��ˆ������ð���·æRH �ð�����à ������� �˜�ðØ���� ð���Ä� ��3 ðr������������€�¼ô˜�²e�‚�Ù²��ƒ�²e�„�Ù²��…�����†�����‡�����ˆ�����‰�����Š�����‹�����¿���¿��ÿ��0��ˆ������ð���Ú Lì!�ð�����à ������ �˜� ð�����Ÿ��������ª ������������ðH���� ð���Ä�� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ðä���ñ���'��� 0� ¤���ðœ�� ð��������ð4���ð(���� ð�������������������� ð���������ðd���� ð���� ��c� ð$�����������¿��ÿ��0��ˆ������ð���·æRH �ð�����à ������� �{�ð���� ð���� ��s� ð*������������€�Ì<{¿��ÿ��0��ˆ������ð���Ú Lì!�ð�����à ������ �{� ð�����Ÿ��������ª ������������ðH���� ð����� ��ƒ� ð0������ƒ��“’ßj�”BÁ�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²���rø����P����� ›��֊��¦”��‘§��^��„y�–��¢��Â� �¡©��¿«��Å��d{�Ç��ï±��ÿ³��¶��¸��Eº��BÒ��öí��ð��Hh�P}�¬n�ò��&ô��· �3 �w�Ø�Ðñ%�D,�p.�Œ0�¶A�ÒC�G�³I�ÉK��[�(]�l_�|a�Àc�Fs�Vu�<�Ё�f�Ï­��߯��Xj�ðp�¾ƒ�œl�á#�»�q�fw���õ�����í�����ª…����ô����C��èF‹���é(���€��à��8��Ø����� ������–���������òú��/�È ���0�Ò�������Õ0����·D���T�i�m�e�s� �N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��·D���A�r�i�a�l���N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�" �·D���C�o�u�r�i�e�r� �N�e�w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������.������Times New Roman����Arial� ���Courier New� ���Wingdings����dan_design_template�5���Cyclone: A Memory-Safe C-Level Programming Language ����A safe C-level language����Caller’s problem?����Safe low-level systems����Some insufficient approaches����Cyclone in brief����The plan from here����Status� ���Evaluation����Code differences����Run-time performance����Larger program: the compiler����Other projects����The plan from here����Not-null pointers����Example����A classic moral� ���Key Design Principles in Action����It’s always aliasing����It’s always aliasing����The plan from here����“Change void* to `a”����Not much new here����Existential types����Regions����Cyclone regions [PLDI 02]����That’s the easy part����The big restriction����Region polymorphism����Type definitions����Region subtyping����Regions evaluation����The plan from here����Other safety holes����And modern conveniences����Plenty of work remains����Related work: making C safer����Related Work: Checking C code����Related work: higher and lower����Summary� ���Availability� �������� ���Fonts Used�������������Design Template���������� ���Slide Titles����)�����sign Template����������ö$������_À‘ãÜÈ� �ô�yDan Grossman���D�a�n� �G�r�o�s�s�m�a�n�$������_À‘ãļ� �ô�Ñ�Dan Grossman���D�a�n� �G�r�o�s�s�m�a�n� Memory���� ���� � �� �#��#�������.������������ Ì�f����������.��������� ���2 ×����-�����.������������ Ì�f����������.������������2 ×�w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�10�·D���W�i�n�g�d�i�n�g�s���w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��¤ ���€�`���ÿÿÿÿ��¥ ������.�������© ������� ��@�£n����ÿý?���" ��d�������d���������@�������ÿÿï�����ÿÿÿÿÿÿ���������  �������@@�������``�������€€�����  ����ðü����ð€��@���~��6�������/������������� ������ �������������/����������������������������������������������������������������������������������������������������������������������7�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Z�������M������������������������������������������������������������������������������������������)�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@�������“����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2������������������������������������������������������������������†��������������8�������0�������c��������������������� ������� ���������������������������� ������� �������������� ������� ���������������������������������������������������������������/�������/��������������2������� ������������������������������������������ ����������������0�������������/��������������������,������+������*������)������(���$���3������'���)���&������%������������������� ������ ���������������:���4������������"������$�������������������������3�������������������������������������������#���������������������������������������!������������������������������������.������2������-������ ������ ������������� ������������ ������������������ƒ� ð0�����ƒ���†A����¿��À��ÅA����ÿ����p�ñ���ÿ3���™���Ìf�Ì�f�ÿ™ÿ�ÿf™�ÿ™��@�ñ���������÷���ð8�����ó���������������€������ó���������������€�����ÐÑ�����������ððn�ʚ;­”Ç�ʚ;���úg�����þ�������ý4���X���d���X���d���ì 0�������¨Õ���������”ÿÿÿ¦ÿÿÿ���p�û�������p��p�û������@ ���<�����ý4���!���d���!���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���d���d���d���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���B���d���B���d���® 0dÙ�����ˆªÑ���������������������ÿ����� ���������������ˆN���Š0�����º���_�_�_�P�P�T�1�0���‹����� ����À���À���Š����º���_�_�_�P�P�T�9���‹ð����®è����¯����������¬`�����������������€ÿÿ�����������������������€ÿÿ�����������������������€ÿÿ����������������������¯����������¬X�����������������������������€ÿÿ����������������������������������������������������������?�Ùd�����Ú�����-���º���1�1� �J�a�n�u�a�r�y� �2�0�0�5� �º*���D�a�n� �G�r�o�s�s�m�a�n�:� �C�y�c�l�o�n�e�O�Ù �����Ú�����=��ð{����ó����������������������Ÿ��������¨4���Cyclone: A Memory-Safe C-Level Programming Language ��¡"���5���������3������ �Ì�fþ��������Ÿ��������¨¬���Dan Grossman University of Washington Joint work with: Trevor Jim AT&T Research Greg Morrisett Harvard University Michael Hicks University of Maryland��¡:���'���������†������(������&�������Ì�fþ�������†���������ó���Â������������������Ÿ���������¨���A safe C-level language�Ÿ��������¨ �� Cyclone is a programming language and compiler aimed at safe systems programming C is not memory safe: void f(int* p, int i, int v) { p[i] = v; } Address p+i might hold important data or code Memory safety is crucial for reasoning about programs ��¡Š��S�������������������9�������������������h���������:�����������������ÿ3�þ�����������������ÿ3�þ������ � ������� �������������������� ��������������™�þ�������������™�þ�������������™�þ�������������™�þ����������� � �������������$������������� �6����������������ó���Ã������������������Ÿ��������� "���C�a�l�l�e�r� s� �p�r�o�b�l�e�m�?���ª�������������������Ÿ��������¨Ã��� void g(void**, void*); int y = 0; int *z = &y; g(&z,0xBAD); *z = 123; Might be safe, but not if g does *x=y Type of g enough for code generation Type of g not enough for safety checking��¡$��N����� ������v������ ���������������������™�þ���������������������������������™�þ �����������������™�þ!�����������������������������������������������������%��������������������������������������ª>��� ������� ��������s���������������&��������������� ���������ó���ë����������'��������Ÿ���������¨���Safe low-level systems�Ÿ��������¨8��For a safety guarantee today, use YFHLL Your Favorite High Level Language YFHLL provides safety in part via: hidden data fields and run-time checks automatic memory management Data representation and resource management are essential aspects of low-level systems There are strong reasons for C-like languages��¡Œ��(���������#����������#���������D����$�������Y���������.����������(��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������#��������������ÿ3�þ!������� �������ÿ3�þ��������������0������� �������ÿ3�þ���������������������-�����������������ó���ì����������(��������Ÿ���������¨���Some insufficient approaches�Ÿ�������� ®��C�o�m�p�i�l�e� �C� �w�i�t�h� �e�x�t�r�a� �i�n�f�o�r�m�a�t�i�o�n� �t�y�p�e� �f�i�e�l�d�s�,� �s�i�z�e� �f�i�e�l�d�s�,� �l�i�v�e�-�p�o�i�n�t�e�r� �t�a�b�l�e�,� �& �t�r�e�a�t�s� �C� �a�s� �a� �h�i�g�h�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e� � �U�s�e� �s�t�a�t�i�c� �a�n�a�l�y�s�i�s� �v�e�r�y� �d�i�f�f�i�c�u�l�t� �l�e�s�s� �m�o�d�u�l�a�r� � �B�a�n� �u�n�s�a�f�e� �f�e�a�t�u�r�e�s� �t�h�e�r�e� �a�r�e� �m�a�n�y� �y�o�u� �n�e�e�d� �t�h�e�m���¡–���!���������U������������������������������������������!�������T������������� ��������������������� ������������ �� ���ó���Ç������������������Ÿ���������¨���Cyclone in brief�Ÿ�������� *��A� �s�a�f�e�,� �c�o�n�v�e�n�i�e�n�t�,� �a�n�d� �m�o�d�e�r�n� �l�a�n�g�u�a�g�e� � �a�t� �t�h�e� �C� �l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� �S�a�f�e�:� �m�e�m�o�r�y� �s�a�f�e�t�y�,� �a�b�s�t�r�a�c�t� �t�y�p�e�s�,� �n�o� �c�o�r�e� �d�u�m�p�s� � �C�-�l�e�v�e�l�:� �u�s�e�r�-�c�o�n�t�r�o�l�l�e�d� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �a�n�d� �r�e�s�o�u�r�c�e� �m�a�n�a�g�e�m�e�n�t�,� �e�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y�,� � m�a�n�i�f�e�s�t� �c�o�s�t� � �C�o�n�v�e�n�i�e�n�t�:� �m�a�y� �n�e�e�d� �m�o�r�e� �t�y�p�e� �a�n�n�o�t�a�t�i�o�n�s�,� �b�u�t� �w�o�r�k� �h�a�r�d� �t�o� �a�v�o�i�d� �i�t� � �M�o�d�e�r�n�:� �a�d�d� �f�e�a�t�u�r�e�s� �t�o� �c�a�p�t�u�r�e� �c�o�m�m�o�n� �i�d�i�o�m�s� � � N�e�w� �c�o�d�e� �f�o�r� �l�e�g�a�c�y� �o�r� �i�n�h�e�r�e�n�t�l�y� �l�o�w�-�l�e�v�e�l� �s�y�s�t�e�m�s� ���¡ô���G����������Z��������Z�6����������Z���������Z�F�������ÿ��þ�������ÿ��þ����������.������������� �����������e������������� � ����������;������������� �����������'��������������6����������������ó���È������������������Ÿ���������¨���The plan from here�Ÿ�������� ê��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �B�e�n�c�h�m�a�r�k�s�,� �p�o�r�t�s�,� �s�y�s�t�e�m�s�,� �c�o�m�p�i�l�e�r�,� �& �A�l�l� �o�n� �E�a�r�t�h� �s�o� �f�a�r� �Jð �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� � �R�e�a�l�l�y� � j�u�s�t� �a� �t�a�s�t�e� �o�f� �C�y�c�l�o�n�e���¡Â�����������Z�>�������Z�)��������Z�(�������Z�-��������Z�"����������Z��������<������������‚����������������������� ��������(�������-�������"����������ó���É������������������Ÿ���������¨���Status�Ÿ�������� ®�� �C�y�c�l�o�n�e� �r�e�a�l�l�y� �e�x�i�s�t�s� �(�e�x�c�e�p�t� �m�e�m�o�r�y�-�s�a�f�e� �t�h�r�e�a�d�s�)� � �>�1�5�0�K� �l�i�n�e�s� �o�f� �C�y�c�l�o�n�e� �c�o�d�e�,� �i�n�c�l�u�d�i�n�g� �t�h�e� �c�o�m�p�i�l�e�r� � �g�c�c� �b�a�c�k�-�e�n�d� �(�L�i�n�u�x�,� �C�y�g�w�i�n�,� �O�S�X�,� �M�i�n�d�s�t�o�r�m�,� �& )� � �U�s�e�r� s� �m�a�n�u�a�l�,� �m�a�i�l�i�n�g� �l�i�s�t�s�,� �& � �S�t�i�l�l� �a� �r�e�s�e�a�r�c�h� �v�e�h�i�c�l�e� � � ���¡À���4������������������¢������������������������3��������������4������������� �0������������� � ������������� �������������� �����������������ª���Œ������� �������?���������ó���Ê������������������Ÿ���������¨ ���Evaluation�Ÿ��������¨æ��� Is Cyclone like C? port code, measure source differences interface with C code (extend systems) What is the performance cost? port code, measure slowdown Is Cyclone good for low-level systems? write systems, ensure scalability ��¡Ê������������������’����" ��N�������������’����" ����������'�����’����" ��"�������������������������������N����������� �� ��������'�������"�����������������ó���Ë��������� ��������Ÿ���������¨���Code differences�Ÿ��������¨‹���Porting not automatic, but quite similar Many changes identify arrays and lengths Some changes incidental (absent prototypes, new keywords)��¡���Œ���������Œ���������ó���Ì��������� ��������Ÿ���������¨���Run-time performance�Ÿ��������¨Ð���RHLinux 7.1 (2.4.9), 1.0GHz PIII, 512MRAM, gcc2.96 -O3, glibc 2.2.4 Comparable to other safe languages to start C level provides important optimization opportunities Understanding the applications could help��¡L���E����������Œ���������D��������������,�������6����������*���������ó���Í���������� ��������Ÿ���������¨���Larger������������������������ ��� ��� ��� ��� ��������������������������������������������������������� ���!���"���#���$���%���&���'���(���)���*���+���,���-���.���/���0���1���2���3���4���5���6���7���8���9���:���;���<���=���>���?���@���A���B���C���D���E���F���G���H���I���J���K���L���M���N���O���P���Q���R���S���T���U���V���W���X���Y���Z���[���\���]���^���_���`���a���b���c���d���e���f���g���h���i���j���k���l���m���n���o���p���q���r���s���t���u���v���w���x���y���z���{���|���}���~������€������‚���ƒ���„���…���†���‡���ˆ���‰���Š���‹���Œ������Ž���������‘���’���“���”���•���–���—���˜���™���š���›���œ������ž���Ÿ��� ���¡���¢���£���¤���¥���¦���§���¨���©���ª���«���¬���­���®���¯���°���±���²���³���´���µ���¶���·���¸���¹���º���»���¼���½���¾���¿���À���Á���Â���Ã���à���Å���Æ���þÿÿÿÈ���É���Ê���Ë���Ì���Í���Î���Ï���Ð���Ñ���Ò���Ó���Ô���Õ���Ö���×���Ø���Ù���Ú���Û���=��ýÿÿÿýÿÿÿß���þÿÿÿá���â���ã���ä���å���æ���ç���è���é���ê���ë���ì���í���î���ï���ð���ñ���ò���ó���ô���õ���ö���÷���ø���ù���ú���û���ü���ý���þ���ÿ�����R�o�o�t� �E�n�t�r�y����������������������������������������������ÿÿÿÿÿÿÿÿ���d›Oφê�ª�¹)è������������ ÖÛìÑøÄ6��@������C�u�r�r�e�n�t� �U�s�e�r�������������������������������������������ÿÿÿÿÿÿÿÿÿÿÿÿ������������������������������������K���D��������S�u�m�m�a�r�y�I�n�f�o�r�m�a�t�i�o�n���������������������������(����ÿÿÿÿÿÿÿÿ����������������������������������������Œ ������P�o�w�e�r�P�o�i�n�t� �D�o�c�u�m�e�n�t���������������������������(�������ÿÿÿÿ�����������������������������������������É������D�o�c�u�m�e�n�t�S�u�m�m�a�r�y�I�n�f�o�r�m�a�t�i�o�n�����������8�ÿÿÿÿÿÿÿÿÿÿÿÿ������������������������������������3���è��������������������������������������������������������������������������ÿÿÿÿÿÿÿÿÿÿÿÿ��������������������������������������������������������������������������������������������������������������������ÿÿÿÿÿÿÿÿÿÿÿÿ��������������������������������������������������������������������������������������������������������������������ÿÿÿÿÿÿÿÿÿÿÿÿ��������������������������������������������������´Õ�Wo 0�10�·D���W�i�n�g�d�i�n�g�s���w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��¤ ���€�`���ÿÿÿÿ��¥ ������.�������© ������� ��@�£n����ÿý?���" ��d�������d���������@�������ÿÿï�����ÿÿÿÿÿÿ���������  �������@@�������``�������€€�����  ����ðü����ð€��@���~��6�������/������������� ������ �������������/����������������������������������������������������������������������������������������������������������������������7�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Z�������M������������������������������������������������������������������������������������������)�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@�������“����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2������������������������������������������������������������������†��������������8�������0�������c��������������������� ������� ���������������������������� ������� �������������� ������� ���������������������������������������������������������������/�������/��������������2������� ������������������������������������������ ����������������0�������������/��������������������,������+������*������)������(���$���3������'���)���&������%������������������� ������ ���������������:���4������������"������$�������������������������3�������������������������������������������#���������������������������������������!������������������������������������.������2������-������ ������ ������������� ������������ ������������������ƒ� ð0�����ƒ���†A����¿��À��ÅA����ÿ����p�ñ���ÿ3���™���Ìf�Ì�f�ÿ™ÿ�ÿf™�ÿ™��@�ñ���������÷���ð8�����ó���������������€������ó���������������€�����ÐÑ�����������ððn�ʚ;­”Ç�ʚ;���úg�����þ�������ý4���X���d���X���d���ì 0�������¨Õ���������”ÿÿÿ¦ÿÿÿ���p�û�������p��p�û������@ ���<�����ý4���!���d���!���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���d���d���d���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���B���d���B���d���® 0dÙ�����ˆªÑ���������������������ÿ����� ���������������ˆN���Š0�����º���_�_�_�P�P�T�1�0���‹����� ����À���À���Š����º���_�_�_�P�P�T�9���‹ð����®è����¯����������¬`�����������������€ÿÿ�����������������������€ÿÿ�����������������������€ÿÿ����������������������¯����������¬X�����������������������������€ÿÿ����������������������������������������������������������?�Ùd�����Ú�����-���º���1�1� �J�a�n�u�a�r�y� �2�0�0�5� �º*���D�a�n� �G�r�o�s�s�m�a�n�:� �C�y�c�l�o�n�e�O�Ù �����Ú�����=��ðW{����ó����������������������Ÿ��������¨4���Cyclone: A Memory-Safe C-Level Programming Language ��¡"���5���������3������ �Ì�fþ��������Ÿ��������¨¬���Dan Grossman University of Washington Joint work with: Trevor Jim AT&T Research Greg Morrisett Harvard University Michael Hicks University of Maryland��¡:���'���������†������(������&�������Ì�fþ�������†���������ó���Â������������������Ÿ���������¨���A safe C-level language�Ÿ��������¨ �� Cyclone is a programming language and compiler aimed at safe systems programming C is not memory safe: void f(int* p, int i, int v) { p[i] = v; } Address p+i might hold important data or code Memory safety is crucial for reasoning about programs ��¡Š��S�������������������9�������������������h���������:�����������������ÿ3�þ�����������������ÿ3�þ������ � ������� �������������������� ��������������™�þ�������������™�þ�������������™�þ�������������™�þ����������� � �������������$������������� �6����������������ó���Ã������������������Ÿ��������� "���C�a�l�l�e�r� s� �p�r�o�b�l�e�m�?���ª�������������������Ÿ��������¨Ã��� void g(void**, void*); int y = 0; int *z = &y; g(&z,0xBAD); *z = 123; Might be safe, but not if g does *x=y Type of g enough for code generation Type of g not enough for safety checking��¡$��N����� ������v������ ���������������������™�þ���������������������������������™�þ �����������������™�þ!�����������������������������������������������������%��������������������������������������ª>��� ������� ��������s���������������&��������������� ���������ó���ë����������'��������Ÿ���������¨���Safe low-level systems�Ÿ��������¨8��For a safety guarantee today, use YFHLL Your Favorite High Level Language YFHLL provides safety in part via: hidden data fields and run-time checks automatic memory management Data representation and resource management are essential aspects of low-level systems There are strong reasons for C-like languages��¡Œ��(���������#����������#���������D����$�������Y���������.����������(��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������#��������������ÿ3�þ!������� �������ÿ3�þ��������������0������� �������ÿ3�þ���������������������-�����������������ó���ì����������(��������Ÿ���������¨���Some insufficient approaches�Ÿ�������� ®��C�o�m�p�i�l�e� �C� �w�i�t�h� �e�x�t�r�a� �i�n�f�o�r�m�a�t�i�o�n� �t�y�p�e� �f�i�e�l�d�s�,� �s�i�z�e� �f�i�e�l�d�s�,� �l�i�v�e�-�p�o�i�n�t�e�r� �t�a�b�l�e�,� �& �t�r�e�a�t�s� �C� �a�s� �a� �h�i�g�h�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e� � �U�s�e� �s�t�a�t�i�c� �a�n�a�l�y�s�i�s� �v�e�r�y� �d�i�f�f�i�c�u�l�t� �l�e�s�s� �m�o�d�u�l�a�r� � �B�a�n� �u�n�s�a�f�e� �f�e�a�t�u�r�e�s� �t�h�e�r�e� �a�r�e� �m�a�n�y� �y�o�u� �n�e�e�d� �t�h�e�m���¡–���!���������U������������������������������������������!�������T������������� ��������������������� ������������ �� ���ó���Ç������������������Ÿ���������¨���Cyclone in brief�Ÿ�������� *��A� �s�a�f�e�,� �c�o�n�v�e�n�i�e�n�t�,� �a�n�d� �m�o�d�e�r�n� �l�a�n�g�u�a�g�e� � �a�t� �t�h�e� �C� �l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� �S�a�f�e�:� �m�e�m�o�r�y� �s�a�f�e�t�y�,� �a�b�s�t�r�a�c�t� �t�y�p�e�s�,� �n�o� �c�o�r�e� �d�u�m�p�s� � �C�-�l�e�v�e�l�:� �u�s�e�r�-�c�o�n�t�r�o�l�l�e�d� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �a�n�d� �r�e�s�o�u�r�c�e� �m�a�n�a�g�e�m�e�n�t�,� �e�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y�,� � m�a�n�i�f�e�s�t� �c�o�s�t� � �C�o�n�v�e�n�i�e�n�t�:� �m�a�y� �n�e�e�d� �m�o�r�e� �t�y�p�e� �a�n�n�o�t�a�t�i�o�n�s�,� �b�u�t� �w�o�r�k� �h�a�r�d� �t�o� �a�v�o�i�d� �i�t� � �M�o�d�e�r�n�:� �a�d�d� �f�e�a�t�u�r�e�s� �t�o� �c�a�p�t�u�r�e� �c�o�m�m�o�n� �i�d�i�o�m�s� � � N�e�w� �c�o�d�e� �f�o�r� �l�e�g�a�c�y� �o�r� �i�n�h�e�r�e�n�t�l�y� �l�o�w�-�l�e�v�e�l� �s�y�s�t�e�m�s� ���¡ô���G����������Z��������Z�6����������Z���������Z�F�������ÿ��þ�������ÿ��þ����������.������������� �����������e������������� � ����������;������������� �����������'��������������6����������������ó���È������������������Ÿ���������¨���The plan from here�Ÿ�������� ê��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �B�e�n�c�h�m�a�r�k�s�,� �p�o�r�t�s�,� �s�y�s�t�e�m�s�,� �c�o�m�p�i�l�e�r�,� �& �A�l�l� �o�n� �E�a�r�t�h� �s�o� �f�a�r� �Jð �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� � �R�e�a�l�l�y� � j�u�s�t� �a� �t�a�s�t�e� �o�f� �C�y�c�l�o�n�e���¡Â�����������Z�>�������Z�)��������Z�(�������Z�-��������Z�"����������Z��������<������������‚����������������������� ��������(�������-�������"����������ó���É������������������Ÿ���������¨���Status�Ÿ�������� ®�� �C�y�c�l�o�n�e� �r�e�a�l�l�y� �e�x�i�s�t�s� �(�e�x�c�e�p�t� �m�e�m�o�r�y�-�s�a�f�e� �t�h�r�e�a�d�s�)� � �>�1�5�0�K� �l�i�n�e�s� �o�f� �C�y�c�l�o�n�e� �c�o�d�e�,� �i�n�c�l�u�d�i�n�g� �t�h�e� �c�o�m�p�i�l�e�r� � �g�c�c� �b�a�c�k�-�e�n�d� �(�L�i�n�u�x�,� �C�y�g�w�i�n�,� �O�S�X�,� �M�i�n�d�s�t�o�r�m�,� �& )� � �U�s�e�r� s� �m�a�n�u�a�l�,� �m�a�i�l�i�n�g� �l�i�s�t�s�,� �& � �S�t�i�l�l� �a� �r�e�s�e�a�r�c�h� �v�e�h�i�c�l�e� � � ���¡À���4������������������¢������������������������3��������������4������������� �0������������� � ������������� �������������� �����������������ª���Œ������� �������?���������ó���Ê������������������Ÿ���������¨ ���Evaluation�Ÿ��������¨æ��� Is Cyclone like C? port code, measure source differences interface with C code (extend systems) What is the performance cost? port code, measure slowdown Is Cyclone good for low-level systems? write systems, ensure scalability ��¡Ê������������������’����" ��N�������������’����" ����������'�����’����" ��"�������������������������������N����������� �� ��������'�������"�����������������ó���Ë��������� ��������Ÿ���������¨���Code differences�Ÿ��������¨‹���Porting not automatic, but quite similar Many changes identify arrays and lengths Some changes incidental (absent prototypes, new keywords)��¡���Œ���������Œ���������ó���Ì��������� ��������Ÿ���������¨���Run-time performance�Ÿ��������¨Ð���RHLinux 7.1 (2.4.9), 1.0GHz PIII, 512MRAM, gcc2.96 -O3, glibc 2.2.4 Comparable to other safe languages to start C level provides important optimization opportunities Understanding the applications could help��¡L���E����������Œ���������D��������������,�������6����������*���������ó���Í���������� ��������Ÿ���������¨���Larger program: the compiler�Ÿ��������¨Ö��� Scalable compiler + libraries (80K lines) build in < 30secs Generic libraries (e.g., lists, hashtables) clients have no syntactic/performance cost Static safety helps exploit the C-level I use &x more than in C ��¡¼��� ���������4��������,���������,��������(����������������� �������3������������� �,�������+������������� �(����������� �� ���� � ������ �� ����� �� ���ó���Î���������� ��������Ÿ���������¨���Other projects�Ÿ��������¨o��Open Kernel Environment [Bos/Samwel, OPENARCH 02] MediaNet [Hicks et al, OPENARCH 03]: RBClick [Patel/Lepreau, OPENARCH 03] STP [Patel et al., SOSP 03] FPGA synthesis [Teifel/Manohar, ISACS 04] Maryland undergrad O/S course (geekOS) [2004] Windows device driver (6K lines) Only 100 lines left in C But unrecoverable failures & other kernel corruptions remain ��¡���������P�W�������P���������P��������������������� � ��������������������������� ��������������������� ��������������������� ��������������������� �'�������������������� �!����������W����������������ªt���������� �������������������������������������������������=��������������,��������������ƒ���������ó���Ò������������������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡z���A��������–�(�������–�-��������–�����������–�������������������������(�������-�������������������ó���Ó�����������������Ÿ���������¨���Not-null pointers�Ÿ��������ª �������������ó���Ô�����������������Ÿ���������¨���Example�Ÿ�������� ê��F�I�L�E�*� �f�o�p�e�n�(�c�o�n�s�t� �c�h�a�r�@�,� �c�o�n�s�t� �c�h�a�r�@�)�;� �i�n�t� �f�g�e�t�c�(�F�I�L�E�@�)�;� �i�n�t� �f�c�l�o�s�e�(�F�I�L�E�@�)�;� �v�o�i�d� �g�(�)� �{� � � �F�I�L�E�*� �f� �=� �f�o�p�e�n�(� f�o�o� ,� � r� )�;� � � �i�n�t� �c�;� � � �w�h�i�l�e�(�(�c� �=� �f�g�e�t�c�(�f�)�)� �!�=� �E�O�F�)� �{�& }� � � �f�c�l�o�s�e�(�f�)�;� �}� � �G�i�v�e�s� �w�a�r�n�i�n�g� �a�n�d� �i�n�s�e�r�t�s� �o�n�e� �n�u�l�l�-�c�h�e�c�k� �E�n�c�o�u�r�a�g�e�s� �a� �h�o�i�s�t�e�d� �c�h�e�c�k���¡Ü���±���������Z�E��������Z������������������™�þ �����������������™�þ �����������������™�þ�����������������™�þ �����������������™�þQ���������������D���������ª†���������� ������� ��������������� ���������������������� �������������� ��������������� �����������������������a���������ó���Õ�����������������Ÿ���������¨���A classic moral�Ÿ��������¨L���FILE* fopen(const char@, const char@); int fgetc(FILE@); int fclose(FILE@); ��¡„���M���������������������������™�þ �����������������™�þ �����������������™�þ �������������� ���ª,���1��������������� ������������������������ó���Ö����������!��������Ÿ���������¨���Key Design Principles in Action�Ÿ��������¨K��Types to express invariants Preconditions for arguments Properties of values in memory Flow analysis where helpful Lets users control explicit checks Soundness + aliasing limits usefulness Users control data representation Pointers are addresses unless user allows otherwise Often can interoperate with C more safely just via types��¡°�����������Z�;�������Z���������Z�J�������Z�"��������Z�4�������Z�9��������Z��������;��������������#�������'�����"�������4�������9���������ª$�����������R���������������ñ���������ó���ò���������.��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ó���������/��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ñ����������-��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�*�����������������(�������-�������������������ó���Ø�����������������Ÿ��������� (��� C�h�a�n�g�e� �v�o�i�d�*� �t�o� �`�a� ��¡:������������������������������������������������Ÿ��������¨•���struct Lst { void* hd; struct Lst* tl; }; struct Lst* map( void* f(void*), struct Lst*); struct Lst* append( struct Lst*, struct Lst*);��¡\���–����� ������;�����������������™�þ1�����������������™�þ!����������ó���Ù������������������Ÿ���������¨���Not much new here�Ÿ��������¨��Closer to C than C++, Java generics, ML, etc. Unlike funcýÿÿÿ�������������� �� �� �� �� �������������������������������������� ��!��"��#��$��%��&��'��(��)��*��+��,��-��.��/��0��1��2��3��4��Ç���þÿÿÿ7��8��9��:��;��<��Ä���>��?��@��A��B��C��D��E��F��G��H��I��J��K��L��M��N��O��P��Q��R��S��T��U��V��W��X��Y��Z��[��\��]��^��_��`��a��b��c��d��e��f��g��h��i��j��k��l��m��n��o��p��q��r��s��t��u��v��w��x��y��z��{��|��}��~��€��ýÿÿÿtional languages, data representation may restrict `a to pointers, int why not structs? why not float? why int? Unlike templates, no code duplication or leaking implementations Unlike objects, no need to tag data��¡Ú���/����������S���������)�����������������f���������/�����"���N����"�������c���������"��������"�������c���������"�������c���������"�������� "�� ��f����"������ª���¦��������������i���������ó���Ú������������������Ÿ���������¨���Existential types�Ÿ�������� ��P�r�o�g�r�a�m�s� �n�e�e�d� �a� �w�a�y� �f�o�r� � c�a�l�l�-�b�a�c�k� �t�y�p�e�s�:� � � � � � �s�t�r�u�c�t� �T� �{� � � � � � �v�o�i�d� �(�*�f�)�(�v�o�i�d�*�,� �i�n�t�)�;� � � � � � �v�o�i�d�*� �e�n�v�;� � � �}�;� � �W�e� �u�s�e� �a�n� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e� �(�s�i�m�p�l�i�f�i�e�d�)�:� � � � � � � �s�t�r�u�c�t� �T� �{� �<�`�a�>� � � � � � �v�o�i�d� �(�@�f�)�(�`�a�,� �i�n�t�)�;� � � � � � �`�a� �e�n�v�;� � � �}�;� � �m�o�r�e� �C�-�l�e�v�e�l� �t�h�a�n� �b�a�k�e�d�-�i�n� �c�l�o�s�u�r�e�s�/�o�b�j�e�c�t�s� ���¡Œ��+��������Z�A����0����Z�����������Z�*��������Z�A����0����Z���,����8�����Z�����������Z�+�������������>�����������������������"���������� ������������ÿ��þ���g�����ÿ��þ���G����ÿ��þ���������g�����ÿ3�þ ���������g�����ÿ3�þ ������������,��� � �������"�����ó���Û�����������������Ÿ���������¨���Regions�Ÿ��������  ��a�.�k�.�a�.� �z�o�n�e�s�,� �a�r�e�n�a�s�,� �& � �E�v�e�r�y� �o�b�j�e�c�t� �i�s� �i�n� �e�x�a�c�t�l�y� �o�n�e� �r�e�g�i�o�n� � �A�l�l�o�c�a�t�i�o�n� �v�i�a� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �D�e�a�l�l�o�c�a�t�e� �a�n� �e�n�t�i�r�e� �r�e�g�i�o�n� � �s�i�m�u�l�t�a�n�e�o�u�s�l�y� � � �(�c�a�n�n�o�t� �f�r�e�e� �a�n� �o�b�j�e�c�t�)� � �O�l�d� �i�d�e�a� �w�i�t�h� �r�e�c�e�n�t� �s�u�p�p�o�r�t� �i�n� �l�a�n�g�u�a�g�e�s� �(�e�.�g�.�,� �R�C�,� �R�T�S�J�)� � �a�n�d� �i�m�p�l�e�m�e�n�t�a�t�i�o�n�s� �(�e�.�g�.�,� �M�L� �K�i�t�)���¡²���|��������Z�*���������Z���������Z�_����������Z���������������&����������������������������7��������������� ��������������_������������ª>���`�������F�����������������������.������� ��������%���������ó���Ü������������������Ÿ���������¨���Cyclone regions [PLDI 02]��¡������������������� ��������Ÿ�������� œ��h�e�a�p� �r�e�g�i�o�n�:� �o�n�e�,� �l�i�v�e�s� �f�o�r�e�v�e�r�,� �c�o�n�s�e�r�v�a�t�i�v�e�l�y� �G�C� d� �s�t�a�c�k� �r�e�g�i�o�n�s�:� �c�o�r�r�e�s�p�o�n�d� �t�o� �l�o�c�a�l�-�d�e�c�l�a�r�a�t�i�o�n� �b�l�o�c�k�s�:� � �{�i�n�t� �x�;� �i�n�t� �y�;� �s�}� �g�r�o�w�a�b�l�e� �r�e�g�i�o�n�s�:� �s�c�o�p�e�d� �l�i�f�e�t�i�m�e�,� �b�u�t� �g�r�o�w�a�b�l�e�:� � � � �{�r�e�g�i�o�n� �r�;� �s�}� � �a�l�l�o�c�a�t�i�o�n� �r�o�u�t�i�n�e�s� �t�a�k�e� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �h�a�n�d�l�e�s� �a�r�e� �f�i�r�s�t�-�c�l�a�s�s� �c�a�l�l�e�r� �d�e�c�i�d�e�s� �w�h�e�r�e�,� �c�a�l�l�e�e� �d�e�c�i�d�e�s� �h�o�w� �m�u�c�h� �n�o� �h�a�n�d�l�e�s� �f�o�r� �s�t�a�c�k� �r�e�g�i�o�n�s���¡Ž��m�������������������4����������������������������B������ ����K�������� ����������(�����������������*������������������������™�þ�����������������™�þ����������������������������������#������������������������™�þ������������������������"�������������������.�������ÿ3�þ���������ªb������������������,����������������������������������������������������1��������\���������ó���Ý�����������������Ÿ��������� (���T�h�a�t� s� �t�h�e� �e�a�s�y� �p�a�r�t��Ÿ��������¨c���The implementation is really simple because the type system statically prevents dangling pointers ��¡h���d���������������������������������������� ���������������������������ÿ��þ��ó���Þ������������������Ÿ���������¨���The big restriction�Ÿ�������� Î��A�n�n�o�t�a�t�e� �a�l�l� �p�o�i�n�t�e�r� �t�y�p�e�s� �w�i�t�h� �a� �r�e�g�i�o�n� �n�a�m�e� �(�a� �t�y�p�e� �v�a�r�i�a�b�l�e� �o�f� �r�e�g�i�o�n� �k�i�n�d�)� � �i�n�t�@�`�r� �m�e�a�n�s� � p�o�i�n�t�e�r� �i�n�t�o� �t�h�e� �r�e�g�i�o�n� �c�r�e�a�t�e�d� �b�y� �t�h�e� �c�o�n�s�t�r�u�c�t� �t�h�a�t� �i�n�t�r�o�d�u�c�e�s� �`�r� �h�e�a�p� �i�n�t�r�o�d�u�c�e�s� �`�H� � �L�:�& �i�n�t�r�o�d�u�c�e�s� �`�L� �{�r�e�g�i�o�n� �r�;� �s�}� �i�n�t�r�o�d�u�c�e�s� �`�r� � �r� �h�a�s� �t�y�p�e� �r�e�g�i�o�n�_�t�<�`�r�>� � �c�o�m�p�i�l�e�-�t�i�m�e� �c�h�e�c�k�:� �o�n�l�y� �l�i�v�e� �r�e�g�i�o�n�s� �a�r�e� �a�c�c�e�s�s�e�d� �b�y� �d�e�f�a�u�l�t�,� �f�u�n�c�t�i�o�n� �a�r�g�u�m�e�n�t�s� �p�o�i�n�t� �t�o� �l�i�v�e� �r�e�g�i�o�n�s� ���¡��P���������S�����$�������B����²���� �������������3���������5�����������������"������� ����������"������������� ����G����������g��������I����"�������c���������"��������b��������c���������"�������c����� ����"���� ���c��������g������™�þ���c����� ����"�������c���������"�������� "�� ����� c� ���� ���� "�� �� ��� c� ������� c� ��� �3����b�����5����b��������c�������ªP���¡���������������'������������������������������'�������j�����������������ó���ß������������������Ÿ���������¨���Region polymorphism�Ÿ�������� ø��A�p�p�l�y� �w�h�a�t� �w�e� �d�i�d� �f�o�r� �t�y�p�e� �v�a�r�i�a�b�l�e�s� �t�o� �r�e�g�i�o�n� �n�a�m�e�s� �(�o�n�l�y� �i�t� s� �m�o�r�e� �i�m�p�o�r�t�a�n�t� �a�n�d� �c�o�u�l�d� �b�e� �m�o�r�e� �o�n�e�r�o�u�s�)� � �v�o�i�d� �s�w�a�p�(�i�n�t� �@�`�r�1� �x�,� �i�n�t� �@�`�r�2� �y�)�{� � � �i�n�t� �t�m�p� �=� �*�x�;� � � �*�x� �=� �*�y�;� � � �*�y� �=� �t�m�p�;� �}� � �i�n�t�@�`�r� �s�u�m�p�t�r�(�r�e�g�i�o�n�_�t�<�`�r�>� �r�,�i�n�t� �x�,�i�n�t� �y�)�{� � � �r�e�t�u�r�n� �r�n�e�w�(�r�)� �(�x�+�y�)�;� �}���¡B��k����������M����� ������E����������k��������������C���������G������™�þ����C��������g�����������c��������g������™�þ���c��������g�����������c��������g������™�þ ���c��������g������™�þ ���c��������C�������C������� g� ����ÿ��þ��� c� ������� g� �����™�þ ��� c� ������� g� ����ÿ��þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������ª,���Ó�������������������������������������ó���à�����������������Ÿ���������¨���Type definitions�Ÿ��������¨K���struct ILst<`r1,`r2> { int@`r1 hd; struct ILst<`r1,`r2> *`r2 tl; }; ��¡ ��L���������� ����C��������g�����ÿ��þ���C������� g� ����ÿ��þ ���C�������g�����ÿ��þ���C�������g�����ÿ��þ��� C� ������$g�$����ÿ��þ���(C�(������,g�,����ÿ��þ ���0C�0�������0���0��ó���á���������� ��������Ÿ���������¨���Region subtyping�Ÿ�������� Ò��I�f� �p� �p�o�i�n�t�s� �t�o� �a�n� �i�n�t� �i�n� �a� �r�e�g�i�o�n� �w�i�t�h� �n�a�m�e� �`�r�1�,� �i�s� �i�t� �e�v�e�r� �s�o�u�n�d� �t�o� �g�i�v�e� �p� �t�y�p�e� �i�n�t�*�`�r�2�?� � �I�f� �s�o�,� �l�e�t� � �i�n�t�*�`�r�1� �<� �i�n�t�*�`�r�2� � �R�e�g�i�o�n� �s�u�b�t�y�p�i�n�g� �i�s� �t�h�e� �o�u�t�l�i�v�e�s� �r�e�l�a�t�i�o�n�s�h�i�p� � � �{�r�e�g�i�o�n� �r�1�;� �& �{�r�e�g�i�o�n� �r�2�;� �& }� �& �}� � �L�I�F�O� �m�a�k�e�s� �s�u�b�t�y�p�i�n�g� �c�o�m�m�o�n� � ���¡$��[����������M�������������������!����������������������������������������������������������������������������������������g�����ÿ��þ������������������������� g� ����ÿ��þ����� ����������C�������g�����ÿ��þ���o�����ÿ��þçÿ���G����������C�������g�����ÿ��þ���n����ÿ��þçÿ���o�����ÿ��þçÿ���� B�� ������ F�� ��������� B�� ��$��� C� ������� B�� ����� C� ������ � ���ª>���ª���������������������� ��������������� �������� ���������ó���â����������"��������Ÿ���������¨���Regions evaluation��ª���������� ����������������Ÿ�������� Æ��L�I�F�O� �r�e�g�i�o�n�s� �g�o�o�d� �f�o�r� �s�o�m�e� �i�d�i�o�m�s� �a�w�k�w�a�r�d� �i�n� �C� �R�e�g�i�o�n�s� �g�e�n�e�r�a�l�i�z�e� �s�t�a�c�k� �v�a�r�i�a�b�l�e�s� �a�n�d� �t�h�e� �h�e�a�p� �D�e�f�a�u�l�t�s� �a�n�d� �i�n�f�e�r�e�n�c�e� �m�a�k�e� �i�t� �s�u�r�p�r�i�s�i�n�g�l�y� �p�a�l�a�t�a�b�l�e� �W�o�r�s�t� �p�a�r�t�:� �d�e�f�i�n�i�n�g� �r�e�g�i�o�n�-�a�l�l�o�c�a�t�e�d� �d�a�t�a� �s�t�r�u�c�t�u�r�e�s� �C�y�c�l�o�n�e� �a�c�t�u�a�l�l�y� �h�a�s� �m�u�c�h� �m�o�r�e� �[�I�S�M�M� �0�4�]� �N�o�n�-�L�I�F�O� �r�e�g�i�o�n�s� � U�n�i�q�u�e� �p�o�i�n�t�e�r�s� �E�x�p�l�i�c�i�t�l�y� �r�e�f�e�r�e�n�c�e�-�c�o�u�n�t�e�d� �p�o�i�n�t�e�r�s� �A� � u�n�i�f�i�e�d� �s�y�s�t�e�m� ,� �n�o�t� �n� �s�u�b�l�a�n�g�a�g�e�s� ���¡’���/��������x�f���������6��������)���������p��������/�������f�������6�������������� �������a���� �� ���� � ����� �� ���ª���W������ ����������������ó���ã����������#��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�A�������(������� ���������� �������������������ó���ä����������$��������Ÿ���������¨���Other safety holes�Ÿ�������� J��A�r�r�a�y�s� �(�w�h�a�t� �o�r� �w�h�e�r�e� �i�s� �t�h�e� �s�i�z�e�)� �O�p�t�i�o�n�s�:� �d�y�n�a�m�i�c� �b�o�u�n�d�,� �i�n� �a� �f�i�e�l�d�/�v�a�r�i�a�b�l�e�,� �c�o�m�p�i�l�e�-�t�i�m�e� �b�o�u�n�d�,� �s�p�e�c�i�a�l� �s�t�r�i�n�g� �s�u�p�p�o�r�t� �T�h�r�e�a�d�s� �(�a�v�o�i�d�i�n�g� �r�a�c�e�s�)� �v�a�p�o�r�w�a�r�e� �t�y�p�e� �s�y�s�t�e�m� �t�o� �e�n�f�o�r�c�e� �l�o�c�k�-�b�a�s�e�d� �m�u�t�u�a�l� �e�x�c�l�u�s�i�o�n� �C�a�s�t�s� �A�l�l�o�w� �o�n�l�y� � u�p� �c�a�s�t�s� �a�n�d� �c�a�s�t�s� �t�o� �n�u�m�b�e�r�s� �U�n�i�o�n�s� �C�h�e�c�k�e�d� �t�a�g�s� �o�r� �b�i�t�s�-�o�n�l�y� �f�i�e�l�d�s� �U�n�i�n�i�t�i�a�l�i�z�e�d� �d�a�t�a� �F�l�o�w� �a�n�a�l�y�s�i�s� �(�s�a�f�e�r� �a�n�d� �e�a�s�i�e�r� �t�h�a�n� �d�e�f�a�u�l�t� �i�n�i�t�i�a�l�i�z�e�r�s�)� �V�a�r�a�r�g�s� �(�s�a�f�e� �v�i�a� �c�h�a�n�g�e�d� �c�a�l�l�i�n�g� �c�o�n�v�e�n�t�i�o�n�)���¡î���#���������X�����������������=�����������������+�����������������!�����������������;��������.���������#�������X��������������=��������������+����������� �� �!���� �� ��������;�������.���������ª>��� ��������������������� �������A��������������'���������ó���å����������%��������Ÿ���������¨���And modern conveniences�Ÿ�������� æ��3�0� �y�e�a�r�s� �a�f�t�e�r� �C�,� �s�o�m�e� �t�h�i�n�g�s� �a�r�e� �w�o�r�t�h� �a�d�d�i�n�g�& � �T�a�g�g�e�d� �u�n�i�o�n�s� �a�n�d� �p�a�t�t�e�r�n� �m�a�t�c�h�i�n�g� �o�n� �t�h�e�m� �I�n�t�r�a�p�r�o�c�e�d�u�r�a�l� �t�y�p�e� �i�n�f�e�r�e�n�c�e� �T�u�p�l�e�s� �(�l�i�k�e� �a�n�o�n�y�m�o�u�s� �s�t�r�u�c�t�s�)� �E�x�c�e�p�t�i�o�n�s� �S�t�r�u�c�t� �a�n�d� �a�r�r�a�y� �i�n�i�t�i�a�l�i�z�e�r�s� �N�a�m�e�s�p�a�c�e�s� �n�e�w� �f�o�r� �a�l�l�o�c�a�t�i�o�n� �+� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� ���¡Z���0�������������������x�Ã���������0������������� �ž���������������"���������ª>���{���������������������������� ��������������H���������ó���ê����������&��������Ÿ���������¨���Plenty of work remains�Ÿ��������¨Ó���Common limitations: Aliasing Arithmetic Unportable assumptions (But interoperating with C is much simpler than in a HLL) Big challenge for next generation: guarantees beyond fail-safe (i.e., graceful abort)��¡X�������������,���������:�������������������Y����������^��������������r���������ª���(������� �������¢���������ó���Ï������������������Ÿ���������¨���Related work: making C safer�Ÿ�������� Ê��C�o�m�p�i�l�e� �t�o� �m�a�k�e� �d�y�n�a�m�i�c� �c�h�e�c�k�s� �p�o�s�s�i�b�l�e� �S�a�f�e�-�C� �[�A�u�s�t�i�n� �e�t� �a�l�.�]�,� �R�T�C� �[�Y�o�n�g�/�H�o�r�w�i�t�z�]�,� �.�.�.� �P�u�r�i�f�y�,� �S�t�a�c�k�g�u�a�r�d�,� �E�l�e�c�t�r�i�c� �F�e�n�c�e�,� �& �C�C�u�r�e�d� �[�N�e�c�u�l�a� �e�t� �a�l�.�]� �p�e�r�f�o�r�m�a�n�c�e� �v�i�a� �w�h�o�l�e�-�p�r�o�g�r�a�m� �a�n�a�l�y�s�i�s� �l�e�s�s� �u�s�e�r� �b�u�r�d�e�n� �l�e�s�s� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t�,� �s�i�n�g�l�e�-�t�h�r�e�a�d�e�d� � �C�o�n�t�r�o�l�-�C� �[�A�d�v�e� �e�t� �a�l�.�]� �w�e�a�k�e�r� �g�u�a�r�a�n�t�y�,� �l�e�s�s� �b�u�r�d�e�n� � �S�F�I� �[�W�a�h�b�e�,� �S�m�a�l�l�,� �.�.�.�]�:� �s�a�n�d�b�o�x�i�n�g� �v�i�a� �b�i�n�a�r�y� �r�e�w�r�i�t�i�n�g� ���¡ð���(��������Z�m�������Z�`�������Z�p��������Z����������Z�(�����������������������������������1��������������`������� ���� �� ����� �� ����� �� ����� �� ����� �� ����� �� �#���� �� ���ª>���@���������������ž�����������������������������a���������ó���í����������*��������Ÿ���������¨���Related Work: Checking C code�Ÿ�������� f��M�o�d�e�l�-�c�h�e�c�k�i�n�g� �C� �c�o�d�e� �(�S�L�A�M�,� �B�L�A�S�T�,� �& )� �L�e�v�e�r�a�g�e�s� �s�c�a�l�a�b�i�l�i�t�y� �o�f� �M�C� �K�e�y� �i�s� �a�u�t�o�m�a�t�i�c� �b�u�i�l�d�i�n�g� �a�n�d� �r�e�f�i�n�i�n�g� �o�f� �m�o�d�e�l� �T�h�e�y� �a�s�s�u�m�e� �(�w�e�a�k�)� �m�e�m�o�r�y� �s�a�f�e�t�y� �L�i�n�t�-�l�i�k�e� �t�o�o�l�s� �(�S�p�l�i�n�t�,� �M�e�t�a�l�,� �P�r�e�F�I�X�,� �& )� �G�o�o�d� �a�t� �r�e�d�u�c�i�n�g� �f�a�l�s�e� �p�o�s�i�t�i�v�e�s� �C�a�n�n�o�t� �e�n�s�u�r�e� �a�b�s�e�n�c�e� �o�f� �b�u�g�s� �M�e�t�a�l� �p�a�r�t�i�c�u�l�a�r�l�y� �g�o�o�d� �f�o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� �C�q�u�a�l� �(�u�s�e�r�-�d�e�f�i�n�e�d� �q�u�a�l�i�f�i�e�r�s�,� �l�o�t�s� �o�f� �i�n�f�e�r�e�n�c�e�)� �B�e�t�t�e�r� �f�o�r� �u�n�c�h�a�n�g�e�a�b�l�e� �c�o�d�e� �o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� � �(�i�.�e�.�,� �t�h�e�y� r�e� �c�o�m�p�l�e�m�e�n�t�a�r�y�)���¡Â���'���������m��������+���������o��������3���������S����������'�������Q���������������������+�������!������������H�������2������������� �S����������ª,���´��������������t�����������������������ó���ð����������,��������Ÿ���������¨���Related work: higher and lower�Ÿ�������� ¸��A�d�a�p�t�e�d�/�e�x�t�e�n�d�e�d� �i�d�e�a�s�:� �p�o�l�y�m�o�r�p�h�i�s�m� �[�M�L�,� �H�a�s�k�e�l�l�,� �& ]� �r�e�g�i�o�n�s� �[�T�o�f�t�e�/�T�a�l�p�i�n�,� �W�a�l�k�e�r� �e�t� �a�l�.�,� �& ]� �s�a�f�e�t�y� �v�i�a� �d�a�t�a�f�l�o�w� �[�J�a�v�a�,� �& ]� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e�s� �[�M�i�t�c�h�e�l�l�/�P�l�o�t�k�i�n�,� �& ]� �c�o�n�t�r�o�l�l�i�n�g� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �[�A�d�a�,� �M�o�d�u�l�a�-�3�,� �& ]� � �S�a�f�e� �l�o�w�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e�s� �[�T�A�L�,� �P�C�C�,� �& ]� �e�n�g�i�n�e�e�r�e�d� �f�o�r� �m�a�c�h�i�n�e�-�g�e�n�e�r�a�t�e�d� �c�o�d�e� � �V�a�u�l�t�:� �s�t�r�o�n�g�e�r� �p�r�o�p�e�r�t�i�e�s� �v�i�a� �r�e�s�t�r�i�c�t�e�d� �a�l�i�a�s�i�n�g� ���¡€������������Á��������)���������'��������4����������������À��������������)�������&��������������4���������ó���Ñ������������������Ÿ���������¨���Summary�Ÿ�������� ò��C�y�c�l�o�n�e�:� �a� �s�a�f�e� �l�a�n�g�u�a�g�e� �a�t� �t�h�e� �C�-�l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� � �S�y�n�e�r�g�i�s�t�i�c� �c�o�m�b�i�n�a�t�i�o�n� �o�f� �t�y�p�e�s�,� �f�l�o�w� �a�n�a�l�y�s�i�s�,� �a�n�d� �r�u�n�-�t�i�m�e� �c�h�e�c�k�s� � �A� �r�e�a�l� �c�o�m�p�i�l�e�r� �a�n�d� �p�r�o�t�o�t�y�p�e� �a�p�p�l�i�c�a�t�i�o�n�s� � �P�r�o�p�e�r�t�i�e�s� �l�i�k�e� � n�o�t� �N�U�L�L� ,� � h�a�s� �l�o�n�g�e�r� �l�i�f�e�t�i�m�e� ,� � h�a�s� �a�r�r�a�y� �l�e�n�g�t�h� & �n�o�w� �i�n� �t�h�e� �l�a�n�g�u�a�g�e� �a�n�d� �c�h�e�c�k�e�d� � �E�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y� �w�i�t�h� �C� �a�l�l�o�w� �s�m�o�o�t�h� �a�n�d� �i�n�c�r�e�m�e�n�t�a�l� �m�o�v�e� �t�o�w�a�r�d� �m�e�m�o�r�y� �s�a�f�e�t�y� � �i�n� �t�h�e�o�r�y� �a�t� �l�e�a�s�t���¡z���g����������������7������������� �E������������� �+������������� �g������������� �U����������������ó���î����������)��������Ÿ���������¨ ���Availability�Ÿ��������  ��L�i�k�e� �a�n�y� �l�a�n�g�u�a�g�e�,� �y�o�u� �h�a�v�e� �t�o� � k�i�c�k� �t�h�e� �t�i�r�e�s� :� �w�w�w�.�r�e�s�e�a�r�c�h�.�a�t�t�.�c�o�m�/�p�r�o�j�e�c�t�s�/�c�y�c�l�o�n�e� � �A�l�s�o� �s�e�e�:� �J�a�n�.� �2�0�0�5� �C�/�C�+�+� �U�s�e�r� s� �J�o�u�r�n�a�l� �U�S�E�N�I�X� �2�0�0�2� � �C�o�n�v�e�r�s�e�l�y�,� �I� �w�a�n�t� �t�o� �k�n�o�w� �N�A�S�A� s� �C�-�l�e�v�e�l� �c�o�d�e� �n�e�e�d�s� �M�a�y�b�e� �i�d�e�a�s� �f�r�o�m� �C�y�c�l�o�n�e� �w�i�l�l� �h�e�l�p� �M�a�y�b�e� �n�o�t� �E�i�t�h�e�r� �w�a�y� �w�o�u�l�d� �b�e� �f�a�s�c�i�n�a�t�i�n�g� ���¡¢���1����������'���������� ����������+�����������������5����������-���������!����������1�������%�������Ì�fþ������� �������+�������„���������ª���1��������������Ì���������ó���æ������������������Ÿ���������¨��� �Ÿ�������� r���[�P�r�e�s�e�n�t�a�t�i�o�n� �e�n�d�s� �h�e�r�e� � � � �s�o�m�e� �a�u�x�i�l�i�a�r�y� �s�l�i�d�e�s� �f�o�l�l�o�w�]���¡���:����������:���������ó���ç������������������Ÿ���������¨���Example in Cyclone�Ÿ��������¨Ž���void f(int@{`j} p, tag_t<`i> i, int v ; `i < `j){ p[i] = v; } Note: regions and locks use implicit defaults (live and accessible)��¡Ì���I�������������������E���������������������������™�þ���������������������������ÿ3�þ ����������������ÿ3�þ�������� ��������ÿ3�þ��������F���������ª,�����������������"��������������R���������ó���ô����������0��������Ÿ���������¨���Some other problems�Ÿ�������� \��O�n�e� �s�a�f�e�t�y� �v�i�o�l�a�t�i�o�n� �t�y�p�i�c�a�l�l�y� �r�e�n�d�e�r�s� �a�l�l� �p�r�o�g�r�a�m� �p�r�o�p�e�r�t�i�e�s� �p�o�t�e�n�t�i�a�l�l�y� �i�r�r�e�l�e�v�a�n�t� � �S�o� �p�r�o�h�i�b�i�t�:� � � � �i�n�c�o�r�r�e�c�t� �c�a�s�t�s�,� �a�r�r�a�y�-�b�o�u�n�d�s� �v�i�o�l�a�t�i�o�n�s�,� �m�i�s�u�s�e�d� �u�n�i�o�n�s�,� �u�n�i�n�i�t�i�a�l�i�z�e�d� �p�o�i�n�t�e�r�s�,� �d�a�n�g�l�i�n�g� �p�o�i�n�t�e�r�s�,� �n�u�l�l�-�p�o�i�n�t�e�r� �d�e�r�e�f�e�r�e�n�c�e�s�,� �d�a�n�g�l�i�n�g� �l�o�n�g�j�m�p�,� �v�a�r�a�r�g� �m�i�s�m�a�t�c�h�,� �n�o�t� �r�e�t�u�r�n�i�n�g� �p�o�i�n�t�e�r�s�,� �d�a�t�a� �r�a�c�e�s�,� �& ��¡,���d��������Z�Ë��������Z�d�������Ë�������/�ð¨�����ó���^�������������������ó���Å�����������%��������ó���Ð�����������&��������ó���è�����������'��������ó���é�����������(��������ó���ï�����������)�������P������ÿÿÿ�������������������������������������������������������������������������ê�����ît���ï������ ��������€���������ù���P��������Ø��  ���ð��0ð������¬��ðœ���ð(���� ð�������������������� ð����¬�����ð~���� ð���¬� ��s� ð*������������€�ä”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���¬� ��s� ð*������������€�T딿���ÿ��� ��ˆ������ð���ð@`��ð�����à �������”� ð �����ž�������ðX���� ð���¬�� ��ƒ� ð0���…����‡������ƒ���¿���À��ÿ������ð���`@°ð �ðH���� ð���¬�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î<���ï������ ��������€���������ù���P��������ÿÿÿ� ”���ðŒ��ð������ø��ð$���ð(���� ð�������������������� ð����ø�����ðr���� ð���ø� ��S� ð�������€�4Ô¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðr���� ð���ø� ��S� ð�������€�ðÔ¿���ÿ��� ����ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���ø�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���âñÄ0¼A#�îÊ���ï������ ��������€���������ù���P��������ÿÿÿ� "���ð���ð��� ���0��ð²���ð(���� ð�������������������� ð����0�����ðr���� ð���0� ��S� ð�������€�¤¤”¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ðS��� ð���0�� ��“� ð6�������€�Ø¥”¿�����ƒ���¿���À��ÿ�������ð���ðàÐŽ � ðí�����Ÿ��������¨W���void f(int*@p) { if(*p != NULL) { g(); **p = 42;//inserted check even w/o g() } }��¡N���X������������������������™�þ���������������™�þK���������ª$�������������������������K��������ð���� ð���0� ��£� ð<������€�´«”��ƒ���¿���À��ÿ�� ��� ��ˆ������ð��� Ppð�ð�����à �������”� ð �����ž�������ð¨���� ð��� 0�� ��“� ð6���€�˜¯”…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���ð� À`� ðB�����Ÿ��������¡������������������������ª ������������ð^���� ð��� 0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€ÐÀ@�ð^���� ð��� 0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€@0@�ð®���¢ ð��� 0�� ��ƒ� ð0���€�D¹”¿�����ƒ���¿���À��ÿ�������ð���P@`J� ðN�����Ÿ��������¨���37��¡��������� ��2����������ª�������������������ð^���� ð���0�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���€ € @�ðX���B ð���0�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð���àð Ðà�ð^���B ð���0�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���à`@à�ð¯���¢ ð���0�� ��£� ð<���€�4.q…����‡����¿�����ƒ���¿���À��ÿ�������ð���` 4 0� ðC�����Ÿ��������¨���p��¡���������������������ª ������������ðH���� ð���0�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���õÄ€S¼S�î„ ���ï������ ��������€���������ù���P��������ÿÿÿ� Ü���ðÔ��ðð������4��ðl���ð(���� ð�������������������� ð����4�����ðx���� ð���4� ��c� ð$�������€�”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð„��� ð���4�� ��“� ð6�������€�„‡”¿�����ƒ���¿���À��ÿ�������ð���ðàÐt � ð����Ÿ��������¨R���void f(int**p) { int* x = *p; if(x != NULL) { g(); *x = 42;//no check } }��¡j���S������������������������™�þ���������������™�þ ���������������™�þ;���������ª>������������������������������� ��������������/��������ð���� ð���4� ��£� ð<������€�°‘”��ƒ���¿���À��ÿ�� ��� ��ˆ������ð��� Ppð�ð�����à �������”� ð �����ž�������ð¨���� ð���4�� ��“� ð6���€�ô–”…����‡����ÿÿ™�‚�€��¿��À��ÿ�������ð���P� Àp� ðB�����Ÿ��������¡������������������������ª ������������ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���àÐÀ �ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���à@0 �ð®���¢ ð��� 4�� ��ƒ� ð0���€�Pæq¿�����ƒ���¿���À��ÿ�������ð���°@`ª� ðN�����Ÿ��������¨���37��¡��������� ��2����������ª�������������������ð^���� ð��� 4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���à €  �ðX���B ð��� 4�€ ��ƒ� ð0���D������¿���À��ËÑV��Ñ���ÿ������ð���@ð ÐA�ð^���B ð��� 4�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���@`@A�ð¯���¢ ð��� 4�� ��£� ð<���€�¬Cq…����‡����¿�����ƒ���¿���À��ÿ�������ð���p` 4 � ðC�����Ÿ��������¨���p��¡���������������������ª ������������ð^���� ð���4�� ��“� ð6���…����‡������ƒ���¿���À��Ë>��ÿ������ð���ÐÀP�ð^���B ð���4�€ ��“� ð6���D������¿���À��ËÑV��Î���Ñ���ÿ������ð���Ð`@ñ�ð¯���¢ ð���4�� ��£� ð<���€�€7q…����‡����¿�����ƒ���¿���À��ÿ�������ð��� pD@� ðC�����Ÿ��������¨���x��¡���������������������ª ������������ðH���� ð���4�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���õÄ€S¼S�î���ï������ ��������€���������ù���@������������ ¬���ð¤��ð������à��ð<���ð(���� ð�������������������� ð����à�����ð~���� ð���à� ��s� ð*������������€�l+”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���à� ��s� ð*������������€�¸”¿���ÿ��� ��ˆ������ð���ð°Ð��ð�����à �������”� ð �����ž�������ðH���� ð���à�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��î6���ï������ ��������€���������ù���@��������ÿÿÿ� Î���ðÆ��€ð������ä��ð^���ð(���� ð�������������������� ð����ä�����ð~���� ð���ä� ��s� ð*������������€� ”¿���ÿ��� ��ˆ������ð���À�°Ð�ð�����à ������� �”� ð �����ž��������ð~���� ð���ä� ��s� ð*������������€�È”¿���ÿ��� ��ˆ������ð���œà�T�ð�����à �������”� ð �����ž�������ð��¢ ð���ä�� ��ƒ� ð0���€�Ü”¿�����ƒ���¿���À��ÿ�������ð��� ððà� ðº����Ÿ��������¨Œ���void f() { int* x; { int y = 0; x = &y; // x not dangling } // x dangling { int* z = NULL; *x = 123; ... } } ��¡ø���Œ��������Z�������������������������™�þ ���������������™�þ���������������™�þ���������������������������������� ���������������™�þ�������������������������������������ª���Œ����������������ðH���� ð���ä�� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²���r0�����Ά�Ô���Ö��˜�Ü� �:(�V*�ò� �Ü�®���õ�����í�ª†�”.����ô����C��èp‹���é(���€��à��8��Ø����� ������–���������òú��/�È ���0�Ò�������Õ0����·D���T�i�m�e�s� �N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��·D���A�r�i�a�l���N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�" �·D���C�o�u�r�i�e�r� �N�e������������������������� ��� ��� ��� ��� ��������������������������������������������������������� ���!���"���#���$���%���&���'���(���)���*���+���,���-���.���/���0���1���2���þÿÿÿ4���5���6���7���8���9���:���;���<���=���>���?���@���A���B���C���D���E���F���G���H���I���J���þÿÿÿL���þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿ����������������������à…ŸòùOh«‘�+'³Ù0���\ �� ������h������p������°������È������ô��� ��� ������� ���8�� ���D�� ���P�����\�����d�����ä�����8���Cyclone: Safe Programming at the C Level of Abstraction���� ���Dan Grossman� Pr���!���T:\talks\dan_design_template.pot�C L��� ���Dan Grossman�des������307�������Microsoft PowerPoint�emp@���0«M–„��@���0ÅtžŸ˜Â@���`®ÒìÑøÄ���Š��G���î ��ÿÿÿÿ����‰g ��� ��o���1��������&��ÿÿÿÿ�����������À��Ð�� ���&��ÿÿÿÿ������&�#�ÿÿÿÿ��TNPP� Ñ�2���ÿÿO����M�i��� ���&� �TNPP���ô ���&��ÿÿÿÿ������&��TNPP� �������������� ������� ÐÀ��� ������ü��ÿÿÿ������-�����ú�����������-����-�� ���!�ð�ÐÀ�������-�����ü��ÿÿÿ������-����ð�����ú�������������-�����&��ÿÿÿÿ��M���…���l��Œ������-����ü��33Ì������-������� ���$�P�†�P�Š�hŠ�h†����������-�����-����ð����&��ÿÿÿÿ����&��ÿÿÿÿ��M���]��l��d�����-����ü��33Ì������-������� ���$�P�^P�bhbh^���������-�����-����ð����&��ÿÿÿÿ����ü����������-����-����!y¨�H����-����-�����û�������������������Üñw@���± ÜÌñ�؟ówáŸów õw fÍ���-���� �������������ûÕÿ�����������@�"Arial���- ʘë�؟ówáŸów õw fÍ���-����ð���� Ì�f����������.���������!���2 ×�¤����Cyclone: A Memory���� ���� � �� �#��#�������.������������ Ì�f����������.��������� ���2 ×����-�����.������������ Ì�f����������.������������2 ×�&���Safe C�� �� �����.������������ Ì�f����������.��������� ���2 ×�©���-�����.������������ Ì�f����������.������������2 ×�·���Level ���� � ����.������������ Ì�f����������.���������%���2 û����Programming Language������$�#� ��� ������������.������������������-����-����ñy88����-����-����� Ì�f����������ûàÿ�����������@�"Arial���± ç˜ë�؟ówáŸów õw fÍ���-����ð���� Ì�f����������.������������2 \m ���Dan Grossman��� �� ����������.������������ Ì�f����������.���������+���2 Š(���University of Washington����� ��� �� �� �� ������� ������.������������ 33Ì����������.���������1���2 òK����Joint work with: Trevor Jim���� � ��� �� ��� �� � � �� ���� � �������.������������ 33Ì����������.������������2 ò" ���AT&T Research����� ������ ������.������������ 33Ì����������.������������2 8���Greg Morrisett� ��� ��� � ���� � ����.������������ 33Ì����������.���������"���2 "���Harvard University�� ��� �� ������ ��� �����.������������ 33Ì����������.������������2 >8 ���Michael Hicks�������� ���������.������������ 33Ì����������.���������(���2 >"���University of Maryland����� ��� �� �� � ��� ���������.������������������-����-����û������¼����"System�Í fÍ�� �!�Š�������Àõ����-����ð����&��TNPP� ������������� ���&��ÿÿÿÿ��������������������������������������������������������������þÿ����������������������ÕÍ՜.“—�+,ù®0���¸��������ˆ������������¨������¸������À������È������Ð��� ���Ø��� ���à������è��� ���ð������ø�������������� ����� ���V�����ä��������On-screen Show��������CUCS�ree����É���������)��������������������������í � ������� ������� ������� ������� program: the compiler�Ÿ��������¨Ö��� Scalable compiler + libraries (80K lines) build in < 30secs Generic libraries (e.g., lists, hashtables) clients have no syntactic/performance cost Static safety helps exploit the C-level I use &x more than in C ��¡¼��� ���������4��������,���������,��������(����������������� �������3������������� �,�������+������������� �(����������� �� ���� � ������ �� ����� �� ���ó���Î���������� ��������Ÿ���������¨���Other projects�Ÿ��������¨o��Open Kernel Environment [Bos/Samwel, OPENARCH 02] MediaNet [Hicks et al, OPENARCH 03]: RBClick [Patel/Lepreau, OPENARCH 03] STP [Patel et al., SOSP 03] FPGA synthesis [Teifel/Manohar, ISACS 04] Maryland undergrad O/S course (geekOS) [2004] Windows device driver (6K lines) Only 100 lines left in C But unrecoverable failures & other kernel corruptions remain ��¡���������P�W�������P���������P��������������������� � ��������������������������� ��������������������� ��������������������� ��������������������� �'�������������������� �!����������W����������������ªt���������� �������������������������������������������������=��������������,��������������ƒ���������ó���Ò������������������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡z���A��������–�(�������–�-��������–�����������–�������������������������(�������-�������������������ó���Ó�����������������Ÿ���������¨���Not-null pointers�Ÿ��������ª �������������ó���Ô�����������������Ÿ���������¨���Example�Ÿ�������� ê��F�I�L�E�*� �f�o�p�e�n�(�c�o�n�s�t� �c�h�a�r�@�,� �c�o�n�s�t� �c�h�a�r�@�)�;� �i�n�t� �f�g�e�t�c�(�F�I�L�E�@�)�;� �i�n�t� �f�c�l�o�s�e�(�F�I�L�E�@�)�;� �v�o�i�d� �g�(�)� �{� � � �F�I�L�E�*� �f� �=� �f�o�p�e�n�(� f�o�o� ,� � r� )�;� � � �i�n�t� �c�;� � � �w�h�i�l�e�(�(�c� �=� �f�g�e�t�c�(�f�)�)� �!�=� �E�O�F�)� �{�& }� � � �f�c�l�o�s�e�(�f�)�;� �}� � �G�i�v�e�s� �w�a�r�n�i�n�g� �a�n�d� �i�n�s�e�r�t�s� �o�n�e� �n�u�l�l�-�c�h�e�c�k� �E�n�c�o�u�r�a�g�e�s� �a� �h�o�i�s�t�e�d� �c�h�e�c�k���¡Ü���±���������Z�E��������Z������������������™�þ �����������������™�þ �����������������™�þ�����������������™�þ �����������������™�þQ���������������D���������ª†���������� ������� ��������������� ���������������������� �������������� ��������������� �����������������������a���������ó���Õ�����������������Ÿ���������¨���A classic moral�Ÿ��������¨L���FILE* fopen(const char@, const char@); int fgetc(FILE@); int fclose(FILE@); ��¡„���M���������������������������™�þ �����������������™�þ �����������������™�þ �������������� ���ª,���1��������������� ������������������������ó���Ö����������!��������Ÿ���������¨���Key Design Principles in Action�Ÿ��������¨K��Types to express invariants Preconditions for arguments Properties of values in memory Flow analysis where helpful Lets users control explicit checks Soundness + aliasing limits usefulness Users control data representation Pointers are addresses unless user allows otherwise Often can interoperate with C more safely just via types��¡°�����������Z�;�������Z���������Z�J�������Z�"��������Z�4�������Z�9��������Z��������;��������������#�������'�����"�������4�������9���������ª$�����������R���������������ñ���������ó���ò���������.��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ó���������/��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ñ����������-��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�*�����������������(�������-�������������������ó���Ø�����������������Ÿ��������� (��� C�h�a�n�g�e� �v�o�i�d�*� �t�o� �`�a� ��¡:������������������������������������������������Ÿ��������¨•���struct Lst { void* hd; struct Lst* tl; }; struct Lst* map( void* f(void*), struct Lst*); struct Lst* append( struct Lst*, struct Lst*);��¡\���–����� ������;�����������������™�þ1�����������������™�þ!����������ó���Ù������������������Ÿ���������¨���Not much new here�Ÿ��������¨��Closer to C than C++, Java generics, ML, etc. Unlike functional languages, data representation may restrict `a to pointers, int why not structs? why not float? why int? Unlike templates, no code duplication or leaking implementations Unlike objects, no need to tag data��¡Ú���/����������S���������)�����������������f���������/�����"���N����"�������c���������"��������"�������c���������"�������c���������"�������� "�� ��f����"������ª���¦��������������i���������ó���Ú������������������Ÿ���������¨���Existential types�Ÿ�������� ��P�r�o�g�r�a�m�s� �n�e�e�d� �a� �w�a�y� �f�o�r� � c�a�l�l�-�b�a�c�k� �t�y�p�e�s�:� � � � � � �s�t�r�u�c�t� �T� �{� � � � � � �v�o�i�d� �(�*�f�)�(�v�o�i�d�*�,� �i�n�t�)�;� � � � � � �v�o�i�d�*� �e�n�v�;� � � �}�;� � �W�e� �u�s�e� �a�n� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e� �(�s�i�m�p�l�i�f�i�e�d�)�:� � � � � � � �s�t�r�u�c�t� �T� �{� �<�`�a�>� � � � � � �v�o�i�d� �(�@�f�)�(�`�a�,� �i�n�t�)�;� � � � � � �`�a� �e�n�v�;� � � �}�;� � �m�o�r�e� �C�-�l�e�v�e�l� �t�h�a�n� �b�a�k�e�d�-�i�n� �c�l�o�s�u�r�e�s�/�o�b�j�e�c�t�s� ���¡Œ��+��������Z�A����0����Z�����������Z�*��������Z�A����0����Z���,����8�����Z�����������Z�+�������������>�����������������������"���������� ������������ÿ��þ���g�����ÿ��þ���G����ÿ��þ���������g�����ÿ3�þ ���������g�����ÿ3�þ ������������,��� � �������"�����ó���Û�����������������Ÿ���������¨���Regions�Ÿ��������  ��a�.�k�.�a�.� �z�o�n�e�s�,� �a�r�e�n�a�s�,� �& � �E�v�e�r�y� �o�b�j�e�c�t� �i�s� �i�n� �e�x�a�c�t�l�y� �o�n�e� �r�e�g�i�o�n� � �A�l�l�o�c�a�t�i�o�n� �v�i�a� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �D�e�a�l�l�o�c�a�t�e� �a�n� �e�n�t�i�r�e� �r�e�g�i�o�n� � �s�i�m�u�l�t�a�n�e�o�u�s�l�y� � � �(�c�a�n�n�o�t� �f�r�e�e� �a�n� �o�b�j�e�c�t�)� � �O�l�d� �i�d�e�a� �w�i�t�h� �r�e�c�e�n�t� �s�u�p�p�o�r�t� �i�n� �l�a�n�g�u�a�g�e�s� �(�e�.�g�.�,� �R�C�,� �R�T�S�J�)� � �a�n�d� �i�m�p�l�e�m�e�n�t�a�t�i�o�n�s� �(�e�.�g�.�,� �M�L� �K�i�t�)���¡²���|��������Z�*���������Z���������Z�_����������Z���������������&����������������������������7��������������� ��������������_������������ª>���`�������F�����������������������.������� ��������%���������ó���Ü������������������Ÿ���������¨���Cyclone regions [PLDI 02]��¡������������������� ��������Ÿ�������� œ��h�e�a�p� �r�e�g�i�o�n�:� �o�n�e�,� �l�i�v�e�s� �f�o�r�e�v�e�r�,� �c�o�n�s�e�r�v�a�t�i�v�e�l�y� �G�C� d� �s�t�a�c�k� �r�e�g�i�o�n�s�:� �c�o�r�r�e�s�p�o�n�d� �t�o� �l�o�c�a�l�-�d�e�c�l�a�r�a�t�i�o�n� �b�l�o�c�k�s�:� � �{�i�n�t� �x�;� �i�n�t� �y�;� �s�}� �g�r�o�w�a�b�l�e� �r�e�g�i�o�n�s�:� �s�c�o�p�e�d� �l�i�f�e�t�i�m�e�,� �b�u�t� �g�r�o�w�a�b�l�e�:� � � � �{�r�e�g�i�o�n� �r�;� �s�}� � �a�l�l�o�c�a�t�i�o�n� �r�o�u�t�i�n�e�s� �t�a�k�e� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �h�a�n�d�l�e�s� �a�r�e� �f�i�r�s�t�-�c�l�a�s�s� �c�a�l�l�e�r� �d�e�c�i�d�e�s� �w�h�e�r�e�,� �c�a�l�l�e�e� �d�e�c�i�d�e�s� �h�o�w� �m�u�c�h� �n�o� �h�a�n�d�l�e�s� �f�o�r� �s�t�a�c�k� �r�e�g�i�o�n�s���¡Ž��m�������������������4����������������������������B������ ����K�������� ����������(�����������������*������������������������™�þ�����������������™�þ����������������������������������#������������������������™�þ������������������������"�������������������.�������ÿ3�þ���������ªb������������������,����������������������������������������������������1��������\���������ó���Ý�����������������Ÿ��������� (���T�h�a�t� s� �t�h�e� �e�a�s�y� �p�a�r�t��Ÿ��������¨c���The implementation is really simple because the type system statically prevents dangling pointers ��¡h���d���������������������������������������� ���������������������������ÿ��þ��ó���Þ������������������Ÿ���������¨���The big restriction�Ÿ�������� Î��A�n�n�o�t�a�t�e� �a�l�l� �p�o�i�n�t�e�r� �t�y�p�e�s� �w�i�t�h� �a� �r�e�g�i�o�n� �n�a�m�e� �(�a� �t�y�p�e� �v�a�r�i�a�b�l�e� �o�f� �r�e�g�i�o�n� �k�i�n�d�)� � �i�n�t�@�`�r� �m�e�a�n�s� � p�o�i�n�t�e�r� �i�n�t�o� �t�h�e� �r�e�g�i�o�n� �c�r�e�a�t�e�d� �b�y� �t�h�e� �c�o�n�s�t�r�u�c�t� �t�h�a�t� �i�n�t�r�o�d�u�c�e�s� �`�r� �h�e�a�p� �i�n�t�r�o�d�u�c�e�s� �`�H� � �L�:�& �i�n�t�r�o�d�u�c�e�s� �`�L� �{�r�e�g�i�o�n� �r�;� �s�}� �i�n�t�r�o�d�u�c�e�s� �`�r� � �r� �h�a�s� �t�y�p�e� �r�e�g�i�o�n�_�t�<�`�r�>� � �c�o�m�p�i�l�e�-�t�i�m�e� �c�h�e�c�k�:� �o�n�l�y� �l�i�v�e� �r�e�g�i�o�n�s� �a�r�e� �a�c�c�e�s�s�e�d� �b�y� �d�e�f�a�u�l�t�,� �f�u�n�c�t�i�o�n� �a�r�g�u�m�e�n�t�s� �p�o�i�n�t� �t�o� �l�i�v�e� �r�e�g�i�o�n�s� ���¡��P���������S�����$�������B����²���� �������������3���������5�����������������"������� ����������"������������� ����G����������g��������I����"�������c���������"��������b��������c���������"�������c����� ����"���� ���c��������g������™�þ���c����� ����"�������c���������"�������� "�� ����� c� ���� ���� "�� �� ��� c� ������� c� ��� �3����b�����5����b��������c�������ªP���¡���������������'������������������������������'�������j�����������������ó���ß������������������Ÿ���������¨���Region polymorphism�Ÿ�������� ø��A�p�p�l�y� �w�h�a�t� �w�e� �d�i�d� �f�o�r� �t�y�p�e� �v�a�r�i�a�b�l�e�s� �t�o� �r�e�g�i�o�n� �n�a�m�e�s� �(�o�n�l�y� �i�t� s� �m�o�r�e� �i�m�p�o�r�t�a�n�t� �a�n�d� �c�o�u�l�d� �b�e� �m�o�r�e� �o�n�e�r�o�u�s�)� � �v�o�i�d� �s�w�a�p�(�i�n�t� �@�`�r�1� �x�,� �i�n�t� �@�`�r�2� �y�)�{� � � �i�n�t� �t�m�p� �=� �*�x�;� � � �*�x� �=� �*�y�;� � � �*�y� �=� �t�m�p�;� �}� � �i�n�t�@�`�r� �s�u�m�p�t�r�(�r�e�g�i�o�n�_�t�<�`�r�>� �r�,�i�n�t� �x�,�i�n�t� �y�)�{� � � �r�e�t�u�r�n� �r�n�e�w�(�r�)� �(�x�+�y�)�;� �}���¡B��k����������M����� ������E����������k��������������C���������G������™�þ����C��������g�����������c��������g������™�þ���c��������g�����������c��������g������™�þ ���c��������g������™�þ ���c��������C�������C������� g� ����ÿ��þ��� c� ������� g� �����™�þ ��� c� ������� g� ����ÿ��þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������ª,���Ó�������������������������������������ó���à�����������������Ÿ���������¨���Type definitions�Ÿ��������¨K���struct ILst<`r1,`r2> { int@`r1 hd; struct ILst<`r1,`r2> *`r2 tl; }; ��¡ ��L���������� ����C��������g�����ÿ��þ���C������� g� ����ÿ��þ ���C�������g�����ÿ��þ���C�������g�����ÿ��þ��� C� ������$g�$����ÿ��þ���(C�(������,g�,����ÿ��þ ���0C�0�������0���0��ó���á���������� ��������Ÿ���������¨���Region subtyping�Ÿ�������� Ò��I�f� �p� �p�o�i�n�t�s� �t�o� �a�n� �i�n�t� �i�n� �a� �r�e�g�i�o�n� �w�i�t�h� �n�a�m�e� �`�r�1�,� �i�s� �i�t� �e�v�e�r� �s�o�u�n�d� �t�o� �g�i�v�e� �p� �t�y�p�e� �i�n�t�*�`�r�2�?� � �I�f� �s�o�,� �l�e�t� � �i�n�t�*�`�r�1� �<� �i�n�t�*�`�r�2� � �R�e�g�i�o�n� �s�u�b�t�y�p�i�n�g� �i�s� �t�h�e� �o�u�t�l�i�v�e�s� �r�e�l�a�t�i�o�n�s�h�i�p� � � �{�r�e�g�i�o�n� �r�1�;� �& �{�r�e�g�i�o�n� �r�2�;� �& }� �& �}� � �L�I�F�O� �m�a�k�e�s� �s�u�b�t�y�p�i�n�g� �c�o�m�m�o�n� � ���¡$��[����������M�������������������!����������������������������������������������������������������������������������������g�����ÿ��þ������������������������� g� ����ÿ��þ����� ����������C�������g�����ÿ��þ���o�����ÿ��þçÿ���G����������C�������g�����ÿ��þ���n����ÿ��þçÿ���o�����ÿ��þçÿ���� B�� ������ F�� ��������� B�� ��$��� C� ������� B�� ����� C� ������ � ���ª>���ª���������������������� ��������������� �������� ���������ó���â����������"��������Ÿ���������¨���Regions evaluation��ª���������� ����������������Ÿ�������� Æ��L�I�F�O� �r�e�g�i�o�n�s� �g�o�o�d� �f�o�r� �s�o�m�e� �i�d�i�o�m�s� �a�w�k�w�a�r�d� �i�n� �C� �R�e�g�i�o�n�s� �g�e�n�e�r�a�l�i�z�e� �s�t�a�c�k� �v�a�r�i�a�b�l�e�s� �a�n�d� �t�h�e� �h�e�a�p� �D�e�f�a�u�l�t�s� �a�n�d� �i�n�f�e�r�e�n�c�e� �m�a�k�e� �i�t� �s�u�r�p�r�i�s�i�n�g�l�y� �p�a�l�a�t�a�b�l�e� �W�o�r�s�t� �p�a�r�t�:� �d�e�f�i�n�i�n�g� �r�e�g�i�o�n�-�a�l�l�o�c�a�t�e�d� �d�a�t�a� �s�t�r�u�c�t�u�r�e�s� �C�y�c�l�o�n�e� �a�c�t�u�a�l�l�y� �h�a�s� �m�u�c�h� �m�o�r�e� �[�I�S�M�M� �0�4�]� �N�o�n�-�L�I�F�O� �r�e�g�i�o�n�s� � U�n�i�q�u�e� �p�o�i�n�t�e�r�s� �E�x�p�l�i�c�i�t�l�y� �r�e�f�e�r�e�n�c�e�-�c�o�u�n�t�e�d� �p�o�i�n�t�e�r�s� �A� � u�n�i�f�i�e�d� �s�y�s�t�e�m� ,� �n�o�t� �n� �s�u�b�l�a�n�g�a�g�e�s� ���¡’���/��������x�f���������6��������)���������p��������/�������f�������6�������������� �������a���� �� ���� � ����� �� ���ª���W������ ����������������ó���ã����������#��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�A�������(������� ���������� �������������������ó���ä����������$��������Ÿ���������¨���Other safety holes�Ÿ�������� J��A�r�r�a�y�s� �(�w�h�a�t� �o�r� �w�h�e�r�e� �i�s� �t�h�e� �s�i�z�e�)� �O�p�t�i�o�n�s�:� �d�y�n�a�m�i�c� �b�o�u�n�d�,� �i�n� �a� �f�i�e�l�d�/�v�a�r�i�a�b�l�e�,� �c�o�m�p�i�l�e�-�t�i�m�e� �b�o�u�n�d�,� �s�p�e�c�i�a�l� �s�t�r�i�n�g� �s�u�p�p�o�r�t� �T�h�r�e�a�d�s� �(�a�v�o�i�d�i�n�g� �r�a�c�e�s�)� �v�a�p�o�r�w�a�r�e� �t�y�p�e� �s�y�s�t�e�m� �t�o� �e�n�f�o�r�c�e� �l�o�c�k�-�b�a�s�e�d� �m�u�t�u�a�l� �e�x�c�l�u�s�i�o�n� �C�a�s�t�s� �A�l�l�o�w� �o�n�l�y� � u�p� �c�a�s�t�s� �a�n�d� �c�a�s�t�s� �t�o� �n�u�m�b�e�r�s� �U�n�i�o�n�s� �C�h�e�c�k�e�d� �t�a�g�s� �o�r� �b�i�t�s�-�o�n�l�y� �f�i�e�l�d�s� �U�n�i�n�i�t�i�a�l�i�z�e�d� �d�a�t�a� �F�l�o�w� �a�n�a�l�y�s�i�s� �(�s�a�f�e�r� �a�n�d� �e�a�s�i�e�r� �t�h�a�n� �d�e�f�a�u�l�t� �i�n�i�t�i�a�l�i�z�e�r�s�)� �V�a�r�a�r�g�s� �(�s�a�f�e� �v�i�a� �c�h�a�n�g�e�d� �c�a�l�l�i�n�g� �c�o�n�v�e�n�t�i�o�n�)���¡î���#���������X�����������������=�����������������+�����������������!�����������������;��������.���������#�������X��������������=��������������+����������� �� �!���� �� ��������;�������.���������ª>��� ��������������������� �������A��������������'���������ó���å����������%��������Ÿ���������¨���And modern conveniences�Ÿ�������� æ��3�0� �y�e�a�r�s� �a�f�t�e�r� �C�,� �s�o�m�e� �t�h�i�n�g�s� �a�r�e� �w�o�r�t�h� �a�d�d�i�n�g�& � �T�a�g�g�e�d� �u�n�i�o�n�s� �a�n�d� �p�a�t�t�e�r�n� �m�a�t�c�h�i�n�g� �o�n� �t�h�e�m� �I�n�t�r�a�p�r�o�c�e�d�u�r�a�l� �t�y�p�e� �i�n�f�e�r�e�n�c�e� �T�u�p�l�e�s� �(�l�i�k�e� �a�n�o�n�y�m�o�u�s� �s�t�r�u�c�t�s�)� �E�x�c�e�p�t�i�o�n�s� �S�t�r�u�c�t� �a�n�d� �a�r�r�a�y� �i�n�i�t�i�a�l�i�z�e�r�s� �N�a�m�e�s�p�a�c�e�s� �n�e�w� �f�o�r� �a�l�l�o�c�a�t�i�o�n� �+� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� ���¡Z���0�������������������x�Ã���������0������������� �ž���������������"���������ª>���{���������������������������� ��������������H���������ó���ê����������&��������Ÿ���������¨���Plenty of work remains�Ÿ��������¨Ó���Common limitations: Aliasing Arithmetic Unportable assumptions (But interoperating with C is much simpler than in a HLL) Big challenge for next generation: guarantees beyond fail-safe (i.e., graceful abort)��¡X�������������,���������:�������������������Y����������^��������������r���������ª���(������� �������¢���������ó���Ï������������������Ÿ���������¨���Related work: making C safer�Ÿ�������� Ê��C�o�m�p�i�l�e� �t�o� �m�a�k�e� �d�y�n�a�m�i�c� �c�h�e�c�k�s� �p�o�s�s�i�b�l�e� �S�a�f�e�-�C� �[�A�u�s�t�i�n� �e�t� �a�l�.�]�,� �R�T�C� �[�Y�o�n�g�/�H�o�r�w�i�t�z�]�,� �.�.�.� �P�u�r�i�f�y�,� �S�t�a�c�k�g�u�a�r�d�,� �E�l�e�c�t�r�i�c� �F�e�n�c�e�,� �& �C�C�u�r�e�d� �[�N�e�c�u�l�a� �e�t� �a�l�.�]� �p�e�r�f�o�r�m�a�n�c�e� �v�i�a� �w�h�o�l�e�-�p�r�o�g�r�a�m� �a�n�a�l�y�s�i�s� �l�e�s�s� �u�s�e�r� �b�u�r�d�e�n� �l�e�s�s� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t�,� �s�i�n�g�l�e�-�t�h�r�e�a�d�e�d� � �C�o�n�t�r�o�l�-�C� �[�A�d�v�e� �e�t� �a�l�.�]� �w�e�a�k�e�r� �g�u�a�r�a�n�t�y�,� �l�e�s�s� �b�u�r�d�e�n� � �S�F�I� �[�W�a�h�b�e�,� �S�m�a�l�l�,� �.�.�.�]�:� �s�a�n�d�b�o�x�i�n�g� �v�i�a� �b�i�n�a�r�y� �r�e�w�r�i�t�i�n�g� ���¡ð���(��������Z�m�������Z�`�������Z�p��������Z����������Z�(�����������������������������������1��������������`������� ���� �� ����� �� ����� �� ����� �� ����� �� ����� �� �#���� �� ���ª>���@���������������ž�����������������������������a���������ó���í����������*��������Ÿ���������¨���Related Work: Checking C code�Ÿ�������� `��M�o�d�e�l�-�c�h�e�c�k�i�n�g� �C� �c�o�d�e� �(�S�L�A�M�,� �B�L�A�S�T�,� �& )� �L�e�v�e�r�a�g�e�s� �s�c�a�l�a�b�i�l�i�t�y� �o�f� �M�C� �K�e�y� �i�s� �a�u�t�o�m�a�t�i�c� �b�u�i�l�d�i�n�g� �a�n�d� �r�e�f�i�n�i�n�g� �o�f� �m�o�d�e�l� �A�s�s�u�m�e�s� �(�w�e�a�k�)� �m�e�m�o�r�y� �s�a�f�e�t�y� �L�i�n�t�-�l�i�k�e� �t�o�o�l�s� �(�S�p�l�i�n�t�,� �M�e�t�a�l�,� �P�r�e�F�I�X�,� �& )� �G�o�o�d� �a�t� �r�e�d�u�c�i�n�g� �f�a�l�s�e� �p�o�s�i�t�i�v�e�s� �C�a�n�n�o�t� �e�n�s�u�r�e� �a�b�s�e�n�c�e� �o�f� �b�u�g�s� �M�e�t�a�l� �p�a�r�t�i�c�u�l�a�r�l�y� �g�o�o�d� �f�o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� �C�q�u�a�l� �(�u�s�e�r�-�d�e�f�i�n�e�d� �q�u�a�l�i�f�i�e�r�s�,� �l�o�t�s� �o�f� �i�n�f�e�r�e�n�c�e�)� � �B�e�t�t�e�r� �f�o�r� �u�n�c�h�a�n�g�e�a�b�l�e� �c�o�d�e� �o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� � �(�i�.�e�.�,� �t�h�e�y� r�e� �c�o�m�p�l�e�m�e�n�t�a�r�y�)���¡Î���'��������Z�i�������Z�+��������Z�o�������Z�4��������Z�S����������Z�'�������L���������������������+�������!������������H�������3������������� �S����������ªP���s���������������6��������������t��������������,���������������T���������ó���ð����������,��������Ÿ���������¨���Related work: higher and lower�Ÿ�������� ¸��A�d�a�p�t�e�d�/�e�x�t�e�n�d�e�d� �i�d�e�a�s�:� �p�o�l�y�m�o�r�p�h�i�s�m� �[�M�L�,� �H�a�s�k�e�l�l�,� �& ]� �r�e�g�i�o�n�s� �[�T�o�f�t�e�/�T�a�l�p�i�n�,� �W�a�l�k�e�r� �e�t� �a�l�.�,� �& ]� �s�a�f�e�t�y� �v�i�a� �d�a�t�a�f�l�o�w� �[�J�a�v�a�,� �& ]� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e�s� �[�M�i�t�c�h�e�l�l�/�P�l�o�t�k�i�n�,� �& ]� �c�o�n�t�r�o�l�l�i�n�g� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �[�A�d�a�,� �M�o�d�u�l�a�-�3�,� �& ]� � �S�a�f�e� �l�o�w�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e�s� �[�T�A�L�,� �P�C�C�,� �& ]� �e�n�g�i�n�e�e�r�e�d� �f�o�r� �m�a�c�h�i�n�e�-�g�e�n�e�r�a�t�e�d� �c�o�d�e� � �V�a�u�l�t�:� �s�t�r�o�n�g�e�r� �p�r�o�p�e�r�t�i�e�s� �v�i�a� �r�e�s�t�r�i�c�t�e�d� �a�l�i�a�s�i�n�g� ���¡€������������Á��������)���������'��������4����������������À��������������)�������&��������������4���������ó���Ñ������������������Ÿ���������¨���Summary�Ÿ�������� ò��C�y�c�l�o�n�e�:� �a� �s�a�f�e� �l�a�n�g�u�a�g�e� �a�t� �t�h�e� �C�-�l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� � �S�y�n�e�r�g�i�s�t�i�c� �c�o�m�b�i�n�a�t�i�o�n� �o�f� �t�y�p�e�s�,� �f�l�o�w� �a�n�a�l�y�s�i�s�,� �a�n�d� �r�u�n�-�t�i�m�e� �c�h�e�c�k�s� � �A� �r�e�a�l� �c�o�m�p�i�l�e�r� �a�n�d� �p�r�o�t�o�t�y�p�e� �a�p�p�l�i�c�a�t�i�o�n�s� � �P�r�o�p�e�r�t�i�e�s� �l�i�k�e� � n�o�t� �N�U�L�L� ,� � h�a�s� �l�o�n�g�e�r� �l�i�f�e�t�i�m�e� ,� � h�a�s� �a�r�r�a�y� �l�e�n�g�t�h� & �n�o�w� �i�n� �t�h�e� �l�a�n�g�u�a�g�e� �a�n�d� �c�h�e�c�k�e�d� � �E�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y� �w�i�t�h� �C� �a�l�l�o�w� �s�m�o�o�t�h� �a�n�d� �i�n�c�r�e�m�e�n�t�a�l� �m�o�v�e� �t�o�w�a�r�d� �m�e�m�o�r�y� �s�a�f�e�t�y� � �i�n� �t�h�e�o�r�y� �a�t� �l�e�a�s�t���¡z���g����������������7������������� �E������������� �+������������� �g������������� �U����������������ó���î����������)��������Ÿ���������¨ ���Availability�Ÿ��������  ��L�i�k�e� �a�n�y� �l�a�n�g�u�a�g�e�,� �y�o�u� �h�a�v�e� �t�o� � k�i�c�k� �t�h�e� �t�i�r�e�s� :� �w�w�w�.�r�e�s�e�a�r�c�h�.�a�t�t�.�c�o�m�/�p�r�o�j�e�c�t�s�/�c�y�c�l�o�n�e� � �A�l�s�o� �s�e�e�:� �J�a�n�.� �2�0�0�5� �C�/�C�+�+� �U�s�e�r� s� �J�o�u�r�n�a�l� �U�S�E�N�I�X� �2�0�0�2� � �C�o�n�v�e�r�s�e�l�y�,� �I� �w�a�n�t� �t�o� �k�n�o�w� �N�A�S�A� s� �C�-�l�e�v�e�l� �c�o�d�e� �n�e�e�d�s� �M�a�y�b�e� �i�d�e�a�s� �f�r�o�m� �C�y�c�l�o�n�e� �w�i�l�l� �h�e�l�p� �M�a�y�b�e� �n�o�t� �E�i�t�h�e�r� �w�a�y� �w�o�u�l�d� �b�e� �f�a�s�c�i�n�a�t�i�n�g� ���¡¢���1����������'���������� ����������+�����������������5����������-���������!����������1�������%�������Ì�fþ������� �������+�������„���������ª���1��������������Ì���������ó���æ������������������Ÿ���������¨��� �Ÿ�������� r���[�P�r�e�s�e�n�t�a�t�i�o�n� �e�n�d�s� �h�e�r�e� � � � �s�o�m�e� �a�u�x�i�l�i�a�r�y� �s�l�i�d�e�s� �f�o�l�l�o�w�]���¡���:����������:���������ó���ç������������������Ÿ���������¨���Example in Cyclone�Ÿ��������¨Ž���void f(int@{`j} p, tag_t<`i> i, int v ; `i < `j){ p[i] = v; } Note: regions and locks use implicit defaults (live and accessible)��¡Ì���I�������������������E���������������������������™�þ���������������������������ÿ3�þ ����������������ÿ3�þ�������� ��������ÿ3�þ��������F���������ª,�����������������"��������������R���������ó���ô����������0��������Ÿ���������¨���Some other problems�Ÿ�������� \��O�n�e� �s�a�f�e�t�y� �v�i�o�l�a�t�i�o�n� �t�y�p�i�c�a�l�l�y� �r�e�n�d�e�r�s� �a�l�l� �p�r�o�g�r�a�m� �p�r�o�p�e�r�t�i�e�s� �p�o�t�e�n�t�i�a�l�l�y� �i�r�r�e�l�e�v�a�n�t� � �S�o� �p�r�o�h�i�b�i�t�:� � � � �i�n�c�o�r�r�e�c�t� �c�a�s�t�s�,� �a�r�r�a�y�-�b�o�u�n�d�s� �v�i�o�l�a�t�i�o�n�s�,� �m�i�s�u�s�e�d� �u�n�i�o�n�s�,� �u�n�i�n�i�t�i�a�l�i�z�e�d� �p�o�i�n�t�e�r�s�,� �d�a�n�g�l�i�n�g� �p�o�i�n�t�e�r�s�,� �n�u�l�l�-�p�o�i�n�t�e�r� �d�e�r�e�f�e�r�e�n�c�e�s�,� �d�a�n�g�l�i�n�g� �l�o�n�g�j�m�p�,� �v�a�r�a�r�g� �m�i�s�m�a�t�c�h�,� �n�o�t� �r�e�t�u�r�n�i�n�g� �p�o�i�n�t�e�r�s�,� �d�a�t�a� �r�a�c�e�s�,� �& ��¡,���d��������Z�Ë��������Z�d�������Ë�������/�ð¨�����ó���^�������������������ó���Å�����������%��������ó���Ð�����������&��������ó���è�����������'��������ó���é�����������(��������ó���ï�����������)�������P������ÿÿÿ�������������������������������������������������������������������������ê�����î<���ï������ ��������€���������ù���P��������Ø�� ”���ðŒ��Ð�ð������ ��ð$���ð(���� ð�������������������� ð���� �����ðr���� ð��� � ��S� ð�������€�´\Œ¿���ÿ��� ����ð���À�°Ð�ð�����à ������� �Œ� ð �����ž��������ðr���� ð��� � ��S� ð�������€�p]Œ¿���ÿ��� ����ð���ð°Ð��ð�����à �������Œ� ð �����ž�������ðH���� ð��� �� ��ƒ� ð0������ƒ��“ŽŸ‹�”Þ½h�¿��ÿ��� ���?���ð ���ÿÿÿ�����€€€������̙�33Ì�ÌÌÿ�²²²��ˆ8����Š0�����º���_�_�_�P�P�T�1�0���‹�����ë.���óñÄ`Ö¦Á��r�����ð.�í��hº���õ���)��í�Ì.�¬¼����ô����C��èʅ���é(���€��à��8��Ø����� ������–���������òú��/�È ���0�Ò�������Õ0����·D���T�i�m�e�s� �N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0����·D���A�r�i�a�l���N�e�w� �R�o�m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�" �·D���C�o�u�r�i�e�r� �N�e�w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0�10�·D���W�i�n�g�d�i�n�g�s���w���m�a�n���œ©Ñ�´Õ�œÕ�ì 0�������´Õ�Wo 0��¤ ���€�`���ÿÿÿÿ��¥ ������.�������© ������� ��@�£n����ÿý?���" ��d�������d���������@�������ÿÿï�����ÿÿÿÿÿÿ���������  �������@@�������``�������€€�����  ����ðü����ð€��@���u��.�������/������������� ������ �������������/����������������������������������������������������������������������������������������������������������������������7�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Z�������M������������������������������������������������������������������������������������������)�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������*��������������������������������������@�������“����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������1������������������������������������������������������������������†��������������8�������0�������c��������������������� ������� ���������������������������� ������� �������������� ������� ���������������������������������������������������������������/�������/��������������2������� ������������������������������������������ ���������������� ������������� �����������������������������������������������$���3���������)����������������������-������0�����������������������:���1�������������������������������������������3������ ����������������������������������!���#���"������#������$������%������&������'������������(������)������*������+������,������ ������2������ ������������.�������������/�������������������������������ƒ� ð0�����ƒ���†A����¿��À��ÅA����ÿ����p�ñ���ÿ3���™���Ìf�Ì�f�ÿ™ÿ�ÿf™�ÿ™��@�ñ���������÷���ð8�����ó���������������€������ó���������������€�����ÐÑ�����������ððn�ʚ;­”Ç�ʚ;���úg�����þ�������ý4���O���d���O���d���ì 0�������¨Õ���������¤þÿÿ¬ÿÿÿ���p�û�������p��p�û������@ ���<�����ý4���!���d���!���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���d���d���d���d���® 0dÙ�����ˆªÑ��������������������<�����ý4���B���d���B���d���® 0dÙ�����ˆªÑ�������������������ÿ����� ���������������ˆN���Š0�����º���_�_�_�P�P�T�1�0���‹����� ����À���À���Š����º���_�_�_�P�P�T�9���‹ð����®è����¯����������¬`�����������������€ÿÿ�����������������������€ÿÿ�����������������������€ÿÿ����������������������¯����������¬X�����������������������������€ÿÿ����������������������������������������������������������?�Ùd�����Ú�����-���º���1�1� �J�a�n�u�a�r�y� �2�0�0�5� �º*���D�a�n� �G�r�o�s�s�m�a�n�:� �C�y�c�l�o�n�e�O�Ù �����Ú�����=��ðÛu����ó����������������������Ÿ��������¨4���Cyclone: A Memory-Safe C-Level Programming Language ��¡"���5���������3������ �Ì�fþ��������Ÿ��������¨¬���Dan Grossman University of Washington Joint work with: Trevor Jim AT&T Research Greg Morrisett Harvard University Michael Hicks University of Maryland��¡:���'���������†������(������&�������Ì�fþ�������†���������ó���Â������������������Ÿ���������¨���A safe C-level language�Ÿ��������¨ �� Cyclone is a programming language and compiler aimed at safe systems programming C is not memory safe: void f(int* p, int i, int v) { p[i] = v; } Address p+i might hold important data or code Memory safety is crucial for reasoning about programs ��¡Š��S�������������������9�������������������h���������:�����������������ÿ3�þ�����������������ÿ3�þ������ � ������� �������������������� ��������������™�þ�������������™�þ�������������™�þ�������������™�þ����������� � �������������$������������� �6����������������ó���Ã������������������Ÿ��������� "���C�a�l�l�e�r� s� �p�r�o�b�l�e�m�?���ª�������������������Ÿ��������¨Ã��� void g(void**, void*); int y = 0; int *z = &y; g(&z,0xBAD); *z = 123; Might be safe, but not if g does *x=y Type of g enough for code generation Type of g not enough for safety checking��¡$��N����� ������v������ ���������������������™�þ���������������������������������™�þ �����������������™�þ!�����������������������������������������������������%��������������������������������������ª>��� ������� ��������s���������������&��������������� ���������ó���ë����������'��������Ÿ���������¨���Safe low-level systems�Ÿ��������¨8��For a safety guarantee today, use YFHLL Your Favorite High Level Language YFHLL provides safety in part via: hidden data fields and run-time checks automatic memory management Data representation and resource management are essential aspects of low-level systems There are strong reasons for C-like languages��¡Œ��(���������#����������#���������D����$�������Y���������.����������(��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������#��������������ÿ3�þ!������� �������ÿ3�þ��������������0������� �������ÿ3�þ���������������������-�����������������ó���ì����������(��������Ÿ���������¨���Some insufficient approaches�Ÿ�������� ®��C�o�m�p�i�l�e� �C� �w�i�t�h� �e�x�t�r�a� �i�n�f�o�r�m�a�t�i�o�n� �t�y�p�e� �f�i�e�l�d�s�,� �s�i�z�e� �f�i�e�l�d�s�,� �l�i�v�e�-�p�o�i�n�t�e�r� �t�a�b�l�e�,� �& �t�r�e�a�t�s� �C� �a�s� �a� �h�i�g�h�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e� � �U�s�e� �s�t�a�t�i�c� �a�n�a�l�y�s�i�s� �v�e�r�y� �d�i�f�f�i�c�u�l�t� �l�e�s�s� �m�o�d�u�l�a�r� � �B�a�n� �u�n�s�a�f�e� �f�e�a�t�u�r�e�s� �t�h�e�r�e� �a�r�e� �m�a�n�y� �y�o�u� �n�e�e�d� �t�h�e�m���¡–���!���������U������������������������������������������!�������T������������� ��������������������� ������������ �� ���ó���Ç������������������Ÿ���������¨���Cyclone in brief�Ÿ�������� *��A� �s�a�f�e�,� �c�o�n�v�e�n�i�e�n�t�,� �a�n�d� �m�o�d�e�r�n� �l�a�n�g�u�a�g�e� � �a�t� �t�h�e� �C� �l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� �S�a�f�e�:� �m�e�m�o�r�y� �s�a�f�e�t�y�,� �a�b�s�t�r�a�c�t� �t�y�p�e�s�,� �n�o� �c�o�r�e� �d�u�m�p�s� � �C�-�l�e�v�e�l�:� �u�s�e�r�-�c�o�n�t�r�o�l�l�e�d� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �a�n�d� �r�e�s�o�u�r�c�e� �m�a�n�a�g�e�m�e�n�t�,� �e�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y�,� � m�a�n�i�f�e�s�t� �c�o�s�t� � �C�o�n�v�e�n�i�e�n�t�:� �m�a�y� �n�e�e�d� �m�o�r�e� �t�y�p�e� �a�n�n�o�t�a�t�i�o�n�s�,� �b�u�t� �w�o�r�k� �h�a�r�d� �t�o� �a�v�o�i�d� �i�t� � �M�o�d�e�r�n�:� �a�d�d� �f�e�a�t�u�r�e�s� �t�o� �c�a�p�t�u�r�e� �c�o�m�m�o�n� �i�d�i�o�m�s� � � N�e�w� �c�o�d�e� �f�o�r� �l�e�g�a�c�y� �o�r� �i�n�h�e�r�e�n�t�l�y� �l�o�w�-�l�e�v�e�l� �s�y�s�t�e�m�s� ���¡ô���G����������Z��������Z�6����������Z���������Z�F�������ÿ��þ�������ÿ��þ����������.������������� �����������e������������� � ����������;������������� �����������'��������������6����������������ó���È������������������Ÿ���������¨���The plan from here�Ÿ�������� ê��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �B�e�n�c�h�m�a�r�k�s�,� �p�o�r�t�s��‚��ƒ��„��…��†��‡��ˆ��‰��Š��‹��Œ����Ž������‘��’��“��”��•��–��—��˜��™��š��›��œ����ž��Ÿ�� ��¡��¢��£��¤��¥��¦��§��¨��©��ª��«��¬��­��®��¯��°��±��²��³��´��µ��¶��·��¸��¹��º��»��¼��½��¾��¿��À��Á��Â��Ã��Ä��Å��Æ��Ç��È��É��Ê��Ë��Ì��Í��Î��Ï��Ð��Ñ��Ò��Ó��Ô��Õ��Ö��×��Ø��Ù��Ú��Û��Ü��Ý��Þ��ß��à��á��â��ã��ä��å��æ��ç��è��é��ê��ë��ì��í��î��ï��ð��ñ��ò��ó��ô��õ��þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ�,� �s�y�s�t�e�m�s�,� �c�o�m�p�i�l�e�r�,� �& �A�l�l� �o�n� �E�a�r�t�h� �s�o� �f�a�r� �Jð �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� � �R�e�a�l�l�y� � j�u�s�t� �a� �t�a�s�t�e� �o�f� �C�y�c�l�o�n�e���¡Â�����������Z�>�������Z�)��������Z�(�������Z�-��������Z�"����������Z��������<������������‚����������������������� ��������(�������-�������"����������ó���É������������������Ÿ���������¨���Status�Ÿ�������� ®�� �C�y�c�l�o�n�e� �r�e�a�l�l�y� �e�x�i�s�t�s� �(�e�x�c�e�p�t� �m�e�m�o�r�y�-�s�a�f�e� �t�h�r�e�a�d�s�)� � �>�1�5�0�K� �l�i�n�e�s� �o�f� �C�y�c�l�o�n�e� �c�o�d�e�,� �i�n�c�l�u�d�i�n�g� �t�h�e� �c�o�m�p�i�l�e�r� � �g�c�c� �b�a�c�k�-�e�n�d� �(�L�i�n�u�x�,� �C�y�g�w�i�n�,� �O�S�X�,� �M�i�n�d�s�t�o�r�m�,� �& )� � �U�s�e�r� s� �m�a�n�u�a�l�,� �m�a�i�l�i�n�g� �l�i�s�t�s�,� �& � �S�t�i�l�l� �a� �r�e�s�e�a�r�c�h� �v�e�h�i�c�l�e� � � ���¡À���4������������������¢������������������������3��������������4������������� �0������������� � ������������� �������������� �����������������ª���Œ������� �������?���������ó���Ê������������������Ÿ���������¨ ���Evaluation�Ÿ��������¨æ��� Is Cyclone like C? port code, measure source differences interface with C code (extend systems) What is the performance cost? port code, measure slowdown Is Cyclone good for low-level systems? write systems, ensure scalability ��¡Ê������������������’����" ��N�������������’����" ����������'�����’����" ��"�������������������������������N����������� �� ��������'�������"�����������������ó���Ë��������� ��������Ÿ���������¨���Code differences�Ÿ��������¨‹���Porting not automatic, but quite similar Many changes identify arrays and lengths Some changes incidental (absent prototypes, new keywords)��¡���Œ���������Œ���������ó���Ì��������� ��������Ÿ���������¨���Run-time performance�Ÿ��������¨Ð���RHLinux 7.1 (2.4.9), 1.0GHz PIII, 512MRAM, gcc2.96 -O3, glibc 2.2.4 Comparable to other safe languages to start C level provides important optimization opportunities Understanding the applications could help��¡L���E����������Œ���������D��������������,�������6����������*���������ó���Í���������� ��������Ÿ���������¨���Larger program: the compiler�Ÿ��������¨Ö��� Scalable compiler + libraries (80K lines) build in < 30secs Generic libraries (e.g., lists, hashtables) clients have no syntactic/performance cost Static safety helps exploit the C-level I use &x more than in C ��¡¼��� ���������4��������,���������,��������(����������������� �������3������������� �,�������+������������� �(����������� �� ���� � ������ �� ����� �� ���ó���Î���������� ��������Ÿ���������¨���Other projects�Ÿ��������¨o��Open Kernel Environment [Bos/Samwel, OPENARCH 02] MediaNet [Hicks et al, OPENARCH 03]: RBClick [Patel/Lepreau, OPENARCH 03] STP [Patel et al., SOSP 03] FPGA synthesis [Teifel/Manohar, ISACS 04] Maryland undergrad O/S course (geekOS) [2004] Windows device driver (6K lines) Only 100 lines left in C But unrecoverable failures & other kernel corruptions remain ��¡���������P�W�������P���������P��������������������� � ��������������������������� ��������������������� ��������������������� ��������������������� �'�������������������� �!����������W����������������ªt���������� �������������������������������������������������=��������������,��������������ƒ���������ó���Ò������������������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡z���A��������–�(�������–�-��������–�����������–�������������������������(�������-�������������������ó���Ó�����������������Ÿ���������¨���Not-null pointers�Ÿ��������ª �������������ó���Ô�����������������Ÿ���������¨���Example�Ÿ�������� ê��F�I�L�E�*� �f�o�p�e�n�(�c�o�n�s�t� �c�h�a�r�@�,� �c�o�n�s�t� �c�h�a�r�@�)�;� �i�n�t� �f�g�e�t�c�(�F�I�L�E�@�)�;� �i�n�t� �f�c�l�o�s�e�(�F�I�L�E�@�)�;� �v�o�i�d� �g�(�)� �{� � � �F�I�L�E�*� �f� �=� �f�o�p�e�n�(� f�o�o� ,� � r� )�;� � � �i�n�t� �c�;� � � �w�h�i�l�e�(�(�c� �=� �f�g�e�t�c�(�f�)�)� �!�=� �E�O�F�)� �{�& }� � � �f�c�l�o�s�e�(�f�)�;� �}� � �G�i�v�e�s� �w�a�r�n�i�n�g� �a�n�d� �i�n�s�e�r�t�s� �o�n�e� �n�u�l�l�-�c�h�e�c�k� �E�n�c�o�u�r�a�g�e�s� �a� �h�o�i�s�t�e�d� �c�h�e�c�k���¡Ü���±���������Z�E��������Z������������������™�þ �����������������™�þ �����������������™�þ�����������������™�þ �����������������™�þQ���������������D���������ª†���������� ������� ��������������� ���������������������� �������������� ��������������� �����������������������a���������ó���Õ�����������������Ÿ���������¨���A classic moral�Ÿ��������¨L���FILE* fopen(const char@, const char@); int fgetc(FILE@); int fclose(FILE@); ��¡„���M���������������������������™�þ �����������������™�þ �����������������™�þ �������������� ���ª,���1��������������� ������������������������ó���Ö����������!��������Ÿ���������¨���Key Design Principles in Action�Ÿ��������¨K��Types to express invariants Preconditions for arguments Properties of values in memory Flow analysis where helpful Lets users control explicit checks Soundness + aliasing limits usefulness Users control data representation Pointers are addresses unless user allows otherwise Often can interoperate with C more safely just via types��¡°�����������Z�;�������Z���������Z�J�������Z�"��������Z�4�������Z�9��������Z��������;��������������#�������'�����"�������4�������9���������ª$�����������R���������������ñ���������ó���ò���������.��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ó���������/��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ñ����������-��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�*�����������������(�������-�������������������ó���Ø�����������������Ÿ��������� (��� C�h�a�n�g�e� �v�o�i�d�*� �t�o� �`�a� ��¡:������������������������������������������������Ÿ��������¨•���struct Lst { void* hd; struct Lst* tl; }; struct Lst* map( void* f(void*), struct Lst*); struct Lst* append( struct Lst*, struct Lst*);��¡\���–����� ������;�����������������™�þ1�����������������™�þ!����������ó���Ù������������������Ÿ���������¨���Not much new here�Ÿ��������¨��Closer to C than C++, Java generics, ML, etc. Unlike functional languages, data representation may restrict `a to pointers, int why not structs? why not float? why int? Unlike templates, no code duplication or leaking implementations Unlike objects, no need to tag data��¡Ú���/����������S���������)�����������������f���������/�����"���N����"�������c���������"��������"�������c���������"�������c���������"�������� "�� ��f����"������ª���¦��������������i���������ó���Ú������������������Ÿ���������¨���Existential types�Ÿ�������� ��P�r�o�g�r�a�m�s� �n�e�e�d� �a� �w�a�y� �f�o�r� � c�a�l�l�-�b�a�c�k� �t�y�p�e�s�:� � � � � � �s�t�r�u�c�t� �T� �{� � � � � � �v�o�i�d� �(�*�f�)�(�v�o�i�d�*�,� �i�n�t�)�;� � � � � � �v�o�i�d�*� �e�n�v�;� � � �}�;� � �W�e� �u�s�e� �a�n� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e� �(�s�i�m�p�l�i�f�i�e�d�)�:� � � � � � � �s�t�r�u�c�t� �T� �{� �<�`�a�>� � � � � � �v�o�i�d� �(�@�f�)�(�`�a�,� �i�n�t�)�;� � � � � � �`�a� �e�n�v�;� � � �}�;� � �m�o�r�e� �C�-�l�e�v�e�l� �t�h�a�n� �b�a�k�e�d�-�i�n� �c�l�o�s�u�r�e�s�/�o�b�j�e�c�t�s� ���¡Œ��+��������Z�A����0����Z�����������Z�*��������Z�A����0����Z���,����8�����Z�����������Z�+�������������>�����������������������"���������� ������������ÿ��þ���g�����ÿ��þ���G����ÿ��þ���������g�����ÿ3�þ ���������g�����ÿ3�þ ������������,��� � �������"�����ó���Û�����������������Ÿ���������¨���Regions�Ÿ��������  ��a�.�k�.�a�.� �z�o�n�e�s�,� �a�r�e�n�a�s�,� �& � �E�v�e�r�y� �o�b�j�e�c�t� �i�s� �i�n� �e�x�a�c�t�l�y� �o�n�e� �r�e�g�i�o�n� � �A�l�l�o�c�a�t�i�o�n� �v�i�a� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �D�e�a�l�l�o�c�a�t�e� �a�n� �e�n�t�i�r�e� �r�e�g�i�o�n� � �s�i�m�u�l�t�a�n�e�o�u�s�l�y� � � �(�c�a�n�n�o�t� �f�r�e�e� �a�n� �o�b�j�e�c�t�)� � �O�l�d� �i�d�e�a� �w�i�t�h� �r�e�c�e�n�t� �s�u�p�p�o�r�t� �i�n� �l�a�n�g�u�a�g�e�s� �(�e�.�g�.�,� �R�C�,� �R�T�S�J�)� � �a�n�d� �i�m�p�l�e�m�e�n�t�a�t�i�o�n�s� �(�e�.�g�.�,� �M�L� �K�i�t�)���¡²���|��������Z�*���������Z���������Z�_����������Z���������������&����������������������������7��������������� ��������������_������������ª>���`�������F�����������������������.������� ��������%���������ó���Ü������������������Ÿ���������¨���Cyclone regions [PLDI 02]��¡������������������� ��������Ÿ�������� œ��h�e�a�p� �r�e�g�i�o�n�:� �o�n�e�,� �l�i�v�e�s� �f�o�r�e�v�e�r�,� �c�o�n�s�e�r�v�a�t�i�v�e�l�y� �G�C� d� �s�t�a�c�k� �r�e�g�i�o�n�s�:� �c�o�r�r�e�s�p�o�n�d� �t�o� �l�o�c�a�l�-�d�e�c�l�a�r�a�t�i�o�n� �b�l�o�c�k�s�:� � �{�i�n�t� �x�;� �i�n�t� �y�;� �s�}� �g�r�o�w�a�b�l�e� �r�e�g�i�o�n�s�:� �s�c�o�p�e�d� �l�i�f�e�t�i�m�e�,� �b�u�t� �g�r�o�w�a�b�l�e�:� � � � �{�r�e�g�i�o�n� �r�;� �s�}� � �a�l�l�o�c�a�t�i�o�n� �r�o�u�t�i�n�e�s� �t�a�k�e� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �h�a�n�d�l�e�s� �a�r�e� �f�i�r�s�t�-�c�l�a�s�s� �c�a�l�l�e�r� �d�e�c�i�d�e�s� �w�h�e�r�e�,� �c�a�l�l�e�e� �d�e�c�i�d�e�s� �h�o�w� �m�u�c�h� �n�o� �h�a�n�d�l�e�s� �f�o�r� �s�t�a�c�k� �r�e�g�i�o�n�s���¡Ž��m�������������������4����������������������������B������ ����K�������� ����������(�����������������*������������������������™�þ�����������������™�þ����������������������������������#������������������������™�þ������������������������"�������������������.�������ÿ3�þ���������ªb������������������,����������������������������������������������������1��������\���������ó���Ý�����������������Ÿ��������� (���T�h�a�t� s� �t�h�e� �e�a�s�y� �p�a�r�t��Ÿ��������¨c���The implementation is really simple because the type system statically prevents dangling pointers ��¡h���d���������������������������������������� ���������������������������ÿ��þ��ó���Þ������������������Ÿ���������¨���The big restriction�Ÿ�������� Î��A�n�n�o�t�a�t�e� �a�l�l� �p�o�i�n�t�e�r� �t�y�p�e�s� �w�i�t�h� �a� �r�e�g�i�o�n� �n�a�m�e� �(�a� �t�y�p�e� �v�a�r�i�a�b�l�e� �o�f� �r�e�g�i�o�n� �k�i�n�d�)� � �i�n�t�@�`�r� �m�e�a�n�s� � p�o�i�n�t�e�r� �i�n�t�o� �t�h�e� �r�e�g�i�o�n� �c�r�e�a�t�e�d� �b�y� �t�h�e� �c�o�n�s�t�r�u�c�t� �t�h�a�t� �i�n�t�r�o�d�u�c�e�s� �`�r� �h�e�a�p� �i�n�t�r�o�d�u�c�e�s� �`�H� � �L�:�& �i�n�t�r�o�d�u�c�e�s� �`�L� �{�r�e�g�i�o�n� �r�;� �s�}� �i�n�t�r�o�d�u�c�e�s� �`�r� � �r� �h�a�s� �t�y�p�e� �r�e�g�i�o�n�_�t�<�`�r�>� � �c�o�m�p�i�l�e�-�t�i�m�e� �c�h�e�c�k�:� �o�n�l�y� �l�i�v�e� �r�e�g�i�o�n�s� �a�r�e� �a�c�c�e�s�s�e�d� �b�y� �d�e�f�a�u�l�t�,� �f�u�n�c�t�i�o�n� �a�r�g�u�m�e�n�t�s� �p�o�i�n�t� �t�o� �l�i�v�e� �r�e�g�i�o�n�s� ���¡��P���������S�����$�������B����²���� �������������3���������5�����������������"������� ����������"������������� ����G����������g��������I����"�������c���������"��������b��������c���������"�������c����� ����"���� ���c��������g������™�þ���c����� ����"�������c���������"�������� "�� ����� c� ���� ���� "�� �� ��� c� ������� c� ��� �3����b�����5����b��������c�������ªP���¡���������������'������������������������������'�������j�����������������ó���ß������������������Ÿ���������¨���Region polymorphism�Ÿ�������� ø��A�p�p�l�y� �w�h�a�t� �w�e� �d�i�d� �f�o�r� �t�y�p�e� �v�a�r�i�a�b�l�e�s� �t�o� �r�e�g�i�o�n� �n�a�m�e�s� �(�o�n�l�y� �i�t� s� �m�o�r�e� �i�m�p�o�r�t�a�n�t� �a�n�d� �c�o�u�l�d� �b�e� �m�o�r�e� �o�n�e�r�o�u�s�)� � �v�o�i�d� �s�w�a�p�(�i�n�t� �@�`�r�1� �x�,� �i�n�t� �@�`�r�2� �y�)�{� � � �i�n�t� �t�m�p� �=� �*�x�;� � � �*�x� �=� �*�y�;� � � �*�y� �=� �t�m�p�;� �}� � �i�n�t�@�`�r� �s�u�m�p�t�r�(�r�e�g�i�o�n�_�t�<�`�r�>� �r�,�i�n�t� �x�,�i�n�t� �y�)�{� � � �r�e�t�u�r�n� �r�n�e�w�(�r�)� �(�x�+�y�)�;� �}���¡B��k����������M����� ������E����������k��������������C���������G������™�þ����C��������g�����������c��������g������™�þ���c��������g�����������c��������g������™�þ ���c��������g������™�þ ���c��������C�������C������� g� ����ÿ��þ��� c� ������� g� �����™�þ ��� c� ������� g� ����ÿ��þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������ª,���Ó�������������������������������������ó���à�����������������Ÿ���������¨���Type definitions�Ÿ��������¨K���struct ILst<`r1,`r2> { int@`r1 hd; struct ILst<`r1,`r2> *`r2 tl; }; ��¡ ��L���������� ����C��������g�����ÿ��þ���C������� g� ����ÿ��þ ���C�������g�����ÿ��þ���C�������g�����ÿ��þ��� C� ������$g�$����ÿ��þ���(C�(������,g�,����ÿ��þ ���0C�0�������0���0��ó���á���������� ��������Ÿ���������¨���Region subtyping�Ÿ�������� Ò��I�f� �p� �p�o�i�n�t�s� �t�o� �a�n� �i�n�t� �i�n� �a� �r�e�g�i�o�n� �w�i�t�h� �n�a�m�e� �`�r�1�,� �i�s� �i�t� �e�v�e�r� �s�o�u�n�d� �t�o� �g�i�v�e� �p� �t�y�p�e� �i�n�t�*�`�r�2�?� � �I�f� �s�o�,� �l�e�t� � �i�n�t�*�`�r�1� �<� �i�n�t�*�`�r�2� � �R�e�g�i�o�n� �s�u�b�t�y�p�i�n�g� �i�s� �t�h�e� �o�u�t�l�i�v�e�s� �r�e�l�a�t�i�o�n�s�h�i�p� � � �{�r�e�g�i�o�n� �r�1�;� �& �{�r�e�g�i�o�n� �r�2�;� �& }� �& �}� � �L�I�F�O� �m�a�k�e�s� �s�u�b�t�y�p�i�n�g� �c�o�m�m�o�n� � ���¡$��[����������M�������������������!����������������������������������������������������������������������������������������g�����ÿ��þ������������������������� g� ����ÿ��þ����� ����������C�������g�����ÿ��þ���o�����ÿ��þçÿ���G����������C�������g�����ÿ��þ���n����ÿ��þçÿ���o�����ÿ��þçÿ���� B�� ������ F�� ��������� B�� ��$��� C� ������� B�� ����� C� ������ � ���ª>���ª���������������������� ��������������� �������� ���������ó���â����������"��������Ÿ���������¨���Regions evaluation��ª���������� ����������������Ÿ�������� Æ��L�I�F�O� �r�e�g�i�o�n�s� �g�o�o�d� �f�o�r� �s�o�m�e� �i�d�i�o�m�s� �a�w�k�w�a�r�d� �i�n� �C� �R�e�g�i�o�n�s� �g�e�n�e�r�a�l�i�z�e� �s�t�a�c�k� �v�a�r�i�a�b�l�e�s� �a�n�d� �t�h�e� �h�e�a�p� �D�e�f�a�u�l�t�s� �a�n�d� �i�n�f�e�r�e�n�c�e� �m�a�k�e� �i�t� �s�u�r�p�r�i�s�i�n�g�l�y� �p�a�l�a�t�a�b�l�e� �W�o�r�s�t� �p�a�r�t�:� �d�e�f�i�n�i�n�g� �r�e�g�i�o�n�-�a�l�l�o�c�a�t�e�d� �d�a�t�a� �s�t�r�u�c�t�u�r�e�s� �C�y�c�l�o�n�e� �a�c�t�u�a�l�l�y� �h�a�s� �m�u�c�h� �m�o�r�e� �[�I�S�M�M� �0�4�]� �N�o�n�-�L�I�F�O� �r�e�g�i�o�n�s� � U�n�i�q�u�e� �p�o�i�n�t�e�r�s� �E�x�p�l�i�c�i�t�l�y� �r�e�f�e�r�e�n�c�e�-�c�o�u�n�t�e�d� �p�o�i�n�t�e�r�s� �A� � u�n�i�f�i�e�d� �s�y�s�t�e�m� ,� �n�o�t� �n� �s�u�b�l�a�n�g�a�g�e�s� ���¡’���/��������x�f���������6��������)���������p��������/�������f�������6�������������� �������a���� �� ���� � ����� �� ���ª���W������ ����������������ó���ã����������#��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�A�������(������� ���������� �������������������ó���ä����������$��������Ÿ���������¨���Other safety holes�Ÿ�������� J��A�r�r�a�y�s� �(�w�h�a�t� �o�r� �w�h�e�r�e� �i�s� �t�h�e� �s�i�z�e�)� �O�p�t�i�o�n�s�:� �d�y�n�a�m�i�c� �b�o�u�n�d�,� �i�n� �a� �f�i�e�l�d�/�v�a�r�i�a�b�l�e�,� �c�o�m�p�i�l�e�-�t�i�m�e� �b�o�u�n�d�,� �s�p�e�c�i�a�l� �s�t�r�i�n�g� �s�u�p�p�o�r�t� �T�h�r�e�a�d�s� �(�a�v�o�i�d�i�n�g� �r�a�c�e�s�)� �v�a�p�o�r�w�a�r�e� �t�y�p�e� �s�y�s�t�e�m� �t�o� �e�n�f�o�r�c�e� �l�o�c�k�-�b�a�s�e�d� �m�u�t�u�a�l� �e�x�c�l�u�s�i�o�n� �C�a�s�t�s� �A�l�l�o�w� �o�n�l�y� � u�p� �c�a�s�t�s� �a�n�d� �c�a�s�t�s� �t�o� �n�u�m�b�e�r�s� �U�n�i�o�n�s� �C�h�e�c�k�e�d� �t�a�g�s� �o�r� �b�i�t�s�-�o�n�l�y� �f�i�e�l�d�s� �U�n�i�n�i�t�i�a�l�i�z�e�d� �d�a�t�a� �F�l�o�w� �a�n�a�l�y�s�i�s� �(�s�a�f�e�r� �a�n�d� �e�a�s�i�e�r� �t�h�a�n� �d�e�f�a�u�l�t� �i�n�i�t�i�a�l�i�z�e�r�s�)� �V�a�r�a�r�g�s� �(�s�a�f�e� �v�i�a� �c�h�a�n�g�e�d� �c�a�l�l�i�n�g� �c�o�n�v�e�n�t�i�o�n�)���¡î���#���������X�����������������=�����������������+�����������������!�����������������;��������.���������#�������X��������������=��������������+����������� �� �!���� �� ��������;�������.���������ª>��� ��������������������� �������A��������������'���������ó���å����������%��������Ÿ���������¨���And modern conveniences�Ÿ�������� æ��3�0� �y�e�a�r�s� �a�f�t�e�r� �C�,� �s�o�m�e� �t�h�i�n�g�s� �a�r�e� �w�o�r�t�h� �a�d�d�i�n�g�& � �T�a�g�g�e�d� �u�n�i�o�n�s� �a�n�d� �p�a�t�t�e�r�n� �m�a�t�c�h�i�n�g� �o�n� �t�h�e�m� �I�n�t�r�a�p�r�o�c�e�d�u�r�a�l� �t�y�p�e� �i�n�f�e�r�e�n�c�e� �T�u�p�l�e�s� �(�l�i�k�e� �a�n�o�n�y�m�o�u�s� �s�t�r�u�c�t�s�)� �E�x�c�e�p�t�i�o�n�s� �S�t�r�u�c�t� �a�n�d� �a�r�r�a�y� �i�n�i�t�i�a�l�i�z�e�r�s� �N�a�m�e�s�p�a�c�e�s� �n�e�w� �f�o�r� �a�l�l�o�c�a�t�i�o�n� �+� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� ���¡Z���0�������������������x�Ã���������0������������� �ž���������������"���������ª>���{���������������������������� ��������������H���������ó���ê����������&��������Ÿ���������¨���Plenty of work remains�Ÿ��������¨Ó���Common limitations: Aliasing Arithmetic Unportable assumptions (But interoperating with C is much simpler than in a HLL) Big challenge for next generation: guarantees beyond fail-safe (i.e., graceful abort)��¡X�������������,���������:�������������������Y����������^��������������r���������ª���(������� �������¢���������ó���Ï������������������Ÿ���������¨���Related work: making C safer�Ÿ�������� Ê��C�o�m�p�i�l�e� �t�o� �m�a�k�e� �d�y�n�a�m�i�c� �c�h�e�c�k�s� �p�o�s�s�i�b�l�e� �S�a�f�e�-�C� �[�A�u�s�t�i�n� �e�t� �a�l�.�]�,� �R�T�C� �[�Y�o�n�g�/�H�o�r�w�i�t�z�]�,� �.�.�.� �P�u�r�i�f�y�,� �S�t�a�c�k�g�u�a�r�d�,� �E�l�e�c�t�r�i�c� �F�e�n�c�e�,� �& �C�C�u�r�e�d� �[�N�e�c�u�l�a� �e�t� �a�l�.�]� �p�e�r�f�o�r�m�a�n�c�e� �v�i�a� �w�h�o�l�e�-�p�r�o�g�r�a�m� �a�n�a�l�y�s�i�s� �l�e�s�s� �u�s�e�r� �b�u�r�d�e�n� �l�e�s�s� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t�,� �s�i�n�g�l�e�-�t�h�r�e�a�d�e�d� � �C�o�n�t�r�o�l�-�C� �[�A�d�v�e� �e�t� �a�l�.�]� �w�e�a�k�e�r� �g�u�a�r�a�n�t�y�,� �l�e�s�s� �b�u�r�d�e�n� � �S�F�I� �[�W�a�h�b�e�,� �S�m�a�l�l�,� �.�.�.�]�:� �s�a�n�d�b�o�x�i�n�g� �v�i�a� �b�i�n�a�r�y� �r�e�w�r�i�t�i�n�g� ���¡ð���(��������Z�m�������Z�`�������Z�p��������Z����������Z�(�����������������������������������1��������������`������� ���� �� ����� �� ����� �� ����� �� ����� �� ����� �� �#���� �� ���ª>���@���������������ž�����������������������������a���������ó���í����������*��������Ÿ���������¨���Related Work: Checking C code�Ÿ�������� `��M�o�d�e�l�-�c�h�e�c�k�i�n�g� �C� �c�o�d�e� �(�S�L�A�M�,� �B�L�A�S�T�,� �& )� �L�e�v�e�r�a�g�e�s� �s�c�a�l�a�b�i�l�i�t�y� �o�f� �M�C� �K�e�y� �i�s� �a�u�t�o�m�a�t�i�c� �b�u�i�l�d�i�n�g� �a�n�d� �r�e�f�i�n�i�n�g� �o�f� �m�o�d�e�l� �A�s�s�u�m�e�s� �(�w�e�a�k�)� �m�e�m�o�r�y� �s�a�f�e�t�y� �L�i�n�t�-�l�i�k�e� �t�o�o�l�s� �(�S�p�l�i�n�t�,� �M�e�t�a�l�,� �P�r�e�F�I�X�,� �& )� �G�o�o�d� �a�t� �r�e�d�u�c�i�n�g� �f�a�l�s�e� �p�o�s�i�t�i�v�e�s� �C�a�n�n�o�t� �e�n�s�u�r�e� �a�b�s�e�n�c�e� �o�f� �b�u�g�s� �M�e�t�a�l� �p�a�r�t�i�c�u�l�a�r�l�y� �g�o�o�d� �f�o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� �C�q�u�a�l� �(�u�s�e�r�-�d�e�f�i�n�e�d� �q�u�a�l�i�f�i�e�r�s�,� �l�o�t�s� �o�f� �i�n�f�e�r�e�n�c�e�)� � �B�e�t�t�e�r� �f�o�r� �u�n�c�h�a�n�g�e�a�b�l�e� �c�o�d�e� �o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� � �(�i�.�e�.�,� �t�h�e�y� r�e� �c�o�m�p�l�e�m�e�n�t�a�r�y�)���¡Î���'��������Z�i�������Z�+��������Z�o�������Z�4��������Z�S����������Z�'�������L���������������������+�������!������������H�������3������������� �S����������ªP���s���������������6��������������t��������������,���������������T���������ó���ð����������,��������Ÿ���������¨���Related work: higher and lower�Ÿ�������� ¸��A�d�a�p�t�e�d�/�e�x�t�e�n�d�e�d� �i�d�e�a�s�:� �p�o�l�y�m�o�r�p�h�i�s�m� �[�M�L�,� �H�a�s�k�e�l�l�,� �& ]� �r�e�g�i�o�n�s� �[�T�o�f�t�e�/�T�a�l�p�i�n�,� �W�a�l�k�e�r� �e�t� �a�l�.�,� �& ]� �s�a�f�e�t�y� �v�i�a� �d�a�t�a�f�l�o�w� �[�J�a�v�a�,� �& ]� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e�s� �[�M�i�t�c�h�e�l�l�/�P�l�o�t�k�i�n�,� �& ]� �c�o�n�t�r�o�l�l�i�n�g� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �[�A�d�a�,� �M�o�d�u�l�a�-�3�,� �& ]� � �S�a�f�e� �l�o�w�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e�s� �[�T�A�L�,� �P�C�C�,� �& ]� �e�n�g�i�n�e�e�r�e�d� �f�o�r� �m�a�c�h�i�n�e�-�g�e�n�e�r�a�t�e�d� �c�o�d�e� � �V�a�u�l�t�:� �s�t�r�o�n�g�e�r� �p�r�o�p�e�r�t�i�e�s� �v�i�a� �r�e�s�t�r�i�c�t�e�d� �a�l�i�a�s�i�n�g� ���¡€������������Á��������)���������'��������4����������������À��������������)�������&��������������4���������ó���Ñ������������������Ÿ���������¨���Summary�Ÿ�������� ò��C�y�c�l�o�n�e�:� �a� �s�a�f�e� �l�a�n�g�u�a�g�e� �a�t� �t�h�e� �C�-�l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� � �S�y�n�e�r�g�i�s�t�i�c� �c�o�m�b�i�n�a�t�i�o�n� �o�f� �t�y�p�e�s�,� �f�l�o�w� �a�n�a�l�y�s�i�s�,� �a�n�d� �r�u�n�-�t�i�m�e� �c�h�e�c�k�s� � �A� �r�e�a�l� �c�o�m�p�i�l�e�r� �a�n�d� �p�r�o�t�o�t�y�p�e� �a�p�p�l�i�c�a�t�i�o�n�s� � �P�r�o�p�e�r�t�i�e�s� �l�i�k�e� � n�o�t� �N�U�L�L� ,� � h�a�s� �l�o�n�g�e�r� �l�i�f�e�t�i�m�e� ,� � h�a�s� �a�r�r�a�y� �l�e�n�g�t�h� & �n�o�w� �i�n� �t�h�e� �l�a�n�g�u�a�g�e� �a�n�d� �c�h�e�c�k�e�d� � �E�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y� �w�i�t�h� �C� �a�l�l�o�w� �s�m�o�o�t�h� �a�n�d� �i�n�c�r�e�m�e�n�t�a�l� �m�o�v�e� �t�o�w�a�r�d� �m�e�m�o�r�y� �s�a�f�e�t�y� � �i�n� �t�h�e�o�r�y� �a�t� �l�e�a�s�t���¡z���g����������������7������������� �E������������� �+������������� �g������������� �U����������������ó���î����������)��������Ÿ���������¨ ���Availability�Ÿ��������  ��L�i�k�e� �a�n�y� �l�a�n�g�u�a�g�e�,� �y�o�u� �h�a�v�e� �t�o� � k�i�c�k� �t�h�e� �t�i�r�e�s� :� �w�w�w�.�r�e�s�e�a�r�c�h�.�a�t�t�.�c�o�m�/�p�r�o�j�e�c�t�s�/�c�y�c�l�o�n�e� � �A�l�s�o� �s�e�e�:� �J�a�n�.� �2�0�0�5� �C�/�C�+�+� �U�s�e�r� s� �J�o�u�r�n�a�l� �U�S�E�N�I�X� �2�0�0�2� � �C�o�n�v�e�r�s�e�l�y�,� �I� �w�a�n�t� �t�o� �k�n�o�w� �N�A�S�A� s� �C�-�l�e�v�e�l� �c�o�d�e� �n�e�e�d�s� �M�a�y�b�e� �i�d�e�a�s� �f�r�o�m� �C�y�c�l�o�n�e� �w�i�l�l� �h�e�l�p� �M�a�y�b�e� �n�o�t� �E�i�t�h�e�r� �w�a�y� �w�o�u�l�d� �b�e� �f�a�s�c�i�n�a�t�i�n�g� ���¡¢���1����������'���������� ����������+�����������������5����������-���������!����������1�������%�������Ì�fþ������� �������+�������„���������ª���1��������������Ì�������/�ð¨�����ó���^�������������������ó���Å�����������%��������ó���Ð�����������&��������ó���è�����������'��������ó���é�����������(��������ó���ï�����������)�������P������ÿÿÿ�������������������������������������������������������������������������ê������r�����è¼���õ�������í�ļ�ºB����ô����C��èօ���é(���€��à��8��Ø����� ������–���������òú��/�È ���0�Ò�������Õ0����·D���T�i�m�e�s� �N�e�w� �R�o�m�a�n���äÓy´Õ�œÕ�ì 0�������´Õ�Wo 0����·D���A�r�i�a�l���N�e�w� �R�o�m�a�n���äÓy´Õ�œÕ�ì 0�������´Õ�Wo 0�" �·D���C�o�u�r�i�e�r� �N�e�w���m�a�n���äÓy´Õ�œÕ�ì 0�������´Õ�Wo 0�10�·D���W�i�n�g�d�i�n�g�s���w���m�a�n���äÓy´Õ�œÕ�ì 0�������´Õ�Wo 0��¤ ���€�`���ÿÿÿÿ��¥ ������.�������© ������� ��@�£n����ÿý?���" ��d�������d���������@�������ÿÿï�����ÿÿÿÿÿÿ���������  �������@@�������``�������€€�����  ����ðü����ð€��@���u��-�������/������������� ������ �������������/����������������������������������������������������������������������������������������������������������������������7�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Z�������M������������������������������������������������������������������������������������������)����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��������������������������������������@�������“����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������-������������������������������������������������������������������†��������������8�������0�������c��������������������� ������� ���������������������������� ������� �������������� ������� ���������������������������������������������������������������/�������/��������������2������� ������������������������������������������ ����������������+��������������������������������������� ������ ������ ������ ���$���3������ ���)���������������������������������������������������:���1�������������������������������������������3�������������������������������������������#��������������������������������� ������������ ������ ������ ������ ������������������2��������������������������������������������������������������ƒ� ð0�����ƒ���†A����¿��À��ÅA����ÿ����p�ñ���ÿ3���™���Ìf�Ì�f�ÿ™ÿ�ÿf™�ÿ™��@�ñ���������÷���ð8�����ó���������������€������ó���������������€�����ÐÝ�����������ððn�ʚ;­”Ç�ʚ;���úg�����þ�������ý4���O���d���O���d���ì 0�������¨Õ���������¤þÿÿ¬ÿÿÿ���p�û�������p��p�û������@ ���<�����ý4���!���d���!���d���® 0dÙ�����ÐÔy�������������������<�����ý4���d���d���d���d���® 0dÙ�����ÐÔy�������������������<�����ý4���B���d���B���d���® 0dÙ�����ÐÔy��������������������ÿ����� ���������������ˆZ���Š0�����º���_�_�_�P�P�T�1�0���‹����� ����À���À���Š����º���_�_�_�P�P�T�9���‹ü����®ô����¯����������¬l�����������������€ÿÿ�������������������������€ÿÿ�������������������������€ÿÿ������������������������¯����������¬X�����������������������������€ÿÿ����������������������������������������������������������?�Ùd�����Ú�����-���º���1�1� �J�a�n�u�a�r�y� �2�0�0�5� �º*���D�a�n� �G�r�o�s�s�m�a�n�:� �C�y�c�l�o�n�e�O�Ù �����Ú�����=��ðÛu����ó����������������������Ÿ��������¨4���Cyclone: A Memory-Safe C-Level Programming Language ��¡"���5���������3������ �Ì�fþ��������Ÿ��������¨¬���Dan Grossman University of Washington Joint work with: Trevor Jim AT&T Research Greg Morrisett Harvard University Michael Hicks University of Maryland��¡:���'���������†������(������&�������Ì�fþ�������†���������ó���Â������������������Ÿ���������¨���A safe C-level language�Ÿ��������¨ �� Cyclone is a programming language and compiler aimed at safe systems programming C is not memory safe: void f(int* p, int i, int v) { p[i] = v; } Address p+i might hold important data or code Memory safety is crucial for reasoning about programs ��¡Š��S�������������������9�������������������h���������:�����������������ÿ3�þ�����������������ÿ3�þ������ � ������� �������������������� ��������������™�þ�������������™�þ�������������™�þ�������������™�þ����������� � �������������$������������� �6����������������ó���Ã������������������Ÿ��������� "���C�a�l�l�e�r� s� �p�r�o�b�l�e�m�?���ª�������������������Ÿ��������¨Ã��� void g(void**, void*); int y = 0; int *z = &y; g(&z,0xBAD); *z = 123; Might be safe, but not if g does *x=y Type of g enough for code generation Type of g not enough for safety checking��¡$��N����� ������v������ ���������������������™�þ���������������������������������™�þ �����������������™�þ!�����������������������������������������������������%��������������������������������������ª>��� ������� ��������s���������������&��������������� ���������ó���ë����������'��������Ÿ���������¨���Safe low-level systems�Ÿ��������¨8��For a safety guarantee today, use YFHLL Your Favorite High Level Language YFHLL provides safety in part via: hidden data fields and run-time checks automatic memory management Data representation and resource management are essential aspects of low-level systems There are strong reasons for C-like languages��¡Œ��(���������#����������#���������D����$�������Y���������.����������(��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������Ì�fþ��������������#��������������ÿ3�þ!������� �������ÿ3�þ��������������0������� �������ÿ3�þ���������������������-�����������������ó���ì����������(��������Ÿ���������¨���Some insufficient approaches�Ÿ�������� ®��C�o�m�p�i�l�e� �C� �w�i�t�h� �e�x�t�r�a� �i�n�f�o�r�m�a�t�i�o�n� �t�y�p�e� �f�i�e�l�d�s�,� �s�i�z�e� �f�i�e�l�d�s�,� �l�i�v�e�-�p�o�i�n�t�e�r� �t�a�b�l�e�,� �& �t�r�e�a�t�s� �C� �a�s� �a� �h�i�g�h�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e� � �U�s�e� �s�t�a�t�i�c� �a�n�a�l�y�s�i�s� �v�e�r�y� �d�i�f�f�i�c�u�l�t� �l�e�s�s� �m�o�d�u�l�a�r� � �B�a�n� �u�n�s�a�f�e� �f�e�a�t�u�r�e�s� �t�h�e�r�e� �a�r�e� �m�a�n�y� �y�o�u� �n�e�e�d� �t�h�e�m���¡–���!���������U������������������������������������������!�������T������������� ��������������������� ������������ �� ���ó���Ç������������������Ÿ���������¨���Cyclone in brief�Ÿ�������� *��A� �s�a�f�e�,� �c�o�n�v�e�n�i�e�n�t�,� �a�n�d� �m�o�d�e�r�n� �l�a�n�g�u�a�g�e� � �a�t� �t�h�e� �C� �l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� �S�a�f�e�:� �m�e�m�o�r�y� �s�a�f�e�t�y�,� �a�b�s�t�r�a�c�t� �t�y�p�e�s�,� �n�o� �c�o�r�e� �d�u�m�p�s� � �C�-�l�e�v�e�l�:� �u�s�e�r�-�c�o�n�t�r�o�l�l�e�d� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �a�n�d� �r�e�s�o�u�r�c�e� �m�a�n�a�g�e�m�e�n�t�,� �e�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y�,� � m�a�n�i�f�e�s�t� �c�o�s�t� � �C�o�n�v�e�n�i�e�n�t�:� �m�a�y� �n�e�e�d� �m�o�r�e� �t�y�p�e� �a�n�n�o�t�a�t�i�o�n�s�,� �b�u�t� �w�o�r�k� �h�a�r�d� �t�o� �a�v�o�i�d� �i�t� � �M�o�d�e�r�n�:� �a�d�d� �f�e�a�t�u�r�e�s� �t�o� �c�a�p�t�u�r�e� �c�o�m�m�o�n� �i�d�i�o�m�s� � � N�e�w� �c�o�d�e� �f�o�r� �l�e�g�a�c�y� �o�r� �i�n�h�e�r�e�n�t�l�y� �l�o�w�-�l�e�v�e�l� �s�y�s�t�e�m�s� ���¡ô���G����������Z��������Z�6����������Z���������Z�F�������ÿ��þ�������ÿ��þ����������.������������� �����������e������������� � ����������;������������� �����������'��������������6����������������ó���È������������������Ÿ���������¨���The plan from here�Ÿ�������� ê��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �B�e�n�c�h�m�a�r�k�s�,� �p�o�r�t�s�,� �s�y�s�t�e�m�s�,� �c�o�m�p�i�l�e�r�,� �& �A�l�l� �o�n� �E�a�r�t�h� �s�o� �f�a�r� �Jð �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� � �R�e�a�l�l�y� � j�u�s�t� �a� �t�a�s�t�e� �o�f� �C�y�c�l�o�n�e���¡Â�����������Z�>�������Z�)��������Z�(�������Z�-��������Z�"����������Z��������<������������‚����������������������� ��������(�������-�������"����������ó���É������������������Ÿ���������¨���Status�Ÿ�������� ®�� �C�y�c�l�o�n�e� �r�e�a�l�l�y� �e�x�i�s�t�s� �(�e�x�c�e�p�t� �m�e�m�o�r�y�-�s�a�f�e� �t�h�r�e�a�d�s�)� � �>�1�5�0�K� �l�i�n�e�s� �o�f� �C�y�c�l�o�n�e� �c�o�d�e�,� �i�n�c�l�u�d�i�n�g� �t�h�e� �c�o�m�p�i�l�e�r� � �g�c�c� �b�a�c�k�-�e�n�d� �(�L�i�n�u�x�,� �C�y�g�w�i�n�,� �O�S�X�,� �M�i�n�d�s�t�o�r�m�,� �& )� � �U�s�e�r� s� �m�a�n�u�a�l�,� �m�a�i�l�i�n�g� �l�i�s�t�s�,� �& � �S�t�i�l�l� �a� �r�e�s�e�a�r�c�h� �v�e�h�i�c�l�e� � � ���¡À���4������������������¢������������������������3��������������4������������� �0������������� � ������������� �������������� �����������������ª���Œ������� �������?���������ó���Ê������������������Ÿ���������¨ ���Evaluation�Ÿ��������¨æ��� Is Cyclone like C? port code, measure source differences interface with C code (extend systems) What is the performance cost? port code, measure slowdown Is Cyclone good for low-level systems? write systems, ensure scalability ��¡Ê������������������’����" ��N�������������’����" ����������'�����’����" ��"�������������������������������N����������� �� ��������'�������"�����������������ó���Ë��������� ��������Ÿ���������¨���Code differences�Ÿ��������¨‹���Porting not automatic, but quite similar Many changes identify arrays and lengths Some changes incidental (absent prototypes, new keywords)��¡���Œ���������Œ���������ó���Ì��������� ��������Ÿ���������¨���Run-time performance�Ÿ��������¨Ð���RHLinux 7.1 (2.4.9), 1.0GHz PIII, 512MRAM, gcc2.96 -O3, glibc 2.2.4 Comparable to other safe languages to start C level provides important optimization opportunities Understanding the applications could help��¡L���E����������Œ���������D��������������,�������6����������*���������ó���Í���������� ��������Ÿ���������¨���Larger program: the compiler�Ÿ��������¨Ö��� Scalable compiler + libraries (80K lines) build in < 30secs Generic libraries (e.g., lists, hashtables) clients have no syntactic/performance cost Static safety helps exploit the C-level I use &x more than in C ��¡¼��� ���������4��������,���������,��������(����������������� �������3������������� �,�������+������������� �(����������� �� ���� � ������ �� ����� �� ���ó���Î���������� ��������Ÿ���������¨���Other projects�Ÿ��������¨o��Open Kernel Environment [Bos/Samwel, OPENARCH 02] MediaNet [Hicks et al, OPENARCH 03]: RBClick [Patel/Lepreau, OPENARCH 03] STP [Patel et al., SOSP 03] FPGA synthesis [Teifel/Manohar, ISACS 04] Maryland undergrad O/S course (geekOS) [2004] Windows device driver (6K lines) Only 100 lines left in C But unrecoverable failures & other kernel corruptions remain ��¡���������P�W�������P���������P��������������������� � ��������������������������� ��������������������� ��������������������� ��������������������� �'�������������������� �!����������W����������������ªt���������� �������������������������������������������������=��������������,��������������ƒ���������ó���Ò������������������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡z���A��������–�(�������–�-��������–�����������–�������������������������(�������-�������������������ó���Ó�����������������Ÿ���������¨���Not-null pointers�Ÿ��������ª �������������ó���Ô�����������������Ÿ���������¨���Example�Ÿ�������� ê��F�I�L�E�*� �f�o�p�e�n�(�c�o�n�s�t� �c�h�a�r�@�,� �c�o�n�s�t� �c�h�a�r�@�)�;� �i�n�t� �f�g�e�t�c�(�F�I�L�E�@�)�;� �i�n�t� �f�c�l�o�s�e�(�F�I�L�E�@�)�;� �v�o�i�d� �g�(�)� �{� � � �F�I�L�E�*� �f� �=� �f�o�p�e�n�(� f�o�o� ,� � r� )�;� � � �i�n�t� �c�;� � � �w�h�i�l�e�(�(�c� �=� �f�g�e�t�c�(�f�)�)� �!�=� �E�O�F�)� �{�& }� � � �f�c�l�o�s�e�(�f�)�;� �}� � �G�i�v�e�s� �w�a�r�n�i�n�g� �a�n�d� �i�n�s�e�r�t�s� �o�n�e� �n�u�l�l�-�c�h�e�c�k� �E�n�c�o�u�r�a�g�e�s� �a� �h�o�i�s�t�e�d� �c�h�e�c�k���¡Ü���±���������Z�E��������Z������������������™�þ �����������������™�þ �����������������™�þ�����������������™�þ �����������������™�þQ���������������D���������ª†���������� ������� ��������������� ���������������������� �������������� ��������������� �����������������������a���������ó���Õ�����������������Ÿ���������¨���A classic moral�Ÿ��������¨L���FILE* fopen(const char@, const char@); int fgetc(FILE@); int fclose(FILE@); ��¡„���M���������������������������™�þ �����������������™�þ �����������������™�þ �������������� ���ª,���1��������������� ������������������������ó���Ö����������!��������Ÿ���������¨���Key Design Principles in Action�Ÿ��������¨K��Types to express invariants Preconditions for arguments Properties of values in memory Flow analysis where helpful Lets users control explicit checks Soundness + aliasing limits usefulness Users control data representation Pointers are addresses unless user allows otherwise Often can interoperate with C more safely just via types��¡°�����������Z�;�������Z���������Z�J�������Z�"��������Z�4�������Z�9��������Z��������;��������������#�������'�����"�������4�������9���������ª$�����������R���������������ñ���������ó���ò���������.��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ó���������/��������Ÿ��������� (���I�t� s� �a�l�w�a�y�s� �a�l�i�a�s�i�n�g��Ÿ��������¨¿���But can avoid checks when compiler knows all aliases. Can know by: Types: precondition checked at call site Flow: new objects start unaliased Else user should use a temporary (the safe thing)��¡ ���C����������}���������À���������ª���„������� �������3���������ó���ñ����������-��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�*�����������������(�������-�������������������ó���Ø�����������������Ÿ��������� (��� C�h�a�n�g�e� �v�o�i�d�*� �t�o� �`�a� ��¡:������������������������������������������������Ÿ��������¨•���struct Lst { void* hd; struct Lst* tl; }; struct Lst* map( void* f(void*), struct Lst*); struct Lst* append( struct Lst*, struct Lst*);��¡\���–����� ������;�����������������™�þ1�����������������™�þ!����������ó���Ù������������������Ÿ���������¨���Not much new here�Ÿ��������¨��Closer to C than C++, Java generics, ML, etc. Unlike functional languages, data representation may restrict `a to pointers, int why not structs? why not float? why int? Unlike templates, no code duplication or leaking implementations Unlike objects, no need to tag data��¡Ú���/����������S���������)�����������������f���������/�����"���N����"�������c���������"��������"�������c���������"�������c���������"�������� "�� ��f����"������ª���¦��������������i���������ó���Ú������������������Ÿ���������¨���Existential types�Ÿ�������� ��P�r�o�g�r�a�m�s� �n�e�e�d� �a� �w�a�y� �f�o�r� � c�a�l�l�-�b�a�c�k� �t�y�p�e�s�:� � � � � � �s�t�r�u�c�t� �T� �{� � � � � � �v�o�i�d� �(�*�f�)�(�v�o�i�d�*�,� �i�n�t�)�;� � � � � � �v�o�i�d�*� �e�n�v�;� � � �}�;� � �W�e� �u�s�e� �a�n� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e� �(�s�i�m�p�l�i�f�i�e�d�)�:� � � � � � � �s�t�r�u�c�t� �T� �{� �<�`�a�>� � � � � � �v�o�i�d� �(�@�f�)�(�`�a�,� �i�n�t�)�;� � � � � � �`�a� �e�n�v�;� � � �}�;� � �m�o�r�e� �C�-�l�e�v�e�l� �t�h�a�n� �b�a�k�e�d�-�i�n� �c�l�o�s�u�r�e�s�/�o�b�j�e�c�t�s� ���¡Œ��+��������Z�A����0����Z�����������Z�*��������Z�A����0����Z���,����8�����Z�����������Z�+�������������>�����������������������"���������� ������������ÿ��þ���g�����ÿ��þ���G����ÿ��þ���������g�����ÿ3�þ ���������g�����ÿ3�þ ������������,��� � �������"�����ó���Û�����������������Ÿ���������¨���Regions�Ÿ��������  ��a�.�k�.�a�.� �z�o�n�e�s�,� �a�r�e�n�a�s�,� �& � �E�v�e�r�y� �o�b�j�e�c�t� �i�s� �i�n� �e�x�a�c�t�l�y� �o�n�e� �r�e�g�i�o�n� � �A�l�l�o�c�a�t�i�o�n� �v�i�a� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �D�e�a�l�l�o�c�a�t�e� �a�n� �e�n�t�i�r�e� �r�e�g�i�o�n� � �s�i�m�u�l�t�a�n�e�o�u�s�l�y� � � �(�c�a�n�n�o�t� �f�r�e�e� �a�n� �o�b�j�e�c�t�)� � �O�l�d� �i�d�e�a� �w�i�t�h� �r�e�c�e�n�t� �s�u�p�p�o�r�t� �i�n� �l�a�n�g�u�a�g�e�s� �(�e�.�g�.�,� �R�C�,� �R�T�S�J�)� � �a�n�d� �i�m�p�l�e�m�e�n�t�a�t�i�o�n�s� �(�e�.�g�.�,� �M�L� �K�i�t�)���¡²���|��������Z�*���������Z���������Z�_����������Z���������������&����������������������������7��������������� ��������������_������������ª>���`�������F�����������������������.������� ��������%���������ó���Ü������������������Ÿ���������¨���Cyclone regions [PLDI 02]��¡������������������� ��������Ÿ�������� œ��h�e�a�p� �r�e�g�i�o�n�:� �o�n�e�,� �l�i�v�e�s� �f�o�r�e�v�e�r�,� �c�o�n�s�e�r�v�a�t�i�v�e�l�y� �G�C� d� �s�t�a�c�k� �r�e�g�i�o�n�s�:� �c�o�r�r�e�s�p�o�n�d� �t�o� �l�o�c�a�l�-�d�e�c�l�a�r�a�t�i�o�n� �b�l�o�c�k�s�:� � �{�i�n�t� �x�;� �i�n�t� �y�;� �s�}� �g�r�o�w�a�b�l�e� �r�e�g�i�o�n�s�:� �s�c�o�p�e�d� �l�i�f�e�t�i�m�e�,� �b�u�t� �g�r�o�w�a�b�l�e�:� � � � �{�r�e�g�i�o�n� �r�;� �s�}� � �a�l�l�o�c�a�t�i�o�n� �r�o�u�t�i�n�e�s� �t�a�k�e� �a� �r�e�g�i�o�n� �h�a�n�d�l�e� � �h�a�n�d�l�e�s� �a�r�e� �f�i�r�s�t�-�c�l�a�s�s� �c�a�l�l�e�r� �d�e�c�i�d�e�s� �w�h�e�r�e�,� �c�a�l�l�e�e� �d�e�c�i�d�e�s� �h�o�w� �m�u�c�h� �n�o� �h�a�n�d�l�e�s� �f�o�r� �s�t�a�c�k� �r�e�g�i�o�n�s���¡Ž��m�������������������4����������������������������B������ ����K�������� ����������(�����������������*������������������������™�þ�����������������™�þ����������������������������������#������������������������™�þ������������������������"�������������������.�������ÿ3�þ���������ªb������������������,����������������������������������������������������1��������\���������ó���Ý�����������������Ÿ��������� (���T�h�a�t� s� �t�h�e� �e�a�s�y� �p�a�r�t��Ÿ��������¨c���The implementation is really simple because the type system statically prevents dangling pointers ��¡h���d���������������������������������������� ���������������������������ÿ��þ��ó���Þ������������������Ÿ���������¨���The big restriction�Ÿ�������� Î��A�n�n�o�t�a�t�e� �a�l�l� �p�o�i�n�t�e�r� �t�y�p�e�s� �w�i�t�h� �a� �r�e�g�i�o�n� �n�a�m�e� �(�a� �t�y�p�e� �v�a�r�i�a�b�l�e� �o�f� �r�e�g�i�o�n� �k�i�n�d�)� � �i�n�t�@�`�r� �m�e�a�n�s� � p�o�i�n�t�e�r� �i�n�t�o� �t�h�e� �r�e�g�i�o�n� �c�r�e�a�t�e�d� �b�y� �t�h�e� �c�o�n�s�t�r�u�c�t� �t�h�a�t� �i�n�t�r�o�d�u�c�e�s� �`�r� �h�e�a�p� �i�n�t�r�o�d�u�c�e�s� �`�H� � �L�:�& �i�n�t�r�o�d�u�c�e�s� �`�L� �{�r�e�g�i�o�n� �r�;� �s�}� �i�n�t�r�o�d�u�c�e�s� �`�r� � �r� �h�a�s� �t�y�p�e� �r�e�g�i�o�n�_�t�<�`�r�>� � �c�o�m�p�i�l�e�-�t�i�m�e� �c�h�e�c�k�:� �o�n�l�y� �l�i�v�e� �r�e�g�i�o�n�s� �a�r�e� �a�c�c�e�s�s�e�d� �b�y� �d�e�f�a�u�l�t�,� �f�u�n�c�t�i�o�n� �a�r�g�u�m�e�n�t�s� �p�o�i�n�t� �t�o� �l�i�v�e� �r�e�g�i�o�n�s� ���¡��P���������S�����$�������B����²���� �������������3���������5�����������������"������� ����������"������������� ����G����������g��������I����"�������c���������"��������b��������c���������"�������c����� ����"���� ���c��������g������™�þ���c����� ����"�������c���������"�������� "�� ����� c� ���� ���� "�� �� ��� c� ������� c� ��� �3����b�����5����b��������c�������ªP���¡���������������'������������������������������'�������j�����������������ó���ß������������������Ÿ���������¨���Region polymorphism�Ÿ�������� ø��A�p�p�l�y� �w�h�a�t� �w�e� �d�i�d� �f�o�r� �t�y�p�e� �v�a�r�i�a�b�l�e�s� �t�o� �r�e�g�i�o�n� �n�a�m�e�s� �(�o�n�l�y� �i�t� s� �m�o�r�e� �i�m�p�o�r�t�a�n�t� �a�n�d� �c�o�u�l�d� �b�e� �m�o�r�e� �o�n�e�r�o�u�s�)� � �v�o�i�d� �s�w�a�p�(�i�n�t� �@�`�r�1� �x�,� �i�n�t� �@�`�r�2� �y�)�{� � � �i�n�t� �t�m�p� �=� �*�x�;� � � �*�x� �=� �*�y�;� � � �*�y� �=� �t�m�p�;� �}� � �i�n�t�@�`�r� �s�u�m�p�t�r�(�r�e�g�i�o�n�_�t�<�`�r�>� �r�,�i�n�t� �x�,�i�n�t� �y�)�{� � � �r�e�t�u�r�n� �r�n�e�w�(�r�)� �(�x�+�y�)�;� �}���¡B��k����������M����� ������E����������k��������������C���������G������™�þ����C��������g�����������c��������g������™�þ���c��������g�����������c��������g������™�þ ���c��������g������™�þ ���c��������C�������C������� g� ����ÿ��þ��� c� ������� g� �����™�þ ��� c� ������� g� ����ÿ��þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������� g� �����™�þ��� c� ������ª,���Ó�������������������������������������ó���à�����������������Ÿ���������¨���Type definitions�Ÿ��������¨K���struct ILst<`r1,`r2> { int@`r1 hd; struct ILst<`r1,`r2> *`r2 tl; }; ��¡ ��L���������� ����C��������g�����ÿ��þ���C������� g� ����ÿ��þ ���C�������g�����ÿ��þ���C�������g�����ÿ��þ��� C� ������$g�$����ÿ��þ���(C�(������,g�,����ÿ��þ ���0C�0�������0���0��ó���á���������� ��������Ÿ���������¨���Region subtyping�Ÿ�������� Ò��I�f� �p� �p�o�i�n�t�s� �t�o� �a�n� �i�n�t� �i�n� �a� �r�e�g�i�o�n� �w�i�t�h� �n�a�m�e� �`�r�1�,� �i�s� �i�t� �e�v�e�r� �s�o�u�n�d� �t�o� �g�i�v�e� �p� �t�y�p�e� �i�n�t�*�`�r�2�?� � �I�f� �s�o�,� �l�e�t� � �i�n�t�*�`�r�1� �<� �i�n�t�*�`�r�2� � �R�e�g�i�o�n� �s�u�b�t�y�p�i�n�g� �i�s� �t�h�e� �o�u�t�l�i�v�e�s� �r�e�l�a�t�i�o�n�s�h�i�p� � � �{�r�e�g�i�o�n� �r�1�;� �& �{�r�e�g�i�o�n� �r�2�;� �& }� �& �}� � �L�I�F�O� �m�a�k�e�s� �s�u�b�t�y�p�i�n�g� �c�o�m�m�o�n� � ���¡$��[����������M�������������������!����������������������������������������������������������������������������������������g�����ÿ��þ������������������������� g� ����ÿ��þ����� ����������C�������g�����ÿ��þ���o�����ÿ��þçÿ���G����������C�������g�����ÿ��þ���n����ÿ��þçÿ���o�����ÿ��þçÿ���� B�� ������ F�� ��������� B�� ��$��� C� ������� B�� ����� C� ������ � ���ª>���ª���������������������� ��������������� �������� ���������ó���â����������"��������Ÿ���������¨���Regions evaluation��ª���������� ����������������Ÿ�������� Æ��L�I�F�O� �r�e�g�i�o�n�s� �g�o�o�d� �f�o�r� �s�o�m�e� �i�d�i�o�m�s� �a�w�k�w�a�r�d� �i�n� �C� �R�e�g�i�o�n�s� �g�e�n�e�r�a�l�i�z�e� �s�t�a�c�k� �v�a�r�i�a�b�l�e�s� �a�n�d� �t�h�e� �h�e�a�p� �D�e�f�a�u�l�t�s� �a�n�d� �i�n�f�e�r�e�n�c�e� �m�a�k�e� �i�t� �s�u�r�p�r�i�s�i�n�g�l�y� �p�a�l�a�t�a�b�l�e� �W�o�r�s�t� �p�a�r�t�:� �d�e�f�i�n�i�n�g� �r�e�g�i�o�n�-�a�l�l�o�c�a�t�e�d� �d�a�t�a� �s�t�r�u�c�t�u�r�e�s� �C�y�c�l�o�n�e� �a�c�t�u�a�l�l�y� �h�a�s� �m�u�c�h� �m�o�r�e� �[�I�S�M�M� �0�4�]� �N�o�n�-�L�I�F�O� �r�e�g�i�o�n�s� � U�n�i�q�u�e� �p�o�i�n�t�e�r�s� �E�x�p�l�i�c�i�t�l�y� �r�e�f�e�r�e�n�c�e�-�c�o�u�n�t�e�d� �p�o�i�n�t�e�r�s� �A� � u�n�i�f�i�e�d� �s�y�s�t�e�m� ,� �n�o�t� �n� �s�u�b�l�a�n�g�a�g�e�s� ���¡’���/��������x�f���������6��������)���������p��������/�������f�������6�������������� �������a���� �� ���� � ����� �� ���ª���W������ ����������������ó���ã����������#��������Ÿ���������¨���The plan from here�Ÿ�������� ,��E�x�p�e�r�i�e�n�c�e� �w�i�t�h� �C�y�c�l�o�n�e� �N�o�t�-�N�U�L�L� �p�o�i�n�t�e�r�s� �T�y�p�e�-�v�a�r�i�a�b�l�e� �e�x�a�m�p�l�e�s� �g�e�n�e�r�i�c�s� �r�e�g�i�o�n�-�b�a�s�e�d� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t� �B�r�i�e�f� �v�i�e�w� �o�f� � e�v�e�r�y�t�h�i�n�g� �e�l�s�e� �R�e�l�a�t�e�d� �w�o�r�k� ���¡p���A��������–�(�������–�-��������–�����������–�A�������(������� ���������� �������������������ó���ä����������$��������Ÿ���������¨���Other safety holes�Ÿ�������� J��A�r�r�a�y�s� �(�w�h�a�t� �o�r� �w�h�e�r�e� �i�s� �t�h�e� �s�i�z�e�)� �O�p�t�i�o�n�s�:� �d�y�n�a�m�i�c� �b�o�u�n�d�,� �i�n� �a� �f�i�e�l�d�/�v�a�r�i�a�b�l�e�,� �c�o�m�p�i�l�e�-�t�i�m�e� �b�o�u�n�d�,� �s�p�e�c�i�a�l� �s�t�r�i�n�g� �s�u�p�p�o�r�t� �T�h�r�e�a�d�s� �(�a�v�o�i�d�i�n�g� �r�a�c�e�s�)� �v�a�p�o�r�w�a�r�e� �t�y�p�e� �s�y�s�t�e�m� �t�o� �e�n�f�o�r�c�e� �l�o�c�k�-�b�a�s�e�d� �m�u�t�u�a�l� �e�x�c�l�u�s�i�o�n� �C�a�s�t�s� �A�l�l�o�w� �o�n�l�y� � u�p� �c�a�s�t�s� �a�n�d� �c�a�s�t�s� �t�o� �n�u�m�b�e�r�s� �U�n�i�o�n�s� �C�h�e�c�k�e�d� �t�a�g�s� �o�r� �b�i�t�s�-�o�n�l�y� �f�i�e�l�d�s� �U�n�i�n�i�t�i�a�l�i�z�e�d� �d�a�t�a� �F�l�o�w� �a�n�a�l�y�s�i�s� �(�s�a�f�e�r� �a�n�d� �e�a�s�i�e�r� �t�h�a�n� �d�e�f�a�u�l�t� �i�n�i�t�i�a�l�i�z�e�r�s�)� �V�a�r�a�r�g�s� �(�s�a�f�e� �v�i�a� �c�h�a�n�g�e�d� �c�a�l�l�i�n�g� �c�o�n�v�e�n�t�i�o�n�)���¡î���#���������X�����������������=�����������������+�����������������!�����������������;��������.���������#�������X��������������=��������������+����������� �� �!���� �� ��������;�������.���������ª>��� ��������������������� �������A��������������'���������ó���å����������%��������Ÿ���������¨���And modern conveniences�Ÿ�������� æ��3�0� �y�e�a�r�s� �a�f�t�e�r� �C�,� �s�o�m�e� �t�h�i�n�g�s� �a�r�e� �w�o�r�t�h� �a�d�d�i�n�g�& � �T�a�g�g�e�d� �u�n�i�o�n�s� �a�n�d� �p�a�t�t�e�r�n� �m�a�t�c�h�i�n�g� �o�n� �t�h�e�m� �I�n�t�r�a�p�r�o�c�e�d�u�r�a�l� �t�y�p�e� �i�n�f�e�r�e�n�c�e� �T�u�p�l�e�s� �(�l�i�k�e� �a�n�o�n�y�m�o�u�s� �s�t�r�u�c�t�s�)� �E�x�c�e�p�t�i�o�n�s� �S�t�r�u�c�t� �a�n�d� �a�r�r�a�y� �i�n�i�t�i�a�l�i�z�e�r�s� �N�a�m�e�s�p�a�c�e�s� �n�e�w� �f�o�r� �a�l�l�o�c�a�t�i�o�n� �+� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� ���¡Z���0�������������������x�Ã���������0������������� �ž���������������"���������ª>���{���������������������������� ��������������H���������ó���ê����������&��������Ÿ���������¨���Plenty of work remains�Ÿ��������¨Ó���Common limitations: Aliasing Arithmetic Unportable assumptions (But interoperating with C is much simpler than in a HLL) Big challenge for next generation: guarantees beyond fail-safe (i.e., graceful abort)��¡X�������������,���������:�������������������Y����������^��������������r���������ª���(������� �������¢���������ó���Ï������������������Ÿ���������¨���Related work: making C safer�Ÿ�������� Ê��C�o�m�p�i�l�e� �t�o� �m�a�k�e� �d�y�n�a�m�i�c� �c�h�e�c�k�s� �p�o�s�s�i�b�l�e� �S�a�f�e�-�C� �[�A�u�s�t�i�n� �e�t� �a�l�.�]�,� �R�T�C� �[�Y�o�n�g�/�H�o�r�w�i�t�z�]�,� �.�.�.� �P�u�r�i�f�y�,� �S�t�a�c�k�g�u�a�r�d�,� �E�l�e�c�t�r�i�c� �F�e�n�c�e�,� �& �C�C�u�r�e�d� �[�N�e�c�u�l�a� �e�t� �a�l�.�]� �p�e�r�f�o�r�m�a�n�c�e� �v�i�a� �w�h�o�l�e�-�p�r�o�g�r�a�m� �a�n�a�l�y�s�i�s� �l�e�s�s� �u�s�e�r� �b�u�r�d�e�n� �l�e�s�s� �m�e�m�o�r�y� �m�a�n�a�g�e�m�e�n�t�,� �s�i�n�g�l�e�-�t�h�r�e�a�d�e�d� � �C�o�n�t�r�o�l�-�C� �[�A�d�v�e� �e�t� �a�l�.�]� �w�e�a�k�e�r� �g�u�a�r�a�n�t�y�,� �l�e�s�s� �b�u�r�d�e�n� � �S�F�I� �[�W�a�h�b�e�,� �S�m�a�l�l�,� �.�.�.�]�:� �s�a�n�d�b�o�x�i�n�g� �v�i�a� �b�i�n�a�r�y� �r�e�w�r�i�t�i�n�g� ���¡ð���(��������Z�m�������Z�`�������Z�p��������Z����������Z�(�����������������������������������1��������������`������� ���� �� ����� �� ����� �� ����� �� ����� �� ����� �� �#���� �� ���ª>���@���������������ž�����������������������������a���������ó���í����������*��������Ÿ���������¨���Related Work: Checking C code�Ÿ�������� `��M�o�d�e�l�-�c�h�e�c�k�i�n�g� �C� �c�o�d�e� �(�S�L�A�M�,� �B�L�A�S�T�,� �& )� �L�e�v�e�r�a�g�e�s� �s�c�a�l�a�b�i�l�i�t�y� �o�f� �M�C� �K�e�y� �i�s� �a�u�t�o�m�a�t�i�c� �b�u�i�l�d�i�n�g� �a�n�d� �r�e�f�i�n�i�n�g� �o�f� �m�o�d�e�l� �A�s�s�u�m�e�s� �(�w�e�a�k�)� �m�e�m�o�r�y� �s�a�f�e�t�y� �L�i�n�t�-�l�i�k�e� �t�o�o�l�s� �(�S�p�l�i�n�t�,� �M�e�t�a�l�,� �P�r�e�F�I�X�,� �& )� �G�o�o�d� �a�t� �r�e�d�u�c�i�n�g� �f�a�l�s�e� �p�o�s�i�t�i�v�e�s� �C�a�n�n�o�t� �e�n�s�u�r�e� �a�b�s�e�n�c�e� �o�f� �b�u�g�s� �M�e�t�a�l� �p�a�r�t�i�c�u�l�a�r�l�y� �g�o�o�d� �f�o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� �C�q�u�a�l� �(�u�s�e�r�-�d�e�f�i�n�e�d� �q�u�a�l�i�f�i�e�r�s�,� �l�o�t�s� �o�f� �i�n�f�e�r�e�n�c�e�)� � �B�e�t�t�e�r� �f�o�r� �u�n�c�h�a�n�g�e�a�b�l�e� �c�o�d�e� �o�r� �u�s�e�r�-�d�e�f�i�n�e�d� �c�h�e�c�k�s� � �(�i�.�e�.�,� �t�h�e�y� r�e� �c�o�m�p�l�e�m�e�n�t�a�r�y�)���¡Î���'��������Z�i�������Z�+��������Z�o�������Z�4��������Z�S����������Z�'�������L���������������������+�������!������������H�������3������������� �S����������ªP���s���������������6��������������t��������������,���������������T���������ó���ð����������,��������Ÿ���������¨���Related work: higher and lower�Ÿ�������� ¸��A�d�a�p�t�e�d�/�e�x�t�e�n�d�e�d� �i�d�e�a�s�:� �p�o�l�y�m�o�r�p�h�i�s�m� �[�M�L�,� �H�a�s�k�e�l�l�,� �& ]� �r�e�g�i�o�n�s� �[�T�o�f�t�e�/�T�a�l�p�i�n�,� �W�a�l�k�e�r� �e�t� �a�l�.�,� �& ]� �s�a�f�e�t�y� �v�i�a� �d�a�t�a�f�l�o�w� �[�J�a�v�a�,� �& ]� �e�x�i�s�t�e�n�t�i�a�l� �t�y�p�e�s� �[�M�i�t�c�h�e�l�l�/�P�l�o�t�k�i�n�,� �& ]� �c�o�n�t�r�o�l�l�i�n�g� �d�a�t�a� �r�e�p�r�e�s�e�n�t�a�t�i�o�n� �[�A�d�a�,� �M�o�d�u�l�a�-�3�,� �& ]� � �S�a�f�e� �l�o�w�e�r�-�l�e�v�e�l� �l�a�n�g�u�a�g�e�s� �[�T�A�L�,� �P�C�C�,� �& ]� �e�n�g�i�n�e�e�r�e�d� �f�o�r� �m�a�c�h�i�n�e�-�g�e�n�e�r�a�t�e�d� �c�o�d�e� � �V�a�u�l�t�:� �s�t�r�o�n�g�e�r� �p�r�o�p�e�r�t�i�e�s� �v�i�a� �r�e�s�t�r�i�c�t�e�d� �a�l�i�a�s�i�n�g� ���¡€������������Á��������)���������'��������4����������������À��������������)�������&��������������4���������ó���Ñ������������������Ÿ���������¨���Summary�Ÿ�������� ò��C�y�c�l�o�n�e�:� �a� �s�a�f�e� �l�a�n�g�u�a�g�e� �a�t� �t�h�e� �C�-�l�e�v�e�l� �o�f� �a�b�s�t�r�a�c�t�i�o�n� � �S�y�n�e�r�g�i�s�t�i�c� �c�o�m�b�i�n�a�t�i�o�n� �o�f� �t�y�p�e�s�,� �f�l�o�w� �a�n�a�l�y�s�i�s�,� �a�n�d� �r�u�n�-�t�i�m�e� �c�h�e�c�k�s� � �A� �r�e�a�l� �c�o�m�p�i�l�e�r� �a�n�d� �p�r�o�t�o�t�y�p�e� �a�p�p�l�i�c�a�t�i�o�n�s� � �P�r�o�p�e�r�t�i�e�s� �l�i�k�e� � n�o�t� �N�U�L�L� ,� � h�a�s� �l�o�n�g�e�r� �l�i�f�e�t�i�m�e� ,� � h�a�s� �a�r�r�a�y� �l�e�n�g�t�h� & �n�o�w� �i�n� �t�h�e� �l�a�n�g�u�a�g�e� �a�n�d� �c�h�e�c�k�e�d� � �E�a�s�y� �i�n�t�e�r�o�p�e�r�a�b�i�l�i�t�y� �w�i�t�h� �C� �a�l�l�o�w� �s�m�o�o�t�h� �a�n�d� �i�n�c�r�e�m�e�n�t�a�l� �m�o�v�e� �t�o�w�a�r�d� �m�e�m�o�r�y� �s�a�f�e�t�y� � �i�n� �t�h�e�o�r�y� �a�t� �l�e�a�s�t���¡z���g����������������7������������� �E������������� �+������������� �g������������� �U����������������ó���î����������)��������Ÿ���������¨ ���Availability�Ÿ��������  ��L�i�k�e� �a�n�y� �l�a�n�g�u�a�g�e�,� �y�o�u� �h�a�v�e� �t�o� � k�i�c�k� �t�h�e� �t�i�r�e�s� :� �w�w�w�.�r�e�s�e�a�r�c�h�.�a�t�t�.�c�o�m�/�p�r�o�j�e�c�t�s�/�c�y�c�l�o�n�e� � �A�l�s�o� �s�e�e�:� �J�a�n�.� �2�0�0�5� �C�/�C�+�+� �U�s�e�r� s� �J�o�u�r�n�a�l� �U�S�E�N�I�X� �2�0�0�2� � �C�o�n�v�e�r�s�e�l�y�,� �I� �w�a�n�t� �t�o� �k�n�o�w� �N�A�S�A� s� �C�-�l�e�v�e�l� �c�o�d�e� �n�e�e�d�s� �M�a�y�b�e� �i�d�e�a�s� �f�r�o�m� �C�y�c�l�o�n�e� �w�i�l�l� �h�e�l�p� �M�a�y�b�e� �n�o�t� �E�i�t�h�e�r� �w�a�y� �w�o�u�l�d� �b�e� �f�a�s�c�i�n�a�t�i�n�g� ���¡¢���1����������'���������� ����������+�����������������5����������-���������!����������1�������%�������Ì�fþ������� �������+�������„���������ª���1��������������Ì�������/�ð¨�����ó���^�������������������ó���Å�����������%��������ó���Ð�����������&��������ó���è�����������'��������ó���é�����������(��������ó���ï�����������)�������P������ÿÿÿ�������������������������������������������������������������������������ê������r�����îB���õ������í�ÊB�ÌÈ����ô����C�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4