stmt.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- Copyright (C) International Computer Science Institute, 1995.  COPYRIGHT  --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
-- the file "Doc/License" of the Sather distribution.  The license is also   --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
--------> Please email comments to sather-bugs@icsi.berkeley.edu. <----------

-- $AM_STMT: Supertype of statement-like components.
-- AM_STMT: Implementation to be included by $AM_STMT nodes. 
-- AM_ASSIGN_STMT: Assignment statment.
-- AM_IF_STMT: Conditional statement.
-- AM_LOOP_STMT: Loop statement.
-- AM_BREAK_STMT: Exit the innermost loop.
-- AM_RETURN_STMT: Return statement.
-- AM_YIELD_STMT: Yield statement.
-- AM_CASE_STMT: Multi-way branch statement.
-- AM_TYPECASE_STMT: Typecase statement.
-- AM_PRE_STMT: Statement representing a precondition.
-- AM_POST_STMT: Statement representing a postcondition.   
-- AM_INITIAL_STMT: Statement with initial code for a postcondition.
-- AM_ASSERT_STMT: Assert statement.
-- AM_INVARIANT_STMT: Statement representing an invariant check.   
-- AM_PROTECT_STMT: Protect statement.
-- AM_RAISE_STMT: Raise statement.
-- AM_EXPR_STMT: An expression used for side-effect
-- AM_COMMENT_STMT: a comment to be inserted into the C-Code
--
-- pSather:
-- AM_ATTACH_STMT
-- AM_LOCK_STMT
-- AM_UNLOCK_STMT
-- AM_WITH_NEAR_STMT
-- AM_SYNC_STMT
-- AM_PREFETCH_STMT
   


abstract class $AM_STMT < $AM, $NEXT{$AM_STMT}

abstract class $AM_STMT < $AM, $NEXT{$AM_STMT} is -- Supertype of statement-like components. copy:$AM_STMT; -- returns a deep copy of self end;

class AM_STMT

class AM_STMT is include AM; include NEXT{$AM_STMT}; -- The next pointer represents the -- next statement in the list, if any. end;

class AM_ASSIGN_STMT < $AM_STMT

class AM_ASSIGN_STMT < $AM_STMT is -- Assignment statment. include AM_STMT; attr dest:$AM_EXPR; -- The destination expression. -- This must be AM_LOCAL_EXPR, AM_GLOBAL_EXPR, AM_ATTR_EXPR, -- or AM_ARR_EXPR. attr src:$AM_EXPR; -- The source expression. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_ASSIGN_STMT::create AM_ASSIGN_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_ASSIGN_STMT::next BOOL::not AM_ASSIGN_STMT::next AM_ASSIGN_STMT::next if ~void(dest) then r.dest:=dest.copy; end;-- AM_ASSIGN_STMT::dest BOOL::not AM_ASSIGN_STMT::dest AM_ASSIGN_STMT::dest if ~void(src) then r.src:=src.copy; end;-- AM_ASSIGN_STMT::src BOOL::not AM_ASSIGN_STMT::src AM_ASSIGN_STMT::src return r; end; -- creates an assignment that has the same effect -- as the AM_PREFETCH_STMT. create(c:AM_PREFETCH_STMT):SAME is r::=#SAME(c.source);-- AM_ASSIGN_STMT::create AM_PREFETCH_STMT::source r.dest:=c.dest;-- AM_ASSIGN_STMT::dest AM_PREFETCH_STMT::dest r.src:=c.src;-- AM_ASSIGN_STMT::src AM_PREFETCH_STMT::src r.next:=void;-- AM_ASSIGN_STMT::next return r; end; end;

class AM_COMMENT_STMT < $AM_STMT

class AM_COMMENT_STMT < $AM_STMT is -- Assignment statment. include AM_STMT; attr comment:STR; -- The comment copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_COMMENT_STMT::create AM_COMMENT_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_COMMENT_STMT::next BOOL::not AM_COMMENT_STMT::next AM_COMMENT_STMT::next r.comment:=comment;-- AM_COMMENT_STMT::comment AM_COMMENT_STMT::comment return r; end; end;

class AM_IF_STMT < $AM_STMT

