Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java @ 7751:ef1b41ea0a90
Implemented an option to turn off generated generic generation using specializations in @Generic.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 08 Feb 2013 16:07:33 +0100 |
parents | bdcb3cc47e16 |
children | ca51efac4d57 |
comparison
equal
deleted
inserted
replaced
7750:bdcb3cc47e16 | 7751:ef1b41ea0a90 |
---|---|
425 CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, STATIC), node.getGenericSpecialization().getReturnType().getActualType(), "generatedGeneric"); | 425 CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, STATIC), node.getGenericSpecialization().getReturnType().getActualType(), "generatedGeneric"); |
426 method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME)); | 426 method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME)); |
427 addValueParameters(method, node.getGenericSpecialization(), true); | 427 addValueParameters(method, node.getGenericSpecialization(), true); |
428 | 428 |
429 CodeTreeBuilder builder = method.createBuilder(); | 429 CodeTreeBuilder builder = method.createBuilder(); |
430 boolean ifStarted = false; | 430 |
431 for (int i = 0; i < node.getSpecializations().length; i++) { | 431 if (node.getGenericSpecialization().isUseSpecializationsForGeneric()) { |
432 SpecializationData specialization = node.getSpecializations()[i]; | 432 boolean ifStarted = false; |
433 if (specialization.isUninitialized()) { | 433 for (int i = 0; i < node.getSpecializations().length; i++) { |
434 continue; | 434 SpecializationData specialization = node.getSpecializations()[i]; |
435 } | 435 if (specialization.isUninitialized()) { |
436 if (!specialization.isGeneric()) { | 436 continue; |
437 if (!ifStarted) { | 437 } |
438 builder.startIf(); | 438 if (!specialization.isGeneric()) { |
439 ifStarted = true; | 439 if (!ifStarted) { |
440 builder.startIf(); | |
441 ifStarted = true; | |
442 } else { | |
443 builder.startElseIf(); | |
444 } | |
445 emitGuards(getContext(), builder, "", specialization, false, true); | |
446 builder.end().startBlock(); | |
440 } else { | 447 } else { |
441 builder.startElseIf(); | 448 builder.startElseBlock(); |
442 } | 449 } |
443 emitGuards(getContext(), builder, "", specialization, false, true); | 450 |
444 builder.end().startBlock(); | 451 emitInvokeDoMethod(builder, specialization, 0); |
445 } else { | 452 builder.end(); |
446 builder.startElseBlock(); | 453 } |
447 } | 454 } else { |
448 | 455 emitInvokeDoMethod(builder, node.getGenericSpecialization(), 0); |
449 emitInvokeDoMethod(builder, specialization, 0); | |
450 builder.end(); | |
451 } | 456 } |
452 return method; | 457 return method; |
453 } | 458 } |
454 | 459 |
455 private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization, int level) { | 460 private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization, int level) { |