Package org.jruby

Examples of org.jruby.RubyInstanceConfig


        EnvironmentInjector environmentInjector = new EnvironmentInjector(config);
        environmentInjector.inject(environmentVars);
    }

    private static RubyInstanceConfig createOptimizedConfiguration() {
        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setCompatVersion(CompatVersion.RUBY2_0);
        config.setCompileMode(CompileMode.OFF);

        return config;
    }
View Full Code Here


            }
            return m;
        }

        public void start() throws IOException {
            config = new RubyInstanceConfig(parentRuntime.getInstanceConfig()) {{
                setEnvironment(environmentMap(env));
                setCurrentDirectory(pwd.toString());
            }};
            if (pipedStreams) {
                config.setInput(new PipedInputStream(processInput));
View Full Code Here

    }

    public int run(NGContext context) {
        context.assertLoopbackClient();

        RubyInstanceConfig config = new RubyInstanceConfig();
        Main main = new Main(config);
       
        config.setCurrentDirectory(context.getWorkingDirectory());
        config.setEnvironment(context.getEnv());

        // reuse one cache of compiled bodies
        config.setClassCache(classCache);

        return main.run(context.getArgs()).getStatus();
    }
View Full Code Here

     *
     * @param container ScriptingContainer to be set configurations.
     */
    public static void setConfiguration(ScriptingContainer container) {
        LocalContextProvider provider = container.getProvider();
        RubyInstanceConfig config = provider.getRubyInstanceConfig();
        String s = SafePropertyAccessor.getProperty(PropertyName.COMPILEMODE.toString());
        if (s != null) {
            if ("jit".equalsIgnoreCase(s)) {
                config.setCompileMode(CompileMode.JIT);
            } else if ("force".equalsIgnoreCase(s)) {
                config.setCompileMode(CompileMode.FORCE);
            } else {
                config.setCompileMode(CompileMode.OFF);
            }
        }
        s = SafePropertyAccessor.getProperty(PropertyName.COMPATVERSION.toString());
        if (s != null) {
            if (isRuby19(s)) {
                config.setCompatVersion(CompatVersion.RUBY1_9);
            }
        }
    }
View Full Code Here

            public void windowClosing(WindowEvent e) {
                tar.shutdown();
            }
        });

        final RubyInstanceConfig config = new RubyInstanceConfig() {{
            CompatVersion compat = CompatVersion.RUBY1_8;
            if (args.length > 0) {
                if (args[0].equals("1.8")) {
                    list.remove(0);
                } else if (args[0].equals("1.9")) {
View Full Code Here

     *
     * @param loadPaths to specify where to look for Ruby modules.
     * @return an instance
     */
    public static Ruby initialize(List loadPaths) {
        return initialize(loadPaths, new RubyInstanceConfig());
    }
View Full Code Here

     * @param loadPaths to specify where to look for Ruby modules.
     * @param classCache to use as a common repository for cached classes
     * @return an instance
     */
    public static Ruby initialize(List loadPaths, ClassCache classCache) {
        RubyInstanceConfig config = new RubyInstanceConfig();
        if (classCache != null) {
            config.setClassCache(classCache);
        }
        return initialize(loadPaths, config);
    }
View Full Code Here

     *
     * @param loader use the provided classloader to create the cache
     * @return
     */
    public static ClassCache createClassCache(ClassLoader loader) {
        return new ClassCache(loader, new RubyInstanceConfig().getJitMax());
    }
View Full Code Here

            }
        }
    }

    private void jitIsEnabled(DefaultMethod method, ThreadContext context, String className, String methodName) {
        RubyInstanceConfig instanceConfig = context.runtime.getInstanceConfig();
       
        if (method.incrementCallCount() >= instanceConfig.getJitThreshold()) {
            jitThresholdReached(method, instanceConfig, context, className, methodName);
        }
    }
View Full Code Here

public class Main
{
  public static void main(String[] args) throws Exception
  {  
    RubyInstanceConfig config = new RubyInstanceConfig();
    config.setArgv(args);
    Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0), config);
    String mainRubyFile = "main";
  
    ArrayList<String> config_data = new ArrayList<String>();
    try{
View Full Code Here

TOP

Related Classes of org.jruby.RubyInstanceConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.