class AM_IF_STMT < $AM_STMT is -- Conditional statement. include AM_STMT; attr test:$AM_EXPR; -- Boolean test expression. attr if_true:$AM_STMT; -- Statements for true branch. attr if_false:$AM_STMT; -- Statements for false branch. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_IF_STMT::create AM_IF_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_IF_STMT::next BOOL::not AM_IF_STMT::next AM_IF_STMT::next if ~void(test) then r.test:=test.copy; end;-- AM_IF_STMT::test BOOL::not AM_IF_STMT::test AM_IF_STMT::test if ~void(if_true) then r.if_true:=if_true.copy; end;-- AM_IF_STMT::if_true BOOL::not AM_IF_STMT::if_true AM_IF_STMT::if_true if ~void(if_false) then r.if_false:=if_false.copy; end;-- AM_IF_STMT::if_false BOOL::not AM_IF_STMT::if_false AM_IF_STMT::if_false return r; end; end;

class AM_LOOP_STMT < $AM_STMT

class AM_LOOP_STMT < $AM_STMT is -- Loop statement. include AM_STMT; attr its:FLIST{AM_ITER_CALL_EXPR}; -- A list of the enclosed iters -- which must be initialized when the loop is entered. attr bits:FLIST{AM_BND_ITER_CALL_EXPR}; -- A list of the enclosed bound -- iter calls which must be initialized when the loop is entered. attr firsts:FLIST{AM_LOCAL_EXPR}; -- Ivin. A list of local Boolean variables corresponding to inlined -- iterators, which must be initialized to true when the loop is entered. attr breaks:INT; -- number of breaks used in the loop attr no_begin_loop:BOOL; -- only for pSather: a loop that uses no iters with -- yields inside locks does not need "BEGIN_LOOP" attr has_init_stmt:BOOL; -- true if the C code has an initial '{' attr has_yield:BOOL; -- True if there is a "yield" in the -- loop body (or a nested loop body). attr body:$AM_STMT; -- The body of the loop. attr init:$AM_STMT; -- statements to execute before entering -- the loop. attr loop_index_var:AM_LOCAL_EXPR; -- local expression used for the loop index attr loop_index:STR; -- local_expr of the array index variable, -- used by the optimizer. uses_loop_index:BOOL is return ~void(loop_index_var); end; attr ar_max_expr:FLIST{STR}; -- list of exprs used to test if ar_local -- has reached the maximum value. Used -- by the optimizer attr first_while_moved:$AM; -- the first while!/until! statement that has been -- moved to the end of the loop. used to avoid -- recursion if the loop consists of only -- while!/until! statements attr hoisted:FLIST{EXPR_HOISTED}; -- list of expressions hoisted, used by the optimizer copy:$AM_STMT is if void(self) then return void; end; #OUT+"it is not possible to copy loops!";-- OUT::create OUT::plus assert(false); return void; -- to keep the compiler happy end; end;

class AM_BREAK_STMT < $AM_STMT

class AM_BREAK_STMT < $AM_STMT is -- Exit the innermost loop. while!, until! and break! get -- transformed into this. include AM_STMT; copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_BREAK_STMT::create AM_BREAK_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_BREAK_STMT::next BOOL::not AM_BREAK_STMT::next AM_BREAK_STMT::next return r; end; end;

class AM_RETURN_STMT < $AM_STMT

class AM_RETURN_STMT < $AM_STMT is -- Return statement. include AM_STMT; attr val:$AM_EXPR; -- The return value, if any. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_RETURN_STMT::create AM_RETURN_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_RETURN_STMT::next BOOL::not AM_RETURN_STMT::next AM_RETURN_STMT::next if ~void(val) then r.val:=val.copy; end;-- AM_RETURN_STMT::val BOOL::not AM_RETURN_STMT::val AM_RETURN_STMT::val return r; end; end;

class AM_YIELD_STMT < $AM_STMT

class AM_YIELD_STMT < $AM_STMT is -- Yield statement. include AM_STMT; attr ret:INT; -- -1 for quit or the index of the -- branch to take next. attr val:$AM_EXPR; -- The return value, if any. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_YIELD_STMT::create AM_YIELD_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_YIELD_STMT::next BOOL::not AM_YIELD_STMT::next AM_YIELD_STMT::next if ~void(val) then r.val:=val.copy; end;-- AM_YIELD_STMT::val BOOL::not AM_YIELD_STMT::val AM_YIELD_STMT::val r.ret:=ret;-- AM_YIELD_STMT::ret AM_YIELD_STMT::ret return r; end; end;

class AM_CASE_STMT < $AM_STMT

