| Title | User guide doesn't explain how to choose object format alignment |
| Status | closed |
| Priority | optional |
| Assigned user | Richard Brooksby |
| Organization | Ravenbrook |
| Description | The user guide "Garbage collecting a language with the MPS" [1] explains how to create an object format, and one of the components of the object format is its alignment. The Scheme example [2] just says: sizeof(mps_word_t) The user guide needs to explain how to choose this alignment, and why "sizeof(mps_word_t)" is the right choice. |
| Analysis | GDR writes: I struggled to explain this choice of alignment. I had thought that it might be possible to deduce the alignment in C by writing code like: #define ALIGNMENT offsetof(struct {char c; obj_s obj}, obj) But I believe this is not reliable: compilers do various kinds of structure-packing that defeat this. (For example, the -fpack-struct option to GCC.) So I don't think that it would be a good idea to use this approach. So "sizeof(mps_word_t)" is probably fine, but you need to help me write the explanation. GDR 2012-10-18: I made my best attempt to explain it, so I've closed this job. |
| How found | inspection |
| Evidence | [1] <https://info.ravenbrook.com/project/mp...user-guide/manual/source/guide/lang.rst>[2] < https://info.ravenbrook.com/project/mp...uide/manual/source/guide/scheme-after.c> |
| Observed in | 1.110.0 |
| Created by | Gareth Rees |
| Created on | 2012-10-17 17:15:16 |
| Last modified by | Gareth Rees |
| Last modified on | 2012-10-18 13:12:06 |
| History | 2012-10-17 GDR Created. |
| Change | Effect | Date | User | Description |
|---|---|---|---|---|
| 179935 | closed | 2012-10-18 13:10:41 | Gareth Rees | Move user-facing material from RHSK's wiki to the manual: New glossary entry "foreign code" Explain how to find the alignment for your object format. Document symbols: mps_class_mv, mps_arena_start_collect, mps_arena_step, mps_chain_create, mps_chain_destroy, mps_chain_t, mps_gen_param_s. |