[macruby-changes] [4110] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 14 20:32:13 PDT 2010
Revision: 4110
http://trac.macosforge.org/projects/ruby/changeset/4110
Author: lsansonetti at apple.com
Date: 2010-05-14 20:32:10 -0700 (Fri, 14 May 2010)
Log Message:
-----------
move the RObject structure from the public headers
Modified Paths:
--------------
MacRuby/trunk/include/ruby/ruby.h
MacRuby/trunk/vm.h
Modified: MacRuby/trunk/include/ruby/ruby.h
===================================================================
--- MacRuby/trunk/include/ruby/ruby.h 2010-05-15 00:31:23 UTC (rev 4109)
+++ MacRuby/trunk/include/ruby/ruby.h 2010-05-15 03:32:10 UTC (rev 4110)
@@ -476,13 +476,6 @@
VALUE flags;
};
-struct RObject {
- struct RBasic basic;
- CFMutableDictionaryRef tbl; /* dynamic ivars (runtime) */
- unsigned int num_slots;
- VALUE *slots; /* static ivars (compilation) */
-};
-
#define RCLASS_SUPER(m) ((VALUE)class_getSuperclass((Class)m))
#define RCLASS_SET_SUPER(m, s) (class_setSuperclass((Class)m, (Class)s))
#define RCLASS_META(m) (class_isMetaClass((Class)m))
@@ -619,7 +612,6 @@
#define R_CAST(st) (struct st*)
#define RBASIC(obj) (R_CAST(RBasic)(obj))
-#define ROBJECT(obj) (R_CAST(RObject)(obj))
#define RDATA(obj) (R_CAST(RData)(obj))
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
#define RBIGNUM(obj) (R_CAST(RBignum)(obj))
Modified: MacRuby/trunk/vm.h
===================================================================
--- MacRuby/trunk/vm.h 2010-05-15 00:31:23 UTC (rev 4109)
+++ MacRuby/trunk/vm.h 2010-05-15 03:32:10 UTC (rev 4110)
@@ -13,6 +13,15 @@
extern "C" {
#endif
+typedef struct rb_object {
+ struct RBasic basic;
+ CFMutableDictionaryRef tbl; /* dynamic ivars (runtime) */
+ unsigned int num_slots;
+ VALUE *slots; /* static ivars (compilation) */
+} rb_object_t;
+
+#define ROBJECT(o) ((rb_object_t *)o)
+
typedef struct {
short min; // min number of args that we accept
short max; // max number of args that we accept (-1 if rest)
@@ -337,7 +346,7 @@
VALUE rb_vm_throw(VALUE tag, VALUE value);
static inline void
-rb_vm_regrow_robject_slots(struct RObject *obj, unsigned int new_num_slot)
+rb_vm_regrow_robject_slots(rb_object_t *obj, unsigned int new_num_slot)
{
unsigned int i;
VALUE *new_slots = (VALUE *)xrealloc(obj->slots,
@@ -354,7 +363,7 @@
static inline VALUE
rb_vm_get_ivar_from_slot(VALUE obj, int slot)
{
- struct RObject *robj = (struct RObject *)obj;
+ rb_object_t *robj = ROBJECT(obj);
assert(slot >= 0);
if ((unsigned int)slot >= robj->num_slots) {
return Qnil;
@@ -365,7 +374,7 @@
static inline void
rb_vm_set_ivar_from_slot(VALUE obj, VALUE val, int slot)
{
- struct RObject *robj = (struct RObject *)obj;
+ rb_object_t *robj = ROBJECT(obj);
assert(slot >= 0);
if ((unsigned int)slot >= robj->num_slots) {
rb_vm_regrow_robject_slots(robj, (unsigned int)slot);
@@ -440,10 +449,9 @@
static inline VALUE
rb_robject_allocate_instance(VALUE klass)
{
- struct RObject *obj;
- int num_slots = 10;
+ const int num_slots = 10;
- obj = (struct RObject *)rb_objc_newobj(sizeof(struct RObject));
+ rb_object_t *obj = (rb_object_t *)rb_objc_newobj(sizeof(rb_object_t));
GC_WB(&obj->slots, xmalloc_ptrs(num_slots * sizeof(VALUE)));
OBJSETUP(obj, klass, T_OBJECT);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100514/1fda38d1/attachment.html>
More information about the macruby-changes
mailing list