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 |
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 ≥ 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); |