Skip to content

Commit

Permalink
Merge branch 'release' for version 2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
joey-coleman committed Jan 16, 2015
2 parents 3c410ec + 2fbc4ec commit 0347161
Show file tree
Hide file tree
Showing 9,229 changed files with 23,235 additions and 315,448 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Icon[^-0-9a-zA-Z]
############################
target/

# eclipse noise #
#################
.metadata/
.classpath
.settings/
Expand Down
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ branches:
- docs
before_install:
- mvn -version
- if [ $TRAVIS_BRANCH == "development" ] ; then { sudo apt-get update -qq; sudo apt-get install -qq nsis nsis-common nsis-pluginapi; } ; fi
# - if [ $TRAVIS_BRANCH == "development" ] ; then { sudo apt-get update -qq; sudo apt-get install -qq nsis nsis-common nsis-pluginapi; } ; fi
install:
- echo "-*- Precompile Core -*-"
- mvn -B install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
- echo "-*- Precompile IDE -*-"
- mvn -B install -f ide/pom.xml -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dgit-commit-id.skip=true
# - echo "-*- Precompile IDE -*-"
#- mvn -B install -f ide/pom.xml -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dgit-commit-id.skip=true
script:
- echo travis_fold:start:compile_core
- mvn -B install
- mvn -B install -Dmaven.javadoc.skip=true
- echo travis_fold:end:compile_core
- echo travis_fold:start:compile_ide
- mvn -B install -f ide/pom.xml -Dgit-commit-id.skip=true -Pall-platforms -P!ui-tests
- echo travis_fold:end:compile_ide
#- echo travis_fold:start:compile_ide
#- mvn -B install -f ide/pom.xml -Dgit-commit-id.skip=true -Pall-platforms -P!ui-tests
#- echo travis_fold:end:compile_ide
2 changes: 1 addition & 1 deletion core/ast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.overturetool</groupId>
<artifactId>core</artifactId>
<version>2.1.4</version>
<version>2.1.6</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 2 additions & 0 deletions core/ast/src/main/java/org/overture/ast/lex/LexLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ public static long getSpanCalls(ILexNameToken name)

