Commit Graph

608 Commits

Author SHA1 Message Date
Joel Dice
fd778c2c76 remove redundant interfaces and generalize shift/reset generics
Turns out Function can do the jobs of both CallbackReceiver and
FunctionReceiver, so I've removed the latter two.

Also, shift and reset should work with a combination of types, not
just a single type, so I've expanded their generic signatures.
2014-03-21 07:38:29 -06:00
Joshua Warner
56ec7fc1f9 Merge pull request #200 from dicej/stack-signal
fix a few stack walking and signal handling bugs
2014-03-14 10:45:18 -06:00
Joel Dice
73e60adeab always add a trap instruction after a throw
Tail call and dead code optimizations can cause code after a throw to
be eliminated, which confuses findUnwindTarget because it doesn't know
what code is throwing the exception.  So we need at least one
instruction to follow the call to the throw_ thunk.  Previously, we
only added such an instruction when we knew the throw was the last
instruction in the bytecode, but it turns out there are other cases
where it is needed, including certain try/finally situations.
2014-03-14 09:54:05 -06:00
Joshua Warner
7fa8c7ec20 remove unused constants (fixes #198) 2014-03-14 09:06:19 -06:00
Joel Dice
1cd822b23e Merge pull request #180 from joshuawarner32/move-allocator
Move allocator & Slice into util
2014-02-27 08:55:24 -07:00
Joshua Warner
e6eead07fa call vm::dynamicCall directly, instead of through System 2014-02-26 15:10:41 -07:00
Joshua Warner
a807966143 use Slice<uint8_t> in FixedAllocator 2014-02-25 20:34:03 -07:00
Joshua Warner
b083f3df04 move fixed allocator out of machine.h 2014-02-25 20:34:03 -07:00
Joshua Warner
bc9f7d2f87 refactor SignalRegistrar interface 2014-02-21 23:37:32 -07:00
Joshua Warner
730dade53e break out signal handling from System 2014-02-21 23:36:40 -07:00
Joshua Warner
5ffdfecdc2 remove vm from code paths, to match namespacing 2014-02-21 13:32:28 -07:00
Joel Dice
1735a7976a do not omit calls to empty methods which may trigger class initialization
There's a small optimization in compileDirectInvoke which tries to
avoid generating calls to empty methods.  However, this causes
problems for code which uses such a call to ensure a class is
initialized -- if we omit that call, the class may not be
initialized and any side effects of that initialization may not
happen when the program expects them to.

This commit ensures that the compiler only omits empty method calls
when the target class does not need initialization.  It also removes
commented-out code in classpath-openjdk.cpp which was responsible for
loading libmawt proactively; that was a hack to get JogAmp to work
before we understood what the real problem was.
2014-02-10 08:40:14 -07:00
Joshua Warner
233a12bf2b remove unnecessary variable initialization 2014-01-03 14:04:57 -07:00
Joshua Warner
6d5f511d04 fix silly error in recent compiler refactor 2014-01-03 12:23:36 -07:00
Joel Dice
e19bdda13e fix uninitialized value warning in compile.cpp
Clang was complaining that newIp might be used uninitialized at the
bottom of our giant, unstructured compile loop, so I initialized it
with a bogus value, which means it will at least fail consistently if
Clang is right and there really is a path by which that code is
reached without otherwise initializing newIp.
2014-01-02 17:44:33 -07:00
Joshua Warner
fa65c67fbf Extract independent runtime thunks into their own file 2013-12-18 22:46:58 -07:00
Joshua Warner
f1c6b97373 Reformat a few extra-long lines 2013-12-18 22:25:23 -07:00
Joshua Warner
b3d6f5d94d Remove redundancy in compiling jump operations 2013-12-18 22:20:18 -07:00
Joshua Warner
ac984775a5 Remove redundancy in compiling arithmetic operations 2013-12-18 22:03:42 -07:00
Joshua Warner
eab36b3a23 Remove boilerplate code (nullaryOp methods in Compiler) 2013-12-18 16:51:20 -07:00
Joshua Warner
bd7b66a898 Remove boilerplate code (unaryOp methods in Compiler) 2013-12-18 16:43:15 -07:00
Joshua Warner
07d0f1172f Remove boilerplate code (float binaryOp methods in Compiler) 2013-12-18 15:22:38 -07:00
Joshua Warner
d5c1a094ca Remove boilerplate code (general binaryOp methods in Compiler) 2013-12-18 15:11:30 -07:00
Joshua Warner
b66a8549fd Remove boilerplate code (jump* methods in Compiler) 2013-12-18 14:38:05 -07:00
Joshua Warner
0340be23ce make sure a busy-waiting loop can't block the GC (and hence the whole VM) 2013-12-13 10:39:36 -07:00
Joshua Warner
06432253ba consolidate many implicit list types into one 2013-12-11 10:54:50 -07:00
Geoff Nixon
69ea1f5721 Bugfixes for Mac OS X, etc. 2013-10-31 01:35:56 -07:00
Joel Dice
87b02eb949 update copyright years
Previously, I used a shell script to extract modification date ranges
from the Git history, but that was complicated and unreliable, so now
every file just gets the same year range in its copyright header.  If
someone needs to know when a specific file was modified and by whom,
they can look at the Git history themselves; no need to include it
redundantly in the header.
2013-07-02 20:52:38 -06:00
Joel Dice
84e23659f9 remove unecessary PROTECT statements
Since there's no possibility of garbage collection during the
lifetimes of these local variables, there's no need to protect the
references.
2013-05-14 14:33:37 -06:00
Simon Ochsenreither
e088fa07ae Make exception messages match the ones from OpenJDK/Android
This commit changes the exception message format of
ClassCastException and CloneNotSupportedException.
2013-05-14 15:04:34 +02:00
Joel Dice
fcfdd6be3a initialize the class if necessary when the "new" operator is invoked
This is one of the conditions specified in
http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.1,
which I had forgotten about.
2013-05-13 13:12:58 -06:00
Joel Dice
bbc5d7fb50 only initialize class when necessary to avoid deadlock
Previously, we would attempt to initialize a class (e.g. call its
static initializer) whenever a method in that class was called, as
well as in any of the cases listed in
http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.

However, the above approach may lead to deadlock in an app which
relies on being able to call non-static methods in parallel with a
static initializer invocation in the same class.  Thus, this commit
ensures that we initialize classes only in the cases defined by the
standard.
2013-04-30 22:48:43 -06:00
Joel Dice
023787d121 fix special case of exception handler table translation
scalac may generate bytecode such that an exception is thrown within
the bounds of a handler for that exception such that the throw is the
last instruction in the method, which we weren't handling properly.
2013-04-22 21:25:15 -06:00
Joel Dice
49d8ccb1bd update Context::executableSize after allocating objectPool
This ensures that, if an exception is thrown later but before the
method has been fully compiled, we will know exactly how much memory
to free.  Previously, we would abort when trying to free the wrong
amount due to an assertion failure.
2013-04-09 18:43:46 -06:00
Joel Dice
b436bd460a fix NaN handling in floating point comparisons 2013-04-03 16:19:33 -06:00
Joel Dice
cc8d655762 use %x,%x format for listing start and end addresses
This matches the format expected by recent versions of GDB's
disassemble command.
2013-04-03 16:07:06 -06:00
Joel Dice
ca84dd26f1 fix System.loadLibrary for OpenJDK tails=true build 2013-03-05 15:43:49 -07:00
Joshua Warner
9327043bc5 Merge branch 'master' into wip
Conflicts:
	makefile
	src/codegen/arm/assembler.cpp
	src/codegen/powerpc/assembler.cpp
	src/codegen/x86/assembler.cpp
2013-02-27 19:27:07 -07:00
Joel Dice
5e2d00010b move headers from src to src/avian
This is necessary to avoid name conflicts on various platforms.  For
example, iOS has its own util.h, and Windows has a process.h.  By
including our version as e.g. "avian/util.h", we avoid confusion with
the system version.
2013-02-27 13:33:29 -07:00
Joshua Warner
4c8b593539 break Architecture out of Assembler 2013-02-23 23:03:01 -07:00
Joshua Warner
b9e281612b move runtime-array to include 2013-02-19 22:56:05 -07:00
Joshua Warner
987af120d8 move codegen headers to include/ 2013-02-19 22:21:22 -07:00
Joshua Warner
d7f088c9e7 adjust package structure in codegen (vm -> avian::codegen and avian::codegen::lir)
The eventual intent with the lir namespace is to formalize some of
the important bits of Assembler interface, to be tested, debug-printed,
and potentially, serialized.

Also, group arguments to apply(...) in OperandInfos
2013-02-12 17:47:57 -07:00
Joshua Warner
3589d5c205 Merge branch 'master' of git://github.com/ReadyTalk/avian
Conflicts:
	src/codegen/arm/assembler.cpp
	src/common.h
	src/machine.cpp
2013-02-12 17:37:19 -07:00
Joshua Warner
f7b49ddb06 allow codegen targets (Architectures and Assemblers) to co-exist
The primary motivation behind this is to allow all the different Assemblers
to be built at once, on a single machine. This should dramatically reduce
the time required to make sure that a particular change doesn't break
the build for one of the not-so-common architectures (arm, powerpc)

Simply pass "codegen-targets=all" to make to compile all
src/codegen/<arch>/assembler.cpp.

Note that while these architectures are built, they will not be fully-
functional.  Certain stuff is assumed to be the same across the entire
build (such as TargetBytesPerWord), but this isn't the case anymore.
2013-02-12 17:16:40 -07:00
Joshua Warner
68776e5d73 move all codegen source in to codegen/ dir 2013-02-10 18:55:38 -07:00
Joshua Warner
964d054117 move RUNTIME_ARRAY into it's own header 2013-02-10 18:07:11 -07:00
Joshua Warner
5dd770d7ea rename cast -> fieldAtOffset 2013-02-10 18:07:03 -07:00
Joshua Warner
d26d8fdb9f rename ceiling -> ceilingDivide 2013-02-10 18:06:15 -07:00
Alexey Pelykh
4228f69a0d Additional AOT_ONLY ifdef 2013-02-09 09:42:26 +02:00