|
18 | 18 |
|
19 | 19 | package gov.nasa.jpf.jvm;
|
20 | 20 |
|
| 21 | +import gov.nasa.jpf.Config; |
| 22 | +import gov.nasa.jpf.util.Misc; |
| 23 | +import gov.nasa.jpf.util.StringSetMatcher; |
| 24 | +import gov.nasa.jpf.vm.*; |
| 25 | + |
21 | 26 | import java.lang.reflect.Modifier;
|
22 | 27 | import java.util.HashMap;
|
23 | 28 | import java.util.LinkedHashMap;
|
24 | 29 | import java.util.LinkedList;
|
25 | 30 |
|
26 |
| -import gov.nasa.jpf.Config; |
27 |
| -import gov.nasa.jpf.util.Misc; |
28 |
| -import gov.nasa.jpf.util.StringSetMatcher; |
29 |
| -import gov.nasa.jpf.vm.AbstractTypeAnnotationInfo; |
30 |
| -import gov.nasa.jpf.vm.AnnotationInfo; |
31 |
| -import gov.nasa.jpf.vm.BootstrapMethodInfo; |
32 |
| -import gov.nasa.jpf.vm.BytecodeAnnotationInfo; |
33 |
| -import gov.nasa.jpf.vm.BytecodeTypeParameterAnnotationInfo; |
34 |
| -import gov.nasa.jpf.vm.ClassInfo; |
35 |
| -import gov.nasa.jpf.vm.ClassInfoException; |
36 |
| -import gov.nasa.jpf.vm.ClassLoaderInfo; |
37 |
| -import gov.nasa.jpf.vm.ClassParseException; |
38 |
| -import gov.nasa.jpf.vm.DirectCallStackFrame; |
39 |
| -import gov.nasa.jpf.vm.ExceptionHandler; |
40 |
| -import gov.nasa.jpf.vm.ExceptionParameterAnnotationInfo; |
41 |
| -import gov.nasa.jpf.vm.FieldInfo; |
42 |
| -import gov.nasa.jpf.vm.FormalParameterAnnotationInfo; |
43 |
| -import gov.nasa.jpf.vm.GenericSignatureHolder; |
44 |
| -import gov.nasa.jpf.vm.InfoObject; |
45 |
| -import gov.nasa.jpf.vm.LocalVarInfo; |
46 |
| -import gov.nasa.jpf.vm.MethodInfo; |
47 |
| -import gov.nasa.jpf.vm.NativeMethodInfo; |
48 |
| -import gov.nasa.jpf.vm.StackFrame; |
49 |
| -import gov.nasa.jpf.vm.SuperTypeAnnotationInfo; |
50 |
| -import gov.nasa.jpf.vm.ThreadInfo; |
51 |
| -import gov.nasa.jpf.vm.ThrowsAnnotationInfo; |
52 |
| -import gov.nasa.jpf.vm.TypeAnnotationInfo; |
53 |
| -import gov.nasa.jpf.vm.TypeParameterAnnotationInfo; |
54 |
| -import gov.nasa.jpf.vm.TypeParameterBoundAnnotationInfo; |
55 |
| -import gov.nasa.jpf.vm.Types; |
56 |
| -import gov.nasa.jpf.vm.VariableAnnotationInfo; |
57 |
| - |
58 | 31 | /**
|
59 | 32 | * a ClassInfo that was created from a Java classfile
|
60 | 33 | */
|
@@ -118,14 +91,15 @@ public void setClassAttribute (ClassFile cf, int attrIndex, String name, int att
|
118 | 91 | public void setBootstrapMethodCount (ClassFile cf, Object tag, int count) {
|
119 | 92 | bootstrapMethods = new BootstrapMethodInfo[count];
|
120 | 93 | }
|
121 |
| - |
| 94 | + |
122 | 95 | @Override
|
123 | 96 | public void setBootstrapMethod (ClassFile cf, Object tag, int idx, int refKind, String cls, String mth,
|
124 | 97 | String parameters, String descriptor, int[] cpArgs) {
|
125 | 98 | String clsName = null;
|
126 | 99 | ClassInfo enclosingLambdaCls;
|
127 |
| - |
128 |
| - if (cpArgs.length > 1) { |
| 100 | + |
| 101 | + if (cls.equals("java/lang/invoke/LambdaMetafactory") && (mth.equals("metafactory") || mth.equals("altMetafactory"))) { |
| 102 | + assert(cpArgs.length>1); |
129 | 103 | // For Lambdas
|
130 | 104 | int mrefIdx = cf.mhMethodRefIndexAt(cpArgs[1]);
|
131 | 105 | clsName = cf.methodClassNameAt(mrefIdx).replace('/', '.');
|
@@ -164,16 +138,17 @@ public void setBootstrapMethod (ClassFile cf, Object tag, int idx, int refKind,
|
164 | 138 | int lambdaRefKind = cf.mhRefTypeAt(cpArgs[1]);
|
165 | 139 | String mthName = cf.methodNameAt(mrefIdx);
|
166 | 140 | String signature = cf.methodDescriptorAt(mrefIdx);
|
167 |
| - String samDescriptor = cf.methodTypeDescriptorAt(cpArgs[2]); |
168 |
| - |
| 141 | + String samDescriptor = cf.methodTypeDescriptorAt(cpArgs[2]); |
| 142 | + |
169 | 143 | setBootstrapMethodInfo(enclosingLambdaCls, mthName, signature, idx, lambdaRefKind, samDescriptor, null,
|
170 |
| - isSerializable ? BootstrapMethodInfo.BMType.SERIALIZABLE_LAMBDA_EXPRESSION |
171 |
| - : BootstrapMethodInfo.BMType.LAMBDA_EXPRESSION); |
172 |
| - } |
173 |
| - else { |
| 144 | + isSerializable ? BootstrapMethodInfo.BMType.SERIALIZABLE_LAMBDA_EXPRESSION |
| 145 | + : BootstrapMethodInfo.BMType.LAMBDA_EXPRESSION); |
| 146 | + } else if (cls.equals("java/lang/runtime/ObjectMethods") && mth.equals("bootstrap")) { |
| 147 | + // ----- |
| 148 | + } else { |
174 | 149 | // For String Concatenation
|
175 |
| - clsName = cls; |
176 |
| - |
| 150 | + clsName = cls; |
| 151 | + assert(mth.startsWith("makeConcat")); |
177 | 152 | if(!clsName.equals(JVMClassInfo.this.getName())) {
|
178 | 153 | enclosingLambdaCls = ClassLoaderInfo.getCurrentResolvedClassInfo(clsName);
|
179 | 154 | } else {
|
|
0 commit comments