-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
import truffleruby patches #1882
Comments
@ aardvark179 can go through these patches and think about what it makes sense to upstream. Thanks very much for the offer. |
Sorry for the slow reply. It would definitely be useful for nokogiri to take some of the patches. The follow seem like excellent candidates:
The changes to The remaining patches are to work round an issue with calling a managed function from native code with varargs. It would be great if nokogiri could put these changes in, probably behind an The other really useful thing would be to default to using system libraries with TruffleRuby, we don't yet support linking static libraries and have had issues in the past with picking up a the |
Looks like patches have moved to https://github.com/oracle/truffleruby/blob/master/lib/truffle/truffle/patches/nokogiri_patches.rb I'm hoping to find some time to work on this soon, especially now that we've got TruffleRuby CI coverage. |
Indeed, I think 3 of these patches are causing the 5 remaining test failures (from #2089 (comment)), @aardvark179 could you check if they are still needed and what changes could be done in Nokogiri to not need them? |
For posterity, in case that build log gets deleted, the errors are:
|
@aardvark179 and I looked at those failures, and it seems the main issue is that Sulong does not support creating a native function pointer for variadic functions like nokogiri/ext/nokogiri/xml_sax_parser.c Lines 196 to 211 in d27cb96
which is stored in native memory and passed to libxml2 in nokogiri/ext/nokogiri/xml_sax_parser.c Line 275 in d27cb96
That seems hard to implement, because Sulong uses libffi (via Truffle NFI) for native calls (when calling to libxml2), and libffi does not support varargs stubs at all. |
As @eregon says, the current variadic error functions look like they will be very hard to support. Luckily |
@aardvark179 Can you clarify? I'm cleaning up the error-handling code right now (see #1610, #2096, and #2097) and would be happy to integrate any suggestions you might have. |
So it looks like you should be able to remove uses of the generic error handler and simply rely on the structured error handler. I had to make one small change to |
Ah, I see what you're saying. Sure, we can probably drop the generic error handler usage; and I would like to omit the use of varargs in TruffleRuby within Nokogiri's code (rather than via a patch). Let's plan on me doing that as part of the work at #2096 and I'll ping back here when that's ready to go and ask y'all to review it. |
@aardvark179 checked and with #2193 + Performance also seems fine when running libxml2/libxslt on Sulong, so I think we might just default to that at some point (use the vendored libxml2 like for CRuby, but no support for precompiled gems yet). |
🤔 Wow. I'll make time this weekend to merge, and update CI and the installation docs. |
oracle/truffleruby@9a5b420 is the PR I was mentioning above in TruffleRuby. That's now merged, so when using |
I just tried nokogiri 1.11.2 and it works well. |
I'm going to close this, then! Thanks for the amazing collaboration! |
The TruffleRuby team is maintaining some patches to Nokogiri that look like they should be pulled in. A chat with one of the maintainers indicates there are changes that are either working around bugs in Nokogiri or else are pretty trivial:
The patches are maintained here: https://github.com/oracle/truffleruby/blob/master/lib/cext/patches/nokogiri_patches.rb
Chat with @chrisseaton here: https://gitter.im/graalvm/truffleruby?at=5c7fac14f895944c084cb856
This story is to:
The text was updated successfully, but these errors were encountered: