www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/10/05:03:07

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU
Date: Mon, 10 Jul 1995 09:51:57 BST
Subject: Passing class/struct/&similar values in registers

  (1) I have a program that has a `class vector{double X,Y,Z; ...};', i.e. a
`vector' value is 12 bytes long. When I altered the program to pass `vector'
type values in an assignment (x=y) and as the value of an operator function,
the program had unexplained out-of-bounds type run-time fails that stopped
when I put it back to keeping all `vector' values in known places and only
passing their addresses. Has anyone else had unexpected fails in recent
versions of djgpp from passing class values that can't go in registers?
  (2) You say that class/struct/etc values can only be passed in registers if
they are 1 or 2 or 4 or 8 bytes long. Why? Surely also 3 or 5 or 6 byte values
can be passed in two registers? (e.g. 3 as AL BX, 5 as AL EBX, 6 as AX EBX).
  It should also be possible to pass a 7-byte value in 2 registers: if its 7
bytes are t u v w x y z:-
    read  e.g. EAX = t u v w; EBX = w x y z;
    write e.g. w x y z = EBX; t u v w = EAX;
  (3) Is there any reason not to have an option where 3 registers can be used
to pass a value in? This would allow any size up to 12 bytes (including e.g. a
set of 3 coordinates, e.g. my `class vector' above) to be passed in registers
and thus (a) quicker, (b) without the bug that I met in (1) above. e.g. (9
bytes as EAX EBX CL, 10 bytes as EAX EBX CX, 11 or 12 bytes as EAX EBX ECX
(with 11 bytes, overlapping as for 7 bytes hereinabove).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019