Commit Graph

404 Commits

Author SHA1 Message Date
Joel Dice
5e740170f2 initial sketch of tail call optimization (non-virtual calls only, so far) 2009-03-31 14:15:08 -06:00
Joel Dice
c9400316fd try harder to find a suitable stack frame site in pickTarget when there are no free registers left 2009-03-16 20:03:59 -06:00
Joel Dice
f5c79355f2 set StealRegisterReserveCount to 2 to avoid running out of registers in when shuffling values around on the stack 2009-03-16 18:00:51 -06:00
Joel Dice
d1018bf078 update copyright years 2009-03-15 12:02:36 -06:00
Joel Dice
073b829c79 avoid running out of eligable source registers for writing a single byte to memory on x86 2009-03-14 16:47:26 -06:00
Joel Dice
8d9409112c reuse source site as destination site if appropriate in getTarget 2009-03-14 14:17:32 -06:00
Joel Dice
ee2d105f6c freeze move operand sites prior to calling the assembler so the assembler won't steal them 2009-03-13 20:55:41 -06:00
Joel Dice
4c27755a53 fix endianness issue storing and loading longs 2009-03-11 21:07:30 -06:00
Joel Dice
49cd2dd9bf fix powerpc bootimage build (second try) 2009-03-10 19:08:16 -06:00
Joel Dice
c11203b401 pass srcSelectSize instead of srcSize to Architecture::plan in appendMove 2009-03-09 12:31:41 -06:00
Joel Dice
e1395f300a fix warnings for optimized build 2009-03-07 17:52:18 -07:00
Joel Dice
14c6deb710 do two passes in MyCompiler::initLocalsFromLogicalIp in order to properly link multiword values together 2009-03-07 17:39:55 -07:00
Joel Dice
7add34944b protect source site from being used as a temporary for move operations 2009-03-07 16:32:05 -07:00
Joel Dice
fd7bef7db3 only accept sites conforming to specified SiteMask in getTarget 2009-03-06 17:37:54 -07:00
Joel Dice
e61d05f00b undo temporary big endian offset correction before leaving maybeMove 2009-03-06 12:14:37 -07:00
Joel Dice
7388da6282 fix endianness issues when loading values smaller than BytesPerWord from the stack 2009-03-06 10:56:11 -07:00
Joel Dice
762df17aa7 use Architecture::plan in BranchEvent ctor to determine acceptable types for address 2009-03-05 20:27:59 -07:00
Joel Dice
8cc1f6def8 remove dead code from MyCompiler::call 2009-03-04 17:52:55 -07:00
Joel Dice
2ca8132d97 implement support for volatile fields 2009-03-02 20:18:15 -07:00
Joel Dice
6eacf7b804 fix bounds checks in MyCompiler::initLocalsFromLogicalIp 2009-03-01 22:47:07 +00:00
Joel Dice
97961ecdde pick a temporary register which is valid as both a destination and a source for the required moves in maybeMove 2009-03-01 15:41:03 -07:00
Joel Dice
97e698d806 fix MyCompiler::peak for big-endian architectures 2009-03-01 12:36:30 -07:00
Joel Dice
696282631a fix endianness issues with 64-bit locals 2009-03-01 12:28:17 -07:00
Joel Dice
93ebb571b3 only add site to result if result is live in CombineEvent::compile and TranslateEvent::compile 2009-02-28 19:08:14 -07:00
Joel Dice
d6bd2e7308 make Compiler::store take both a source size and a destination size to avoid endianness issues; change order of Compiler::load parameters to match 2009-02-28 16:17:24 -07:00
Joel Dice
3e6c30a4b5 always return an 8-byte value (or void) from native functions called from Java
This is important on the 32-bit OS X PowerPC ABI, since the location
of the low 32-bits of a return value change depending on whether the
entire value is 64-bits or not.
2009-02-28 14:20:43 -07:00
Joel Dice
c5dd97ffea ensure that we release temporaries back to the compiler in powerpc.cpp; allow the first operand of a comparison to be a constant 2009-02-28 13:41:37 -07:00
Joel Dice
73aa499371 clean up offsetToFrameIndex code 2009-02-26 18:53:35 -07:00
Joel Dice
d7d3dd5055 various bugfixes, especially concerning frame allocation and offset calculation 2009-02-25 20:49:42 -07:00
Joel Dice
2554673dda call c->arch->plan in CallEvent ctor to ensure the address operand is placed into the proper operand type for the call instruction 2009-02-25 18:11:41 -07:00
Joel Dice
324caaf98b add size parameter to Assembler::returnLow since the register used depends on the return value size on PowerPC 2009-02-17 18:19:31 -07:00
Joel Dice
cea5a9315d fix block delimiting code in compile.cpp to avoid cycles and nested blocks 2009-02-15 11:11:00 -07:00
Joel Dice
7803663fc9 fix block delimiting code in compiler.cpp to minimize the number of blocks needed
This exposed bugs in x86.cpp concerning alignment padding which are now
fixed.
2009-02-14 17:52:44 -07:00
Joel Dice
f58f7b3bdf fix bugs pertaining to tracking reads and and value sites across subroutines (jsr and ret instructions) 2009-02-14 13:26:39 -07:00
Joel Dice
9b0d6854ec fix merge conflicts 2009-02-09 16:22:51 -07:00
Joel Dice
a1ec71423e Merge branch 'master' into powerpc
Conflicts:

	makefile
	src/assembler.h
	src/binaryToMacho.cpp
	src/compile.cpp
	src/compiler.cpp
	src/x86.cpp