class AM_CASE_STMT < $AM_STMT is -- Multi-way branch statement. include AM_STMT; attr test:$AM_EXPR; -- Expression to test. attr tgts:FLIST{FLIST{$AM_CONST}}; -- The target values. Each entry is -- an array of the targets for the corresponding statement list. attr stmts:FLIST{$AM_STMT}; -- The statement lists. attr else_stmts:$AM_STMT; -- The else statements. attr no_else:BOOL; -- True if there is no "else" part. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_CASE_STMT::create AM_CASE_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_CASE_STMT::next BOOL::not AM_CASE_STMT::next AM_CASE_STMT::next if ~void(test) then r.test:=test.copy; end;-- AM_CASE_STMT::test BOOL::not AM_CASE_STMT::test AM_CASE_STMT::test r.tgts:=tgts;-- AM_CASE_STMT::tgts AM_CASE_STMT::tgts r.stmts:=#;-- AM_CASE_STMT::stmts FLIST{1}::create loop x::=stmts.elt!;-- AM_CASE_STMT::stmts FLIST{1}::elt! if ~void(x) then x:=x.copy; end;-- BOOL::not r.stmts:=r.stmts.push(void);-- AM_CASE_STMT::stmts AM_CASE_STMT::stmts FLIST{1}::push end; if ~void(else_stmts) then r.else_stmts:=else_stmts.copy; end;-- AM_CASE_STMT::else_stmts BOOL::not AM_CASE_STMT::else_stmts AM_CASE_STMT::else_stmts r.no_else:=no_else;-- AM_CASE_STMT::no_else AM_CASE_STMT::no_else return r; end; end;

class AM_TYPECASE_STMT < $AM_STMT

class AM_TYPECASE_STMT < $AM_STMT is -- Typecase statement. include AM_STMT; attr test:AM_LOCAL_EXPR; -- Local variable to test. attr tgts:FLIST{$TP}; -- The target types. attr stmts:FLIST{$AM_STMT}; -- The statement lists. attr else_stmts:$AM_STMT; -- The else statements, also void stmts if there attr has_void_stmts:BOOL; -- True if has void stmts. attr no_else:BOOL; -- True if there is no "else" part. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_TYPECASE_STMT::create AM_TYPECASE_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_TYPECASE_STMT::next BOOL::not AM_TYPECASE_STMT::next AM_TYPECASE_STMT::next r.test:=test; -- local variables are not copied-- AM_TYPECASE_STMT::test AM_TYPECASE_STMT::test r.tgts:=tgts;-- AM_TYPECASE_STMT::tgts AM_TYPECASE_STMT::tgts r.stmts:=#;-- AM_TYPECASE_STMT::stmts FLIST{1}::create loop x::=stmts.elt!;-- AM_TYPECASE_STMT::stmts FLIST{1}::elt! if ~void(x) then x:=x.copy; end;-- BOOL::not r.stmts:=r.stmts.push(x);-- AM_TYPECASE_STMT::stmts AM_TYPECASE_STMT::stmts FLIST{1}::push end; if ~void(else_stmts) then r.else_stmts:=else_stmts.copy; end;-- AM_TYPECASE_STMT::else_stmts BOOL::not AM_TYPECASE_STMT::else_stmts AM_TYPECASE_STMT::else_stmts r.no_else:=no_else;-- AM_TYPECASE_STMT::no_else AM_TYPECASE_STMT::no_else return r; end; end;

class AM_PRE_STMT < $AM_STMT

class AM_PRE_STMT < $AM_STMT is -- Statement representing a precondition. include AM_STMT; attr tp:$TP; -- The type which this is from. attr test:$AM_EXPR; -- Expression to test. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_PRE_STMT::create AM_PRE_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_PRE_STMT::next BOOL::not AM_PRE_STMT::next AM_PRE_STMT::next r.tp:=tp;-- AM_PRE_STMT::tp AM_PRE_STMT::tp if ~void(test) then r.test:=test.copy; end;-- AM_PRE_STMT::test BOOL::not AM_PRE_STMT::test AM_PRE_STMT::test return r; end; end;

class AM_POST_STMT < $AM_STMT

class AM_POST_STMT < $AM_STMT is -- Statement representing a postcondition. include AM_STMT; attr tp:$TP; -- The type which this is from. attr test:$AM_EXPR; -- Expression to test. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_POST_STMT::create AM_POST_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_POST_STMT::next BOOL::not AM_POST_STMT::next AM_POST_STMT::next r.tp:=tp;-- AM_POST_STMT::tp AM_POST_STMT::tp if ~void(test) then r.test:=test.copy; end;-- AM_POST_STMT::test BOOL::not AM_POST_STMT::test AM_POST_STMT::test return r; end; end;

