Showing the changes to java (1 of 1 file). Show all
Unified · Split
| @@ -1714,6 +1714,50 @@ xjavadup() · 1713 unmodified lines | |||
| 1714 | acqreg(code.j[J.src[1]].dst); | 1714 | acqreg(code.j[J.src[1]].dst); |
| 1715 | } | 1715 | } |
| 1716 | 1716 | ||
| 1717 | xgetclass(a: ref Addr, class: int) | ||
| 1718 | { | ||
| 1719 | imframe, iindw, i: ref Inst; | ||
| 1720 | n, rtflag: int; | ||
| 1721 | rtc: ref RTClass; | ||
| 1722 | cr: ref Creloc; | ||
| 1723 | frm, frf: ref Freloc; | ||
| 1724 | ai: ref ArrayInfo; | ||
| 1725 | |||
| 1726 | # Ensure that Class is loaded | ||
| 1727 | rtc = getRTClass(RCLASSCLASS); | ||
| 1728 | callrtload(rtc, RCLASSCLASS); | ||
| 1729 | |||
| 1730 | cr = getCreloc(RLOADER); | ||
| 1731 | frm = getFreloc(cr, RMP, nil, 0); | ||
| 1732 | frf = getFreloc(cr, "getclassclass", nil, 0); | ||
| 1733 | |||
| 1734 | imframe = loadermframe(frm, frf); | ||
| 1735 | |||
| 1736 | # 1st arg: our name | ||
| 1737 | |||
| 1738 | i = newi(IMOVP); | ||
| 1739 | addrsind(i.s, Amp, mpstring(THISCLASS)); | ||
| 1740 | addrdind(i.d, Afpind, imframe.d.offset, REGSIZE); | ||
| 1741 | datareloc(i); | ||
| 1742 | |||
| 1743 | # 2nd arg: the name of Class to load | ||
| 1744 | |||
| 1745 | i = newi(IMOVP); | ||
| 1746 | addrsind(i.s, Amp, mpstring(CLASSNAME(class))); | ||
| 1747 | addrdind(i.d, Afpind, imframe.d.offset, REGSIZE+IBY2WD); | ||
| 1748 | datareloc(i); | ||
| 1749 | |||
| 1750 | # Result: Class object pointer | ||
| 1751 | |||
| 1752 | i = newi(ILEA); | ||
| 1753 | dstreg(J.dst, DIS_P); | ||
| 1754 | *i.s = *J.dst; | ||
| 1755 | addrdind(i.d, Afpind, imframe.d.offset, REGRET*IBY2WD); | ||
| 1756 | |||
| 1757 | loadermcall(imframe, frf, frm); | ||
| 1758 | relreg(imframe.d); | ||
| 1759 | } | ||
| 1760 | |||
| 1717 | xldc() | 1761 | xldc() |
| 1718 | { | 1762 | { |
| 1719 | i: ref Inst; | 1763 | i: ref Inst; |
| @@ -1743,7 +1787,13 @@ xldc() · 23 unmodified lines | |||
| 1743 | addDreloc(i, PSRC, PSIND); | 1787 | addDreloc(i, PSRC, PSIND); |
| 1744 | CON_Class => | 1788 | CON_Class => |
| 1745 | # TODO: stub! | 1789 | # TODO: stub! |
| 1746 | xjavaload(IMOVW); | 1790 | #xjavanew("java/lang/String", J.dst); |
| 1791 | #i = newi(IMOVP); | ||
| 1792 | #*i.s = *J.movsrc; | ||
| 1793 | #*i.d = *J.dst; | ||
| 1794 | #sind2dind(i.d, STR_DISSTR); | ||
| 1795 | #addDreloc(i, PSRC, PSIND); | ||
| 1796 | xgetclass(J.dst, ix); | ||
| 1747 | * => | 1797 | * => |
| 1748 | badpick("xldc[2]"); | 1798 | badpick("xldc[2]"); |
| 1749 | } | 1799 | } |