CompiledCode.st
changeset 8913 b9498d27a554
parent 8835 d9b8b58d6566
child 9296 ff844fd2a954
equal deleted inserted replaced
8912:3d1947a79cf3 8913:b9498d27a554
   129     "return the maximum number of arguments a method can have.
   129     "return the maximum number of arguments a method can have.
   130      This is a limit in the VM, which may be removed in one of 
   130      This is a limit in the VM, which may be removed in one of 
   131      the next versions ..."
   131      the next versions ..."
   132 
   132 
   133 %{  /* NOCONTEXT */
   133 %{  /* NOCONTEXT */
   134     RETURN (__MKSMALLINT(MAX_METHOD_ARGS));
   134     RETURN (__mkSmallInteger(MAX_METHOD_ARGS));
   135 %}
   135 %}
   136 !
   136 !
   137 
   137 
   138 numArgsMaskInFlags
   138 numArgsMaskInFlags
   139 
   139 
   140 %{  /* NOCONTEXT */
   140 %{  /* NOCONTEXT */
   141     /* made this a primitive to get define in stc.h */
   141     /* made this a primitive to get define in stc.h */
   142 
   142 
   143     RETURN (__MKSMALLINT(F_NARGS));
   143     RETURN (__mkSmallInteger(F_NARGS));
   144 %}.
   144 %}.
   145 
   145 
   146     "
   146     "
   147      self numArgsMaskInFlags
   147      self numArgsMaskInFlags
   148     "
   148     "
   151 numArgsShiftInFlags
   151 numArgsShiftInFlags
   152 
   152 
   153 %{  /* NOCONTEXT */
   153 %{  /* NOCONTEXT */
   154     /* made this a primitive to get define in stc.h */
   154     /* made this a primitive to get define in stc.h */
   155 
   155 
   156     RETURN (__MKSMALLINT(F_NARGSHIFT));
   156     RETURN (__mkSmallInteger(F_NARGSHIFT));
   157 %}.
   157 %}.
   158 
   158 
   159     "
   159     "
   160      self numArgsShiftInFlags
   160      self numArgsShiftInFlags
   161     "
   161     "
   164 numVarsMaskInFlags
   164 numVarsMaskInFlags
   165 
   165 
   166 %{  /* NOCONTEXT */
   166 %{  /* NOCONTEXT */
   167     /* made this a primitive to get define in stc.h */
   167     /* made this a primitive to get define in stc.h */
   168 
   168 
   169     RETURN (__MKSMALLINT(F_NVARS));
   169     RETURN (__mkSmallInteger(F_NVARS));
   170 %}.
   170 %}.
   171 
   171 
   172     "
   172     "
   173      self numVarsMaskInFlags
   173      self numVarsMaskInFlags
   174     "
   174     "
   177 numVarsShiftInFlags
   177 numVarsShiftInFlags
   178 
   178 
   179 %{  /* NOCONTEXT */
   179 %{  /* NOCONTEXT */
   180     /* made this a primitive to get define in stc.h */
   180     /* made this a primitive to get define in stc.h */
   181 
   181 
   182     RETURN (__MKSMALLINT(F_NVARSHIFT));
   182     RETURN (__mkSmallInteger(F_NVARSHIFT));
   183 %}.
   183 %}.
   184 
   184 
   185     "
   185     "
   186      self numVarsShiftInFlags
   186      self numVarsShiftInFlags
   187     "
   187     "
  1269     if (aBoolean == true)
  1269     if (aBoolean == true)
  1270         newFlags |= F_CHECKED;
  1270         newFlags |= F_CHECKED;
  1271     else
  1271     else
  1272         newFlags &= ~F_CHECKED;
  1272         newFlags &= ~F_CHECKED;
  1273 
  1273 
  1274     __INST(flags) = __MKSMALLINT(newFlags);
  1274     __INST(flags) = __mkSmallInteger(newFlags);
  1275 %}
  1275 %}
  1276 !
  1276 !
  1277 
  1277 
  1278 dynamic
  1278 dynamic
  1279     "return the flag stating that the machine code was created
  1279     "return the flag stating that the machine code was created
  1334     if (aBoolean == true)
  1334     if (aBoolean == true)
  1335 	newFlags |= F_MARKBIT;
  1335 	newFlags |= F_MARKBIT;
  1336     else
  1336     else
  1337 	newFlags &= ~F_MARKBIT;
  1337 	newFlags &= ~F_MARKBIT;
  1338 
  1338 
  1339     __INST(flags) = __MKSMALLINT(newFlags);
  1339     __INST(flags) = __mkSmallInteger(newFlags);
  1340 %}
  1340 %}
  1341 ! !
  1341 ! !
  1342 
  1342 
  1343 !CompiledCode methodsFor:'private-compiler interface'!
  1343 !CompiledCode methodsFor:'private-compiler interface'!
  1344 
  1344 
  1390         ^ self
  1390         ^ self
  1391     ].
  1391     ].
  1392 %{
  1392 %{
  1393     /* made this a primitive to get define in stc.h */
  1393     /* made this a primitive to get define in stc.h */
  1394 #ifdef F_NARGS
  1394 #ifdef F_NARGS
  1395     __INST(flags) = __MKSMALLINT( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) );
  1395     __INST(flags) = __mkSmallInteger( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) );
  1396 #endif
  1396 #endif
  1397 %}
  1397 %}
  1398 
  1398 
  1399 
  1399 
  1400 !
  1400 !
  1409     INT f = __intVal(__INST(flags));
  1409     INT f = __intVal(__INST(flags));
  1410 
  1410 
  1411     /* made this a primitive to get define in stc.h */
  1411     /* made this a primitive to get define in stc.h */
  1412     if (__isSmallInteger(aNumber)) {
  1412     if (__isSmallInteger(aNumber)) {
  1413         f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT);
  1413         f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT);
  1414         __INST(flags) = __MKSMALLINT(f);
  1414         __INST(flags) = __mkSmallInteger(f);
  1415     }
  1415     }
  1416 %}
  1416 %}
  1417 
  1417 
  1418 
  1418 
  1419 !
  1419 !
  1423 
  1423 
  1424      WARNING: for internal use by ST/X debuggers only.
  1424      WARNING: for internal use by ST/X debuggers only.
  1425               This method may be removed without notice."
  1425               This method may be removed without notice."
  1426 
  1426 
  1427 %{  /* NOCONTEXT */
  1427 %{  /* NOCONTEXT */
  1428     int n = (__intVal(__INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT;
  1428     INT n = (__intVal(__INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT;
  1429 
  1429 
  1430     /* made this a primitive to get define in stc.h */
  1430     /* made this a primitive to get define in stc.h */
  1431     RETURN (__MKSMALLINT(n));
  1431     RETURN (__mkSmallInteger(n));
  1432 %}
  1432 %}
  1433 
  1433 
  1434 !
  1434 !
  1435 
  1435 
  1436 stackSize:aNumber
  1436 stackSize:aNumber
  1446     INT f = __intVal(__INST(flags));
  1446     INT f = __intVal(__INST(flags));
  1447 
  1447 
  1448     /* made this a primitive to get define in stc.h */
  1448     /* made this a primitive to get define in stc.h */
  1449     if (__isSmallInteger(aNumber)) {
  1449     if (__isSmallInteger(aNumber)) {
  1450         f = (f & ~F_NSTACK) | (__intVal(aNumber) << F_NSTACKSHIFT);
  1450         f = (f & ~F_NSTACK) | (__intVal(aNumber) << F_NSTACKSHIFT);
  1451         __INST(flags) = __MKSMALLINT(f);
  1451         __INST(flags) = __mkSmallInteger(f);
  1452     }
  1452     }
  1453 %}
  1453 %}
  1454 
  1454 
  1455 ! !
  1455 ! !
  1456 
  1456 
  1460     "ANSI alias for numArgs: return the number of arguments, the method expects." 
  1460     "ANSI alias for numArgs: return the number of arguments, the method expects." 
  1461 
  1461 
  1462 %{  /* NOCONTEXT */
  1462 %{  /* NOCONTEXT */
  1463     /* made this a primitive to get define in stc.h */
  1463     /* made this a primitive to get define in stc.h */
  1464 
  1464 
  1465     RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
  1465     RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
  1466 %}.
  1466 %}.
  1467     "
  1467     "
  1468      The old implementation simply counted the arguments from
  1468      The old implementation simply counted the arguments from
  1469      the methods source - new versions include this information
  1469      the methods source - new versions include this information
  1470      in the flag instVar, for more security in #perform:
  1470      in the flag instVar, for more security in #perform:
  1566     "return the number of arguments, the method expects." 
  1566     "return the number of arguments, the method expects." 
  1567 
  1567 
  1568 %{  /* NOCONTEXT */
  1568 %{  /* NOCONTEXT */
  1569     /* made this a primitive to get define in stc.h */
  1569     /* made this a primitive to get define in stc.h */
  1570 
  1570 
  1571     RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
  1571     RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
  1572 %}.
  1572 %}.
  1573     "
  1573     "
  1574      The old implementation simply counted the arguments from
  1574      The old implementation simply counted the arguments from
  1575      the methods source - new versions include this information
  1575      the methods source - new versions include this information
  1576      in the flag instVar, for more security in #perform:
  1576      in the flag instVar, for more security in #perform:
  1590      - for debugging only."
  1590      - for debugging only."
  1591 
  1591 
  1592 %{  /* NOCONTEXT */
  1592 %{  /* NOCONTEXT */
  1593     /* made this a primitive to get define in stc.h */
  1593     /* made this a primitive to get define in stc.h */
  1594 
  1594 
  1595     RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NVARS) >> F_NVARSHIFT));
  1595     RETURN (__mkSmallInteger((__intVal(__INST(flags)) & F_NVARS) >> F_NVARSHIFT));
  1596 %}
  1596 %}
  1597 
  1597 
  1598 
  1598 
  1599 
  1599 
  1600 !
  1600 !
  1680 ! !
  1680 ! !
  1681 
  1681 
  1682 !CompiledCode class methodsFor:'documentation'!
  1682 !CompiledCode class methodsFor:'documentation'!
  1683 
  1683 
  1684 version
  1684 version
  1685     ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.100 2005-04-11 14:41:33 cg Exp $'
  1685     ^ '$Header: /cvs/stx/stx/libbasic/CompiledCode.st,v 1.101 2005-07-08 17:15:01 cg Exp $'
  1686 ! !
  1686 ! !