diff runtime/object.h @ 186:ba35ab624ec2

Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
author Mike Pavone <pavone@retrodev.com>
date Fri, 07 Oct 2011 00:10:02 -0700
parents 9fab36cc706b
children
line wrap: on
line diff
--- a/runtime/object.h	Wed Jul 27 21:32:40 2011 -0700
+++ b/runtime/object.h	Fri Oct 07 00:10:02 2011 -0700
@@ -32,7 +32,9 @@
 } blueprint;
 
 struct object {
+#ifndef USE_GC
 	rh_atomic32(refcount);
+#endif
 	blueprint  *bprint;
 };
 
@@ -66,29 +68,34 @@
 
 #define get_blueprint(object) (object)->bprint
 
+#ifdef USE_GC
+#define add_ref(object) object
+#define release_ref(object) 
+#else
 #define add_ref(object) (rh_atomic_add((object), refcount, 1),object)
+void release_ref(object * obj);
+#endif
 
-returntype call_method(uint32_t methodid, calldata * params);
+/*returntype call_method(uint32_t methodid, calldata * params);
 returntype set_field(uint32_t setfieldid, calldata * params);
-returntype get_field(uint32_t getfieldid, calldata * params);
+returntype get_field(uint32_t getfieldid, calldata * params);*/
 object * alloc_object(blueprint * bp);
 void * alloc_variable(uint32_t size);
 object * new_object(uint32_t type);
 object * new_object_bp(blueprint * bp);
 multisize * new_multisize(uint32_t type, uint32_t size);
-void release_ref(object * obj);
 blueprint * register_type_byid(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup);
 blueprint * register_type(int32_t size, special_func init, special_func copy, special_func cleanup);
 blueprint * new_blueprint(uint32_t type, int32_t size, special_func init, special_func copy, special_func cleanup);
 void add_method(blueprint * bp, uint32_t methodid, rhope_func impl);
 void add_getter(blueprint * bp, uint32_t fieldid, rhope_func impl);
 void add_setter(blueprint * bp, uint32_t fieldid, rhope_func impl);
-returntype convert_to(uint32_t convertto, calldata * params);
-returntype convert_from(uint32_t convertfrom, calldata * params);
+/*returntype convert_to(uint32_t convertto, calldata * params);
+returntype convert_from(uint32_t convertfrom, calldata * params);*/
 object * copy_object(object * tocopy);
 object * naked_to_boxed(uint32_t type, void * rawdata);
 void boxed_to_naked(object * src, void * dest);
-returntype coerce_value(uint32_t type, calldata * params);
+/*returntype coerce_value(uint32_t type, calldata * params);*/
 blueprint * get_blueprint_byid(uint32_t type);
 
 extern blueprint ** registered_types;