Package org.jruby.ast.executable

Examples of org.jruby.ast.executable.Script


            // successfully got back a jitted method
            successCount.incrementAndGet();

            // finally, grab the script
            Script jitCompiledScript = sourceClass.newInstance();

            // add to the jitted methods set
            Set<Script> jittedMethods = ruby.get().getJittedMethods();
            jittedMethods.add(jitCompiledScript);
View Full Code Here


            return state.library == null;
        }
       
        public void trySearch(SearchState state) throws RaiseException {
            // no library or extension found, try to load directly as a class
            Script script;
            String className = buildClassName(state.searchFile);
            int lastSlashIndex = className.lastIndexOf('/');
            if (lastSlashIndex > -1 && lastSlashIndex < className.length() - 1 && !Character.isJavaIdentifierStart(className.charAt(lastSlashIndex + 1))) {
                if (lastSlashIndex == -1) {
                    className = "_" + className;
View Full Code Here

                clazz = jcl.defineClass(className, buf);
            }
           
            // if it's a compiled JRuby script, instantiate and run it
            if (Script.class.isAssignableFrom(clazz)) {
                Script script = (Script)clazz.newInstance();
                script.setFilename(resource.getName());
                script.load(runtime.getCurrentContext(), runtime.getTopSelf(), IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
            }
        } catch (IOException e) {
            throw runtime.newIOErrorFromException(e);
        } catch (InstantiationException ie) {
            if (runtime.getDebug().isTrue()) {
View Full Code Here

     * @return The result of executing the specified script
     */
    public IRubyObject runWithGetsLoop(Node scriptNode, boolean printing, boolean processLineEnds, boolean split, boolean yarvCompile) {
        ThreadContext context = getCurrentContext();
       
        Script script = null;
        YARVCompiledRunner runner = null;
        boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
        if (compile || !yarvCompile) {
            script = tryCompile(scriptNode);
            if (compile && script == null) {
View Full Code Here

     * @param yarvCompile Whether to compile the script to YARV (Ruby 1.9)
     * bytecode before execution
     * @return The result of executing the script
     */
    public IRubyObject runNormally(Node scriptNode, boolean yarvCompile) {
        Script script = null;
        YARVCompiledRunner runner = null;
        boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
        boolean forceCompile = getInstanceConfig().getCompileMode().shouldPrecompileAll();
        if (yarvCompile) {
            runner = tryCompileYarv(scriptNode);
View Full Code Here

    private Script tryCompile(Node node) {
        return tryCompile(node, new JRubyClassLoader(getJRubyClassLoader()));
    }
   
    private Script tryCompile(Node node, JRubyClassLoader classLoader) {
        Script script = null;
        try {
            String filename = node.getPosition().getFile();
            String classname = JavaNameMangler.mangledFilenameForStartupClasspath(filename);

            ASTInspector inspector = new ASTInspector();
View Full Code Here

            context.setFile(filename);
            context.preNodeEval(objectClass, self, filename);
           
            Node scriptNode = parseFile(in, filename, null);
           
            Script script = tryCompile(scriptNode, new JRubyClassLoader(jrubyClassLoader));
            if (script == null) {
                System.err.println("Error, could not compile; pass -J-Djruby.jit.logging.verbose=true for more details");
            }

            runScript(script);
View Full Code Here

            return state.library == null;
        }
       
        public void trySearch(SearchState state) throws RaiseException {
            // no library or extension found, try to load directly as a class
            Script script;
            String className = buildClassName(state.searchFile);
            int lastSlashIndex = className.lastIndexOf('/');
            if (lastSlashIndex > -1 && lastSlashIndex < className.length() - 1 && !Character.isJavaIdentifierStart(className.charAt(lastSlashIndex + 1))) {
                if (lastSlashIndex == -1) {
                    className = "_" + className;
View Full Code Here

        this.resource = resource;
    }

    public void load(Ruby runtime, boolean wrap) {
        try {
            Script script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getName());
            if (script == null) {
                // we're depending on the side effect of the load, which loads the class but does not turn it into a script
                // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here.
                return;
            }
            script.setFilename(resource.getName());
            runtime.loadScript(script);
        } catch (IOException e) {
            throw runtime.newIOErrorFromException(e);
        }
    }
View Full Code Here

            // successfully got back a jitted method
            counts.successCount.incrementAndGet();

            // finally, grab the script
            Script jitCompiledScript = sourceClass.newInstance();

            // add to the jitted methods set
            Set<Script> jittedMethods = context.getRuntime().getJittedMethods();
            jittedMethods.add(jitCompiledScript);
View Full Code Here

TOP

Related Classes of org.jruby.ast.executable.Script

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.