Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
BEGIN LICENSE BLOCK ***** Version: EPL 1.0/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Eclipse Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.eclipse.org/legal/epl-v10.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyright (C) 2009 Charles Oliver Nutter <headius@headius.com> Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the EPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the EPL, the GPL or the LGPL. END LICENSE BLOCK ***
 
 package org.jruby.internal.runtime.methods;
 
 import org.jruby.Ruby;
This is the mixed-mode method type. It will call out to JIT compiler to see if the compiler wants to JIT or not. If the JIT compiler does JIT this it will return the new method to be executed here instead of executing the interpreted version of this method. The next invocation of the method will end up causing the runtime to load and execute the newly JIT'd method.
 
 public class TraceableJittedMethod extends DynamicMethod {
     private final StaticScope staticScope;
     private final Script jitCompiledScript;
     private final ISourcePosition position;
     private final Arity arity;
     private final DefaultMethod realMethod;
     
     public TraceableJittedMethod(RubyModule implementationClassStaticScope staticScopeScript jitCompiledScript,
             String nameCallConfiguration jitCallConfigVisibility visibilityArity arityISourcePosition position,
             DefaultMethod realMethod) {
         super(implementationClassvisibilityjitCallConfigname);
         this. = position;
         this. = jitCompiledScript;
         this. = staticScope;
         this. = arity;
         this. = realMethod;
     }
 
     public StaticScope getStaticScope() {
         return ;
     }
 
     @Override
     public DynamicMethod getRealMethod() {
         return ;
     }
 
     @Override
     public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject[] argsBlock block) {
         Ruby runtime = context.runtime;
         int callNumber = context.callNumber;
         
         try {
             pre(contextselfnameblockargs.length);
 
             return .__file__(contextselfargsblock);
         } catch (JumpException.ReturnJump rj) {
             return handleReturn(contextrjcallNumber);
         } catch (JumpException.RedoJump rj) {
             return handleRedo(runtime);
         } finally {
             post(runtimecontextname);
         }
     }
 
     @Override
     public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject[] args) {
         Ruby runtime = context.runtime;
         int callNumber = context.callNumber;
        try {
            pre(contextselfname.args.length);
            return .__file__(contextselfargs.);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtime,contextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString name) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfname., 0);
            return .__file__(contextself.);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameBlock block) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfnameblock, 0);
            return .__file__(contextselfblock);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfname., 1);
            return .__file__(contextselfarg0.);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0Block block) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfnameblock, 1);
            return .__file__(contextselfarg0block);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfname., 2);
            return .__file__(contextselfarg0arg1.);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1Block block) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfnameblock, 2);
            return .__file__(contextselfarg0arg1block);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1IRubyObject arg2) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfname., 3);
            return .__file__(contextselfarg0arg1arg2.);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1IRubyObject arg2Block block) {
        Ruby runtime = context.runtime;
        int callNumber = context.callNumber;
        try {
            pre(contextselfnameblock, 3);
            return .__file__(contextselfarg0arg1arg2block);
        } catch (JumpException.ReturnJump rj) {
            return handleReturn(contextrjcallNumber);
        } catch (JumpException.RedoJump rj) {
            return handleRedo(runtime);
        } finally {
            post(runtimecontextname);
        }
    }
    protected void pre(ThreadContext contextIRubyObject selfString nameBlock blockint argsLength) {
        Ruby runtime = context.runtime;
        .pre(contextselfgetImplementationClass(), nameblock);
        getArity().checkArity(runtimeargsLength);
        
        if (runtime.hasEventHooks()) traceCall(contextruntimename);
    }
    protected void post(Ruby runtimeThreadContext contextString name) {
        if (runtime.hasEventHooks()) traceReturn(contextruntimename);
        
        .post(context);
    }
    private void traceReturn(ThreadContext contextRuby runtimeString name) {
        runtime.callEventHooks(context.context.getFile(), context.getLine(), namegetImplementationClass());
    }
    private void traceCall(ThreadContext contextRuby runtimeString name) {
        runtime.callEventHooks(context..getFile(), .getStartLine(), namegetImplementationClass());
    }
    public ISourcePosition getPosition() {
        return ;
    }
    @Override
    public Arity getArity() {
        return ;
    }
    public DynamicMethod dup() {
    }
New to GrepCode? Check out our FAQ X