Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8117883

nasgen prototype, instance member count calculation is wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • core-libs
    • b70
    • generic
    • generic

        This issue was reported via a nashorn-dev email: http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-June/004784.html

        --- email content duplicated here ----
        Hi all,
        During digging a little into the bytecode generated by Nasgen, there is a pattern of "new ArrayList(memberCount)", but that member count is 1 more that what is needed, this is not always the case, as it depends on the members.
        This doesn't have functional impact, but every single byte counts
        The root cause for Prototype, is that Constructor are included in the total count, but it is not added.

        To give example:
        NativeArrayBuffer$Prototype:

           { ArrayList list = new ArrayList(2);
              list.add(AccessorProperty.create("slice", 2, "G$slice", "S$slice")); $nasgenmap$ = PropertyMap.newMap(list); }
        although the list will contain a single entry, ArrayList was initialized by 2.
        This also happens in the ScriptClass, e.g.:
        NativeArray: { ArrayList list = new ArrayList(2);
              list.add(AccessorProperty.create("length", 6, "length", "length")); $nasgenmap$ = PropertyMap.newMap(list); }
        But it is fine in, e.g.:
        ArrayBufferView: { ArrayList list = new ArrayList(4); list.add(AccessorProperty.create("buffer", 7, "buffer", (MethodHandle)null)); list.add(AccessorProperty.create("byteOffset", 7, "byteOffset", (MethodHandle)null)); list.add(AccessorProperty.create("byteLength", 7, "byteLength", (MethodHandle)null)); list.add(AccessorProperty.create("length", 7, "length", (MethodHandle)null)); $nasgenmap$ = PropertyMap.newMap(list); }
        Thanks,Ahmed

              sundar Sundararajan Athijegannathan
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: