MethodDescriptor nodemd=fc.getMethod();
Set methodset=null;
Set runmethodset=null;
+
if (nodemd.isStatic()||nodemd.getReturnType()==null) {
methodset=new HashSet();
methodset.add(nodemd);
methodset.addAll(runmethodset);
} else throw new Error("Can't find run method");
}
+ /* Add New Check for Thread Join */
+ if (nodemd.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&
+ nodemd.getSymbol().equals("join")) {
+ assert(nodemd.getModifiers().isNative());
+ }
}
+
Integer currreturnval=EITHER; //Start off with the either value
for(Iterator methodit=methodset.iterator();methodit.hasNext();) {
MethodDescriptor md=(MethodDescriptor) methodit.next();
boolean isnative=md.getModifiers().isNative();
+ boolean isjoin = md.getSymbol().equals("join");
LocalityBinding lb=new LocalityBinding(md, isatomic);
if (isnative&&isatomic) {
throw new Error("Starting thread on local object not allowed in context:\n"+currlb.getExplanation());
if(thistype.equals(CONFLICT))
throw new Error("Using type that can be either local or global in context:\n"+currlb.getExplanation());
- if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic)
+ //if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic)
+ /* TODO Remove this ..This is a hack for thread join() call */
+ if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic && !isjoin)
throw new Error("Using global object outside of transaction in context:\n"+currlb.getExplanation());
- if (runmethodset==null&&isnative&&thistype.equals(GLOBAL))
+ //if (runmethodset==null&&isnative&&thistype.equals(GLOBAL))
+ /* TODO Remove this ..This is a hack for thread join() call */
+ if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin)
throw new Error("Potential call to native method "+md+" on global objects:\n"+currlb.getExplanation());
lb.setGlobalThis(thistype);
}
public class Thread {
/* Don't allow overriding this method. If you do, it will break dispatch
* because we don't have the type information necessary. */
+ private boolean threadDone;
+
+ public Thread() {
+ threadDone = false;
+ }
+
+ //public native static void join();
+ public native void join();
public final native void start(int mid);