Permalink
Browse files

Tons of stuff (too much probably)

  • Loading branch information...
1 parent 611cd74 commit feb91b43f113f8dc3b5e28c569cabc0a9c3d508c Evan Phoenix committed May 8, 2008
Showing with 4,041 additions and 935 deletions.
  1. BIN runtime/stable/bootstrap.rba
  2. BIN runtime/stable/compiler.rba
  3. BIN runtime/stable/core.rba
  4. BIN runtime/stable/loader.rbc
  5. BIN runtime/stable/platform.rba
  6. +3 −0 vm/.gitignore
  7. +13 −5 vm/builtin_array.hpp
  8. +3 −3 vm/builtin_bignum.cpp
  9. +1 −1 vm/builtin_bignum.hpp
  10. +37 −0 vm/builtin_block_environment.hpp
  11. +19 −0 vm/builtin_bytearray.hpp
  12. +8 −4 vm/builtin_channel.cpp
  13. +11 −2 vm/builtin_channel.hpp
  14. +2 −3 vm/builtin_class.cpp
  15. +44 −20 vm/builtin_class.hpp
  16. +3 −2 vm/builtin_compiledmethod.cpp
  17. +87 −0 vm/builtin_compiledmethod.hpp
  18. +10 −3 vm/builtin_contexts.cpp
  19. +13 −2 vm/builtin_contexts.hpp
  20. +24 −0 vm/builtin_exception.hpp
  21. +29 −0 vm/builtin_executable.hpp
  22. +68 −0 vm/builtin_fixnum.hpp
  23. +11 −0 vm/builtin_float.cpp
  24. +8 −1 vm/builtin_float.hpp
  25. +72 −78 vm/builtin_hash.cpp
  26. +22 −12 vm/builtin_hash.hpp
  27. +57 −0 vm/builtin_immediates.hpp
  28. +8 −3 vm/builtin_io.cpp
  29. +74 −0 vm/builtin_io.hpp
  30. +4 −4 vm/builtin_iseq.cpp
  31. +13 −5 vm/builtin_iseq.hpp
  32. +16 −14 vm/builtin_list.cpp
  33. +30 −12 vm/builtin_list.hpp
  34. +33 −43 vm/builtin_lookuptable.cpp
  35. +48 −0 vm/builtin_lookuptable.hpp
  36. +24 −0 vm/builtin_memorypointer.hpp
  37. +17 −0 vm/builtin_methodtable.hpp
  38. +45 −0 vm/builtin_nativefunction.hpp
  39. +49 −31 vm/builtin_object.cpp
  40. +1 −1 vm/builtin_regexp.cpp
  41. +32 −18 vm/builtin_regexp.hpp
  42. +12 −3 vm/builtin_selector.hpp
  43. +2 −2 vm/builtin_sendsite.cpp
  44. +26 −0 vm/builtin_staticscope.hpp
  45. +11 −11 vm/builtin_string.cpp
  46. +15 −12 vm/builtin_string.hpp
  47. +2 −2 vm/builtin_symbol.cpp
  48. +62 −0 vm/builtin_symbol.hpp
  49. +10 −6 vm/builtin_task.cpp
  50. +1 −1 vm/builtin_task.hpp
  51. +14 −0 vm/builtin_thread.cpp
  52. +3 −0 vm/builtin_thread.hpp
  53. +30 −0 vm/builtin_tuple.hpp
  54. +21 −0 vm/compiled_file.cpp
  55. +28 −0 vm/compiled_file.hpp
  56. +7 −0 vm/doc/execution.txt
  57. +59 −0 vm/environment.cpp
  58. +24 −0 vm/environment.hpp
  59. +1 −1 vm/event.cpp
  60. +2 −2 vm/event.hpp
  61. +0 −41 vm/ffi.hpp
  62. +347 −0 vm/field_extract.rb
  63. +3 −3 vm/global_cache.hpp
  64. +3 −1 vm/globals.hpp
  65. +25 −98 vm/instructions.rb
  66. +19 −0 vm/main.cpp
  67. +53 −23 vm/marshal.cpp
  68. +2 −2 vm/marshal.hpp
  69. +45 −12 vm/object.hpp
  70. +4 −1 vm/objectmemory.hpp
  71. +6 −3 vm/objects.cpp
  72. +49 −378 vm/objects.hpp
  73. +4 −0 vm/prelude.hpp
  74. +62 −0 vm/primitives.cpp
  75. +14 −0 vm/primitives.hpp
  76. +55 −1 vm/test/Rakefile
  77. +56 −3 vm/test/test_channel.hpp
  78. +41 −0 vm/test/test_compiled_file.hpp
  79. +23 −0 vm/test/test_compiledmethod.hpp
  80. +1 −1 vm/test/test_event.hpp
  81. +1,653 −0 vm/test/test_instructions.hpp
  82. +6 −5 vm/test/test_lookuptable.hpp
  83. +10 −2 vm/test/test_marshal.hpp
  84. +1 −1 vm/test/test_message.hpp
  85. +4 −4 vm/test/test_object.hpp
  86. +13 −13 vm/test/test_objectmemory.hpp
  87. +4 −3 vm/test/test_objects.hpp
  88. +2 −2 vm/test/test_regexp.hpp
  89. +16 −16 vm/test/test_task.hpp
  90. +67 −3 vm/test/test_unmarshal.hpp
  91. +3 −2 vm/test/test_vm.hpp
  92. +62 −0 vm/test/test_vmmethod.hpp
  93. +12 −3 vm/type_info.cpp
  94. +12 −2 vm/type_info.hpp
  95. +59 −2 vm/vm.cpp
  96. +13 −0 vm/vm.hpp
  97. +20 −3 vm/vmmethod.cpp
  98. +3 −0 vm/vmmethod.hpp
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,3 @@
+test/.deps/*
+gen/*
+external_libs
View
@@ -4,13 +4,14 @@
namespace rubinius {
class Array : public BuiltinType {
public:
- const static size_t fields = 4;
+ const static size_t fields = 5;
const static object_type type = ArrayType;
- INTEGER total;
- Tuple* tuple;
- INTEGER start;
- OBJECT shared;
+ OBJECT __ivars__; // slot
+ INTEGER total; // slot
+ Tuple* tuple; // slot
+ INTEGER start; // slot
+ OBJECT shared; // slot
size_t size() {
return total->n2i();
@@ -23,6 +24,13 @@ namespace rubinius {
OBJECT set(STATE, size_t idx, OBJECT val);
OBJECT append(STATE, OBJECT val);
bool includes_p(STATE, OBJECT val);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
};
View
@@ -170,7 +170,7 @@ namespace rubinius {
}
void Bignum::init(STATE) {
- state->add_type_info(new Bignum::Info(G(bignum)));
+ state->add_type_info(new Bignum::Info(Bignum::type));
}
Bignum* Bignum::create(STATE, native_int num) {
@@ -253,7 +253,6 @@ namespace rubinius {
INTEGER Bignum::div(STATE, INTEGER b, INTEGER mod_obj) {
NMP;
- mp_int *mod = MP(mod_obj);
mp_int m, x, y, z;
if(kind_of<Fixnum>(b)) {
@@ -297,7 +296,8 @@ namespace rubinius {
mp_copy(&y, &m);
}
- if(mod) {
+ if(!mod_obj->nil_p()) {
+ mp_int *mod = MP(mod_obj);
mp_copy(&m, mod);
}
View
@@ -57,7 +57,7 @@ namespace rubinius {
class Info : public TypeInfo {
public:
- Info(Class* cls) : TypeInfo(cls) { }
+ Info(object_type type) : TypeInfo(type) { }
virtual void cleanup(OBJECT obj);
};
};
@@ -0,0 +1,37 @@
+#ifndef RBX_BUILTIN_BLOCK_ENVIRONMENT_HPP
+#define RBX_BUILTIN_BLOCK_ENVIRONMENT_HPP
+
+namespace rubinius {
+ class CompiledMethod;
+ class MethodContext;
+ class BlockContext;
+ class Message;
+
+ class BlockEnvironment : public BuiltinType {
+ public:
+ const static size_t fields = 5;
+ const static object_type type = BlockEnvType;
+
+ OBJECT __ivars__; // slot
+ MethodContext* home; // slot
+ MethodContext* home_block; // slot
+ OBJECT local_count; // slot
+ CompiledMethod* method; // slot
+
+ static BlockEnvironment* under_context(STATE, CompiledMethod* cm,
+ MethodContext* parent, MethodContext* active);
+
+ void call(STATE, size_t args);
+ void call(STATE, Message& msg);
+ BlockContext* create_context(STATE);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
+ };
+};
+
+#endif
View
@@ -0,0 +1,19 @@
+#ifndef RBX_BUILTIN_BYTEARRAY_HPP
+#define RBX_BUILTIN_BYTEARRAY_HPP
+
+namespace rubinius {
+ class ByteArray : public BuiltinType {
+ public:
+ const static size_t fields = 0;
+ const static object_type type = ByteArrayType;
+
+ static ByteArray* create(STATE, size_t bytes);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ };
+ };
+};
+
+#endif
View
@@ -9,6 +9,13 @@ namespace rubinius {
}
void Channel::send(STATE, OBJECT val) {
+ if(!waiting->empty_p()) {
+ Thread* thr = as<Thread>(waiting->shift(state));
+ thr->set_top(state, val);
+ state->queue_thread(thr);
+ return;
+ }
+
if(value->nil_p()) {
List* lst = List::create(state);
lst->append(state, val);
@@ -33,10 +40,7 @@ namespace rubinius {
}
bool Channel::has_readers_p() {
- return false;
+ return !waiting->empty_p();
}
- void Thread::sleep_for(STATE, Channel* chan) {
-
- }
}
View
@@ -7,16 +7,25 @@ namespace rubinius {
const static size_t fields = 3;
const static object_type type = ChannelType;
- OBJECT value;
- List* waiting;
+ OBJECT __ivars__; // slot
+ OBJECT value; // slot
+ List* waiting; // slot
static Channel* create(STATE);
void send(STATE, OBJECT);
void receive(STATE);
bool has_readers_p();
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
class ChannelCallback : public ObjectCallback {
+ public:
TypedRoot<Channel*> channel;
ChannelCallback(STATE, Channel* chan) : ObjectCallback(state) {
View
@@ -78,14 +78,13 @@ namespace rubinius {
MetaClass* MetaClass::attach(STATE, OBJECT obj, OBJECT sup) {
MetaClass *meta;
- meta = (MetaClass*)state->om->new_object(G(metaclass),
- MetaClass::fields);
+ meta = (MetaClass*)state->new_object(G(metaclass));
if(!sup) { sup = obj->klass; }
meta->IsMeta = TRUE;
SET(meta, attached_instance, obj);
meta->setup(state);
SET(meta, superclass, sup);
- state->om->set_class(obj, meta);
+ SET(obj, klass, meta);
return meta;
}
View
@@ -6,16 +6,14 @@
namespace rubinius {
class Module : public BuiltinType {
public:
- const static size_t fields = 7;
+ const static size_t fields = 5;
const static object_type type = ModuleType;
- OBJECT instance_variables;
- LookupTable* method_table;
- OBJECT method_cache;
- SYMBOL name;
- LookupTable* constants;
- OBJECT encloser;
- Class* superclass;
+ OBJECT __ivars__; // slot
+ LookupTable* method_table; // slot
+ SYMBOL name; // slot
+ LookupTable* constants; // slot
+ Module* superclass; // slot
static Module* create(STATE);
void setup(STATE);
@@ -28,23 +26,37 @@ namespace rubinius {
OBJECT get_const(STATE, char* sym);
void set_name(STATE, Module* under, SYMBOL name);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
class Class : public Module {
public:
- const static size_t fields = 11;
+ const static size_t fields = 9;
const static object_type type = ClassType;
- FIXNUM instance_fields;
- OBJECT has_ivars;
- OBJECT needs_cleanup;
- FIXNUM instance_type;
+ FIXNUM instance_fields; // slot
+ OBJECT has_ivars; // slot
+ OBJECT needs_cleanup; // slot
+ FIXNUM instance_type; // slot
void set_object_type(size_t type) {
instance_type = Object::i2n(type);
}
static Class* create(STATE, Class* super);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
/* See t1 */
@@ -57,22 +69,34 @@ namespace rubinius {
class MetaClass : public Class {
public:
- const static size_t fields = 12;
+ const static size_t fields = 10;
const static object_type type = MetaclassType;
- OBJECT attached_instance;
-
- static bool is_a(OBJECT obj) {
- return obj->obj_type == MetaclassType;
- }
+ OBJECT attached_instance; // slot
static MetaClass* attach(STATE, OBJECT obj, OBJECT sup = NULL);
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
class IncludedModule : public Module {
public:
+ const static size_t field = 6;
+ const static object_type type = IncModType;
- OBJECT module;
+ OBJECT module; // slot
+
+ class Info : public TypeInfo {
+ public:
+ Info(object_type type) : TypeInfo(type) { }
+ virtual void set_field(STATE, OBJECT target, size_t index, OBJECT val);
+ virtual OBJECT get_field(STATE, OBJECT target, size_t index);
+ };
};
};
@@ -1,14 +1,15 @@
#include "builtin.hpp"
#include "ffi.hpp"
+#include "marshal.hpp"
namespace rubinius {
CompiledMethod* CompiledMethod::create(STATE) {
CompiledMethod* cm = (CompiledMethod*)state->new_object(G(cmethod));
return cm;
}
- CompiledMethod::Visibility* CompiledMethod::Visibility::create(STATE) {
- return (CompiledMethod::Visibility*)state->new_object(G(cmethod_vis));
+ MethodVisibility* MethodVisibility::create(STATE) {
+ return (MethodVisibility*)state->new_object(G(cmethod_vis));
}
void CompiledMethod::post_marshal(STATE) {
Oops, something went wrong.

0 comments on commit feb91b4

Please sign in to comment.