comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java @ 8243:d81ff782fa1a

Removed @SpecializationThrows from codegen API. Replaced it by a simplier version in @Specialization.
author Christian Humer <christian.humer@gmail.com>
date Mon, 04 Mar 2013 17:20:26 +0100
parents ac4e8c16ffdf
children 703c09f8640c
comparison
equal deleted inserted replaced
8242:ac4e8c16ffdf 8243:d81ff782fa1a
910 builder.end().end(); 910 builder.end().end();
911 } 911 }
912 } 912 }
913 913
914 private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization, int level) { 914 private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization, int level) {
915 if (specialization.getExceptions().length > 0) { 915 if (!specialization.getExceptions().isEmpty()) {
916 builder.startTryBlock(); 916 builder.startTryBlock();
917 } 917 }
918 918
919 builder.startReturn(); 919 builder.startReturn();
920 startCallOperationMethod(builder, specialization); 920 startCallOperationMethod(builder, specialization);
921 addValueParameterNamesWithCasts(builder, specialization.getNode().getGenericSpecialization(), specialization); 921 addValueParameterNamesWithCasts(builder, specialization.getNode().getGenericSpecialization(), specialization);
922 builder.end().end(); // start call operation 922 builder.end().end(); // start call operation
923 builder.end(); // return 923 builder.end(); // return
924 924
925 if (specialization.getExceptions().length > 0) { 925 if (!specialization.getExceptions().isEmpty()) {
926 for (SpecializationThrowsData exception : specialization.getExceptions()) { 926 for (SpecializationThrowsData exception : specialization.getExceptions()) {
927 builder.end().startCatchBlock(exception.getJavaClass(), "ex" + level); 927 builder.end().startCatchBlock(exception.getJavaClass(), "ex" + level);
928 928
929 builder.startReturn().startCall(generatedGenericMethodName(exception.getTransitionTo())); 929 builder.startReturn().startCall(generatedGenericMethodName(exception.getTransitionTo()));
930 builder.string(THIS_NODE_LOCAL_VAR_NAME); 930 builder.string(THIS_NODE_LOCAL_VAR_NAME);
1120 } 1120 }
1121 1121
1122 private CodeTree createExecute(CodeTreeBuilder parent, SpecializationData specialization) { 1122 private CodeTree createExecute(CodeTreeBuilder parent, SpecializationData specialization) {
1123 NodeData node = specialization.getNode(); 1123 NodeData node = specialization.getNode();
1124 CodeTreeBuilder builder = new CodeTreeBuilder(parent); 1124 CodeTreeBuilder builder = new CodeTreeBuilder(parent);
1125 if (specialization.getExceptions().length > 0) { 1125 if (!specialization.getExceptions().isEmpty()) {
1126 builder.startTryBlock(); 1126 builder.startTryBlock();
1127 } 1127 }
1128 1128
1129 if ((specialization.isUninitialized() || specialization.isGeneric()) && node.needsRewrites(getContext())) { 1129 if ((specialization.isUninitialized() || specialization.isGeneric()) && node.needsRewrites(getContext())) {
1130 builder.startReturn().startCall(factoryClassName(node), generatedGenericMethodName(null)); 1130 builder.startReturn().startCall(factoryClassName(node), generatedGenericMethodName(null));
1142 addValueParameterNames(builder, specialization, null, false); 1142 addValueParameterNames(builder, specialization, null, false);
1143 builder.end().end(); // operation call 1143 builder.end().end(); // operation call
1144 builder.end(); // return 1144 builder.end(); // return
1145 } 1145 }
1146 1146
1147 if (specialization.getExceptions().length > 0) { 1147 if (!specialization.getExceptions().isEmpty()) {
1148 for (SpecializationThrowsData exception : specialization.getExceptions()) { 1148 for (SpecializationThrowsData exception : specialization.getExceptions()) {
1149 builder.end().startCatchBlock(exception.getJavaClass(), "ex"); 1149 builder.end().startCatchBlock(exception.getJavaClass(), "ex");
1150 builder.tree(createReturnSpecializeAndExecute(parent, exception.getTransitionTo(), null)); 1150 builder.tree(createReturnSpecializeAndExecute(parent, exception.getTransitionTo(), null));
1151 } 1151 }
1152 builder.end(); 1152 builder.end();