2009-02-09 16:22:01 -07:00
Joel Dice
a1fc8a4dac add site to result in MemoryEvent::compile regardless of whether the result is live, since the memory location may be used as the target of a move and we need to keep the reference count of the base and index registers nonzero 2009-02-08 19:08:56 -07:00
Joel Dice
29616c4abc freeze target site when using temporary in maybeMove 2009-02-08 18:58:33 -07:00
Joel Dice
4ca45ffa41 fix two bugs concerning tracking available registers and reserving them when necessary 2009-02-08 16:20:28 -07:00
Joel Dice
0fbe89c147 set Value::high when appropriate in MyCompiler::initLocalsFromLogicalIp 2009-02-08 15:13:49 -07:00
Joel Dice
175ec1ff48 remove debug logging 2009-02-08 13:22:28 -07:00
Joel Dice
5066bfdabf tweak register and frame site allocation code to avoid failure in corner cases 2009-02-08 13:21:35 -07:00
Joel Dice
55d2ee1823 avoid clobbering values in sign-extension case of MoveEvent.compile 2009-02-02 19:13:02 -07:00
Joel Dice
123e22322c turn off debug logging 2009-02-01 16:21:55 -07:00
Joel Dice
2e3fd111d4 fix regressions on x86_64 2009-02-01 16:19:11 -07:00
Joel Dice
8b1801c465 various bugfixes involving multiword values 2009-02-01 16:10:56 -07:00
Joel Dice
11408dc2cd fix popIndex calculation in CallEvent ctor 2009-01-31 12:35:45 -07:00
Joel Dice
8b6319fbc8 assume stack grows towards negative addresses when loading and storing multiword locals 2009-01-31 12:05:06 -07:00
Joel Dice
a11d018dc2 fix assertion in MyCompiler::peek 2009-01-29 18:43:46 -07:00
Joel Dice
1c3504b62a fix various stack bugs 2009-01-29 18:36:19 -07:00
Joel Dice
565ece136b begin refactoring compiler.cpp to treat each word of a multiword value seperately 2009-01-25 15:03:38 -07:00
Joel Dice
034444db57 fix a couple of bugs handling multi-word values 2009-01-12 09:26:43 -07:00
Joel Dice
582e975a8a remove temporary debug code 2009-01-11 16:46:36 -07:00
Joel Dice
85ac9b9c71 revert overflow code in sitesToString since we now prune dead buddies from values 2009-01-11 16:46:22 -07:00
Joel Dice
05bd86e2ed use upper 32 bits of mask in pickRegisterTarget when picking register for high word; set Target::Impossible to 5 since 4 is a valid cost 2009-01-11 16:42:41 -07:00
Joel Dice
04bc58fd95 reorder code in MemorySite::release so we can use low->size before it is overwritten 2009-01-11 16:24:25 -07:00
Joel Dice
5a76277b84 remove dead buddies from values so they don't accumulate without bound; when resolving sites, avoid picking those which belong to other values; various bugfixes 2009-01-11 15:53:51 -07:00
Joel Dice
e3976e66d3 avoid using all registers when marshalling sites, since we need at least one register free for memory-to-memory moves; various bugfixes 2009-01-11 11:48:02 -07:00
Joel Dice
8459489212 avoid overflow in sitesToString 2009-01-04 15:58:05 -07:00
Joel Dice
c56f37197c marshal values at branches to avoid duplication of effort at junctions 2009-01-04 14:52:46 -07:00
Joel Dice
f4689093ee try harder to find an acceptable source site in resolveSourceJunctionSites 2009-01-04 13:35:09 -07:00
Joel Dice
ce1e161f52 allocate larger buffer for sitesToString 2009-01-04 12:38:31 -07:00
Joel Dice
095e6d7bc3 prefer unowned resources in resourceCost 2009-01-04 12:34:38 -07:00
Joel Dice
ded2ffe437 more compile.cpp refactoring 2009-01-03 18:17:51 -07:00
Joel Dice
ae24a6c18e continue refactoring compiler.cpp to simplify register and frame resource allocation 2009-01-03 14:34:45 -07:00
Joel Dice
7b546936d6 snapshot 2009-01-02 17:44:47 -07:00
Joel Dice
c678fb30a4 snapshot 2008-12-24 13:35:43 -07:00
Joel Dice
f96ee3ea73 handle p->value->reads == 0 case in visit 2008-12-22 18:25:00 -07:00
Joel Dice
897586aa76 clobber overlapping locals in storeLocal; move fallback code in trySteal to increase its applicability 2008-12-22 17:55:29 -07:00
Joel Dice
ac37941fa5 fix build error in previous commit 2008-12-21 18:14:24 -07:00
Joel Dice
c9bec0ce96 only steal sites recursively when all else fails in trySteal 2008-12-21 18:14:20 -07:00
Joel Dice
c78e76c747 temporarily reacquire source in releaseRegister
This avoids a SEGV when freezing the register.
2008-12-21 14:48:26 -07:00
Joel Dice
055ec4dd9f various fixes and cleanups concerning 64-bit values on 32-bit systems 2008-12-21 14:41:56 -07:00
Joel Dice
b23f7374e9 don't steal sites in pickJunctionSite 2008-12-20 17:45:52 -07:00
Joel Dice
b9b7ae4003 avoid clobbering first operand in CombineEvent.compile 2008-12-20 16:05:01 -07:00
Joel Dice
cf4e8e7ec2 various fixes for marshalling values among registers and frame sites 2008-12-20 14:55:45 -07:00
Joel Dice
75b3bf98ab pick only unfrozen frame sites in save 2008-12-20 11:13:58 -07:00
Joel Dice
a40ae85588 clear sites from dead value in removeBuddy 2008-12-15 18:21:01 -07:00
Joel Dice
8819d01522 only set Context::forfeitedSite if value is live 2008-12-15 17:42:32 -07:00
Joel Dice
39358e6652 update junction read based on liveness of local value on first visit to junction, not stub read value 2008-12-15 07:35:19 -07:00
Joel Dice
7f4bd51464 don't use trySteal when moving sites between buddies 2008-12-13 13:54:26 -07:00
Joel Dice
4717e94fa3 remove value buddies after setting sites to junction sites, not after populating junction sites
This mirrors how snapshots are captured and restored for branch events.
Also, switch back to resolving junction sites before capturing fork
snapshots so we capture the true state of each value immediately before
the branch.
2008-12-13 12:59:02 -07:00
Joel Dice
d50febe088 various control-flow related bugfixes 2008-12-11 18:09:36 -07:00
Joel Dice
d4363d250a mark and fix up absolute addresses in boot image code 2008-12-02 09:45:20 -07:00
Joel Dice
264779ed2a copy site if necessary to avoid chaining to another site in resolveJunctionSite 2008-11-25 19:23:47 -07:00
Joel Dice
58a9718d82 clean stack sites more aggressively after function calls to avoid GC bugs 2008-11-25 16:00:40 -07:00
Joel Dice
eea2225176 save locals to memory before executing any instruction which might trigger an exception if that instruction lies within an exception handler 2008-11-25 10:34:48 -07:00
Joel Dice
3d9e508e3e fix regression in last commit 2008-11-17 08:44:35 -07:00
Joel Dice
9aee242408 Merge branch 'powerpc' of oss:/var/local/git/avian into powerpc
Conflicts:

	src/compiler.cpp
2008-11-17 08:22:07 -07:00
Joel Dice
7ea5a4a64f avoid inifinite recursion in trySteal 2008-11-17 08:20:48 -07:00
Joel Dice
92a8a4d83b clean up subroutine code in wake of merge from master branch 2008-11-15 18:03:43 -07:00
Joel Dice
fb770d10fb implement jsr/ret support
The Subroutine test won't pass due to a bug in the stack mapping code
such that objects may be missed during GC.
2008-11-13 17:59:21 -07:00
Joel Dice
fae0ccfe96 fix unused parameter warnings 2008-11-11 18:09:45 -07:00
Joel Dice
6f5613ebd9 minor code cleanup in MoveEvent::compile 2008-11-11 17:48:21 -07:00
Joel Dice
191bfb6141 fix 4-to-8 byte sign extensions for ia32 and clean up MoveEvent; all tests now pass on ia32 2008-11-11 17:39:26 -07:00
Joel Dice
671fd1c0f9 set popIndex for stack arguments in CallEvent constructor 2008-11-11 11:56:23 -07:00
Joel Dice
c80eb51c17 Merge branch 'master' into powerpc
Conflicts:

	makefile
	src/assembler.h
	src/compile.cpp
	src/compiler.cpp
	src/compiler.h
	src/finder.cpp
