src/share/classes/com/sun/tools/javap/StackMapWriter.java

changeset 1339
0e5899f09dab
parent 581
f2fdd52e4e87
child 1648
a03c4a86ea2b
equal deleted inserted replaced
1338:ad2ca2a4ab5e 1339:0e5899f09dab
1 /* 1 /*
2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2009, 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
23 * questions. 23 * questions.
24 */ 24 */
25 25
26 package com.sun.tools.javap; 26 package com.sun.tools.javap;
27 27
28 import com.sun.tools.classfile.AccessFlags; 28 import java.util.Arrays;
29 import java.util.HashMap; 29 import java.util.HashMap;
30 import java.util.Map; 30 import java.util.Map;
31 31
32 import com.sun.tools.classfile.AccessFlags;
32 import com.sun.tools.classfile.Attribute; 33 import com.sun.tools.classfile.Attribute;
33 import com.sun.tools.classfile.Code_attribute; 34 import com.sun.tools.classfile.Code_attribute;
34 import com.sun.tools.classfile.ConstantPool; 35 import com.sun.tools.classfile.ConstantPool;
35 import com.sun.tools.classfile.ConstantPoolException; 36 import com.sun.tools.classfile.ConstantPoolException;
36 import com.sun.tools.classfile.Descriptor; 37 import com.sun.tools.classfile.Descriptor;
231 public Integer visit_chop_frame(chop_frame frame, Integer pc) { 232 public Integer visit_chop_frame(chop_frame frame, Integer pc) {
232 int new_pc = pc + frame.getOffsetDelta() + 1; 233 int new_pc = pc + frame.getOffsetDelta() + 1;
233 StackMap prev = map.get(pc); 234 StackMap prev = map.get(pc);
234 assert (prev != null); 235 assert (prev != null);
235 int k = 251 - frame.frame_type; 236 int k = 251 - frame.frame_type;
236 verification_type_info[] new_locals = new verification_type_info[prev.locals.length - k]; 237 verification_type_info[] new_locals = Arrays.copyOf(prev.locals, prev.locals.length - k);
237 System.arraycopy(prev.locals, 0, new_locals, 0, new_locals.length);
238 StackMap m = new StackMap(new_locals, empty); 238 StackMap m = new StackMap(new_locals, empty);
239 map.put(new_pc, m); 239 map.put(new_pc, m);
240 return new_pc; 240 return new_pc;
241 } 241 }
242 242

mercurial