Mercurial > repos > rhope
comparison runtime/object.h @ 63:04baa003de5a
Merged latest changes with better C branch
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 05 May 2010 22:12:23 -0400 |
parents | b218af069da7 70af7fa155d0 |
children | d4b44ae2e34a |
comparison
equal
deleted
inserted
replaced
62:b218af069da7 | 63:04baa003de5a |
---|---|
25 uint32_t last_setfieldid; | 25 uint32_t last_setfieldid; |
26 uint32_t first_convertto; | 26 uint32_t first_convertto; |
27 uint32_t last_convertto; | 27 uint32_t last_convertto; |
28 uint32_t first_convertfrom; | 28 uint32_t first_convertfrom; |
29 uint32_t last_convertfrom; | 29 uint32_t last_convertfrom; |
30 uint32_t size; | 30 int32_t size; |
31 uint32_t boxed_size; | 31 int32_t boxed_size; |
32 } blueprint; | 32 } blueprint; |
33 | 33 |
34 typedef struct object { | 34 struct object { |
35 rh_atomic32(refcount); | 35 rh_atomic32(refcount); |
36 blueprint *bprint; | 36 blueprint *bprint; |
37 } object; | 37 }; |
38 | 38 |
39 typedef struct { | 39 typedef struct { |
40 object base; | 40 object base; |
41 uint32_t size; | 41 uint32_t size; |
42 } multisize; | 42 } multisize; |
46 object *params[1]; | 46 object *params[1]; |
47 struct calldata *lastframe; | 47 struct calldata *lastframe; |
48 uint16_t num_params; | 48 uint16_t num_params; |
49 uint16_t resume; | 49 uint16_t resume; |
50 uint32_t func; | 50 uint32_t func; |
51 } calldata; | 51 }; |
52 #pragma pack(pop) | 52 #pragma pack(pop) |
53 | 53 |
54 #define OBegin typedef struct { object header; | 54 #define OBegin typedef struct { |
55 #define Object(name) } t_ ## name; | 55 #define Object(name) } nt_ ## name; typedef struct { object SP_header; nt_ ## name payload; } t_ ## name; |
56 | 56 #define MObject(name) } nt_ ## name; typedef struct { multisize SP_header; nt_ ## name payload; } t_ ## name; |
57 #define MOBegin typedef struct { multisize header; | 57 #define Box(nakedtype,fieldname,objectname) typedef struct{ object SP_header; nakedtype fieldname; } t_ ## objectname; |
58 | 58 |
59 #define get_blueprint(object) (object)->bprint | 59 #define get_blueprint(object) (object)->bprint |
60 | 60 |
61 #define add_ref(object) (rh_atomic_add((object), refcount, 1),object) | 61 #define add_ref(object) (rh_atomic_add((object), refcount, 1),object) |
62 | 62 |
67 void * alloc_variable(uint32_t size); | 67 void * alloc_variable(uint32_t size); |
68 object * new_object(uint32_t type); | 68 object * new_object(uint32_t type); |
69 object * new_object_bp(blueprint * bp); | 69 object * new_object_bp(blueprint * bp); |
70 multisize * new_multisize(uint32_t type, uint32_t size); | 70 multisize * new_multisize(uint32_t type, uint32_t size); |
71 void release_ref(object * obj); | 71 void release_ref(object * obj); |
72 blueprint * register_type_byid(uint32_t type, uint32_t size, special_func init, special_func copy, special_func cleanup); | 72 blueprint * register_type_byid(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup); |
73 blueprint * new_blueprint(uint32_t type, uint32_t size, special_func init, special_func copy, special_func cleanup); | 73 blueprint * new_blueprint(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup); |
74 void add_method(blueprint * bp, uint32_t methodid, rhope_func impl); | 74 void add_method(blueprint * bp, uint32_t methodid, rhope_func impl); |
75 void add_getter(blueprint * bp, uint32_t fieldid, rhope_func impl); | 75 void add_getter(blueprint * bp, uint32_t fieldid, rhope_func impl); |
76 void add_setter(blueprint * bp, uint32_t fieldid, rhope_func impl); | 76 void add_setter(blueprint * bp, uint32_t fieldid, rhope_func impl); |
77 returntype convert_to(uint32_t convertto, calldata * params); | 77 returntype convert_to(uint32_t convertto, calldata * params); |
78 returntype convert_from(uint32_t convertfrom, calldata * params); | 78 returntype convert_from(uint32_t convertfrom, calldata * params); |