public static List<Integer> getHitList(File file)
{
//FIXME skip lex location in other files
// idea: if !lextLocation.getFile().equals(file) then continue;
List<Integer> hits = new Vector<Integer>();

synchronized (allLocations)
Expand Down
2 changes: 0 additions & 2 deletions core/ast/src/main/resources/overtureII.astv2
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ stm {-> package='org.overture.ast.statements'
| {forPatternBind} [patternBind]:patternBind.def [reverse]:java_Boolean [exp]:exp [statement]:stm (seqType):type.#seq
| {if} [ifExp]:exp [thenStm]:stm [elseIf]:stm.elseIf* [elseStm]:stm
| {letBeSt} [bind]:multipleBind [suchThat]:exp [statement]:stm (def):definition.multiBindList
//| #LetDef
| {let} [localDefs]:definition* [statement]:stm
| {notYetSpecified} [opname]:LexNameToken [args]:exp* /* FIXME -- these params are probably useless */
| {return} [expression]:exp
Expand All @@ -582,7 +581,6 @@ stm {-> package='org.overture.ast.statements'
| {stop} [obj]:exp
| {subclassResponsibility}
| {tixe} [traps]:stmtAlternative.tixe* [body]:stm
//| {traceVariable} //TODO why does this have a value inside?
| {trap} [patternBind]:patternBind.def [with]:stm [body]:stm
| {while} [exp]:exp [statement]:stm
| {periodic} [opname]:LexNameToken [args]:exp* (period):java_Long (jitter):java_Long (delay):java_Long (offset):java_Long
Expand Down
2 changes: 1 addition & 1 deletion core/codegen-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.overturetool</groupId>
<artifactId>core</artifactId>
<version>2.1.4<!--Replaceable: Main Version--></version>
<version>2.1.6<!--Replaceable: Main Version--></version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package org.overture.codegen.runtime;

import java.io.Serializable;

/**
* This interface contains only one method that every generated class should implement
* when the concurrency features are selected for generation.
* Returns a boolean value which is the result of the evaluation of the corresponding permission predicate generated
* @param
* Takes a number which represent the constant that is assigned to the each class method.
*
* @author gkanos
*
*/
public interface EvaluatePP extends Serializable
{
public Boolean evaluatePP(final Number fnr);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
package org.overture.codegen.runtime;

/**
* This is the Sentinel class which the inner classes are extending.
* It contains methods and variables for holding and manipulating the history counters existing in VDM++
* @author gkanos
*
*/
public class Sentinel
{
public volatile long[] act;
public volatile long[] fin;
public volatile long[] req;
public volatile long[] active;
public volatile long[] waiting;
public volatile long[] act; //holds the #act history counter.
public volatile long[] fin; //holds the #fin history counter.
public volatile long[] req; //holds the #req history counter.
public volatile long[] active; //holds the #active history counter.
public volatile long[] waiting; //holds the #waiting history counter.

EvaluatePP instance;
public EvaluatePP instance; // hold the instance of the class that the evaluatePP() is going to be used.

//the initialization of the instance of Sentinel class.
//Takes as parameters the instance of the class implementing the EvaluatePP
//and the number of methods to define the size of the arrays.
public void init(EvaluatePP inst, long nrf )
{
instance = inst;
Expand All @@ -19,46 +27,47 @@ public void init(EvaluatePP inst, long nrf )
active = new long[(int)nrf];
waiting = new long[(int)nrf];
}

//This methods is used to enable the activation of a method.
public synchronized void entering(long fnr2) {
int fnr = (int) fnr2;
requesting(fnr);
int fnr = (int) fnr2; //Here the long value is casted into in to be used as index to the arrays.
requesting(fnr);//the #req counter is changed to add one to it.
try{
if(! instance.evaluatePP(fnr).booleanValue())
if(! instance.evaluatePP(fnr).booleanValue()) //the first evaluation of the permition predicate.
{
waiting(fnr, +1);
while (!instance.evaluatePP(fnr).booleanValue())
waiting(fnr, +1);//if the permission predicate is false. It add one to the #waiting counter.
while (!instance.evaluatePP(fnr).booleanValue())//reevaluation of the permission predicate.
{
this.wait();
this.wait(); //actual thread wait method. This freeze the thread waiting for the execution of its method.
}
waiting(fnr, -1);
waiting(fnr, -1); //if predicate changes to true, #waiting is changed to remove one.
}
}catch(InterruptedException e){}
activating(fnr);
activating(fnr);//the #act and the #active counters are change to add one to them
}

//this method is registering the termination of a method.
public synchronized void leaving(long fnr2){
int fn = (int) fnr2;
fin[fn]++;
active[fn]--;
fin[fn]++; //changes the #fin counter adding one to it.
active[fn]--; //changes the #active counter removing one to it.
stateChanged();
}

//this method notifies the threads that a counter has be changed to reevaluate their permission predicates.
public synchronized void stateChanged(){
notifyAll();
}

//The method that actually changes the #req history counter.
private synchronized void requesting(int fn){
req[fn]++;
stateChanged();
}

//The method that actually changing the #act and #active history counters.
private synchronized void activating(int fn){
act[fn]++;
active[fn]++;
stateChanged();
}

//The method that actually changing the #waiting history counter.
//The offset defines how many methods of the same name are waiting.
private synchronized void waiting(int fn, int offset){
waiting[fn] += offset;
stateChanged();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.overture.codegen.runtime;
/**
* This class was defined as intermediate layer class in order to extend through it the Thread class
* and activate the daemon property for the threads that are started.
* The daemon property needs to be active in order for the Java threads to have similar behavior
* as the VDM threads in respect to the JVM and the VDM debugger.
* @author gkanos
*
*/
public class VDMThread extends Thread
{
public VDMThread()
{
setDaemon(true);
}
}
2 changes: 1 addition & 1 deletion core/codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.overturetool</groupId>
<artifactId>core</artifactId>
<version>2.1.4<!--Replaceable: Main Version--></version>
<version>2.1.6<!--Replaceable: Main Version--></version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.overture.codegen.analysis.vdm;

import java.util.LinkedList;
import java.util.List;

import org.overture.ast.analysis.AnalysisException;
import org.overture.ast.analysis.DepthFirstAnalysisAdaptor;
import org.overture.ast.intf.lex.ILexNameToken;

public class NameCollector extends DepthFirstAnalysisAdaptor
{
private List<String> names;

public NameCollector()
{
this.names = new LinkedList<String>();
}

public List<String> namesToAvoid()
{
return names;
}

@Override
public void inILexNameToken(ILexNameToken node) throws AnalysisException
{
String name = node.getName();

if (!names.contains(name))
{
names.add(name);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.overture.codegen.analysis.vdm;

import java.util.List;

import org.overture.ast.analysis.AnalysisException;
import org.overture.ast.analysis.DepthFirstAnalysisAdaptor;
import org.overture.ast.intf.lex.ILexNameToken;
import org.overture.ast.lex.LexNameToken;

class RenameAnalysis extends DepthFirstAnalysisAdaptor
{
private List<Renaming> renamings;

public RenameAnalysis(List<Renaming> renamings)
{
this.renamings = renamings;
}

@Override
public void caseILexNameToken(ILexNameToken node)
throws AnalysisException
{
for (Renaming r : renamings)
{
if (node.getLocation().equals(r.getLoc()))
{
node.parent().replaceChild(node, consLexNameToken(node, r.getNewName()));
}
}
}

private LexNameToken consLexNameToken(ILexNameToken defName,
String newName)
{
LexNameToken newLexName = new LexNameToken(defName.getModule(), newName, defName.getLocation(), defName.getOld(), defName.getExplicit());
newLexName.setTypeQualifier(defName.getTypeQualifier());

return newLexName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package org.overture.codegen.analysis.vdm;

import org.overture.ast.intf.lex.ILexLocation;

public class Renaming implements Comparable<Renaming>
{
private ILexLocation loc;
private String oldName;
private String newName;

public Renaming(ILexLocation loc, String oldName, String newName)
{
if(loc == null)
{
throw new IllegalArgumentException("Location cannot be null in Renaming");
}

if(oldName == null || oldName.isEmpty())
{
throw new IllegalArgumentException("The old name of a renaming cannot be null or the empty String");
}

if(newName == null || newName.isEmpty())
{
throw new IllegalArgumentException("The new name of a renaming cannot be null or the empty String");
}

this.loc = loc;
this.oldName = oldName;
this.newName = newName;
}

public ILexLocation getLoc()
{
return loc;
}

public String getOldName()
{
return oldName;
}

public String getNewName()
{
return newName;
}

@Override
public String toString()
{
return String.format("'%s' changed to '%s' %s", oldName, newName, loc);
}

@Override
public int hashCode()
{
return loc.hashCode();
}

@Override
public boolean equals(Object obj)
{
if(this == obj)
{
return true;
}

if(!(obj instanceof Renaming))
{
return false;
}

Renaming other = (Renaming) obj;

return loc.equals(other.loc);
}

@Override
public int compareTo(Renaming arg0)
{
return arg0.getLoc().getStartOffset() - loc.getStartOffset();
}
}
Loading

0 comments on commit 0347161

Please sign in to comment.