5
5
#define SIXMODELOBJECT_H_GUARD
7
7
#include "storage_spec.h"
8
#include "serialization.h"
9
10
/* The commonalities shared between all 6model objects, no matter what the
10
11
* REPR is. This struct should be placed as the first thing in the object
69
70
/* S-Tables (short for Shared Table) contains the commonalities shared between
70
71
* a (HOW, REPR) pairing (for example, (HOW for the class Dog, P6Opaque). */
71
72
typedef struct SixModel_REPROps REPROps;
73
struct SixModel_STable {
73
74
/* The representation operation table. */
127
128
/* The underlying package stash. */
131
/* Serialization context that this s-table belongs to. */
130
134
/* Parrot-specific set of v-table to method mappings, for overriding
131
135
* of Parrot v-table functions. */
291
295
* thread safety requirements. */
292
296
void (*change_type) (PARROT_INTERP, PMC *Object, PMC *NewType);
298
/* Object serialization. Writes the objects body out using the passed
299
* serialization writer. */
300
void (*serialize) (PARROT_INTERP, STable *st, void *data, SerializationWriter *writer);
302
/* Object deserialization. Reads the objects body in using the passed
303
* serialization reader. */
304
void (*deserialize) (PARROT_INTERP, STable *st, void *data, SerializationReader *reader);
306
/* REPR data serialization. Seserializes the per-type representation data that
307
* is attached to the supplied STable. */
308
void (*serialize_repr_data) (PARROT_INTERP, STable *st, SerializationWriter *writer);
310
/* REPR data deserialization. Deserializes the per-type representation data and
311
* attaches it to the supplied STable. */
312
void (*deserialize_repr_data) (PARROT_INTERP, STable *st, SerializationReader *reader);
294
314
/* This Parrot-specific addition to the API is used to mark an object. */
295
315
void (*gc_mark) (PARROT_INTERP, STable *st, void *data);
330
350
#define IS_CONCRETE(o) (!PObj_flag_TEST(private0, (o)))
331
351
#define MARK_AS_TYPE_OBJECT(o) PObj_flag_SET(private0, (o))
353
/* Write barriers for noticing changes to objects or STables with an SC. */
354
typedef void (* obj_sc_barrier_func) (PARROT_INTERP, PMC *obj);
355
typedef void (* st_sc_barrier_func) (PARROT_INTERP, STable *st);
356
#define OBJ_SC_WRITE_BARRIER(o) \
358
((obj_sc_barrier_func) \
359
D2FPTR(VTABLE_get_pointer(interp, \
360
VTABLE_get_pmc_keyed_str(interp, interp->root_namespace, \
361
Parrot_str_new_constant(interp, "_OBJ_SC_BARRIER")))))(interp, o); \
363
#define ST_SC_WRITE_BARRIER(st) \
365
((st_sc_barrier_func) \
366
D2FPTR(VTABLE_get_pointer(interp, \
367
VTABLE_get_pmc_keyed_str(interp, interp->root_namespace, \
368
Parrot_str_new_constant(interp, "_ST_SC_BARRIER")))))(interp, st); \
333
371
/* Object model initialization. */
334
372
void SixModelObject_initialize(PARROT_INTERP, PMC **knowhow, PMC **knowhow_attribute);
336
374
/* Some utility functions. */
375
void set_wrapping_object(PMC *wrapper);
337
376
PMC * wrap_object(PARROT_INTERP, void *obj);
338
377
PMC * create_stable(PARROT_INTERP, REPROps *REPR, PMC *HOW);
339
378
PMC * decontainerize(PARROT_INTERP, PMC *var);