class AM_INITIAL_STMT < $AM_STMT

class AM_INITIAL_STMT < $AM_STMT is -- Statement with initial code for a postcondition. include AM_STMT; attr tp:$TP; -- The type which this is from. attr stmts:$AM_STMT; -- Statements to execute. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_INITIAL_STMT::create AM_INITIAL_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_INITIAL_STMT::next BOOL::not AM_INITIAL_STMT::next AM_INITIAL_STMT::next r.tp:=tp;-- AM_INITIAL_STMT::tp AM_INITIAL_STMT::tp if ~void(stmts) then r.stmts:=stmts.copy; end;-- AM_INITIAL_STMT::stmts BOOL::not AM_INITIAL_STMT::stmts AM_INITIAL_STMT::stmts return r; end; end;

class AM_INVARIANT_STMT < $AM_STMT

class AM_INVARIANT_STMT < $AM_STMT is -- Statement representing an invariant check. (If present, this -- type must define "invariant:BOOL"). include AM_STMT; attr sig:SIG; -- Signature of the invariant. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_INVARIANT_STMT::create AM_INVARIANT_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_INVARIANT_STMT::next BOOL::not AM_INVARIANT_STMT::next AM_INVARIANT_STMT::next r.sig:=sig;-- AM_INVARIANT_STMT::sig AM_INVARIANT_STMT::sig return r; end; end;

class AM_ASSERT_STMT < $AM_STMT

class AM_ASSERT_STMT < $AM_STMT is -- Assert statement. include AM_STMT; attr tp:$TP; -- The type which this is from. attr test:$AM_EXPR; -- Expression to test. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_ASSERT_STMT::create AM_ASSERT_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_ASSERT_STMT::next BOOL::not AM_ASSERT_STMT::next AM_ASSERT_STMT::next if ~void(test) then r.test:=test.copy; end;-- AM_ASSERT_STMT::test BOOL::not AM_ASSERT_STMT::test AM_ASSERT_STMT::test r.tp:=tp;-- AM_ASSERT_STMT::tp AM_ASSERT_STMT::tp return r; end; end;

class AM_PROTECT_STMT < $AM_STMT

class AM_PROTECT_STMT < $AM_STMT is -- Protect statement. include AM_STMT; attr body:$AM_STMT; -- The body of the protect. attr tgts:FLIST{$TP}; -- The target types for the "whens". attr stmts:FLIST{$AM_STMT}; -- The statement lists. attr else_stmts:$AM_STMT; -- The else statements. attr no_else:BOOL; -- True if there is no "else" part. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_PROTECT_STMT::create AM_PROTECT_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_PROTECT_STMT::next BOOL::not AM_PROTECT_STMT::next AM_PROTECT_STMT::next if ~void(body) then r.body:=body.copy; end;-- AM_PROTECT_STMT::body BOOL::not AM_PROTECT_STMT::body AM_PROTECT_STMT::body r.tgts:=tgts;-- AM_PROTECT_STMT::tgts AM_PROTECT_STMT::tgts r.stmts:=#;-- AM_PROTECT_STMT::stmts FLIST{1}::create loop x::=stmts.elt!;-- AM_PROTECT_STMT::stmts FLIST{1}::elt! if ~void(x) then x:=x.copy; end;-- BOOL::not r.stmts:=r.stmts.push(x);-- AM_PROTECT_STMT::stmts AM_PROTECT_STMT::stmts FLIST{1}::push end; if ~void(else_stmts) then r.else_stmts:=else_stmts.copy; end;-- AM_PROTECT_STMT::else_stmts BOOL::not AM_PROTECT_STMT::else_stmts AM_PROTECT_STMT::else_stmts r.no_else:=no_else;-- AM_PROTECT_STMT::no_else AM_PROTECT_STMT::no_else return r; end; end;

class AM_RAISE_STMT < $AM_STMT

class AM_RAISE_STMT < $AM_STMT is -- Raise statement. include AM_STMT; attr val:$AM_EXPR; -- The exception object. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_RAISE_STMT::create AM_RAISE_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_RAISE_STMT::next BOOL::not AM_RAISE_STMT::next AM_RAISE_STMT::next if ~void(val) then r.val:=val.copy; end;-- AM_RAISE_STMT::val BOOL::not AM_RAISE_STMT::val AM_RAISE_STMT::val return r; end; end;