2008-11-11 08:21:48 -07:00
Joel Dice
2304a656cf in releaseRegister, if the register is not the exclusive site of a value, steal it 2008-11-10 21:25:36 -07:00
Joel Dice
96a7c71c30 fix loading 8-byte values on 32-bit systems 2008-11-10 19:12:36 -07:00
Joel Dice
5fc9ad058b more bugfixes; all tests pass on amd64 2008-11-10 17:07:44 -07:00
Joel Dice
00d8142de9 various bugfixes; all but one test are passing on amd64 2008-11-09 16:56:37 -07:00
Joel Dice
000aeb25c1 handle case where first instruction is the target of a branch properly 2008-11-08 16:21:30 -07:00
Joel Dice
decd24965a implement multiplyCR and divideCR 2008-11-08 15:42:26 -07:00
Joel Dice
61539bae31 fix stack mapping bugs which broke GC 2008-11-08 15:36:38 -07:00
Joel Dice
312539af64 fix moves involving sign or zero extension 2008-11-08 13:47:26 -07:00
Joel Dice
f01f4441d9 various bugfixes and instructions implemented to get more tests passing 2008-11-06 17:39:38 -07:00
Joel Dice
1ba497d90a fix Exceptions test for amd64 2008-11-02 15:25:51 -07:00
Joel Dice
04da77e95b snapshot 2008-11-02 13:35:35 -07:00
Joel Dice
3e81405a33 snapshot 2008-11-01 16:16:18 -06:00
Joel Dice
dd4dc18916 snapshot 2008-11-01 13:14:13 -06:00
Joel Dice
6f1d02dae7 remove the libstdc++ dependency once and for all
The trick is to make all destructors non-virtual.  This is safe because
we never use the delete operator, which is the only case where virtual
destructors are relevant.  This is a better solution than implementing
our own delete operator, because we want libraries loaded at runtime to
use the libstdc++ version, not ours.
2008-10-28 15:40:50 -06:00
Joel Dice
d20ee74d79 fix stack frame offset calculations for 64-bit values; insert dummy events for instructions which start with stack activity 2008-10-24 20:12:02 -06:00
Joel Dice
7d6ca28b2f snapshot 2008-10-18 18:15:57 -06:00
Joel Dice
26614e2182 use same code to spill registers and stack frame slots 2008-10-16 18:10:35 -06:00
Joel Dice
5391c68efd bugfixes 2008-10-14 18:45:31 -06:00
Joel Dice
aaaf388652 fix handling of instructions which are targets of more than one conditional branch 2008-10-13 18:18:18 -06:00
Joel Dice
3c798f5bd7 various bugfixes concerning control flow boundaries 2008-10-11 18:23:08 -06:00
Joel Dice
81cb951b08 fix stack corruption due to spurious pop events generated for jsr bytecodes 2008-10-09 17:14:52 -06:00
Joel Dice
83d5d6fde4 avoid unnecessary moves in resolveJunctionSite; distinguish between branches and other events when deciding when to marshal values at junctions 2008-10-07 18:08:13 -06:00
Joel Dice
f6c4496166 various bugfixes 2008-10-05 18:50:59 -06:00
Joel Dice
adb63778f0 fix stack and local snapshots for DummyEvents 2008-10-04 18:14:43 -06:00
Joel Dice
83aa342bc8 hello, world on amd64 2008-10-04 11:26:35 -06:00
Joel Dice
df75153a85 handle case of null Stack::pushEvent in CallEvent ctor 2008-09-30 11:22:46 -06:00
Joel Dice
d409f89d5d ensure that only one value holds a given frame site at at time 2008-09-28 15:56:12 -06:00
Joel Dice
61c708d7b2 reserve stack space for arguments to native calls 2008-09-28 13:00:52 -06:00
Joel Dice
c699725cf8 avoid running out of registers when picking junction sites 2008-09-27 16:01:39 -06:00
Joel Dice
11c2afbf91 bugfixes 2008-09-24 18:48:32 -06:00
Joel Dice
f2bf152eba more bugfixes 2008-09-23 18:01:42 -06:00
Joel Dice
d4938115ef various bugfixes 2008-09-23 15:18:41 -06:00
Joel Dice
b8dd495ada fix build 2008-09-22 08:28:18 -06:00
Joel Dice
86bec5e3b7 sketch out handling of reads at control flow blocks with multiple predecessors 2008-09-21 18:58:54 -06:00
Joel Dice
1b4ad1db42 snapshot 2008-09-20 17:42:46 -06:00
Joel Dice
606e5cb238 lots of bugfixes - finally got Simple.pow() working 2008-09-14 20:28:42 -06:00
Joel Dice
bd9e8a77e2 improved tracking of data flow across control flow boundaries 2008-09-13 15:09:26 -06:00
Joel Dice
392a1417e5 lots of bugfixes and a few instructions added 2008-09-08 18:31:19 -06:00
Joel Dice
dcdf78dc44 fix localOffset calculation 2008-09-07 20:21:11 -06:00
Joel Dice
af9758a6d3 got a simple arithmetic test working 2008-09-07 14:12:11 -06:00
Joel Dice
9971eaa92a support out-of-order compilation in x86 assembler 2008-09-06 19:37:12 -06:00
Joel Dice
ed806ca740 working towards compiling simple methods 2008-09-06 15:25:41 -06:00
Joel Dice
e13b755048 more progress towards new JIT code - this compiles but won't run properly 2008-09-05 09:00:38 -06:00
Joel Dice
5f7d68b404 snapshot 2008-08-30 14:12:27 -06:00
Joel Dice
767c3ce2e4 snapshot 2008-08-28 16:43:35 -06:00
Joel Dice
a062d8c975 progress towards refactored JIT compiler to support PowerPC and data flow analysis across control flow boundaries 2008-08-23 12:04:36 -06:00
Joel Dice
9efe6f1f05 snapshot 2008-08-16 11:45:36 -06:00
Joel Dice
29df431df5 snapshot 2008-07-23 17:58:29 -06:00
Joel Dice
f0c9deaa06 snapshot 2008-07-17 17:34:38 -06:00
Joel Dice
23043d140f snapshot 2008-07-05 14:21:13 -06:00
Joel Dice
eabb37e6eb add lcmp instruction to Compiler and corresponding LongCompare instruction to Assembler, since that's the only efficient way to implement the lcmp bytecode on x86 2008-06-12 10:56:48 -06:00
Joel Dice
94f7efc160 ignore contents of stack location in popNow if the value already resides elsewhere besides the stack 2008-06-11 08:47:06 -06:00
Joel Dice
633ef83fa1 fix handling of values which appear more than once on the stack in trySteal 2008-06-10 18:48:46 -06:00