Commit c90b7751 authored by Lubomir Bulej's avatar Lubomir Bulej

ProcessorParserException: renamed to ArgProcessorParserException to simplify...

ProcessorParserException: renamed to ArgProcessorParserException to simplify merge of "newagent" code.
ArgProcessorParserException, SnippetParserException, ScopeParserException: subclass the ParserException class.
Proc, ProcArgType, ProcMethod: renamed to ArgProcessor, ArgProcessorKind, and ArgProcessorMethod to simplify merge of "newagent" code.

Other classes updated to reflect the name changes.
parent 10c1f4a7
......@@ -38,7 +38,7 @@ import ch.usi.dag.disl.exclusion.ExclusionSet;
import ch.usi.dag.disl.guard.GuardHelper;
import ch.usi.dag.disl.localvar.SyntheticLocalVar;
import ch.usi.dag.disl.localvar.ThreadLocalVar;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.processor.generator.PIResolver;
import ch.usi.dag.disl.processor.generator.ProcGenerator;
import ch.usi.dag.disl.processor.generator.ProcInstance;
......@@ -129,8 +129,8 @@ public final class DiSL {
}
// initialize processors
final Map<Type, Proc> processors = parser.getProcessors();
for (final Proc processor : processors.values()) {
final Map<Type, ArgProcessor> processors = parser.getProcessors();
for (final ArgProcessor processor : processors.values()) {
processor.init(parser.getAllLocalVars());
}
......
......@@ -11,16 +11,16 @@ import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import ch.usi.dag.disl.annotation.ArgumentProcessor;
import ch.usi.dag.disl.exception.ArgProcessorParserException;
import ch.usi.dag.disl.exception.GuardException;
import ch.usi.dag.disl.exception.MarkerException;
import ch.usi.dag.disl.exception.ParserException;
import ch.usi.dag.disl.exception.ProcessorParserException;
import ch.usi.dag.disl.exception.ReflectionException;
import ch.usi.dag.disl.exception.ScopeParserException;
import ch.usi.dag.disl.exception.SnippetParserException;
import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.localvar.LocalVars;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.snippet.Snippet;
public class DislClassParser {
......@@ -30,7 +30,7 @@ public class DislClassParser {
public void parse(InputStream is) throws ParserException,
SnippetParserException, ReflectionException, ScopeParserException,
StaticContextGenException, ProcessorParserException,
StaticContextGenException, ArgProcessorParserException,
MarkerException, GuardException {
// prepare class node
......@@ -91,7 +91,7 @@ public class DislClassParser {
return snippetParser.getSnippets();
}
public Map<Type, Proc> getProcessors() {
public Map<Type, ArgProcessor> getProcessors() {
return processorParser.getProcessors();
}
}
package ch.usi.dag.disl.exception;
public class ProcessorParserException extends DiSLException {
public class ArgProcessorParserException extends ParserException {
private static final long serialVersionUID = -7463716384020447033L;
public ProcessorParserException() {
public ArgProcessorParserException() {
super();
}
public ProcessorParserException(String message, Throwable cause) {
public ArgProcessorParserException(String message, Throwable cause) {
super(message, cause);
}
public ProcessorParserException(String message) {
public ArgProcessorParserException(String message) {
super(message);
}
public ProcessorParserException(Throwable cause) {
public ArgProcessorParserException(Throwable cause) {
super(cause);
}
}
package ch.usi.dag.disl.exception;
public class ScopeParserException extends DiSLException {
public class ScopeParserException extends ParserException {
private static final long serialVersionUID = -8728473299351707468L;
......
package ch.usi.dag.disl.exception;
public class SnippetParserException extends DiSLException {
public class SnippetParserException extends ParserException {
private static final long serialVersionUID = -2826083567381934062L;
......
......@@ -6,12 +6,12 @@ import ch.usi.dag.disl.exception.ReflectionException;
import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.localvar.LocalVars;
public class Proc {
public class ArgProcessor {
private String name;
private List<ProcMethod> methods;
private List<ArgProcessorMethod> methods;
public Proc(String name, List<ProcMethod> methods) {
public ArgProcessor(String name, List<ArgProcessorMethod> methods) {
super();
this.name = name;
this.methods = methods;
......@@ -21,14 +21,14 @@ public class Proc {
return name;
}
public List<ProcMethod> getMethods() {
public List<ArgProcessorMethod> getMethods() {
return methods;
}
public void init(LocalVars allLVs) throws StaticContextGenException,
ReflectionException {
for(ProcMethod method : methods) {
for(ArgProcessorMethod method : methods) {
method.init(allLVs);
}
}
......
......@@ -5,7 +5,7 @@ import org.objectweb.asm.Type;
import ch.usi.dag.disl.annotation.ProcessAlso;
import ch.usi.dag.disl.exception.DiSLFatalException;
public enum ProcArgType {
public enum ArgProcessorKind {
BOOLEAN(Type.BOOLEAN_TYPE),
BYTE(Type.BYTE_TYPE),
......@@ -19,7 +19,7 @@ public enum ProcArgType {
private Type asmType;
private ProcArgType(Type asmType) {
private ArgProcessorKind(Type asmType) {
this.asmType = asmType;
}
......@@ -27,7 +27,7 @@ public enum ProcArgType {
return asmType;
}
public static ProcArgType valueOf(Type type) {
public static ArgProcessorKind valueOf(Type type) {
if(type == null) {
throw new DiSLFatalException("Conversion from null not defined");
......@@ -78,7 +78,7 @@ public enum ProcArgType {
+ " not defined");
}
public static ProcArgType valueOf(ProcessAlso.Type type) {
public static ArgProcessorKind valueOf(ProcessAlso.Type type) {
if(type == null) {
throw new DiSLFatalException("Conversion from null not defined");
......
......@@ -7,18 +7,18 @@ import ch.usi.dag.disl.exception.ReflectionException;
import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.localvar.LocalVars;
public class ProcMethod {
public class ArgProcessorMethod {
private String originClassName;
private String originMethodName;
private EnumSet<ProcArgType> types;
private EnumSet<ArgProcessorKind> types;
private Method guard;
private ProcUnprocessedCode unprocessedCode;
private ProcCode code;
public ProcMethod(String originClassName, String originMethodName,
EnumSet<ProcArgType> types, Method guard,
public ArgProcessorMethod(String originClassName, String originMethodName,
EnumSet<ArgProcessorKind> types, Method guard,
ProcUnprocessedCode unprocessedCode) {
super();
this.originClassName = originClassName;
......@@ -36,7 +36,7 @@ public class ProcMethod {
return originMethodName;
}
public EnumSet<ProcArgType> getTypes() {
public EnumSet<ArgProcessorKind> getTypes() {
return types;
}
......
......@@ -13,9 +13,9 @@ import org.objectweb.asm.tree.MethodInsnNode;
import ch.usi.dag.disl.exception.DiSLFatalException;
import ch.usi.dag.disl.exception.ProcessorException;
import ch.usi.dag.disl.guard.GuardHelper;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ProcArgType;
import ch.usi.dag.disl.processor.ProcMethod;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.processor.ArgProcessorKind;
import ch.usi.dag.disl.processor.ArgProcessorMethod;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorMode;
import ch.usi.dag.disl.snippet.ProcInvocation;
import ch.usi.dag.disl.snippet.Shadow;
......@@ -23,7 +23,7 @@ import ch.usi.dag.disl.snippet.Snippet;
public class ProcGenerator {
Map<Proc, ProcInstance> insideMethodPIs = new HashMap<Proc, ProcInstance>();
Map<ArgProcessor, ProcInstance> insideMethodPIs = new HashMap<ArgProcessor, ProcInstance>();
public PIResolver compute(Map<Snippet, List<Shadow>> snippetMarkings)
throws ProcessorException {
......@@ -151,15 +151,15 @@ public class ProcGenerator {
}
private List<ProcMethodInstance> createMethodInstances(int argPos,
int argsCount, Type argType, Proc processor, Shadow shadow,
int argsCount, Type argType, ArgProcessor processor, Shadow shadow,
ProcInvocation prcInv) {
ProcArgType methodArgType = ProcArgType.valueOf(argType);
ArgProcessorKind methodArgType = ArgProcessorKind.valueOf(argType);
List<ProcMethodInstance> result = new LinkedList<ProcMethodInstance>();
// traverse all methods and find the proper ones
for (ProcMethod method : processor.getMethods()) {
for (ArgProcessorMethod method : processor.getMethods()) {
// check argument type
if(method.getTypes().contains(methodArgType)) {
......
package ch.usi.dag.disl.processor.generator;
import ch.usi.dag.disl.processor.ProcArgType;
import ch.usi.dag.disl.processor.ArgProcessorKind;
import ch.usi.dag.disl.processor.ProcCode;
......@@ -8,11 +8,11 @@ public class ProcMethodInstance {
private int argPos;
private int argsCount;
private ProcArgType argType;
private ArgProcessorKind argType;
private String argTypeDesc;
private ProcCode code;
public ProcMethodInstance(int argPos, int argsCount, ProcArgType argType,
public ProcMethodInstance(int argPos, int argsCount, ArgProcessorKind argType,
String argTypeDesc, ProcCode code) {
super();
this.argPos = argPos;
......@@ -30,7 +30,7 @@ public class ProcMethodInstance {
return argsCount;
}
public ProcArgType getArgType() {
public ArgProcessorKind getArgType() {
return argType;
}
......
package ch.usi.dag.disl.snippet;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorMode;
public class ProcInvocation {
private Proc processor;
private ArgProcessor processor;
private ArgumentProcessorMode procApplyType;
public ProcInvocation(Proc processor, ArgumentProcessorMode procApplyType) {
public ProcInvocation(ArgProcessor processor, ArgumentProcessorMode procApplyType) {
super();
this.processor = processor;
this.procApplyType = procApplyType;
}
public Proc getProcessor() {
public ArgProcessor getProcessor() {
return processor;
}
......
......@@ -10,7 +10,7 @@ import ch.usi.dag.disl.exception.ReflectionException;
import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.localvar.LocalVars;
import ch.usi.dag.disl.marker.Marker;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.scope.Scope;
/**
......@@ -112,7 +112,7 @@ public class Snippet implements Comparable<Snippet> {
/**
* Initializes snippet -- prepares the snippet code.
*/
public void init(LocalVars allLVs, Map<Type, Proc> processors,
public void init(LocalVars allLVs, Map<Type, ArgProcessor> processors,
boolean exceptHandler, boolean useDynamicBypass)
throws StaticContextGenException, ReflectionException,
ProcessorException {
......
......@@ -27,7 +27,7 @@ import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.localvar.LocalVars;
import ch.usi.dag.disl.marker.BytecodeMarker;
import ch.usi.dag.disl.marker.Marker;
import ch.usi.dag.disl.processor.Proc;
import ch.usi.dag.disl.processor.ArgProcessor;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorContext;
import ch.usi.dag.disl.processorcontext.ArgumentProcessorMode;
import ch.usi.dag.disl.util.AsmHelper;
......@@ -63,7 +63,7 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
/**
* Processes the stored data and creates snippet code structure.
*/
public SnippetCode process(LocalVars allLVs, Map<Type, Proc> processors,
public SnippetCode process(LocalVars allLVs, Map<Type, ArgProcessor> processors,
Marker marker, boolean exceptHandler, boolean useDynamicBypass)
throws StaticContextGenException, ReflectionException,
ProcessorException {
......@@ -147,7 +147,7 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
}
private ProcessorInfo insnInvokesProcessor(AbstractInsnNode instr, int i,
Map<Type, Proc> processors, Marker marker)
Map<Type, ArgProcessor> processors, Marker marker)
throws ProcessorException, ReflectionException {
final String APPLY_METHOD = "apply";
......@@ -212,7 +212,7 @@ public class SnippetUnprocessedCode extends UnprocessedCode {
+ " can be used only with BytecodeMarker");
}
Proc processor = processors.get(processorType);
ArgProcessor processor = processors.get(processorType);
if (processor == null) {
throw new ProcessorException("In snippet " + className + "."
......
......@@ -9,7 +9,7 @@ import java.util.Set;
import ch.usi.dag.disl.coderep.StaticContextMethod;
import ch.usi.dag.disl.exception.ReflectionException;
import ch.usi.dag.disl.exception.StaticContextGenException;
import ch.usi.dag.disl.processor.ProcMethod;
import ch.usi.dag.disl.processor.ArgProcessorMethod;
import ch.usi.dag.disl.resolver.SCResolver;
import ch.usi.dag.disl.snippet.ProcInvocation;
import ch.usi.dag.disl.snippet.Shadow;
......@@ -116,7 +116,7 @@ public class SCGenerator {
for (ProcInvocation pi : snippetCode.getInvokedProcessors ().values ()) {
// add static contexts from all processor methods
for (ProcMethod pm : pi.getProcessor ().getMethods ()) {
for (ArgProcessorMethod pm : pi.getProcessor ().getMethods ()) {
// add to the pool
scMethods.addAll (pm.getCode ().getStaticContexts ());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment