242 } |
242 } |
243 } |
243 } |
244 |
244 |
245 LambdaForm(String debugName, |
245 LambdaForm(String debugName, |
246 int arity, Name[] names, int result) { |
246 int arity, Name[] names, int result) { |
247 this(debugName, arity, names, result, true); |
247 this(debugName, arity, names, result, /*forceInline=*/true); |
248 } |
248 } |
249 LambdaForm(String debugName, |
249 LambdaForm(String debugName, |
250 int arity, Name[] names, int result, boolean forceInline) { |
250 int arity, Name[] names, int result, boolean forceInline) { |
251 assert(namesOK(arity, names)); |
251 assert(namesOK(arity, names)); |
252 this.arity = arity; |
252 this.arity = arity; |
261 compileToBytecode(); |
261 compileToBytecode(); |
262 } |
262 } |
263 } |
263 } |
264 LambdaForm(String debugName, |
264 LambdaForm(String debugName, |
265 int arity, Name[] names) { |
265 int arity, Name[] names) { |
266 this(debugName, arity, names, LAST_RESULT, true); |
266 this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true); |
267 } |
267 } |
268 LambdaForm(String debugName, |
268 LambdaForm(String debugName, |
269 int arity, Name[] names, boolean forceInline) { |
269 int arity, Name[] names, boolean forceInline) { |
270 this(debugName, arity, names, LAST_RESULT, forceInline); |
270 this(debugName, arity, names, LAST_RESULT, forceInline); |
271 } |
271 } |
272 LambdaForm(String debugName, |
272 LambdaForm(String debugName, |
273 Name[] formals, Name[] temps, Name result) { |
273 Name[] formals, Name[] temps, Name result) { |
274 this(debugName, |
274 this(debugName, |
275 formals.length, buildNames(formals, temps, result), LAST_RESULT, true); |
275 formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true); |
276 } |
276 } |
277 LambdaForm(String debugName, |
277 LambdaForm(String debugName, |
278 Name[] formals, Name[] temps, Name result, boolean forceInline) { |
278 Name[] formals, Name[] temps, Name result, boolean forceInline) { |
279 this(debugName, |
279 this(debugName, |
280 formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline); |
280 formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline); |
289 names[length - 1] = result; |
289 names[length - 1] = result; |
290 return names; |
290 return names; |
291 } |
291 } |
292 |
292 |
293 private LambdaForm(String sig) { |
293 private LambdaForm(String sig) { |
294 this(sig, true); |
|
295 } |
|
296 |
|
297 private LambdaForm(String sig, boolean forceInline) { |
|
298 // Make a blank lambda form, which returns a constant zero or null. |
294 // Make a blank lambda form, which returns a constant zero or null. |
299 // It is used as a template for managing the invocation of similar forms that are non-empty. |
295 // It is used as a template for managing the invocation of similar forms that are non-empty. |
300 // Called only from getPreparedForm. |
296 // Called only from getPreparedForm. |
301 assert(isValidSignature(sig)); |
297 assert(isValidSignature(sig)); |
302 this.arity = signatureArity(sig); |
298 this.arity = signatureArity(sig); |
303 this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity); |
299 this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity); |
304 this.names = buildEmptyNames(arity, sig); |
300 this.names = buildEmptyNames(arity, sig); |
305 this.debugName = "LF.zero"; |
301 this.debugName = "LF.zero"; |
306 this.forceInline = forceInline; |
302 this.forceInline = true; |
307 assert(nameRefsAreLegal()); |
303 assert(nameRefsAreLegal()); |
308 assert(isEmpty()); |
304 assert(isEmpty()); |
309 assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature(); |
305 assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature(); |
310 } |
306 } |
311 |
307 |