public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
rubinius / vm / builtin_class.hpp
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 1 #ifndef RBX_BUILTIN_CLASS_HPP
2 #define RBX_BUILTIN_CLASS_HPP
3
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 4 #include "objects.hpp"
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 5
6 namespace rubinius {
7 class Module : public BuiltinType {
8 public:
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 9 const static size_t fields = 5;
22ef7b8b » evanphx 2008-04-16 Pass 1 through adding Task ... 10 const static object_type type = ModuleType;
4c08cc4b » evanphx 2008-04-10 Add object cleanup post col... 11
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 12 OBJECT __ivars__; // slot
13 LookupTable* method_table; // slot
14 SYMBOL name; // slot
15 LookupTable* constants; // slot
16 Module* superclass; // slot
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 17
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 18 static Module* create(STATE);
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 19 void setup(STATE);
304caf31 » evanphx 2008-04-04 Bunch more work. 20 void setup(STATE, char* name, Module* under = NULL);
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 21 void setup(STATE, SYMBOL name, Module* under = NULL);
304caf31 » evanphx 2008-04-04 Bunch more work. 22 void set_const(STATE, OBJECT sym, OBJECT val);
fceff3d8 » evanphx 2008-04-09 NativeFunction, Selector, S... 23 void set_const(STATE, char* name, OBJECT val);
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 24 OBJECT get_const(STATE, SYMBOL sym);
25 OBJECT get_const(STATE, SYMBOL sym, bool* found);
304caf31 » evanphx 2008-04-04 Bunch more work. 26 OBJECT get_const(STATE, char* sym);
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 27
28 void set_name(STATE, Module* under, SYMBOL name);
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 29
30 class Info : public TypeInfo {
31 public:
879a0469 » evanphx 2008-05-15 A whole slew. Enhanced type... 32 BASIC_TYPEINFO(TypeInfo)
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 33 };
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 34 };
35
36 class Class : public Module {
37 public:
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 38 const static size_t fields = 9;
22ef7b8b » evanphx 2008-04-16 Pass 1 through adding Task ... 39 const static object_type type = ClassType;
40
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 41 FIXNUM instance_fields; // slot
42 OBJECT has_ivars; // slot
43 OBJECT needs_cleanup; // slot
44 FIXNUM instance_type; // slot
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 45
fceff3d8 » evanphx 2008-04-09 NativeFunction, Selector, S... 46 void set_object_type(size_t type) {
22ef7b8b » evanphx 2008-04-16 Pass 1 through adding Task ... 47 instance_type = Object::i2n(type);
fceff3d8 » evanphx 2008-04-09 NativeFunction, Selector, S... 48 }
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 49
50 static Class* create(STATE, Class* super);
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 51
52 class Info : public TypeInfo {
53 public:
879a0469 » evanphx 2008-05-15 A whole slew. Enhanced type... 54 BASIC_TYPEINFO(TypeInfo)
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 55 };
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 56 };
57
58 class MetaClass : public Class {
59 public:
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 60 const static size_t fields = 10;
22ef7b8b » evanphx 2008-04-16 Pass 1 through adding Task ... 61 const static object_type type = MetaclassType;
62
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 63 OBJECT attached_instance; // slot
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 64
9eb47483 » evanphx 2008-04-20 Flesh out Task considerable... 65 static MetaClass* attach(STATE, OBJECT obj, OBJECT sup = NULL);
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 66
67 class Info : public TypeInfo {
68 public:
879a0469 » evanphx 2008-05-15 A whole slew. Enhanced type... 69 BASIC_TYPEINFO(TypeInfo)
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 70 };
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 71 };
72
73 class IncludedModule : public Module {
74 public:
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 75 const static size_t field = 6;
76 const static object_type type = IncModType;
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 77
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 78 OBJECT module; // slot
79
80 class Info : public TypeInfo {
81 public:
879a0469 » evanphx 2008-05-15 A whole slew. Enhanced type... 82 BASIC_TYPEINFO(TypeInfo)
feb91b43 » evanphx 2008-05-07 Tons of stuff (too much pro... 83 };
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 84 };
85
879a0469 » evanphx 2008-05-15 A whole slew. Enhanced type... 86 /* See t1 */
87 template <>
88 static bool kind_of<Module>(OBJECT obj) {
89 return obj->reference_p() &&
90 (obj->obj_type == Module::type ||
91 obj->obj_type == Class::type ||
92 obj->obj_type == MetaClass::type ||
93 obj->obj_type == IncludedModule::type);
94 }
95
96
d769c944 » evanphx 2008-03-25 Initial work on new C++ VM 97 };
98
99 #endif