SmallInteger.st
changeset 1688 8a42db1eea60
parent 1672 1b56d6e95c9e
child 1695 465e1eba8e8e
equal deleted inserted replaced
1687:9aa71404d407 1688:8a42db1eea60
   290 	    static struct inlineCache val = _ILC5;
   290 	    static struct inlineCache val = _ILC5;
   291 	    OBJ aLarge;
   291 	    OBJ aLarge;
   292 
   292 
   293 	    aLarge = (*val.ilc_func)(@global(LargeInteger),
   293 	    aLarge = (*val.ilc_func)(@global(LargeInteger),
   294 				     @symbol(sign:value16:value16:value16:value16:),
   294 				     @symbol(sign:value16:value16:value16:value16:),
   295 				     CON_COMMA nil, &val, 
   295 				     nil, &val, 
   296 				     negative ? __MKSMALLINT(-1) : __MKSMALLINT(1),
   296 				     negative ? __MKSMALLINT(-1) : __MKSMALLINT(1),
   297 				     __MKSMALLINT(lowBits(productLow)),
   297 				     __MKSMALLINT(lowBits(productLow)),
   298 				     __MKSMALLINT(hiBits(productLow)),
   298 				     __MKSMALLINT(hiBits(productLow)),
   299 				     __MKSMALLINT(lowBits(productHi)),
   299 				     __MKSMALLINT(lowBits(productHi)),
   300 				     __MKSMALLINT(hiBits(productHi)) );
   300 				     __MKSMALLINT(hiBits(productHi)) );
   741                     static struct inlineCache val = _ILC5;
   741                     static struct inlineCache val = _ILC5;
   742                     OBJ aLarge;
   742                     OBJ aLarge;
   743 
   743 
   744                     aLarge = (*val.ilc_func)(@global(LargeInteger),
   744                     aLarge = (*val.ilc_func)(@global(LargeInteger),
   745                                      @symbol(sign:value16:value16:value16:value16:),
   745                                      @symbol(sign:value16:value16:value16:value16:),
   746                                      CON_COMMA nil, &val,
   746                                      nil, &val,
   747                                      __MKSMALLINT(1),
   747                                      __MKSMALLINT(1),
   748                                      __MKSMALLINT(lowBits(result)),
   748                                      __MKSMALLINT(lowBits(result)),
   749                                      __MKSMALLINT(hiBits(result)),
   749                                      __MKSMALLINT(hiBits(result)),
   750                                      __MKSMALLINT(lowBits(result >> 32)),
   750                                      __MKSMALLINT(lowBits(result >> 32)),
   751                                      __MKSMALLINT(hiBits(result >> 32)) );
   751                                      __MKSMALLINT(hiBits(result >> 32)) );
  1342 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(0))) {
  1342 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(0))) {
  1343 	    if ((code = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
  1343 	    if ((code = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
  1344 #ifdef NEW_BLOCK_CALL
  1344 #ifdef NEW_BLOCK_CALL
  1345 		do {
  1345 		do {
  1346 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1346 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1347 		    (*code)(aBlock COMMA_CON);
  1347 		    (*code)(aBlock);
  1348 		} while(--tmp);
  1348 		} while(--tmp);
  1349 		RETURN (self);
  1349 		RETURN (self);
  1350 #else /* old BLOCK_CALL */
  1350 #else /* old BLOCK_CALL */
  1351 		/*
  1351 		/*
  1352 		 * arg is a compiled block - 
  1352 		 * arg is a compiled block - 
  1358 		     * home will not move - keep in in a register
  1358 		     * home will not move - keep in in a register
  1359 		     */
  1359 		     */
  1360 # if defined(UNROLL_LOOPS)
  1360 # if defined(UNROLL_LOOPS)
  1361 		    while (tmp > 4) {
  1361 		    while (tmp > 4) {
  1362 			if (InterruptPending != nil) __interrupt__(CONARG);
  1362 			if (InterruptPending != nil) __interrupt__(CONARG);
  1363 			(*code)(rHome COMMA_CON);
  1363 			(*code)(rHome);
  1364 			if (InterruptPending != nil) __interrupt__(CONARG);
  1364 			if (InterruptPending != nil) __interrupt__(CONARG);
  1365 			(*code)(rHome COMMA_CON);
  1365 			(*code)(rHome);
  1366 			if (InterruptPending != nil) __interrupt__(CONARG);
  1366 			if (InterruptPending != nil) __interrupt__(CONARG);
  1367 			(*code)(rHome COMMA_CON);
  1367 			(*code)(rHome);
  1368 			if (InterruptPending != nil) __interrupt__(CONARG);
  1368 			if (InterruptPending != nil) __interrupt__(CONARG);
  1369 			(*code)(rHome COMMA_CON);
  1369 			(*code)(rHome);
  1370 			tmp -= 4;
  1370 			tmp -= 4;
  1371 		    }
  1371 		    }
  1372 # endif
  1372 # endif
  1373 		    do {
  1373 		    do {
  1374 			if (InterruptPending != nil) __interrupt__(CONARG);
  1374 			if (InterruptPending != nil) __interrupt__(CONARG);
  1375 			(*code)(rHome COMMA_CON);
  1375 			(*code)(rHome);
  1376 		    } while(--tmp);
  1376 		    } while(--tmp);
  1377 		    RETURN (self);
  1377 		    RETURN (self);
  1378 		}
  1378 		}
  1379 		home = rHome;
  1379 		home = rHome;
  1380 		do {
  1380 		do {
  1381 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1381 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1382 		    (*code)(home COMMA_CON);
  1382 		    (*code)(home);
  1383 		} while(--tmp);
  1383 		} while(--tmp);
  1384 		RETURN (self);
  1384 		RETURN (self);
  1385 #endif /* NEW_BLOCK_CALL */
  1385 #endif /* NEW_BLOCK_CALL */
  1386 	    }
  1386 	    }
  1387 
  1387 
  1432 	 * arg is something else - call it with value"
  1432 	 * arg is something else - call it with value"
  1433 	 */
  1433 	 */
  1434 	do {
  1434 	do {
  1435 	    if (InterruptPending != nil) __interrupt__(CONARG);
  1435 	    if (InterruptPending != nil) __interrupt__(CONARG);
  1436 
  1436 
  1437 	    (*blockVal.ilc_func)(aBlock, @symbol(value), CON_COMMA nil, &blockVal);
  1437 	    (*blockVal.ilc_func)(aBlock, @symbol(value), nil, &blockVal);
  1438 	} while(--tmp);
  1438 	} while(--tmp);
  1439     }
  1439     }
  1440 #undef INTERPRET
  1440 #undef INTERPRET
  1441 #undef HOME
  1441 #undef HOME
  1442 %}
  1442 %}
  1470 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
  1470 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
  1471 #ifdef NEW_BLOCK_CALL
  1471 #ifdef NEW_BLOCK_CALL
  1472 	    if (step < 0) {
  1472 	    if (step < 0) {
  1473 		while (tmp >= final) {
  1473 		while (tmp >= final) {
  1474 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1474 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1475 		    (*code)(aBlock, CON_COMMA __MKSMALLINT(tmp));
  1475 		    (*code)(aBlock, __MKSMALLINT(tmp));
  1476 		    tmp += step;
  1476 		    tmp += step;
  1477 		}
  1477 		}
  1478 	    } else {
  1478 	    } else {
  1479 		while (tmp <= final) {
  1479 		while (tmp <= final) {
  1480 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1480 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1481 		    (*code)(aBlock, CON_COMMA __MKSMALLINT(tmp));
  1481 		    (*code)(aBlock, __MKSMALLINT(tmp));
  1482 		    tmp += step;
  1482 		    tmp += step;
  1483 		}
  1483 		}
  1484 	    }
  1484 	    }
  1485 #else
  1485 #else
  1486 	    /*
  1486 	    /*
  1494 		    /*
  1494 		    /*
  1495 		     * home is on stack - will not move
  1495 		     * home is on stack - will not move
  1496 		     */
  1496 		     */
  1497 		    while (tmp >= final) {
  1497 		    while (tmp >= final) {
  1498 			if (InterruptPending != nil) __interrupt__(CONARG);
  1498 			if (InterruptPending != nil) __interrupt__(CONARG);
  1499 			(*code)(rHome, CON_COMMA __MKSMALLINT(tmp));
  1499 			(*code)(rHome, __MKSMALLINT(tmp));
  1500 			tmp += step;
  1500 			tmp += step;
  1501 		    }
  1501 		    }
  1502 		} else {
  1502 		} else {
  1503 		    while (tmp >= final) {
  1503 		    while (tmp >= final) {
  1504 			if (InterruptPending != nil) __interrupt__(CONARG);
  1504 			if (InterruptPending != nil) __interrupt__(CONARG);
  1505 			(*code)(home, CON_COMMA __MKSMALLINT(tmp));
  1505 			(*code)(home, __MKSMALLINT(tmp));
  1506 			tmp += step;
  1506 			tmp += step;
  1507 		    }
  1507 		    }
  1508 		}
  1508 		}
  1509 	    } else {
  1509 	    } else {
  1510 		if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
  1510 		if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
  1511 		    /*
  1511 		    /*
  1512 		     * home is on stack - will not move
  1512 		     * home is on stack - will not move
  1513 		     */
  1513 		     */
  1514 		    while (tmp <= final) {
  1514 		    while (tmp <= final) {
  1515 			if (InterruptPending != nil) __interrupt__(CONARG);
  1515 			if (InterruptPending != nil) __interrupt__(CONARG);
  1516 			(*code)(rHome, CON_COMMA __MKSMALLINT(tmp));
  1516 			(*code)(rHome, __MKSMALLINT(tmp));
  1517 			tmp += step;
  1517 			tmp += step;
  1518 		    }
  1518 		    }
  1519 		} else {
  1519 		} else {
  1520 		    while (tmp <= final) {
  1520 		    while (tmp <= final) {
  1521 			if (InterruptPending != nil) __interrupt__(CONARG);
  1521 			if (InterruptPending != nil) __interrupt__(CONARG);
  1522 			(*code)(home, CON_COMMA __MKSMALLINT(tmp));
  1522 			(*code)(home, __MKSMALLINT(tmp));
  1523 			tmp += step;
  1523 			tmp += step;
  1524 		    }
  1524 		    }
  1525 		}
  1525 		}
  1526 	    }
  1526 	    }
  1527 #endif
  1527 #endif
  1533 		while (tmp >= final) {
  1533 		while (tmp >= final) {
  1534 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1534 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1535 
  1535 
  1536 		    (*blockVal.ilc_func)(aBlock, 
  1536 		    (*blockVal.ilc_func)(aBlock, 
  1537 					 @symbol(value:), 
  1537 					 @symbol(value:), 
  1538 					 CON_COMMA nil, &blockVal,
  1538 					 nil, &blockVal,
  1539 					 __MKSMALLINT(tmp));
  1539 					 __MKSMALLINT(tmp));
  1540 		    tmp += step;
  1540 		    tmp += step;
  1541 		}
  1541 		}
  1542 	    } else {
  1542 	    } else {
  1543 		while (tmp <= final) {
  1543 		while (tmp <= final) {
  1544 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1544 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1545 
  1545 
  1546 		    (*blockVal.ilc_func)(aBlock, 
  1546 		    (*blockVal.ilc_func)(aBlock, 
  1547 					 @symbol(value:), 
  1547 					 @symbol(value:), 
  1548 					 CON_COMMA nil, &blockVal,
  1548 					 nil, &blockVal,
  1549 					 __MKSMALLINT(tmp));
  1549 					 __MKSMALLINT(tmp));
  1550 		    tmp += step;
  1550 		    tmp += step;
  1551 		}
  1551 		}
  1552 	    }
  1552 	    }
  1553 	}
  1553 	}
  1581 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
  1581 	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
  1582 	    if ((code = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
  1582 	    if ((code = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
  1583 #ifdef NEW_BLOCK_CALL
  1583 #ifdef NEW_BLOCK_CALL
  1584 		while (tmp <= final) {
  1584 		while (tmp <= final) {
  1585 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1585 		    if (InterruptPending != nil) __interrupt__(CONARG);
  1586 		    (*code)(aBlock, CON_COMMA __MKSMALLINT(tmp));
  1586 		    (*code)(aBlock, __MKSMALLINT(tmp));
  1587 		    tmp++;
  1587 		    tmp++;
  1588 		}
  1588 		}
  1589 #else /* old BLOCK_CALL */
  1589 #else /* old BLOCK_CALL */
  1590 		/*
  1590 		/*
  1591 		 * arg is a compiled block - 
  1591 		 * arg is a compiled block - 
  1603 			int t4;
  1603 			int t4;
  1604 
  1604 
  1605 			while ((t4 = tmp+4) < final) {
  1605 			while ((t4 = tmp+4) < final) {
  1606 			    OBJ idx = __MKSMALLINT(tmp);
  1606 			    OBJ idx = __MKSMALLINT(tmp);
  1607 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1607 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1608 			    (*code)(rHome, CON_COMMA idx);
  1608 			    (*code)(rHome, idx);
  1609 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1609 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1610 			    (*code)(rHome, CON_COMMA _ADD_INT(idx, 1));
  1610 			    (*code)(rHome, _ADD_INT(idx, 1));
  1611 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1611 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1612 			    (*code)(rHome, CON_COMMA _ADD_INT(idx,2));
  1612 			    (*code)(rHome, _ADD_INT(idx,2));
  1613 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1613 			    if (InterruptPending != nil) __interrupt__(CONARG);
  1614 			    (*code)(rHome, CON_COMMA _ADD_INT(idx,3));
  1614 			    (*code)(rHome, _ADD_INT(idx,3));
  1615 			    tmp = t4;
  1615 			    tmp = t4;
  1616 			}
  1616 			}
  1617 		    }
  1617 		    }
  1618 # endif
  1618 # endif
  1619 		    while (tmp <= final) {
  1619 		    while (tmp <= final) {
  1620 			if (InterruptPending != nil) __interrupt__(CONARG);
  1620 			if (InterruptPending != nil) __interrupt__(CONARG);
  1621 			(*code)(rHome, CON_COMMA __MKSMALLINT(tmp));
  1621 			(*code)(rHome, __MKSMALLINT(tmp));
  1622 			tmp++;
  1622 			tmp++;
  1623 		    }
  1623 		    }
  1624 		} else {
  1624 		} else {
  1625 		    home = rHome;
  1625 		    home = rHome;
  1626 		    while (tmp <= final) {
  1626 		    while (tmp <= final) {
  1627 			if (InterruptPending != nil) __interrupt__(CONARG);
  1627 			if (InterruptPending != nil) __interrupt__(CONARG);
  1628 			(*code)(home, CON_COMMA __MKSMALLINT(tmp));
  1628 			(*code)(home, __MKSMALLINT(tmp));
  1629 			tmp++;
  1629 			tmp++;
  1630 		    }
  1630 		    }
  1631 		}
  1631 		}
  1632 		RETURN (self);
  1632 		RETURN (self);
  1633 #endif /* NEW_BLOCK_CALL */
  1633 #endif /* NEW_BLOCK_CALL */
  1672 	while (tmp <= final) {
  1672 	while (tmp <= final) {
  1673 	    if (InterruptPending != nil) __interrupt__(CONARG);
  1673 	    if (InterruptPending != nil) __interrupt__(CONARG);
  1674 
  1674 
  1675 	    (*blockVal.ilc_func)(aBlock, 
  1675 	    (*blockVal.ilc_func)(aBlock, 
  1676 				     @symbol(value:), 
  1676 				     @symbol(value:), 
  1677 				     CON_COMMA nil, &blockVal, 
  1677 				     nil, &blockVal, 
  1678 				     __MKSMALLINT(tmp));
  1678 				     __MKSMALLINT(tmp));
  1679 	    tmp++;
  1679 	    tmp++;
  1680 	}
  1680 	}
  1681 	RETURN ( self );
  1681 	RETURN ( self );
  1682     }
  1682     }
  2094 ! !
  2094 ! !
  2095 
  2095 
  2096 !SmallInteger  class methodsFor:'documentation'!
  2096 !SmallInteger  class methodsFor:'documentation'!
  2097 
  2097 
  2098 version
  2098 version
  2099     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.55 1996-09-22 13:01:43 cg Exp $'
  2099     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.56 1996-10-02 11:33:54 cg Exp $'
  2100 ! !
  2100 ! !