Showing the changes to java/appl/java/classloader.b (1 of 1 file). Show all
Unified · Split
| @@ -1668,6 +1668,7 @@ multianewarray(ndim: int, c: ref Class, etype: int, bounds: array of int): ref A · 1667 unmodified lines | ||
| 1668 | 1668 | |
| 1669 | 1669 | arraycopy(src: ref Array, sx: int, dst: ref Array, dx: int, n: int) |
| 1670 | 1670 | { |
| 1671 | + trace(JDEBUG, sys->sprint("Arraycopy called: src[%d], dst[%d], %d, %d, %d", len src.holder, len dst.holder, sx, dx, n)); | |
| 1671 | 1672 | if (arrayclass == nil) |
| 1672 | 1673 | loadarrayclass(); |
| 1673 | 1674 | if (src == nil || dst == nil) |
| @@ -1692,6 +1693,7 @@ arraycopy(src: ref Array, sx: int, dst: ref Array, dx: int, n: int) · 18 unmodified lines | ||
| 1692 | 1693 | if (sx < 0 || dx < 0 || n < 0 || sx + n > len src.holder || dx + n > len dst.holder || sx > 2147483647 - n || dx > 2147483647 - n) |
| 1693 | 1694 | sthrow("ArrayIndexOutOfBoundsException"); |
| 1694 | 1695 | dst.holder[dx:] = sa[sx:sx + n]; |
| 1696 | + trace(JDEBUG, "Arraycopy completed successfully"); | |
| 1695 | 1697 | } |
| 1696 | 1698 | |
| 1697 | 1699 | # |
| @@ -1777,25 +1779,23 @@ drem(x, y: real): real · 79 unmodified lines | ||
| 1777 | 1779 | |
| 1778 | 1780 | Class.run(c: self ref Class, args: list of string) |
| 1779 | 1781 | { |
| 1780 | − m := c.findsmethod(MAINFIELD, VOIDSIGNATURE); | |
| 1782 | + m := c.findsmethod(MAINFIELD, MAINSIGNATURE); | |
| 1781 | 1783 | if (m == nil) |
| 1782 | 1784 | loaderror( nosuchmethod, sys->sprint("%s: missing static method main", c.name)); |
| 1783 | 1785 | main = c; |
| 1784 | − #if (arrayclass == nil) | |
| 1785 | − # loadarrayclass(); | |
| 1786 | − #if (stringclass == nil) | |
| 1787 | − # loadstringclass(); | |
| 1788 | − #n := len args; | |
| 1789 | − #h := array[n] of ref JavaString; | |
| 1790 | − #d := stringclass.moddata; | |
| 1791 | − #for (i := 0; i < n; i++) { | |
| 1792 | − # h[i] = ref JavaString(d, hd args); | |
| 1793 | − # args = tl args; | |
| 1794 | − #} | |
| 1795 | − #c.xeq(m.value, ref Array(arraymd, h, 1, stringclass, 0)); | |
| 1786 | + if (arrayclass == nil) | |
| 1787 | + loadarrayclass(); | |
| 1788 | + if (stringclass == nil) | |
| 1789 | + loadstringclass(); | |
| 1790 | + n := len args; | |
| 1791 | + h := array[n] of ref JavaString; | |
| 1792 | + d := stringclass.moddata; | |
| 1793 | + for (i := 0; i < n; i++) { | |
| 1794 | + h[i] = ref JavaString(d, hd args); | |
| 1795 | + args = tl args; | |
| 1796 | + } | |
| 1796 | 1797 | getthreaddata(); |
| 1797 | − #r := jassist->mcalla(c.mod, m.value, ref Array(arraymd, h, 1, stringclass, 0)); | |
| 1798 | − r := jassist->mcall0(c.mod, m.value); | |
| 1798 | + r := jassist->mcalla(c.mod, m.value, ref Array(arraymd, h, 1, stringclass, 0)); | |
| 1799 | 1799 | delthreaddata(); |
| 1800 | 1800 | } |
| 1801 | 1801 | |
| @@ -1935,6 +1935,15 @@ Class.resolve(c: self ref Class) · 133 unmodified lines | ||
| 1935 | 1935 | sz += sizeof(t.signature); |
| 1936 | 1936 | sd = f :: sd; |
| 1937 | 1937 | } else { |
| 1938 | + superfield: ref Field; | |
| 1939 | + if (c.super != nil) | |
| 1940 | + superfield = c.super.findofield(t.field); | |
| 1941 | + if (superfield != nil) { | |
| 1942 | + trace(JDEBUG, sys->sprint("%s: superclass data", t.field)); | |
| 1943 | + p[i].what = PVALUE; | |
| 1944 | + p[i].value = superfield.value; | |
| 1945 | + continue; | |
| 1946 | + } | |
| 1938 | 1947 | trace(JDEBUG, sys->sprint("%s: new data", t.field)); |
| 1939 | 1948 | oz = alignto(oz, t.signature); |
| 1940 | 1949 | p[i].what = PVALUE; |
| @@ -2059,24 +2068,28 @@ Class.makeobjtype(c: self ref Class) · 118 unmodified lines | ||
| 2059 | 2068 | # |
| 2060 | 2069 | Class.makevmtable(c: self ref Class, m: list of ref Field, z: int): array of Method |
| 2061 | 2070 | { |
| 2071 | + trace(JDEBUG, sys->sprint("Makevmtable for %s, %d", c.name, z)); | |
| 2062 | 2072 | t := array[z] of Method; |
| 2063 | 2073 | if (c.super != nil) { |
| 2064 | 2074 | s := c.super.virtualmethods; |
| 2065 | 2075 | n := len s; |
| 2066 | − for (i := 0; i < n; i++) | |
| 2076 | + for (i := 0; i < n; i++) { | |
| 2077 | + trace(JDEBUG, sys->sprint("Makevmtable adding super method %s", s[i].field.field + s[i].field.signature)); | |
| 2067 | 2078 | t[i] = s[i]; |
| 2079 | + } | |
| 2068 | 2080 | } |
| 2069 | 2081 | while (m != nil) { |
| 2070 | 2082 | f := hd m; |
| 2071 | 2083 | n := f.value; |
| 2072 | − # TODO: check if we don't have this method in links, so just use parent class's one | |
| 2073 | − trace(JDEBUG, sys->sprint("Makevmtable for %s, %d", c.name, z)); | |
| 2084 | + trace(JDEBUG, sys->sprint("Makevmtable checking %s %d %d", f.field + f.signature, n, f.flags)); | |
| 2074 | 2085 | { |
| 2075 | 2086 | f.value = c.getmethod(f.field, f.signature, f.flags); |
| 2076 | 2087 | } |
| 2077 | 2088 | exception e { |
| 2078 | 2089 | JCLDREX + nosuchmethod + "*" => |
| 2079 | − ; # silently ignore | |
| 2090 | + # TODO: check if we really have it in superclass vmtable | |
| 2091 | + m = tl m; | |
| 2092 | + continue; | |
| 2080 | 2093 | } |
| 2081 | 2094 | t[n].field = f; |
| 2082 | 2095 | t[n].class = c; |
| @@ -2589,6 +2602,8 @@ Class.getmethod(c: self ref Class, f, s: string, flags: int): int · 506 unmodified lines | ||
| 2589 | 2602 | if (l[i].name == m) |
| 2590 | 2603 | return i; |
| 2591 | 2604 | } |
| 2605 | + if (flags & ACC_NATIVE) | |
| 2606 | + trace(JDEBUG, sys->sprint("Native method %s not found in %s", m, c.name)); | |
| 2592 | 2607 | if (!(flags & (ACC_ABSTRACT | ACC_NATIVE))) |
| 2593 | 2608 | { |
| 2594 | 2609 | loaderror( nosuchmethod, sys->sprint("method %x %s '%s' %s not found", flags, f, s, m) ); |
| @@ -2753,7 +2768,7 @@ Class.resolvereloc(c: self ref Class, r, s: string, flags: int): (int, int) · 158 unmodified lines | ||
| 2753 | 2768 | f: ref Field; |
| 2754 | 2769 | case flags & Rmask { |
| 2755 | 2770 | Rgetputfield => |
| 2756 | − f = findfield(c.objectdata, r); | |
| 2771 | + f = c.findofield(r); | |
| 2757 | 2772 | if (f == nil) |
| 2758 | 2773 | loaderror(nosuchfield, sys->sprint("%s not resolved in class %s", r, c.name)); |
| 2759 | 2774 | else { |