Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved compiledmethod_load primitive from Object to System.

  • Loading branch information...
commit ce498c16ff4212e0e4b88d452bb28db4fbbb2711 1 parent c9db058
@rue rue authored
View
23 vm/builtin/object.cpp
@@ -54,29 +54,6 @@ namespace rubinius {
return other;
}
- // HACK: remove this when performance is better and compiled_file.rb
- // unmarshal_data method works.
- OBJECT Object::compiledfile_load(STATE, String* path, OBJECT version) {
- if(!state->probe->nil_p()) {
- state->probe->load_runtime(state, std::string(path->c_str()));
- }
-
- std::ifstream stream(path->c_str());
- if(!stream) {
- std::ostringstream msg;
- msg << "unable to open file to run: " << path->c_str();
- Exception::io_error(state, msg.str().c_str());
- }
-
- CompiledFile* cf = CompiledFile::load(stream);
- if(cf->magic != "!RBIX") {
- std::ostringstream msg;
- msg << "Invalid file: " << path->c_str();
- Exception::io_error(state, msg.str().c_str());
- }
-
- return cf->body(state);
- }
void Object::copy_flags(STATE, OBJECT source) {
this->obj_type = source->obj_type;
View
24 vm/builtin/system.cpp
@@ -18,6 +18,30 @@ namespace rubinius {
/* Primitives */
+ //
+ // HACK: remove this when performance is better and compiled_file.rb
+ // unmarshal_data method works.
+ Object* System::compiledfile_load(STATE, String* path, Object* version) {
+ if(!state->probe->nil_p()) {
+ state->probe->load_runtime(state, std::string(path->c_str()));
+ }
+
+ std::ifstream stream(path->c_str());
+ if(!stream) {
+ std::ostringstream msg;
+ msg << "unable to open file to run: " << path->c_str();
+ Exception::io_error(state, msg.str().c_str());
+ }
+
+ CompiledFile* cf = CompiledFile::load(stream);
+ if(cf->magic != "!RBIX") {
+ std::ostringstream msg;
+ msg << "Invalid file: " << path->c_str();
+ Exception::io_error(state, msg.str().c_str());
+ }
+
+ return cf->body(state);
+ }
Object* Object::yield_gdb(STATE, Object* obj) {
obj->show(state);
View
4 vm/builtin/system.hpp
@@ -30,6 +30,10 @@ namespace rubinius {
public: /* Primitives */
+ /** Load a compiled file. */
+ // Ruby.primitive :compiledfile_load
+ static Object* compiledfile_load(STATE, String* path, Object* version);
+
/**
* When running under GDB, stop here.
*
Please sign in to comment.
Something went wrong with that request. Please try again.