comparison runtime/object.h @ 49:3e20ed8959c4

Added initial FFI implementation, Array type and 64-bit integers
author Mike Pavone <pavone@retrodev.com>
date Thu, 08 Apr 2010 01:02:18 -0400
parents aabda74c7a88
children 70af7fa155d0
comparison
equal deleted inserted replaced
48:a24eb366195c 49:3e20ed8959c4
24 uint32_t last_setfieldid; 24 uint32_t last_setfieldid;
25 uint32_t first_convertto; 25 uint32_t first_convertto;
26 uint32_t last_convertto; 26 uint32_t last_convertto;
27 uint32_t first_convertfrom; 27 uint32_t first_convertfrom;
28 uint32_t last_convertfrom; 28 uint32_t last_convertfrom;
29 uint32_t size; 29 int32_t size;
30 uint32_t boxed_size; 30 int32_t boxed_size;
31 } blueprint; 31 } blueprint;
32 32
33 typedef struct object { 33 typedef struct object {
34 rh_atomic32(refcount); 34 rh_atomic32(refcount);
35 blueprint *bprint; 35 blueprint *bprint;
51 uint16_t resume; 51 uint16_t resume;
52 object *params[1]; 52 object *params[1];
53 } calldata; 53 } calldata;
54 54
55 #define OBegin typedef struct { 55 #define OBegin typedef struct {
56 #define Object(name) } nt_ ## name; typedef struct { object _SP_header; nt_ ## name payload; } t_ ## name; 56 #define Object(name) } nt_ ## name; typedef struct { object SP_header; nt_ ## name payload; } t_ ## name;
57 #define Box(nakedtype,fieldname,objectname) typedef struct{ object _SP_header; nakedtype fieldname; } t_ ## objectname; 57 #define MObject(name) } nt_ ## name; typedef struct { multisize SP_header; nt_ ## name payload; } t_ ## name;
58 58 #define Box(nakedtype,fieldname,objectname) typedef struct{ object SP_header; nakedtype fieldname; } t_ ## objectname;
59 #define MOBegin typedef struct { multisize header;
60 59
61 #define get_blueprint(object) (object)->bprint 60 #define get_blueprint(object) (object)->bprint
62 61
63 #define add_ref(object) (rh_atomic_add((object), refcount, 1),object) 62 #define add_ref(object) (rh_atomic_add((object), refcount, 1),object)
64 63
69 void * alloc_variable(uint32_t size); 68 void * alloc_variable(uint32_t size);
70 object * new_object(uint32_t type); 69 object * new_object(uint32_t type);
71 object * new_object_bp(blueprint * bp); 70 object * new_object_bp(blueprint * bp);
72 multisize * new_multisize(uint32_t type, uint32_t size); 71 multisize * new_multisize(uint32_t type, uint32_t size);
73 void release_ref(object * obj); 72 void release_ref(object * obj);
74 blueprint * register_type_byid(uint32_t type, uint32_t size, special_func init, special_func copy, special_func cleanup); 73 blueprint * register_type_byid(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup);
75 blueprint * new_blueprint(uint32_t type, uint32_t size, special_func init, special_func copy, special_func cleanup); 74 blueprint * new_blueprint(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup);
76 void add_method(blueprint * bp, uint32_t methodid, rhope_func impl); 75 void add_method(blueprint * bp, uint32_t methodid, rhope_func impl);
77 void add_getter(blueprint * bp, uint32_t fieldid, rhope_func impl); 76 void add_getter(blueprint * bp, uint32_t fieldid, rhope_func impl);
78 void add_setter(blueprint * bp, uint32_t fieldid, rhope_func impl); 77 void add_setter(blueprint * bp, uint32_t fieldid, rhope_func impl);
79 returntype convert_to(uint32_t convertto, calldata * params); 78 returntype convert_to(uint32_t convertto, calldata * params);
80 returntype convert_from(uint32_t convertfrom, calldata * params); 79 returntype convert_from(uint32_t convertfrom, calldata * params);