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

changeset 816
7c537f4298fb
parent 798
4868a36f6fd8
child 820
2d5aff89aaa3
equal deleted inserted replaced
815:d17f37522154 816:7c537f4298fb
1 /* 1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
24 */ 24 */
25 25
26 package com.sun.tools.javac.jvm; 26 package com.sun.tools.javac.jvm;
27 27
28 import com.sun.tools.javac.code.*; 28 import com.sun.tools.javac.code.*;
29
30 import com.sun.tools.javac.code.Symbol.*; 29 import com.sun.tools.javac.code.Symbol.*;
31 import com.sun.tools.javac.code.Type.*; 30 import com.sun.tools.javac.code.Type.*;
32 import com.sun.tools.javac.jvm.Code.*; 31 import com.sun.tools.javac.jvm.Code.*;
33 import com.sun.tools.javac.tree.JCTree; 32 import com.sun.tools.javac.tree.JCTree;
33 import com.sun.tools.javac.util.Assert;
34 34
35 import static com.sun.tools.javac.jvm.ByteCodes.*; 35 import static com.sun.tools.javac.jvm.ByteCodes.*;
36 36
37 /** A helper class for code generation. Items are objects 37 /** A helper class for code generation. Items are objects
38 * that stand for addressable entities in the bytecode. Each item 38 * that stand for addressable entities in the bytecode. Each item
385 */ 385 */
386 Type type; 386 Type type;
387 387
388 LocalItem(Type type, int reg) { 388 LocalItem(Type type, int reg) {
389 super(Code.typecode(type)); 389 super(Code.typecode(type));
390 assert reg >= 0; 390 Assert.check(reg >= 0);
391 this.type = type; 391 this.type = type;
392 this.reg = reg; 392 this.reg = reg;
393 } 393 }
394 394
395 Item load() { 395 Item load() {
467 /** An item representing a dynamic call site. 467 /** An item representing a dynamic call site.
468 */ 468 */
469 class DynamicItem extends StaticItem { 469 class DynamicItem extends StaticItem {
470 DynamicItem(Symbol member) { 470 DynamicItem(Symbol member) {
471 super(member); 471 super(member);
472 assert member.owner == syms.invokeDynamicType.tsym; 472 Assert.check(member.owner == syms.invokeDynamicType.tsym);
473 } 473 }
474 474
475 Item load() { 475 Item load() {
476 assert false; 476 Assert.error();
477 return null; 477 return null;
478 } 478 }
479 479
480 void store() { 480 void store() {
481 assert false; 481 Assert.error();
482 } 482 }
483 483
484 Item invoke() { 484 Item invoke() {
485 // assert target.hasNativeInvokeDynamic(); 485 // assert target.hasNativeInvokeDynamic();
486 MethodType mtype = (MethodType)member.erasure(types); 486 MethodType mtype = (MethodType)member.erasure(types);
618 break; 618 break;
619 case OBJECTcode: 619 case OBJECTcode:
620 ldc(); 620 ldc();
621 break; 621 break;
622 default: 622 default:
623 assert false; 623 Assert.error();
624 } 624 }
625 return stackItem[typecode]; 625 return stackItem[typecode];
626 } 626 }
627 //where 627 //where
628 /** Return true iff float number is positive 0. 628 /** Return true iff float number is positive 0.
714 void drop() { 714 void drop() {
715 lhs.store(); 715 lhs.store();
716 } 716 }
717 717
718 void stash(int toscode) { 718 void stash(int toscode) {
719 assert false; 719 Assert.error();
720 } 720 }
721 721
722 int width() { 722 int width() {
723 return lhs.width() + Code.width(typecode); 723 return lhs.width() + Code.width(typecode);
724 } 724 }
782 void drop() { 782 void drop() {
783 load().drop(); 783 load().drop();
784 } 784 }
785 785
786 void stash(int toscode) { 786 void stash(int toscode) {
787 assert false; 787 Assert.error();
788 } 788 }
789 789
790 CondItem mkCond() { 790 CondItem mkCond() {
791 return this; 791 return this;
792 } 792 }

mercurial