History

Implemented ldc class loading, using runtime call

Dmitry Kabak (userdima committed 13 years ago

Commit a27b0801 parent 17255791 file · +51 −1Browse files

Showing the changes to java (1 of 1 file). Show all

Unified · Split

java/appl/j2d/xlate.b+51−1
@@ -1714,6 +1714,50 @@ xjavadup() · 1713 unmodified lines
17141714 acqreg(code.j[J.src[1]].dst);
17151715 }
17161716
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+
17171761 xldc()
17181762 {
17191763 i: ref Inst;
@@ -1743,7 +1787,13 @@ xldc() · 23 unmodified lines
17431787 addDreloc(i, PSRC, PSIND);
17441788 CON_Class =>
17451789 # 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);
17471797 * =>
17481798 badpick("xldc[2]");
17491799 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t