class AM_EXPR_STMT < $AM_STMT

class AM_EXPR_STMT < $AM_STMT is -- An expression used for side-effect. include AM_STMT; attr expr:$AM_EXPR; -- The expression to evaluate. --pSather attr at:$AM_EXPR; copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_EXPR_STMT::create AM_EXPR_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_EXPR_STMT::next BOOL::not AM_EXPR_STMT::next AM_EXPR_STMT::next if ~void(expr) then r.expr:=expr.copy; end;-- AM_EXPR_STMT::expr BOOL::not AM_EXPR_STMT::expr AM_EXPR_STMT::expr if ~void(at) then r.at:=at.copy; end;-- AM_EXPR_STMT::at BOOL::not AM_EXPR_STMT::at AM_EXPR_STMT::at return r; end; end;
--class AM_PAR_BEGIN_STMT < $AM_STMT is -- -- pSather -- include AM_STMT; -- -- attr locals:FLIST{AM_LOCAL_EXPR}; -- locals declared after "par". -- -- attr stack:AM_LOCAL_EXPR; -- attr stackname: IDENT; -- attr stacktypes : FLIST{$TP}; -- attr before_locals:FLIST{AM_LOCAL_EXPR}; -- locals declared before "par". -- attr surrounding_par:AM_PAR_BEGIN_STMT; -- attr par_ob:AM_LOCAL_EXPR; -- attr active_locals_size:INT; --end; -- --class AM_PAR_END_STMT < $AM_STMT is -- --pSather -- include AM_STMT; --end;

class AM_SYNC_STMT < $AM_STMT

class AM_SYNC_STMT < $AM_STMT is include AM_STMT; copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_SYNC_STMT::create AM_SYNC_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_SYNC_STMT::next BOOL::not AM_SYNC_STMT::next AM_SYNC_STMT::next return r; end; end;

class AM_ATTACH_STMT < $AM_STMT

class AM_ATTACH_STMT < $AM_STMT is -- pSather include AM_STMT; attr rout:SIG; attr helper:AM_LOCAL_EXPR; attr gate:AM_LOCAL_EXPR; attr at:$AM_EXPR; copy:$AM_STMT is if void(self) then return void; end; #OUT+"it is not possible to copy attach statements!";-- OUT::create OUT::plus assert(false); return void; -- to keep the compiler happy end; end;

class AM_LOCK_STMT < $AM_STMT

class AM_LOCK_STMT < $AM_STMT is -- pSather include AM_STMT; attr guards:FLIST{$AM_EXPR}; -- The guards attr locks:FLIST{ARRAY{$AM_EXPR}}; -- The locks to obtain attr stmts:FLIST{$AM_STMT}; -- The statement lists for the branches attr else_stmts:$AM_STMT; -- The else statements. attr manual_unlock:BOOL; -- if this is true, all statments that -- exit the lock statment have to unlock -- it manually with a special macro defined -- in pSather.h. The optimizer may set it to true -- in some special cirumstances (for example there -- cannot be any raise statements) copy:$AM_STMT is if void(self) then return void; end; r::=new; loop r.guards:=r.guards.push(guards.elt!.copy); end;-- AM_LOCK_STMT::guards AM_LOCK_STMT::guards FLIST{1}::push AM_LOCK_STMT::guards FLIST{1}::elt! loop r.stmts:=r.stmts.push(stmts.elt!.copy); end;-- AM_LOCK_STMT::stmts AM_LOCK_STMT::stmts FLIST{1}::push AM_LOCK_STMT::stmts FLIST{1}::elt! loop e::=locks.elt!;-- AM_LOCK_STMT::locks FLIST{1}::elt! n:ARRAY{$AM_EXPR}:=#(e.size);-- ARRAY{1}::create ARRAY{1}::size loop n.set!(e.elt!); end;-- ARRAY{1}::set! ARRAY{1}::elt! r.locks:=r.locks.push(n); -- AM_LOCK_STMT::locks AM_LOCK_STMT::locks FLIST{1}::push end; r.else_stmts:=else_stmts.copy;-- AM_LOCK_STMT::else_stmts AM_LOCK_STMT::else_stmts return r; end; end;

class AM_UNLOCK_STMT < $AM_STMT

