Issue #13188 has been updated by Shyouhei Urabe.


Martin Drst wrote:
> Shyouhei Urabe wrote:
> > AFAIK the ruby interpreter uses lots of global variables, which makes it practically impossible to re-initialize.
> 
> How difficult would it be to fix this?

Nobu and myself each once tried to move those global variables into the VM struct, to make it possible to have multiple VMs at once (mvm).  My try changed hundreds of thousands of lines and resulted in inferior performance.  It was because accessing global variable is in fact much faster than to indirectly refer them via VM-stored pointers.

So it is not only very hard to fix, but even when we do so, we have to live with slowness.

----------------------------------------
Bug #13188: Reinitialize Ruby VM. 
https://bugs.ruby-lang.org/issues/13188#change-62870

* Author: Joe Daniels
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.0.0-p648
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
It appears that by following what appears to be a pretty standard setup procedure: 

~~~
ruby_init_stack(variable_in_this_stack_frame)
ruby_init();
ruby_init_loadpath();
        
rb_require("enc/encdb");
rb_require("enc/trans/transdb");
ruby_process_options(Int32(options.count), &cargs)

var state: Int32 = 0;
if ruby_executable_node(node, &state) != 0 {
    state = ruby_exec_node(node)
}
if state != 0 {
    throw RubyError.current
}


ruby_cleanup(state);
~~~

Its not possible to recreate the VM. Are there instructions on this process? or is this an actionable task for which contributions from a first time contributor would be accepted? 





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>