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

changeset 1326
30c36e23f154
parent 1109
3cdfa97e1be9
child 1336
26d93df3905a
equal deleted inserted replaced
1325:b2064a216117 1326:30c36e23f154
1 /* 1 /*
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2012, 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
120 */ 120 */
121 public CRTable crt; 121 public CRTable crt;
122 122
123 /*---------- internal fields: --------------- */ 123 /*---------- internal fields: --------------- */
124 124
125 /** Are we generating code with jumps >= 32K? 125 /** Are we generating code with jumps ≥ 32K?
126 */ 126 */
127 public boolean fatcode; 127 public boolean fatcode;
128 128
129 /** Code generation enabled? 129 /** Code generation enabled?
130 */ 130 */
1075 public void align(int incr) { 1075 public void align(int incr) {
1076 if (alive) 1076 if (alive)
1077 while (cp % incr != 0) emitop0(nop); 1077 while (cp % incr != 0) emitop0(nop);
1078 } 1078 }
1079 1079
1080 /** Place a byte into code at address pc. Pre: pc + 1 <= cp. 1080 /** Place a byte into code at address pc.
1081 * Pre: {@literal pc + 1 <= cp }.
1081 */ 1082 */
1082 private void put1(int pc, int op) { 1083 private void put1(int pc, int op) {
1083 code[pc] = (byte)op; 1084 code[pc] = (byte)op;
1084 } 1085 }
1085 1086
1086 /** Place two bytes into code at address pc. Pre: pc + 2 <= cp. 1087 /** Place two bytes into code at address pc.
1088 * Pre: {@literal pc + 2 <= cp }.
1087 */ 1089 */
1088 private void put2(int pc, int od) { 1090 private void put2(int pc, int od) {
1089 // pre: pc + 2 <= cp 1091 // pre: pc + 2 <= cp
1090 put1(pc, od >> 8); 1092 put1(pc, od >> 8);
1091 put1(pc+1, od); 1093 put1(pc+1, od);
1092 } 1094 }
1093 1095
1094 /** Place four bytes into code at address pc. Pre: pc + 4 <= cp. 1096 /** Place four bytes into code at address pc.
1097 * Pre: {@literal pc + 4 <= cp }.
1095 */ 1098 */
1096 public void put4(int pc, int od) { 1099 public void put4(int pc, int od) {
1097 // pre: pc + 4 <= cp 1100 // pre: pc + 4 <= cp
1098 put1(pc , od >> 24); 1101 put1(pc , od >> 24);
1099 put1(pc+1, od >> 16); 1102 put1(pc+1, od >> 16);
1988 */ 1991 */
1989 public void newRegSegment() { 1992 public void newRegSegment() {
1990 nextreg = max_locals; 1993 nextreg = max_locals;
1991 } 1994 }
1992 1995
1993 /** End scopes of all variables with registers >= first. 1996 /** End scopes of all variables with registers &ge; first.
1994 */ 1997 */
1995 public void endScopes(int first) { 1998 public void endScopes(int first) {
1996 int prevNextReg = nextreg; 1999 int prevNextReg = nextreg;
1997 nextreg = first; 2000 nextreg = first;
1998 for (int i = nextreg; i < prevNextReg; i++) endScope(i); 2001 for (int i = nextreg; i < prevNextReg; i++) endScope(i);

mercurial