Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e45b261154bc
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a7809747c0dd
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Feb 27, 2016

  1. Fixed displaying -Xhelp.

    brixen committed Feb 27, 2016
    Copy the full SHA
    9619289 View commit details
  2. Copy the full SHA
    4d8a7ba View commit details
  3. Copy the full SHA
    a780974 View commit details
Showing with 34 additions and 2 deletions.
  1. +1 −1 library/rubinius/configuration.rb
  2. +21 −0 vm/builtin/code_db.cpp
  3. +1 −0 vm/builtin/code_db.hpp
  4. +11 −1 vm/environment.cpp
2 changes: 1 addition & 1 deletion library/rubinius/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'core/build_config'
require 'core/build_config' unless defined?(Rubinius::BUILD_CONFIG)
require 'rubinius/configuration_variables'

Rubinius::ConfigurationVariables.define do |c|
21 changes: 21 additions & 0 deletions vm/builtin/code_db.cpp
Original file line number Diff line number Diff line change
@@ -25,6 +25,27 @@ namespace rubinius {
G(codedb)->set_object_type(state, CodeDBType);
}

bool CodeDB::valid_database_p(STATE, std::string path) {
struct stat st;

std::string signature_path = path + "/signature";
if(stat(signature_path.c_str(), &st) || !S_ISREG(st.st_mode)) {
return false;
}

std::string index_path = path + "/index";
if(stat(index_path.c_str(), &st) || !S_ISREG(st.st_mode)) {
return false;
}

std::string data_path = path + "/data";
if(stat(data_path.c_str(), &st) || !S_ISREG(st.st_mode)) {
return false;
}

return true;
}

CodeDB* CodeDB::open(STATE, String* path) {
return open(state, path->c_str(state));
}
1 change: 1 addition & 0 deletions vm/builtin/code_db.hpp
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ namespace rubinius {
attr_accessor(path, String);

static void init(STATE);
static bool valid_database_p(STATE, std::string path);

// Rubinius.primitive :code_db_open
static CodeDB* open(STATE, String* path);
12 changes: 11 additions & 1 deletion vm/environment.cpp
Original file line number Diff line number Diff line change
@@ -632,7 +632,17 @@ namespace rubinius {
* is relative to this path.
*/
void Environment::load_core(STATE, std::string root) {
CodeDB::open(state, config.codedb_core_path.value.c_str());
try {
if(CodeDB::valid_database_p(state, config.codedb_core_path.value)) {
CodeDB::open(state, config.codedb_core_path.value.c_str());
} else {
std::string core = root + "/core";
CodeDB::open(state, core.c_str());
}
} catch(RubyException& exc) {
exc.show(state);
exit(1);
}
}

void Environment::load_tool() {