final NativeInvoker compile(RubyModule implementationClass, com.kenai.jffi.Function function, Signature signature, String methodName) { if (compilationFailed || (counter.incrementAndGet() < THRESHOLD && !"force".equalsIgnoreCase(Options.COMPILE_MODE.load()))) { return null; } Class<? extends NativeInvoker> compiledClass; synchronized (this) { if (compiledClassRef == null || (compiledClass = compiledClassRef.get()) == null) { compiledClass = newInvokerClass(jitSignature, methodName); if (compiledClass == null) { compilationFailed = true; return null; } compiler.registerClass(this, compiledClass); compiledClassRef = new WeakReference<Class<? extends NativeInvoker>>(compiledClass); } } try { Constructor<? extends NativeInvoker> cons = compiledClass.getDeclaredConstructor(RubyModule.class, com.kenai.jffi.Function.class, Signature.class); return cons.newInstance(implementationClass, function, signature); } catch (Throwable t) { throw new RuntimeException(t); } }
final NativeInvoker compile(RubyModule implementationClass, com.kenai.jffi.Function function, Signature signature, String methodName) { if (compilationFailed || (counter.incrementAndGet() < THRESHOLD && Options.COMPILE_MODE.load() != RubyInstanceConfig.CompileMode.FORCE)) { return null; } Class<? extends NativeInvoker> compiledClass; synchronized (this) { if (compiledClassRef == null || (compiledClass = compiledClassRef.get()) == null) { compiledClass = newInvokerClass(jitSignature, methodName); if (compiledClass == null) { compilationFailed = true; return null; } compiler.registerClass(this, compiledClass); compiledClassRef = new WeakReference<Class<? extends NativeInvoker>>(compiledClass); } } try { Constructor<? extends NativeInvoker> cons = compiledClass.getDeclaredConstructor(RubyModule.class, com.kenai.jffi.Function.class, Signature.class); return cons.newInstance(implementationClass, function, signature); } catch (Throwable t) { throw new RuntimeException(t); } }
final NativeInvoker compile(RubyModule implementationClass, com.kenai.jffi.Function function, Signature signature, String methodName) { if (compilationFailed || (counter.incrementAndGet() < THRESHOLD && Options.COMPILE_MODE.load() != RubyInstanceConfig.CompileMode.FORCE)) { return null; } Class<? extends NativeInvoker> compiledClass; synchronized (this) { if (compiledClassRef == null || (compiledClass = compiledClassRef.get()) == null) { compiledClass = newInvokerClass(jitSignature, methodName); if (compiledClass == null) { compilationFailed = true; return null; } compiler.registerClass(this, compiledClass); compiledClassRef = new WeakReference<Class<? extends NativeInvoker>>(compiledClass); } } try { Constructor<? extends NativeInvoker> cons = compiledClass.getDeclaredConstructor(RubyModule.class, com.kenai.jffi.Function.class, Signature.class); return cons.newInstance(implementationClass, function, signature); } catch (Throwable t) { throw new RuntimeException(t); } }
final NativeInvoker compile(RubyModule implementationClass, com.kenai.jffi.Function function, Signature signature, String methodName) { if (compilationFailed || (counter.incrementAndGet() < THRESHOLD && !"force".equalsIgnoreCase(Options.COMPILE_MODE.load()))) { return null; } Class<? extends NativeInvoker> compiledClass; synchronized (this) { if (compiledClassRef == null || (compiledClass = compiledClassRef.get()) == null) { compiledClass = newInvokerClass(jitSignature, methodName); if (compiledClass == null) { compilationFailed = true; return null; } compiler.registerClass(this, compiledClass); compiledClassRef = new WeakReference<Class<? extends NativeInvoker>>(compiledClass); } } try { Constructor<? extends NativeInvoker> cons = compiledClass.getDeclaredConstructor(RubyModule.class, com.kenai.jffi.Function.class, Signature.class); return cons.newInstance(implementationClass, function, signature); } catch (Throwable t) { throw new RuntimeException(t); } }