JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-4732

Clean up anything that calls dataGetStruct on a wrapped Java object to get the object

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.5
    • Fix Version/s: None
    • Component/s: Java Integration
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In 1.5, we made a lot of progress toward eliminating the double-wrapping of Java objects present in previous versions. This was accomplished by adding a simple Object reference to JavaProxy and only lazily creating the JavaObject we used with dataWrapStruct.

      Unfortunately there's still a lot of cases that use dataGetStruct to get the JavaObject to get the Object, which causes that wrapper to get stood up again. I found a number of cases in JavaProxyMethods, for example, and there may be others around.

      In order to really solidify the memory and perf gains from having a simple directly-wrapped Object, we should:

      • Fix the cases in JavaProxyMethods
      • Add some logging into the lazy code in JavaProxy that shows where it's being called
      • Fix those other cases

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        I've cleaned up a number of cases throughout the codebase by putting a Thread.dumpStack into JavaProxy.dataGetStruct and fixing anything that called it. Those fixes were pushed to master in 7a8e661 and to 1.5 in f81d88f.

        A notable number of items were not fixed: specifically, anything in ArrayJavaProxy that calls getJavaArray is still causing a JavaObject (a JavaArray) to be stood up for those operations. This is a larger job to fix than I want to tackle now, since Array logic is still split across Java and Ruby code. I'm marking this bug for 1.6 to address the remainder of the work.

        Show
        Charles Oliver Nutter added a comment - I've cleaned up a number of cases throughout the codebase by putting a Thread.dumpStack into JavaProxy.dataGetStruct and fixing anything that called it. Those fixes were pushed to master in 7a8e661 and to 1.5 in f81d88f. A notable number of items were not fixed: specifically, anything in ArrayJavaProxy that calls getJavaArray is still causing a JavaObject (a JavaArray) to be stood up for those operations. This is a larger job to fix than I want to tackle now, since Array logic is still split across Java and Ruby code. I'm marking this bug for 1.6 to address the remainder of the work.
        Hide
        Charles Oliver Nutter added a comment -

        Couple more fixes:

        commit d8b91a00f26454b228a6dcb4ab5fd13d03794dbd
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Wed Sep 19 16:54:17 2012 -0500
        
            Eliminate a couple more JavaArray accesses (JRUBY-4732).
        
        :100644 100644 5458b82... 7822f0d... M	src/org/jruby/java/proxies/ArrayJavaProxy.java
        

        Most of the JavaArray accesses are trickier to get rid of because they need the converter to properly box or unbox the resulting value.

        Show
        Charles Oliver Nutter added a comment - Couple more fixes: commit d8b91a00f26454b228a6dcb4ab5fd13d03794dbd Author: Charles Oliver Nutter <headius@headius.com> Date: Wed Sep 19 16:54:17 2012 -0500 Eliminate a couple more JavaArray accesses (JRUBY-4732). :100644 100644 5458b82... 7822f0d... M src/org/jruby/java/proxies/ArrayJavaProxy.java Most of the JavaArray accesses are trickier to get rid of because they need the converter to properly box or unbox the resulting value.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Charles Oliver Nutter
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: