Example #1
0
  /**
   * Loads the runtime kernel files stored in /runtime.
   * These files consist of the compiled Ruby /kernel code in .rbc files, which
   * are needed to bootstrap the Ruby kernel.
   * This method is called after the VM has completed bootstrapping, and is
   * ready to load Ruby code.
   *
   * @param root The path to the /runtime directory. All kernel loading is
   *             relative to this path.
   */
  void Environment::load_kernel(std::string root) {
    // Check that the index file exists; this tells us which sub-directories to
    // load, and the order in which to load them
    std::string index = root + "/index";
    std::ifstream stream(index.c_str());
    if(!stream) {
      std::string error = "Unable to load kernel index: " + root;
      throw std::runtime_error(error);
    }

    // Pull in the signature file; this helps control when .rbc files need to
    // be discarded and recompiled due to changes to the compiler since the
    // .rbc files were created.
    std::string sig_path = root + "/signature";
    std::ifstream sig_stream(sig_path.c_str());
    if(sig_stream) {
      sig_stream >> signature_;
      G(rubinius)->set_const(state, "Signature",
                       Integer::from(state, signature_));
      sig_stream.close();
    } else {
Example #2
0
  /* Loads the runtime kernel files. They're stored in /kernel.
   * These files consist of classes needed to bootstrap the kernel
   * and just get things started in general.
   *
   * @param root [String] The file root for /kernel. This expects to find
   *                      alpha.rbc (will compile if not there).
   * @param env  [Environment&] The environment for Rubinius. It is the uber
   *                      manager for multiple VMs and process-Ruby interaction. 
   */
  void Environment::load_kernel(std::string root) {
    std::string dirs = root + "/index";
    std::ifstream stream(dirs.c_str());
    if(!stream) {
      std::string error = "Unable to load kernel index: " + root;
      throw std::runtime_error(error);
    }

    // Load the ruby file to prepare for bootstrapping Ruby!
    // The bootstrapping for the VM is already done by the time we're here.

    // First, pull in the signature file. This helps control when .rbc files need
    // to be discarded.

    std::string sig_path = root + "/signature";
    std::ifstream sig_stream(sig_path.c_str());
    if(sig_stream) {
      sig_stream >> signature_;
      G(rubinius)->set_const(state, "Signature",
                       Integer::from(state, signature_));
      sig_stream.close();
    } else {
Example #3
0
  /* Loads the runtime kernel files. They're stored in /kernel.
   * These files consist of classes needed to bootstrap the kernel
   * and just get things started in general.
   *
   * @param root [String] The file root for /kernel. This expects to find
   *                      alpha.rbc (will compile if not there).
   * @param env  [Environment&] The environment for Rubinius. It is the uber
   *                      manager for multiple VMs and process-Ruby interaction. 
   */
  void Environment::load_kernel(std::string root) {
    std::string dirs = root + "/index";
    std::ifstream stream(dirs.c_str());
    if(!stream) {
      std::cerr << "It appears that " << root << "/index is missing.\n";
      exit(1);
    }

    // Load the ruby file to prepare for bootstrapping Ruby!
    // The bootstrapping for the VM is already done by the time we're here.

    // First, pull in the signature file. This helps control when .rbc files need
    // to be discarded.

    std::string sig_path = root + "/signature";
    std::ifstream sig_stream(sig_path.c_str());
    if(sig_stream) {
      sig_stream >> signature_;
      G(rubinius)->set_const(state, "Signature",
                       Integer::from(state, signature_));
      sig_stream.close();
    } else {