1 /* |
1 /* |
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 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 |
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 |
29 |
|
30 import static com.sun.tools.javac.code.TypeTag.UNINITIALIZED_OBJECT; |
|
31 import static com.sun.tools.javac.code.TypeTag.UNINITIALIZED_THIS; |
30 |
32 |
31 /** These pseudo-types appear in the generated verifier tables to |
33 /** These pseudo-types appear in the generated verifier tables to |
32 * indicate objects that have been allocated but not yet constructed. |
34 * indicate objects that have been allocated but not yet constructed. |
33 * |
35 * |
34 * <p><b>This is NOT part of any supported API. |
36 * <p><b>This is NOT part of any supported API. |
35 * If you write code that depends on this, you do so at your own risk. |
37 * If you write code that depends on this, you do so at your own risk. |
36 * This code and its internal interfaces are subject to change or |
38 * This code and its internal interfaces are subject to change or |
37 * deletion without notice.</b> |
39 * deletion without notice.</b> |
38 */ |
40 */ |
39 class UninitializedType extends Type.DelegatedType { |
41 class UninitializedType extends Type.DelegatedType { |
40 public static final int UNINITIALIZED_THIS = TypeTags.TypeTagCount; |
|
41 public static final int UNINITIALIZED_OBJECT = UNINITIALIZED_THIS + 1; |
|
42 |
42 |
43 public static UninitializedType uninitializedThis(Type qtype) { |
43 public static UninitializedType uninitializedThis(Type qtype) { |
44 return new UninitializedType(UNINITIALIZED_THIS, qtype, -1); |
44 return new UninitializedType(UNINITIALIZED_THIS, qtype, -1); |
45 } |
45 } |
46 |
46 |
47 public static UninitializedType uninitializedObject(Type qtype, int offset) { |
47 public static UninitializedType uninitializedObject(Type qtype, int offset) { |
48 return new UninitializedType(UNINITIALIZED_OBJECT, qtype, offset); |
48 return new UninitializedType(UNINITIALIZED_OBJECT, qtype, offset); |
49 } |
49 } |
50 |
50 |
51 public final int offset; // PC where allocation took place |
51 public final int offset; // PC where allocation took place |
52 private UninitializedType(int tag, Type qtype, int offset) { |
52 private UninitializedType(TypeTag tag, Type qtype, int offset) { |
53 super(tag, qtype); |
53 super(tag, qtype); |
54 this.offset = offset; |
54 this.offset = offset; |
55 } |
55 } |
56 |
56 |
57 Type initializedType() { |
57 Type initializedType() { |