class AM_UNLOCK_STMT < $AM_STMT is -- pSather include AM_STMT; attr lock_ob:$AM_EXPR; -- The lock to release. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_UNLOCK_STMT::create AM_UNLOCK_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_UNLOCK_STMT::next BOOL::not AM_UNLOCK_STMT::next AM_UNLOCK_STMT::next if ~void(lock_ob) then r.lock_ob:=lock_ob.copy; end;-- AM_UNLOCK_STMT::lock_ob BOOL::not AM_UNLOCK_STMT::lock_ob AM_UNLOCK_STMT::lock_ob return r; end; end;

class AM_WITH_NEAR_STMT < $AM_STMT

class AM_WITH_NEAR_STMT < $AM_STMT is -- pSather include AM_STMT; attr objects:ARRAY{$AM_EXPR}; -- The identifiers to be near. attr near_part:$AM_STMT; -- The body of the 'then'-part. attr else_part:$AM_STMT; -- The body of the 'else'-part. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_WITH_NEAR_STMT::create AM_WITH_NEAR_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_WITH_NEAR_STMT::next BOOL::not AM_WITH_NEAR_STMT::next AM_WITH_NEAR_STMT::next r.objects:=#(objects.size);-- AM_WITH_NEAR_STMT::objects ARRAY{1}::create AM_WITH_NEAR_STMT::objects ARRAY{1}::size loop x::=objects.elt!;-- AM_WITH_NEAR_STMT::objects ARRAY{1}::elt! if ~void(x) then x:=x.copy; end;-- BOOL::not r.objects.set!(x);-- AM_WITH_NEAR_STMT::objects ARRAY{1}::set! end; r.near_part:=near_part.copy;-- AM_WITH_NEAR_STMT::near_part AM_WITH_NEAR_STMT::near_part r.else_part:=else_part.copy;-- AM_WITH_NEAR_STMT::else_part AM_WITH_NEAR_STMT::else_part return r; end; end;

class AM_PREFETCH_STMT < $AM_STMT

class AM_PREFETCH_STMT < $AM_STMT is -- Similar to an assign statement, but the function call -- returns immediatly. The value is only available after waiting -- for it with an AM_WAITFOR. -- This works currently only if src an AM_ATTR_EXPR include AM_STMT; attr prefetch:AM_LOCAL_EXPR; -- prefetch variable attr dest:$AM_EXPR; -- The destination expression. -- This must be AM_LOCAL_EXPR, AM_GLOBAL_EXPR, AM_ATTR_EXPR, -- or AM_ARR_EXPR. attr comment:STR; attr src:$AM_EXPR; -- The source expression. copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_PREFETCH_STMT::create AM_PREFETCH_STMT::source if ~void(next) then r.next:=next.copy; end;-- AM_PREFETCH_STMT::next BOOL::not AM_PREFETCH_STMT::next AM_PREFETCH_STMT::next if ~void(dest) then r.dest:=dest.copy; end;-- AM_PREFETCH_STMT::dest BOOL::not AM_PREFETCH_STMT::dest AM_PREFETCH_STMT::dest if ~void(src) then r.src:=src.copy; end;-- AM_PREFETCH_STMT::src BOOL::not AM_PREFETCH_STMT::src AM_PREFETCH_STMT::src if ~void(prefetch) then r.prefetch:=prefetch; end;-- AM_PREFETCH_STMT::prefetch BOOL::not AM_PREFETCH_STMT::prefetch AM_PREFETCH_STMT::prefetch return r; end; end;

class AM_WAITFOR_STMT < $AM_STMT

class AM_WAITFOR_STMT < $AM_STMT is -- waits until the prefetch has finished include AM_STMT; attr prefetch:AM_LOCAL_EXPR; attr src:$AM_EXPR; -- a reference to the same expression in AM_PREFETCH_STMT attr dest:$AM_EXPR; -- a reference to the same expression in AM_PREFETCH_STMT copy:$AM_STMT is if void(self) then return void; end; r::=#SAME(source);-- AM_WAITFOR_STMT::create AM_WAITFOR_STMT::source r.prefetch:=prefetch;-- AM_WAITFOR_STMT::prefetch AM_WAITFOR_STMT::prefetch r.src:=src;-- AM_WAITFOR_STMT::src AM_WAITFOR_STMT::src r.dest:=dest;-- AM_WAITFOR_STMT::dest AM_WAITFOR_STMT::dest return r; end; end; -- vim:sw=3:nosmartindent