| 4 | | The status as it is on 28 okt 2009. See branch tt_1020 for more details. |
| 5 | | (broken at the moment will be fixed tomorrow I hope,small svn problem) |
| 6 | | |
| 7 | | This will give some extra detail on the plan and will give a view on the current status. |
| 8 | | Any comments are welcome. |
| 9 | | |
| | 4 | The status as it is on 28 okt 2009. See branch tt_1020 for more details. [[BR]] |
| | 5 | (broken at the moment will be fixed tomorrow I hope,small svn problem) [[BR]] |
| | 6 | [[BR]] |
| | 7 | This will give some extra detail on the plan and will give a view on the current status. [[BR]] |
| | 8 | Any comments are welcome. [[BR]] |
| | 9 | [[BR]] |
| 11 | | become an object. (default.pmc will get renamed back to object.pmc). |
| 12 | | The C pmc can keep using there C structures as they did before. But with a few restrictions. |
| 13 | | All field must be one off the following types. |
| 14 | | (AT_POINTER) void* (to some C structure/data) |
| 15 | | (AT_PMC_POINTER) pmc* (pointer to a pmc) |
| 16 | | (AT_STRING) STRING* (pointer to a String) |
| 17 | | (AT_INTEGER) INTVAL (integer) |
| 18 | | (AT_FLOAT) FLOATVAL (float value) |
| 19 | | The usage of attributes as an array is no longer allowed. (ATTR INTVAL vals[4] = no long allowed) |
| | 11 | become an object. (default.pmc will get renamed back to object.pmc). [[BR]] |
| | 12 | The C pmc can keep using there C structures as they did before. But with a few restrictions. [[BR]] |
| | 13 | All field must be one off the following types. [[BR]] |
| | 14 | (AT_POINTER) void* (to some C structure/data) [[BR]] |
| | 15 | (AT_PMC_POINTER) pmc* (pointer to a pmc) [[BR]] |
| | 16 | (AT_STRING) STRING* (pointer to a String) [[BR]] |
| | 17 | (AT_INTEGER) INTVAL (integer) [[BR]] |
| | 18 | (AT_FLOAT) FLOATVAL (float value) [[BR]] |
| | 19 | The usage of attributes as an array is no longer allowed. (ATTR INTVAL vals[4] = no long allowed) [[BR]] |
| 25 | | following attributes in the class.pmc are used. |
| 26 | | -attrib_index2type |
| 27 | | Tells which type of value can be found at each index. If it is index halfway of double value then it is a invalid value. |
| 28 | | That is a small gap. |
| 29 | | -attrib_markwalk |
| 30 | | Array with the indexes to the items which has to marked. |
| 31 | | -attrib_indexes |
| 32 | | Array with the indexes to all items. |
| 33 | | |
| 34 | | For exmaple when using the following attributes. |
| 35 | | attr Context * ctx; |
| 36 | | attr PMC * some_pmc; |
| 37 | | attr INTVAL myval; |
| 38 | | attr FLOAT myfloat; |
| 39 | | attr STRING * mystring; |
| 40 | | Then these attributes will look like: |
| 41 | | attrib_index2type = [AT_POINTER,AT_PMC_POINTER,AT_INTEGER,AT_FLOAT,invalid,AT_STRING] |
| 42 | | attrib_mark_walk = [1,5] |
| 43 | | attrib_indexes = [0,1,2,3,5] |
| 44 | | |
| | 25 | following attributes in the class.pmc are used. [[BR]] |
| | 26 | -attrib_index2type [[BR]] |
| | 27 | Tells which type of value can be found at each index. If it is index halfway of double value then it is a invalid value. |
| | 28 | That is a small gap. [[BR]] |
| | 29 | -attrib_markwalk [[BR]] |
| | 30 | Array with the indexes to the items which has to marked. [[BR]] |
| | 31 | -attrib_indexes [[BR]] |
| | 32 | Array with the indexes to all items. [[BR]] |
| | 33 | [[BR]] |
| | 34 | For exmaple when using the following attributes. [[BR]] |
| | 35 | attr Context * ctx; [[BR]] |
| | 36 | attr PMC * some_pmc; [[BR]] |
| | 37 | attr INTVAL myval; [[BR]] |
| | 38 | attr FLOAT myfloat; [[BR]] |
| | 39 | attr STRING * mystring; [[BR]] |
| | 40 | Then these attributes will look like: [[BR]] |
| | 41 | attrib_index2type = [AT_POINTER,AT_PMC_POINTER,AT_INTEGER,AT_FLOAT,invalid,AT_STRING] [[BR]] |
| | 42 | attrib_mark_walk = [1,5] [[BR]] |
| | 43 | attrib_indexes = [0,1,2,3,5] [[BR]] |
| | 44 | [[BR]] |
| 53 | | at which they are loaded. |
| 54 | | |
| 55 | | 0 ATTR INTVAL id; /* The type number of the PMC. [deprecated: See RT #48024] */ |
| 56 | | 0 ATTR STRING *name; /* The name of the class. */ |
| 57 | | 0 ATTR STRING *fullname; /* The name of the class. */ |
| 58 | | 2 ATTR PMC *_namespace; /* The namespace it's linked to, if any. */ |
| 59 | | - ATTR INTVAL instantiated; /* Any instantiations since last modification? */ |
| 60 | | 1 ATTR PMC *parents; /* Immediate parent classes. */ |
| 61 | | 2 ATTR PMC *all_parents; /* Cached list of ourself and all parents, in MRO order. */ |
| 62 | | 2 ATTR PMC *roles; /* An array of roles. */ |
| 63 | | 2 ATTR PMC *methods; /* Hash of method names to methods in this class. */ |
| 64 | | - ATTR PMC *vtable_overrides; /* Hash of Parrot v-table methods we override. */ |
| 65 | | 2 ATTR PMC *attrib_metadata; /* Hash of attributes in this class to hashes of metadata. */ |
| 66 | | 2 ATTR PMC *attrib_index; /* Lookup table for attributes in this and parents. */ |
| 67 | | 2 ATTR PMC *attrib_cache; /* Cache of visible attrib names to indexes. */ |
| 68 | | - ATTR PMC *resolve_method; /* List of method names the class provides to resolve |
| 69 | | * conflicts with methods from roles. */ |
| 70 | | - ATTR PMC *parent_overrides; |
| | 53 | at which they are loaded.[[BR]] |
| | 54 | [[BR]] |
| | 55 | 0 ATTR INTVAL id; /* The type number of the PMC. [deprecated: See RT #48024] */ [[BR]] |
| | 56 | 0 ATTR STRING *name; /* The name of the class. */ [[BR]] |
| | 57 | 0 ATTR STRING *fullname; /* The name of the class. */ [[BR]] |
| | 58 | 2 ATTR PMC *_namespace; /* The namespace it's linked to, if any. */ [[BR]] |
| | 59 | - ATTR INTVAL instantiated; /* Any instantiations since last modification? */ [[BR]] |
| | 60 | 1 ATTR PMC *parents; /* Immediate parent classes. */ [[BR]] |
| | 61 | 2 ATTR PMC *all_parents; /* Cached list of ourself and all parents, in MRO order. */ [[BR]] |
| | 62 | 2 ATTR PMC *roles; /* An array of roles. */ [[BR]] |
| | 63 | 2 ATTR PMC *methods; /* Hash of method names to methods in this class. */ [[BR]] |
| | 64 | - ATTR PMC *vtable_overrides; /* Hash of Parrot v-table methods we override. */ [[BR]] |
| | 65 | 2 ATTR PMC *attrib_metadata; /* Hash of attributes in this class to hashes of metadata. */ [[BR]] |
| | 66 | 2 ATTR PMC *attrib_index; /* Lookup table for attributes in this and parents. */ [[BR]] |
| | 67 | 2 ATTR PMC *attrib_cache; /* Cache of visible attrib names to indexes. */ [[BR]] |
| | 68 | - ATTR PMC *resolve_method; /* List of method names the class provides to resolve [[BR]] |
| | 69 | conflicts with methods from roles. */ [[BR]] |
| | 70 | - ATTR PMC *parent_overrides; [[BR]] |
| 94 | | "isa_hash","_namespace",*"mro",*"attr_size",*"pmc_class" will become reduntant. |
| 95 | | * are already removed |
| 96 | | |
| 97 | | So after completion of this change the vtable struct will only hold pointers to the vtable functions. |
| 98 | | The pmc will have no more pointer to the vtable struct, all needed information is stored in the pmcclass object. |
| 99 | | |
| | 93 | "isa_hash","_namespace",*"mro",*"attr_size",*"pmc_class" will become reduntant. [[BR]] |
| | 94 | * are already removed [[BR]] |
| | 95 | [[BR]] |
| | 96 | So after completion of this change the vtable struct will only hold pointers to the vtable functions. |
| | 97 | The pmc will have no more pointer to the vtable struct, all needed information is stored in the pmcclass object. [[BR]] |
| | 98 | [[BR]] |
| 110 | | this change. |
| 111 | | When a INTVAL,FLOAT or STRING is stored it will get unbox and stored. |
| 112 | | When rertrieving them they will get boxed again. |
| 113 | | Attributes of type void* can not be accessed, they are "private". |
| 114 | | Note that the code in the core pmc's just keep using the c structure. |
| | 109 | this change. [[BR]] |
| | 110 | When a INTVAL,FLOAT or STRING is stored it will get unbox and stored. [[BR]] |
| | 111 | When rertrieving them they will get boxed again. [[BR]] |
| | 112 | Attributes of type void* can not be accessed, they are "private". [[BR]] |
| | 113 | Note that the code in the core pmc's just keep using the c structure. [[BR]] |
| 135 | | The following work has already been doen. |
| 136 | | |
| 137 | | -Replace interp->vtables[] by interp->classes[] |
| 138 | | -Added needed extra fields in class.pmc |
| 139 | | -Make bootstrap/load code in lib/Parrot/pmc2c/ for loading the full class information of the core pmcs |
| 140 | | -Addapt the class registration code, (some changes still be done) |
| 141 | | -Creation of the new attribute indexing system |
| 142 | | -Store pmcclass object into seperate gc pool. |
| | 134 | The following work has already been done. [[BR]] |
| | 135 | [[BR]] |
| | 136 | -Replace interp->vtables[] by interp->classes[] [[BR]] |
| | 137 | -Added needed extra fields in class.pmc [[BR]] |
| | 138 | -Make bootstrap/load code in lib/Parrot/pmc2c/ for loading the full class information of the core pmcs [[BR]] |
| | 139 | -Addapt the class registration code, (some changes still be done) [[BR]] |
| | 140 | -Creation of the new attribute indexing system [[BR]] |
| | 141 | -Store pmcclass object into seperate gc pool. [[BR]] |
| 147 | | become an attribute instead of being directly stored in the pmc->data field. |
| 148 | | -Move the functionality of the object.pmc to default.pmc partly done |
| 149 | | --The mark,clone,thaw,freeze,visit and finishthaw has still to be done. |
| 150 | | |
| 151 | | Work to do and thing not yet build |
| 152 | | |
| 153 | | This is the work that has still to be done, to complete this change. |
| 154 | | |
| 155 | | -mark,clone,freeze,thaw,visit,finishthaw functions |
| 156 | | Pir code can extends a core pmcs class and extra attributes to it. These extra attributes also needs to get handled. |
| 157 | | This applies to the following function. |
| 158 | | Marking -> mark |
| 159 | | Cloning -> clone |
| 160 | | Freeze/thaw -> freeze,thaw,visit,finishthaw |
| | 146 | become an attribute instead of being directly stored in the pmc->data field. [[BR]] |
| | 147 | -Move the functionality of the object.pmc to default.pmc partly done [[BR]] |
| | 148 | --The mark,clone,thaw,freeze,visit and finishthaw has still to be done. [[BR]] |
| | 149 | [[BR]] |
| | 150 | Work to do and thing not yet build[[BR]] |
| | 151 | [[BR]] |
| | 152 | This is the work that has still to be done, to complete this change. [[BR]] |
| | 153 | [[BR]] |
| | 154 | -mark,clone,freeze,thaw,visit,finishthaw functions [[BR]] |
| | 155 | Pir code can extends a core pmcs class and extra attributes to it. These extra attributes also needs to get handled. [[BR]] |
| | 156 | This applies to the following function. [[BR]] |
| | 157 | Marking -> mark [[BR]] |
| | 158 | Cloning -> clone [[BR]] |
| | 159 | Freeze/thaw -> freeze,thaw,visit,finishthaw [[BR]] |
| 172 | | but that cost extra space, which is not needed. |
| 173 | | |
| 174 | | -get/set attr overrides |
| 175 | | "get_attr_keyed","set_attr_keyed" are free and not implemented by any core pmc |
| 176 | | "get_attr_str","set_attr_str" implemented in callsignature, exception,task,eventhandler |
| 177 | | |
| 178 | | -kill pmcproxy.pmc |
| 179 | | --make sure the init and init_pmc vtable function still get called in rigth order |
| 180 | | --step by step removal of pmcproxy functions |
| 181 | | --switch over to class.pmc initialize function |
| 182 | | --kill pmcproxy.pmc file |
| 183 | | |
| 184 | | -kill old object.pmc file |
| 185 | | -rename default.pmc to object.pmc |
| 186 | | |
| 187 | | -clean up |
| 188 | | --step by step of vtable struct fields, which are no longer used |
| 189 | | --remove vtable field from pmc struct |
| 190 | | --remove old no longer used code |
| 191 | | --fixup broken tests |
| 192 | | ---threads.t and interpreter cloning may need some extra time |
| 193 | | --fixup coding standaard |
| 194 | | |
| 195 | | -fixup the documentation |
| 196 | | |
| 197 | | |
| 198 | | - |
| 199 | | |
| 200 | | Discussion on Performance |
| | 171 | but that cost extra space, which is not needed. [[BR]] |
| | 172 | [[BR]] |
| | 173 | -get/set attr overrides [[BR]] |
| | 174 | "get_attr_keyed","set_attr_keyed" are free and not implemented by any core pmc [[BR]] |
| | 175 | "get_attr_str","set_attr_str" implemented in callsignature, exception,task,eventhandler [[BR]] |
| | 176 | [[BR]] |
| | 177 | -kill pmcproxy.pmc [[BR]] |
| | 178 | --make sure the init and init_pmc vtable function still get called in rigth order [[BR]] |
| | 179 | --step by step removal of pmcproxy functions [[BR]] |
| | 180 | --switch over to class.pmc initialize function [[BR]] |
| | 181 | --kill pmcproxy.pmc file [[BR]] |
| | 182 | [[BR]] |
| | 183 | -kill old object.pmc file [[BR]] |
| | 184 | -rename default.pmc to object.pmc [[BR]] |
| | 185 | [[BR]] |
| | 186 | -clean up [[BR]] |
| | 187 | --step by step of vtable struct fields, which are no longer used [[BR]] |
| | 188 | --remove vtable field from pmc struct [[BR]] |
| | 189 | --remove old no longer used code [[BR]] |
| | 190 | --fixup broken tests [[BR]] |
| | 191 | ---threads.t and interpreter cloning may need some extra time [[BR]] |
| | 192 | --fixup coding standaard [[BR]] |
| | 193 | [[BR]] |
| | 194 | -fixup the documentation [[BR]] |
| | 195 | [[BR]] |
| | 196 | Discussion on Performance [[BR]] |
| 202 | | some performance. |
| 203 | | |
| 204 | | +no more pmc proxy object |
| 205 | | = gaining speed (no more looking up needed) |
| 206 | | = use less memory in case of extending core pmc (lots less memory) |
| 207 | | -vtable function acces pmc->class->vtable->function instead of pmc->vtable->function |
| 208 | | -some non allowed attribute types are wrapped up |
| 209 | | -auto_attr is gone, see for example context.pmc. If there are no attributes then no mem is allocated. |
| 210 | | -call to vtable get/set attribute functions must do extra index 2 type action |
| 211 | | -call to vtable get/set attribute functions do unbox and boxing, but only in case of accessing |
| 212 | | a core pmc attribute, so this one does not count :) |
| 213 | | +allowing later on patch for vtable override function, which does the following thing: |
| | 198 | some performance.[[BR]] |
| | 199 | [[BR]] |
| | 200 | +no more pmc proxy object [[BR]] |
| | 201 | = gaining speed (no more looking up needed) [[BR]] |
| | 202 | = use less memory in case of extending core pmc (lots less memory) [[BR]] |
| | 203 | -vtable function acces pmc->class->vtable->function instead of pmc->vtable->function [[BR]] |
| | 204 | -some non allowed attribute types are wrapped up [[BR]] |
| | 205 | -auto_attr is gone, see for example context.pmc. If there are no attributes then no mem is allocated. [[BR]] |
| | 206 | -call to vtable get/set attribute functions must do extra index 2 type action [[BR]] |
| | 207 | -call to vtable get/set attribute functions do unbox and boxing, but only in case of accessing [[BR]] |
| | 208 | a core pmc attribute, so this one does not count :) [[BR]] |
| | 209 | +allowing later on patch for vtable override function, which does the following thing: [[BR]] |
| 216 | | to do a lookup search all the time. Gaining lots of speed. |
| 217 | | +no more special code inplace for handling core pmcs |
| 218 | | -the class.pmc needs some more initialization. |
| 219 | | +- the mark,clone,freeze and thaw function will change |
| 220 | | - mark function must only walk the pmc* and String* attributes |
| 221 | | - clone function must take care of the different attribute types |
| 222 | | |
| 223 | | +the already nice parrot code will get better smoothed out, gaining dev time (important one for me :)) |
| 224 | | |
| 225 | | |
| | 212 | to do a lookup search all the time. Gaining lots of speed. [[BR]] |
| | 213 | +no more special code inplace for handling core pmcs [[BR]] |
| | 214 | -the class.pmc needs some more initialization. [[BR]] |
| | 215 | +- the mark,clone,freeze and thaw function will change [[BR]] |
| | 216 | - mark function must only walk the pmc* and String* attributes [[BR]] |
| | 217 | - clone function must take care of the different attribute types [[BR]] |
| | 218 | [[BR]] |
| | 219 | +the already nice parrot code will get better smoothed out, gaining dev time (important one for me :)) [[BR]] |
| | 220 | [[BR]] |
| | 221 | [[BR]] |