< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java

Print this page

438 
439         /** The represented symbol.
440          */
441         Symbol member;
442 
443         StaticItem(Symbol member) {
444             super(Code.typecode(member.erasure(types)));
445             this.member = member;
446         }
447 
448         Item load() {
449             code.emitop2(getstatic, member, PoolWriter::putMember);
450             return stackItem[typecode];
451         }
452 
453         void store() {
454             code.emitop2(putstatic, member, PoolWriter::putMember);
455         }
456 
457         Item invoke() {
458             MethodType mtype = (MethodType)member.erasure(types);
459             int rescode = Code.typecode(mtype.restype);
460             code.emitInvokestatic(member, mtype);
461             return stackItem[rescode];
462         }
463 
464         public String toString() {
465             return "static(" + member + ")";
466         }
467     }
468 
469     /** An item representing a dynamic call site.
470      */
471     class DynamicItem extends StaticItem {
472         DynamicItem(Symbol member) {
473             super(member);
474         }
475 
476         Item load() {
477             Assert.check(member.kind == Kinds.Kind.VAR);
478             Type type = member.erasure(types);

438 
439         /** The represented symbol.
440          */
441         Symbol member;
442 
443         StaticItem(Symbol member) {
444             super(Code.typecode(member.erasure(types)));
445             this.member = member;
446         }
447 
448         Item load() {
449             code.emitop2(getstatic, member, PoolWriter::putMember);
450             return stackItem[typecode];
451         }
452 
453         void store() {
454             code.emitop2(putstatic, member, PoolWriter::putMember);
455         }
456 
457         Item invoke() {
458             MethodType mtype = (MethodType)member.externalType(types); // static factories
459             int rescode = Code.typecode(mtype.restype);
460             code.emitInvokestatic(member, mtype);
461             return stackItem[rescode];
462         }
463 
464         public String toString() {
465             return "static(" + member + ")";
466         }
467     }
468 
469     /** An item representing a dynamic call site.
470      */
471     class DynamicItem extends StaticItem {
472         DynamicItem(Symbol member) {
473             super(member);
474         }
475 
476         Item load() {
477             Assert.check(member.kind == Kinds.Kind.VAR);
478             Type type = member.erasure(types);
< prev index next >