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 | arraycopy(src: ref Array, sx: int, dst: ref Array, dx: int, n: int) | 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 | if (arrayclass == nil) | 1672 | if (arrayclass == nil) |
| 1672 | loadarrayclass(); | 1673 | loadarrayclass(); |
| 1673 | if (src == nil || dst == nil) | 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 | if (sx < 0 || dx < 0 || n < 0 || sx + n > len src.holder || dx + n > len dst.holder || sx > 2147483647 - n || dx > 2147483647 - n) | 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 | sthrow("ArrayIndexOutOfBoundsException"); | 1694 | sthrow("ArrayIndexOutOfBoundsException"); |
| 1694 | dst.holder[dx:] = sa[sx:sx + n]; | 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 | Class.run(c: self ref Class, args: list of string) | 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 | if (m == nil) | 1783 | if (m == nil) |
| 1782 | loaderror( nosuchmethod, sys->sprint("%s: missing static method main", c.name)); | 1784 | loaderror( nosuchmethod, sys->sprint("%s: missing static method main", c.name)); |
| 1783 | main = c; | 1785 | main = c; |
| 1784 | #if (arrayclass == nil) | 1786 | if (arrayclass == nil) |
| 1785 | # loadarrayclass(); | 1787 | loadarrayclass(); |
| 1786 | #if (stringclass == nil) | 1788 | if (stringclass == nil) |
| 1787 | # loadstringclass(); | 1789 | loadstringclass(); |
| 1788 | #n := len args; | 1790 | n := len args; |
| 1789 | #h := array[n] of ref JavaString; | 1791 | h := array[n] of ref JavaString; |
| 1790 | #d := stringclass.moddata; | 1792 | d := stringclass.moddata; |
| 1791 | #for (i := 0; i < n; i++) { | 1793 | for (i := 0; i < n; i++) { |
| 1792 | # h[i] = ref JavaString(d, hd args); | 1794 | h[i] = ref JavaString(d, hd args); |
| 1793 | # args = tl args; | 1795 | args = tl args; |
| 1794 | #} | 1796 | } |
| 1795 | #c.xeq(m.value, ref Array(arraymd, h, 1, stringclass, 0)); | ||
| 1796 | getthreaddata(); | 1797 | getthreaddata(); |
| 1797 | #r := jassist->mcalla(c.mod, m.value, ref Array(arraymd, h, 1, stringclass, 0)); | 1798 | r := jassist->mcalla(c.mod, m.value, ref Array(arraymd, h, 1, stringclass, 0)); |
| 1798 | r := jassist->mcall0(c.mod, m.value); | ||
| 1799 | delthreaddata(); | 1799 | delthreaddata(); |
| 1800 | } | 1800 | } |
| 1801 | 1801 | ||
| @@ -1935,6 +1935,15 @@ Class.resolve(c: self ref Class) · 133 unmodified lines | |||
| 1935 | sz += sizeof(t.signature); | 1935 | sz += sizeof(t.signature); |
| 1936 | sd = f :: sd; | 1936 | sd = f :: sd; |
| 1937 | } else { | 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 | trace(JDEBUG, sys->sprint("%s: new data", t.field)); | 1947 | trace(JDEBUG, sys->sprint("%s: new data", t.field)); |
| 1939 | oz = alignto(oz, t.signature); | 1948 | oz = alignto(oz, t.signature); |
| 1940 | p[i].what = PVALUE; | 1949 | p[i].what = PVALUE; |
| @@ -2059,24 +2068,28 @@ Class.makeobjtype(c: self ref Class) · 118 unmodified lines | |||
| 2059 | # | 2068 | # |
| 2060 | Class.makevmtable(c: self ref Class, m: list of ref Field, z: int): array of Method | 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 | t := array[z] of Method; | 2072 | t := array[z] of Method; |
| 2063 | if (c.super != nil) { | 2073 | if (c.super != nil) { |
| 2064 | s := c.super.virtualmethods; | 2074 | s := c.super.virtualmethods; |
| 2065 | n := len s; | 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 | t[i] = s[i]; | 2078 | t[i] = s[i]; |
| 2079 | } | ||
| 2068 | } | 2080 | } |
| 2069 | while (m != nil) { | 2081 | while (m != nil) { |
| 2070 | f := hd m; | 2082 | f := hd m; |
| 2071 | n := f.value; | 2083 | n := f.value; |
| 2072 | # TODO: check if we don't have this method in links, so just use parent class's one | 2084 | trace(JDEBUG, sys->sprint("Makevmtable checking %s %d %d", f.field + f.signature, n, f.flags)); |
| 2073 | trace(JDEBUG, sys->sprint("Makevmtable for %s, %d", c.name, z)); | ||
| 2074 | { | 2085 | { |
| 2075 | f.value = c.getmethod(f.field, f.signature, f.flags); | 2086 | f.value = c.getmethod(f.field, f.signature, f.flags); |
| 2076 | } | 2087 | } |
| 2077 | exception e { | 2088 | exception e { |
| 2078 | JCLDREX + nosuchmethod + "*" => | 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 | t[n].field = f; | 2094 | t[n].field = f; |
| 2082 | t[n].class = c; | 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 | if (l[i].name == m) | 2602 | if (l[i].name == m) |
| 2590 | return i; | 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 | if (!(flags & (ACC_ABSTRACT | ACC_NATIVE))) | 2607 | if (!(flags & (ACC_ABSTRACT | ACC_NATIVE))) |
| 2593 | { | 2608 | { |
| 2594 | loaderror( nosuchmethod, sys->sprint("method %x %s '%s' %s not found", flags, f, s, m) ); | 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 | f: ref Field; | 2768 | f: ref Field; |
| 2754 | case flags & Rmask { | 2769 | case flags & Rmask { |
| 2755 | Rgetputfield => | 2770 | Rgetputfield => |
| 2756 | f = findfield(c.objectdata, r); | 2771 | f = c.findofield(r); |
| 2757 | if (f == nil) | 2772 | if (f == nil) |
| 2758 | loaderror(nosuchfield, sys->sprint("%s not resolved in class %s", r, c.name)); | 2773 | loaderror(nosuchfield, sys->sprint("%s not resolved in class %s", r, c.name)); |
| 2759 | else { | 2774 | else { |