Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AOT compile of method with conditional return results in "is not compiled Ruby; use java_import to load normal classes" #3453

Closed
danshep opened this issue Nov 10, 2015 · 1 comment

Comments

@danshep
Copy link

danshep commented Nov 10, 2015

test.rb:

module Xsg
  def self.bad_method(argument)
    return if argument
    dummy_assign = true
  end
end
d:\temp>jrubyc test.rb && jruby -e "require 'jruby'; JRuby.runtime.debug = true; require './test.class'"
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jruby.runtime.load.CompiledScriptLoader.loadScriptFromFile(CompiledScriptLoader.java:35)
        at org.jruby.runtime.load.LibrarySearcher$ClassResourceLibrary.load(LibrarySearcher.java:257)
        at org.jruby.runtime.load.LibrarySearcher$FoundLibrary.load(LibrarySearcher.java:35)
        at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:896)
        at org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:541)
        at org.jruby.runtime.load.LoadService.requireCommon(LoadService.java:426)
        at org.jruby.runtime.load.LoadService.require(LoadService.java:392)
        at org.jruby.RubyKernel.requireCommon(RubyKernel.java:946)
        at org.jruby.RubyKernel.require19(RubyKernel.java:939)
        at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(RubyKernel$INVOKER$s$1$0$require19.gen)
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:380)
        at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:290)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:77)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:197)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:183)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:197)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
        at DashE.invokeOther5:require(-e)
        at DashE.RUBY$script(-e:1)
        at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
        at org.jruby.ir.Compiler$1.load(Compiler.java:111)
        at org.jruby.Ruby.runScript(Ruby.java:821)
        at org.jruby.Ruby.runScript(Ruby.java:813)
        at org.jruby.Ruby.runNormally(Ruby.java:751)
        at org.jruby.Ruby.runFromMain(Ruby.java:573)
        at org.jruby.Main.doRunFromMain(Main.java:409)
        at org.jruby.Main.internalRun(Main.java:304)
        at org.jruby.Main.run(Main.java:233)
        at org.jruby.Main.main(Main.java:200)
Caused by: java.lang.IllegalArgumentException: Unhandled operation: unbox_fixnum
        at org.jruby.ir.persistence.IRReaderStream.decodeInstr(IRReaderStream.java:291)
        at org.jruby.ir.persistence.IRReaderStream.decodeInstructionsAt(IRReaderStream.java:173)
        at org.jruby.ir.persistence.IRReader.load(IRReader.java:54)
        at org.jruby.ir.runtime.IRRuntimeHelpers.decodeScopeFromBytes(IRRuntimeHelpers.java:1424)
        at test.loadIR(test.rb)
        ... 37 more
Exception `LoadError' at org/jruby/RubyKernel.java:939 - d:/temp/test.class is not compiled Ruby; use java_import to load normal classes
LoadError: d:/temp/test.class is not compiled Ruby; use java_import to load normal classes
  require at org/jruby/RubyKernel.java:939
  require at C:/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
    <top> at -e:1
@subbuss
Copy link
Contributor

subbuss commented Dec 21, 2015

Fixed in 16824ff.

@subbuss subbuss closed this as completed Dec 21, 2015
@enebo enebo added this to the JRuby 9.0.5.0 milestone Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants