5
5
#include "repr_registry.h"
6
6
#include "knowhow_bootstrapper.h"
7
7
#include "serialization_context.h"
8
+ #include "reprs/KnowHOWREPR.h"
8
9
9
10
/* Cached type IDs. */
10
11
static INTVAL stable_id = 0 ;
@@ -16,8 +17,32 @@ static STRING *find_method_str = NULL;
16
17
static STRING * type_check_str = NULL ;
17
18
static STRING * accepts_type_str = NULL ;
18
19
20
+ static PMC * boot_type (PARROT_INTERP , PMC * knowhow , char * type_name , char * repr_name , INTVAL index ) {
21
+ PMC * knowhow_how = STABLE (knowhow )-> HOW ;
22
+ PMC * meta_obj = REPR (knowhow_how )-> allocate (interp , STABLE (knowhow_how ));
23
+ PMC * sc = SC_get_sc (interp , Parrot_str_new_constant (interp , "__6MODEL_CORE__" ));
24
+ REPROps * repr ;
25
+ PMC * type_obj ;
26
+
27
+ REPR (meta_obj )-> initialize (interp , STABLE (meta_obj ), OBJECT_BODY (meta_obj ));
28
+ ((KnowHOWREPRInstance * )PMC_data (meta_obj ))-> body .name = Parrot_str_new_constant (interp , type_name );
29
+ repr = REPR_get_by_name (interp , Parrot_str_new_constant (interp , repr_name ));
30
+ type_obj = repr -> type_object_for (interp , meta_obj );
31
+ STABLE (type_obj )-> method_cache = ((KnowHOWREPRInstance * )PMC_data (meta_obj ))-> body .methods ;
32
+ STABLE (type_obj )-> mode_flags = METHOD_CACHE_AUTHORITATIVE ;
33
+
34
+ VTABLE_set_pmc_keyed_int (interp , sc , index , type_obj );
35
+ SC_PMC (type_obj ) = sc ;
36
+ STABLE (type_obj )-> sc = sc ;
37
+ VTABLE_set_pmc_keyed_int (interp , sc , index + 1 , STABLE (type_obj )-> HOW );
38
+ SC_PMC (STABLE (type_obj )-> HOW ) = sc ;
39
+ STABLE (STABLE (type_obj )-> HOW )-> sc = sc ;
40
+
41
+ return type_obj ;
42
+ }
43
+
19
44
/* Initializes 6model and produces the KnowHOW core meta-object. */
20
- void SixModelObject_initialize (PARROT_INTERP , PMC * * knowhow , PMC * * knowhow_attribute ) {
45
+ void SixModelObject_initialize (PARROT_INTERP , PMC * * knowhow , PMC * * knowhow_attribute , PMC * * boot_array ) {
21
46
PMC * initial_sc ;
22
47
STRING * initial_sc_name ;
23
48
@@ -43,6 +68,8 @@ void SixModelObject_initialize(PARROT_INTERP, PMC **knowhow, PMC **knowhow_attri
43
68
44
69
/* Set up the simple KnowHOWAttribute. */
45
70
* knowhow_attribute = SixModelObject_setup_knowhow_attribute (interp , initial_sc , * knowhow );
71
+
72
+ * boot_array = boot_type (interp , * knowhow , "BOOTArray" , "VMArray" , 2 );
46
73
}
47
74
48
75
/* Sets the object that we'll wrap the next allocation in. */
0 commit comments