ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Среда
27 ноября
139434 Топик полностью
yes (20.11.2008 17:01, просмотров: 68) ответил Evgeny_CD на ->
кстати - еще одна извращенческая фичя поддерживаемая спарк-ом и достаточно интересная (связанная с невыравнеееыми данными) - Tagged Arithmetic но бессмысленная С-компилер не пользует, а куда прмменить ее сам я не придумал The tagged add/subtract instructions assume tagged-format data, in which a tag occupies the two low-order bits of each operand. If either of the two operands has a nonzero tag, or if arithmetic overflow occurs, the operation sets the PSR’s overflow bit. Some variants of the tagged arithmetic instructions cause a tag_overflow exception instead of setting the overflow bit. Tagged arithmetic operations are used regularly in languages with dynamically typed data, such as Lisp and Smalltalk. One possible model for tagging is to use a tag value of 0 for integers, and a tag value of 3 for pointers to pairs of words (that is, list cells). Using this model, suppose that p is a tagged pointer to a list cell (that is, p has “3” in its low-order two bits). Since load/store instructions execute successfully only with properly aligned addresses, if p is a list cell with a tag of “3” (a pointer), a load/store word instruction with an address specifier of “p-3” or “p+1” will succeed, accessing the first or second word (respectively) of the list cell. If p is not a pointer (that is, contains a tag other than 3), such a load/store will cause a mem_address_not_aligned trap. This scheme can be used to test for unexpected data types. The non-trapping versions of the tagged arithmetic instructions typically incur the overhead of a following “branch on overflow” instruction, plus execution of code to deal with the overflow when the overflow condition occurs. The trapping versions incur no per-instruction overhead, but have the overhead of a tag_overflow trap when overflow occurs. So, the choice of whether to use the trapping or non-trapping versions of the tagged arithmetic instructions depends on two factors: