Hello Christian, > Silly question, putting immutable objects in a read only section is not > enough?
I'm mainly concerned about objects in the heap. Typically, immutable objects are still mutable while they are being constructed. Typical code looks like this: struct data *wp; struct data const *p; wp = (struct data *) malloc (sizeof (struct data)); wp->x = 7; wp->y = 42; p = wp; assert (p->x == 7); assert (p->y == 42); ((struct data *) p)->x = 9; // Violation of immutability, no crash ... free (p); To enforce immutability, it would be transformed to struct data *wp; struct data const *p; wp = (struct data *) immmalloc (sizeof (struct data)); wp->x = 7; wp->y = 42; p = immfreeze (wp); assert (p->x == 7); assert (p->y == 42); ((struct data *) p)->x = 9; // Violation of immutability, crashes ... immfree (p); > If accepted, it should have no impact on compilation speed which is one of > the most important aspect of tcc (after correctness of course and execution > speed which comes second). Changes must also apply to all current supported > platforms. That is one possible outcome. Another possible outcome is a research paper. Another possible outcome is a prototype that serves to guide an implementation in GCC. Another possibility is to use the idea for a GSoC student project. Bruno _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel