[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/mate OPmhandler.nc, NONE, 1.1 MOPcontrol.nc, 1.3, 1.4 MOPcontrolM.nc, 1.3, 1.4 MOPhandlerM.nc, 1.4, 1.5 MemoryM.nc, 1.6, 1.7 motlle.ldf, 1.3, 1.4 tinyscheme.ldf, 1.1, 1.2 OPmhandler4.nc, 1.3, NONE

David Gay idgay at users.sourceforge.net
Tue Nov 22 15:25:24 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4450/mate

Modified Files:
	MOPcontrol.nc MOPcontrolM.nc MOPhandlerM.nc MemoryM.nc 
	motlle.ldf tinyscheme.ldf 
Added Files:
	OPmhandler.nc 
Removed Files:
	OPmhandler4.nc 
Log Message:
opmb[ft]p3


--- NEW FILE: OPmhandler.nc ---
/*
 * Copyright (c) 2004-2005 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
configuration OPmhandler {
  provides interface MateBytecode;
  provides interface MateBytecodeLock;
}
implementation {
  components MOPhandlerM, MOPcall, MProxy;

  MateBytecode = MOPhandlerM.ExecHandler;
  MateBytecodeLock = MOPhandlerM.ExecHandlerLocks;

  MOPhandlerM.Exec -> MOPcall.Exec;
  MOPhandlerM.G -> MProxy;
  MOPhandlerM.GC -> MProxy;
  MOPhandlerM.S -> MProxy;
  MOPhandlerM.T -> MProxy;
}

Index: MOPcontrol.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MOPcontrol.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MOPcontrol.nc	1 Nov 2005 02:28:11 -0000	1.3
--- MOPcontrol.nc	22 Nov 2005 23:25:22 -0000	1.4
***************
*** 13,16 ****
--- 13,18 ----
      interface MateBytecode as BranchIfFalse;
      interface MateBytecode as BranchIfTrue;
+     interface MateBytecode as BranchIfFalsePreserve;
+     interface MateBytecode as BranchIfTruePreserve;
    }
  }
***************
*** 21,24 ****
--- 23,28 ----
    BranchIfTrue = MOPcontrolM.BranchIfTrue;
    BranchIfFalse = MOPcontrolM.BranchIfFalse;
+   BranchIfFalsePreserve = MOPcontrolM.BranchIfFalsePreserve;
+   BranchIfTruePreserve = MOPcontrolM.BranchIfTruePreserve;
  
    MOPcontrolM.T -> MProxy;

Index: MOPcontrolM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MOPcontrolM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MOPcontrolM.nc	1 Nov 2005 02:28:11 -0000	1.3
--- MOPcontrolM.nc	22 Nov 2005 23:25:22 -0000	1.4
***************
*** 13,16 ****
--- 13,18 ----
      interface MateBytecode as BranchIfFalse;
      interface MateBytecode as BranchIfTrue;
+     interface MateBytecode as BranchIfFalsePreserve;
+     interface MateBytecode as BranchIfTruePreserve;
    }
    uses {
***************
*** 64,67 ****
--- 66,101 ----
      return 1;
    }
+ 
+   /* Branches that pop if the value is false, don't pop if it's true
+      (used to support Scheme's => (in cond) and or constructions
+   */
+   mvalue preservePop(MateContext *context) {
+     mvalue v = call S.get(context, 0);
+ 
+     if (!call T.truep(v))
+       call S.pop(context, 1);
+ 
+     return v;
+   }
+ 
+   command result_t BranchIfTruePreserve.execute(uint8_t instr, MateContext *context) {
+     mvalue v = preservePop(context);
+     branch(instr - OP_MBT3, call T.truep(v), context);
+     return SUCCESS;
+   }
+ 
+   command uint8_t BranchIfTruePreserve.byteLength() {
+     return 1;
+   }
+ 
+   command result_t BranchIfFalsePreserve.execute(uint8_t instr, MateContext *context) {
+     mvalue v = preservePop(context);
+     branch(instr - OP_MBF3, !call T.truep(v), context);
+     return SUCCESS;
+   }
+ 
+   command uint8_t BranchIfFalsePreserve.byteLength() {
+     return 1;
+   }
  }
  

Index: MOPhandlerM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MOPhandlerM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MOPhandlerM.nc	1 Nov 2005 02:28:11 -0000	1.4
--- MOPhandlerM.nc	22 Nov 2005 23:25:22 -0000	1.5
***************
*** 23,27 ****
  implementation {
    command result_t ExecHandler.execute(uint8_t instr, MateContext *context) {
!     uint8_t handler = instr - OP_MHANDLER4;
      mvalue hval;
  
--- 23,27 ----
  implementation {
    command result_t ExecHandler.execute(uint8_t instr, MateContext *context) {
!     uint8_t handler = context->currentHandler;
      mvalue hval;
  
***************
*** 32,41 ****
  
      // suppress undefined handlers
      if (hval != call T.nil())
        {
- 	/* Code executes in the special "handler" which corresponds to the
- 	   whole capsule */
- 	context->currentHandler = MATE_HANDLER_NUM;
- 
  	call S.reset(context);
  	if (call S.push(context, hval))
--- 32,38 ----
  
      // suppress undefined handlers
+     // (the PC will fall through to 1, which means OP_HALT, in this case)
      if (hval != call T.nil())
        {
  	call S.reset(context);
  	if (call S.push(context, hval))

Index: MemoryM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MemoryM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MemoryM.nc	1 Nov 2005 02:28:11 -0000	1.6
--- MemoryM.nc	22 Nov 2005 23:25:22 -0000	1.7
***************
*** 105,109 ****
      switch (pc)
        {
!       case 0: return OP_MHANDLER4 + id;
        case 1: return OP_HALT;
        case 2: return OP_MFRAME;
--- 105,109 ----
      switch (pc)
        {
!       case 0: return OP_MHANDLER;
        case 1: return OP_HALT;
        case 2: return OP_MFRAME;

Index: motlle.ldf
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/motlle.ldf,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** motlle.ldf	23 Oct 2005 21:09:24 -0000	1.3
--- motlle.ldf	22 Nov 2005 23:25:22 -0000	1.4
***************
*** 52,54 ****
  <PRIMITIVE opcode="mwritedl3">
  <PRIMITIVE opcode="mframe">
! <PRIMITIVE opcode="mhandler4" locks=true>
--- 52,54 ----
  <PRIMITIVE opcode="mwritedl3">
  <PRIMITIVE opcode="mframe">
! <PRIMITIVE opcode="mhandler" locks=true>

Index: tinyscheme.ldf
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/tinyscheme.ldf,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tinyscheme.ldf	25 Oct 2005 23:11:52 -0000	1.1
--- tinyscheme.ldf	22 Nov 2005 23:25:22 -0000	1.2
***************
*** 1,7 ****
! <LANGUAGE name="tinyscheme" desc="not quite scheme">
  <PRIMITIVE opcode="halt">
  <PRIMITIVE opcode="madd">
  <PRIMITIVE opcode="mba3">
  <PRIMITIVE opcode="mbf3">
  <PRIMITIVE opcode="mbitand">
  <PRIMITIVE opcode="mbitnot">
--- 1,8 ----
! <LANGUAGE name="tinyscheme" desc="nearly scheme">
  <PRIMITIVE opcode="halt">
  <PRIMITIVE opcode="madd">
  <PRIMITIVE opcode="mba3">
  <PRIMITIVE opcode="mbf3">
+ <PRIMITIVE opcode="mbfp3">
  <PRIMITIVE opcode="mbitand">
  <PRIMITIVE opcode="mbitnot">
***************
*** 9,12 ****
--- 10,14 ----
  <PRIMITIVE opcode="mbitxor">
  <PRIMITIVE opcode="mbt3">
+ <PRIMITIVE opcode="mbtp3">
  <PRIMITIVE opcode="mclearl">
  <PRIMITIVE opcode="mclosure">
***************
*** 52,54 ****
  <PRIMITIVE opcode="mwritedl3">
  <PRIMITIVE opcode="mframe">
! <PRIMITIVE opcode="mhandler4" locks=true>
--- 54,56 ----
  <PRIMITIVE opcode="mwritedl3">
  <PRIMITIVE opcode="mframe">
! <PRIMITIVE opcode="mhandler" locks=true>

--- OPmhandler4.nc DELETED ---



More information about the Tinyos-commits mailing list