mate.git
11 years agocodegen: handle exceptions of a method master
Bernhard Urban [Sun, 9 Sep 2012 16:03:45 +0000 (18:03 +0200)]
codegen: handle exceptions of a method

also, use bimap for mapping jpc and npc values

TODO: if no handler is found, throw it to caller method

11 years agocodegen: get full jnmap in patcher
Bernhard Urban [Sun, 9 Sep 2012 12:56:15 +0000 (14:56 +0200)]
codegen: get full jnmap in patcher

at compile-time, the java PC to native PC map is not complete yet.

11 years agocodegen: map each real PC to java bytecode PC
Bernhard Urban [Sun, 9 Sep 2012 12:46:40 +0000 (14:46 +0200)]
codegen: map each real PC to java bytecode PC

and store that information also in the global table (needed for handling a
exception at runtime)

11 years agobasicblock: store length of basiblock (i.e. bytes of instructionstream)
Bernhard Urban [Sun, 9 Sep 2012 12:24:01 +0000 (14:24 +0200)]
basicblock: store length of basiblock (i.e. bytes of instructionstream)

11 years agobasicblock: build exceptionmap
Bernhard Urban [Sun, 9 Sep 2012 12:04:26 +0000 (14:04 +0200)]
basicblock: build exceptionmap

11 years agojava/lang: env for exceptions
Bernhard Urban [Sun, 9 Sep 2012 15:07:58 +0000 (17:07 +0200)]
java/lang: env for exceptions

11 years agocodegen: simplify glue code and emit code for all basicblocks
Bernhard Urban [Sun, 9 Sep 2012 11:38:13 +0000 (13:38 +0200)]
codegen: simplify glue code and emit code for all basicblocks

hence, also blocks which are not reachable in a non-exceptional case (aka.
exception handlers)

11 years agobasicblock: handle athrow as return
Bernhard Urban [Sun, 9 Sep 2012 15:59:57 +0000 (17:59 +0200)]
basicblock: handle athrow as return

11 years agocodegen: make use of Functor instance
Bernhard Urban [Sun, 9 Sep 2012 09:59:24 +0000 (11:59 +0200)]
codegen: make use of Functor instance

11 years agobasicblock: build up CFG differently
Bernhard Urban [Wed, 5 Sep 2012 18:36:49 +0000 (20:36 +0200)]
basicblock: build up CFG differently

we already get all those entry points in the previous pass

11 years agobasicblock: rewrite buildCFG with states
Bernhard Urban [Wed, 5 Sep 2012 17:52:48 +0000 (19:52 +0200)]
basicblock: rewrite buildCFG with states

11 years agobasicblock: annotate BBs with exceptions
Bernhard Urban [Tue, 4 Sep 2012 18:59:34 +0000 (20:59 +0200)]
basicblock: annotate BBs with exceptions

11 years agobasiblock: remove `markBackwardTargets'
Bernhard Urban [Tue, 4 Sep 2012 17:18:14 +0000 (19:18 +0200)]
basiblock: remove `markBackwardTargets'

... and fold it into `calculateInstructionOffsets', using state monad power.
I added an older testcase, as it forces this situation. However, it won't fail
when removing this feature, but it would lead to code duplication on basicblock
level.

11 years agobasicblock: using arrows
Bernhard Urban [Tue, 4 Sep 2012 16:34:01 +0000 (18:34 +0200)]
basicblock: using arrows

I feel so awesome now, woooot :D

11 years agobasicblock: use state monad to save all targets from previous pass
Bernhard Urban [Sun, 2 Sep 2012 18:36:53 +0000 (20:36 +0200)]
basicblock: use state monad to save all targets from previous pass

speedup at BigInstance1: 6s -> 2s

11 years agobasicblock: use simpler type
Bernhard Urban [Sun, 2 Sep 2012 17:59:44 +0000 (19:59 +0200)]
basicblock: use simpler type

11 years agobasicblock: small optimization of algo
Bernhard Urban [Sun, 2 Sep 2012 17:33:34 +0000 (19:33 +0200)]
basicblock: small optimization of algo

11 years agoathrow: add trapskeleton for it
Bernhard Urban [Sun, 2 Sep 2012 10:12:01 +0000 (12:12 +0200)]
athrow: add trapskeleton for it

11 years agodebug: show disasm in intel syntax
Bernhard Urban [Sun, 2 Sep 2012 09:43:12 +0000 (11:43 +0200)]
debug: show disasm in intel syntax

as the codeGen syntax is more like intel syntax ;/

11 years agoinstanceOf: test anonymous interface
Bernhard Urban [Wed, 29 Aug 2012 10:53:15 +0000 (12:53 +0200)]
instanceOf: test anonymous interface

11 years agoGC: implemented QuickCheck magic to test GC of huge object trees
Harald Steinlechner [Sat, 1 Sep 2012 21:42:43 +0000 (23:42 +0200)]
GC: implemented QuickCheck magic to test GC of huge object trees

11 years agoGC: implemented basic GC memory swapping; some refactoring
Harald Steinlechner [Sat, 1 Sep 2012 18:33:58 +0000 (20:33 +0200)]
GC: implemented basic GC memory swapping; some refactoring

11 years agoGC: TwoSpace copy evacuation basically works
Harald Steinlechner [Sat, 1 Sep 2012 17:17:23 +0000 (19:17 +0200)]
GC: TwoSpace copy evacuation basically works

11 years agoGC/MemoryManager: implemented evacuate
Harald Steinlechner [Sat, 1 Sep 2012 14:35:49 +0000 (16:35 +0200)]
GC/MemoryManager: implemented evacuate

11 years agoGC: refactored Ptr specific test implementation into Mate/Tests/MockRefs;
Harald Steinlechner [Sat, 1 Sep 2012 13:08:01 +0000 (15:08 +0200)]
GC: refactored Ptr specific test implementation into Mate/Tests/MockRefs;

11 years agoGC: added newRef field
Harald Steinlechner [Sat, 1 Sep 2012 12:54:42 +0000 (14:54 +0200)]
GC: added newRef field

11 years agoscratch: stack->register mapping experiments. preparation for hoopl tests
Harald Steinlechner [Fri, 31 Aug 2012 23:55:17 +0000 (01:55 +0200)]
scratch: stack->register mapping experiments. preparation for hoopl tests

11 years agoscratch/GC: playground for datastructures to be used in GC - probably...
Harald Steinlechner [Sun, 26 Aug 2012 14:50:00 +0000 (16:50 +0200)]
scratch/GC: playground for datastructures to be used in GC - probably...

11 years agohlint: style cleanup
Bernhard Urban [Tue, 28 Aug 2012 22:58:08 +0000 (00:58 +0200)]
hlint: style cleanup

11 years agoinstanceOf: also consider interfaces
Bernhard Urban [Tue, 28 Aug 2012 22:24:20 +0000 (00:24 +0200)]
instanceOf: also consider interfaces

11 years agoinstanceOf: class hierarchy are considered properly now
Bernhard Urban [Tue, 28 Aug 2012 17:39:50 +0000 (19:39 +0200)]
instanceOf: class hierarchy are considered properly now

TODO: interfaces

11 years agoinstanceOf: make decision at runtime
Bernhard Urban [Tue, 28 Aug 2012 15:11:12 +0000 (17:11 +0200)]
instanceOf: make decision at runtime

preperation for a serious instanceOf implementation

11 years agoMemoryManager: twoSpace memorymanager initialization code; here its time for monad...
Harald Steinlechner [Mon, 27 Aug 2012 18:16:53 +0000 (20:16 +0200)]
MemoryManager: twoSpace memorymanager initialization code; here its time for monad transformers...

11 years agomoved GC/MemoryManager into Mate (more comfortable with packages etc - integration...
Harald Steinlechner [Mon, 27 Aug 2012 17:43:18 +0000 (19:43 +0200)]
moved GC/MemoryManager into Mate (more comfortable with packages etc - integration approaches ;-))

11 years agoscratch/GC: progress with data structures and traversals
Harald Steinlechner [Mon, 27 Aug 2012 17:41:04 +0000 (19:41 +0200)]
scratch/GC: progress with data structures and traversals

11 years agoscratch/GC: progress with data structures and traversals
Harald Steinlechner [Mon, 27 Aug 2012 16:30:32 +0000 (18:30 +0200)]
scratch/GC: progress with data structures and traversals

11 years agoscratch/GC: sketched datastructures etc for obj graph traversal
Harald Steinlechner [Mon, 27 Aug 2012 12:28:37 +0000 (14:28 +0200)]
scratch/GC: sketched datastructures etc for obj graph traversal

11 years agoobjectformat: one word after mtable in object layout
Bernhard Urban [Mon, 27 Aug 2012 11:10:17 +0000 (13:10 +0200)]
objectformat: one word after mtable in object layout

also use ptrSize in ClassPool

11 years agotrapmap: delete some entries
Bernhard Urban [Mon, 27 Aug 2012 10:08:30 +0000 (12:08 +0200)]
trapmap: delete some entries

11 years agopatching: define patcher in X86CodeGen itself where possible
Bernhard Urban [Mon, 27 Aug 2012 09:59:16 +0000 (11:59 +0200)]
patching: define patcher in X86CodeGen itself where possible

11 years agolazy classloading: yet another bug
Bernhard Urban [Sun, 26 Aug 2012 22:22:26 +0000 (00:22 +0200)]
lazy classloading: yet another bug

by computing the field access offset, the class has to loaded. but this should
happen at runtime, on the first field access, not at compile time. see
tests/Instance7.java

11 years agotraps: delete traps... TODO
Bernhard Urban [Mon, 27 Aug 2012 09:10:08 +0000 (11:10 +0200)]
traps: delete traps... TODO

11 years agoREADME: remove old information
Bernhard Urban [Sat, 25 Aug 2012 19:12:03 +0000 (21:12 +0200)]
README: remove old information

11 years agodebug: remove #ifdef's and use dumb logger
Bernhard Urban [Sat, 25 Aug 2012 19:06:03 +0000 (21:06 +0200)]
debug: remove #ifdef's and use dumb logger

advantage:
- Haskell code, i.e. tools like hlint or ghc-mod don't have problems with
  processing the source files with CPP
- no (ugly?) old school CPP stuff

disadvantage:
- it's not really a printf thingy (maybe we'll be able to use it soon)

11 years agoWall: remove some warnings
Bernhard Urban [Fri, 24 Aug 2012 18:21:13 +0000 (20:21 +0200)]
Wall: remove some warnings

11 years agoglobalmaphack: be more general (fmap, factoring, ...)
Bernhard Urban [Fri, 24 Aug 2012 18:18:21 +0000 (20:18 +0200)]
globalmaphack: be more general (fmap, factoring, ...)

11 years agoRevert "globalmaphack: use old school CPP"
Bernhard Urban [Fri, 24 Aug 2012 17:48:14 +0000 (19:48 +0200)]
Revert "globalmaphack: use old school CPP"

fall back to "standard" cpp by ghc, since cpphs doesn't work with ghc-mod.

This reverts commit 94985402292306da1db46b1750927ef46bdb87d3.

Conflicts:

Makefile

11 years agoGarbageAlloc: little refactoring - all GC allocate methods should have GC suffix...
Harald Steinlechner [Fri, 24 Aug 2012 13:03:27 +0000 (15:03 +0200)]
GarbageAlloc: little refactoring - all GC allocate methods should have GC suffix; all non GC methods on the other hand should suffix Unmanaged;

11 years agoMethodPool: removed demo call stuff - added printGCStats instead;
Harald Steinlechner [Fri, 24 Aug 2012 12:41:38 +0000 (14:41 +0200)]
MethodPool: removed demo call stuff - added printGCStats instead;
added Makefile to build simple GC tests in scratch (tests which cannot be run with openjdk currently because  native interface stuff);

11 years agohs-boehmgc/buildsystem: rm of tempdir after cabal install caused problems with foreig...
Harald Steinlechner [Fri, 24 Aug 2012 09:21:46 +0000 (11:21 +0200)]
hs-boehmgc/buildsystem: rm of tempdir after cabal install caused problems with foreign libs (libgc not found during linking); this occurs due to linking with mate - altough  cabal Setup.hs patches correct extra-library-dirs these dirs dont exist after build;

there are two possible fixes:
- ship hs-boehmgc with libgc
- patch cabal install dirs into cabal file in Setup.hs

11 years agoexperiments with JNI;
Harald Steinlechner [Thu, 23 Aug 2012 18:44:21 +0000 (20:44 +0200)]
experiments with JNI;

11 years agoGC: first working version of boehm gc. working with: 8af66bf9d36f75558ec49e0461099d5f...
Harald Steinlechner [Thu, 23 Aug 2012 15:45:47 +0000 (17:45 +0200)]
GC: first working version of boehm gc. working with: 8af66bf9d36f75558ec49e0461099d5f41024574 of hs-boehmgc

11 years agogc: delegated mallocs in GarbageAlloc to hs-boehmgc (Mate.GC.Boehm.mallocBytes);
Harald Steinlechner [Wed, 22 Aug 2012 18:20:05 +0000 (20:20 +0200)]
gc: delegated mallocs in GarbageAlloc to hs-boehmgc (Mate.GC.Boehm.mallocBytes);
tests: implemented little memory leaking example
jmate: added sketch implementation of Runtime class (which should be used to query heap memory and force GCs)

11 years agonative: demo for a call to haskell functions at runtime
Bernhard Urban [Wed, 22 Aug 2012 18:01:07 +0000 (20:01 +0200)]
native: demo for a call to haskell functions at runtime

still a hack though

11 years agostyle suggestion for data decl.
Bernhard Urban [Mon, 20 Aug 2012 20:18:47 +0000 (22:18 +0200)]
style suggestion for data decl.

11 years agodebug: more readable debuginfo
Bernhard Urban [Mon, 20 Aug 2012 16:21:23 +0000 (18:21 +0200)]
debug: more readable debuginfo

11 years agotraps: use harpy for patching
Bernhard Urban [Sat, 18 Aug 2012 16:22:46 +0000 (18:22 +0200)]
traps: use harpy for patching

pro:
o more readable

contra:
o probably slower than plain patching
o no saftey checks any more (but we could add that if we want)

11 years agoinvokevirtual: implement lazy class loading right
Bernhard Urban [Fri, 17 Aug 2012 22:21:12 +0000 (00:21 +0200)]
invokevirtual: implement lazy class loading right

also use a different trap strategy, namely SIGILL instead of SIGSEGV, which
makes handling a lot easier and simplifies code imho.

11 years agocodegen: approx. initial codebuffer size according to codesize @ bytecode
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
codegen: approx. initial codebuffer size according to codesize @ bytecode

11 years agotests: big object fail
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
tests: big object fail

11 years agodebug: ifdef this, because ghc doesn't eliminate this :/
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
debug: ifdef this, because ghc doesn't eliminate this :/

11 years agonativeMaschine: use NativeWord instead of Word32
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
nativeMaschine: use NativeWord instead of Word32

11 years agonew insn: fix wrong behaviour on lazy class init
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
new insn: fix wrong behaviour on lazy class init

TODO:
- invokevirtual
- invokeinterface

11 years agocodegen: register dump at runtime
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
codegen: register dump at runtime

just a debugging aid

11 years agojava runtime: add simple version of instanceof
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
java runtime: add simple version of instanceof

just works if we check for the same type, like:
>  A a = new A();
>   if (a instanceof A) {
>   [...]

11 years agorefactor: trivial stuff and add -fwarn-tabs to $(GHC_OPT)
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
refactor: trivial stuff and add -fwarn-tabs to $(GHC_OPT)

11 years agoTODO: update; Debug: note about `printfFake'
Bernhard Urban [Fri, 17 Aug 2012 17:21:45 +0000 (19:21 +0200)]
TODO: update;  Debug: note about `printfFake'

11 years agoMakefile: add boot class dependency for debug build
Bernhard Urban [Thu, 2 Aug 2012 20:01:50 +0000 (22:01 +0200)]
Makefile: add boot class dependency for debug build

11 years agobasicblock: stupid index bug @ debug output
Bernhard Urban [Thu, 9 Aug 2012 14:17:28 +0000 (16:17 +0200)]
basicblock: stupid index bug @ debug output

11 years agoinstallenv: use custom harpy repo
Bernhard Urban [Thu, 2 Aug 2012 19:37:24 +0000 (21:37 +0200)]
installenv: use custom harpy repo

and provide a simple shell function for installing from a git
repository

11 years agostaticcall trap: use different magic sequence
Bernhard Urban [Thu, 2 Aug 2012 19:37:24 +0000 (21:37 +0200)]
staticcall trap: use different magic sequence

place invalid opcode *before* both NOPs, otherwise two NOP instrunctions are
executed before every actual traphandling stuff (although, CPUs nowadays will
optimize those NOP-sequences away anyways I guess...)

btw, fuuuu @ byte order *sigh*  I'll never get it...

11 years agodebugmode: no maybe anymore
Bernhard Urban [Thu, 2 Aug 2012 19:37:24 +0000 (21:37 +0200)]
debugmode: no maybe anymore

11 years agohlint: stuff
Bernhard Urban [Thu, 2 Aug 2012 19:37:24 +0000 (21:37 +0200)]
hlint: stuff

11 years agonativeMachine: use constants
Bernhard Urban [Thu, 2 Aug 2012 19:37:24 +0000 (21:37 +0200)]
nativeMachine: use constants

- rename NativeMaSchine to NativeMachine
- new module for constants in order to avoid module cycles

11 years agonativeMaschine: s/unsigned int/ptrdiff_t/g
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
nativeMaschine: s/unsigned int/ptrdiff_t/g

more portable

11 years agonativeMaschine: add module for binding target machine
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
nativeMaschine: add module for binding target machine

TODO: use wordSize where appropriate

11 years agorefactor: store amount of arguments of a method in RawMethod
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
refactor: store amount of arguments of a method in RawMethod

also kick `Maybe' at parseMethod in BasicBlock. It's just annoying to unpack
it from Maybe everywhere. Just fail @ parseMethod if we don't find the codeseg

11 years agocode style: just different indent
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
code style: just different indent

11 years agomaxlocals: store it in new data type RawMethod, with MapBB & Co
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
maxlocals: store it in new data type RawMethod, with MapBB & Co

we need that information, in order to reserve enough memory on the stack (was
hardcoded so far)

11 years agoMakefile: don't delete tags file
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
Makefile: don't delete tags file

11 years agocodegen: factor i{load,store} shortcuts
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
codegen: factor i{load,store} shortcuts

11 years agoTODO: replace traps?
Bernhard Urban [Tue, 31 Jul 2012 20:22:28 +0000 (22:22 +0200)]
TODO: replace traps?

11 years agorefactor: style, fun, hlint, ...
Bernhard Urban [Wed, 18 Jul 2012 21:12:20 +0000 (23:12 +0200)]
refactor: style, fun, hlint, ...

warmup for serious stuff (hopefully)

11 years agoMakefile: cleanup/describe options, update .PHONY, ...
Bernhard Urban [Wed, 18 Jul 2012 20:59:20 +0000 (22:59 +0200)]
Makefile: cleanup/describe options, update .PHONY, ...

11 years agoglobalmaphack: use old school CPP
Bernhard Urban [Wed, 18 Jul 2012 17:33:33 +0000 (19:33 +0200)]
globalmaphack: use old school CPP

I tried (1) typeclasses and (2) TH, but failed:
(1) typeclasses are not designed to emulate object managment
(2) TH needs GHCi (or at least something at compile-time?), and this doesn't
    work well with MateVM build stuff :/

11 years agoMakefile: adapt *.compile for new javac behaivour too
Bernhard Urban [Tue, 17 Jul 2012 20:02:47 +0000 (22:02 +0200)]
Makefile: adapt *.compile for new javac behaivour too

11 years agogdb: disable ghc's rts timer and disable signal handlers
Bernhard Urban [Tue, 17 Jul 2012 18:27:06 +0000 (20:27 +0200)]
gdb: disable ghc's rts timer and disable signal handlers

debugging jitted code is nice again (as it was with 6.12.*)

11 years agoMakefile: fix for new javac version
Bernhard Urban [Tue, 17 Jul 2012 17:41:07 +0000 (19:41 +0200)]
Makefile: fix for new javac version

seems like it doesn't search the userdir as before

11 years agorefactor stuff
Bernhard Urban [Tue, 17 Jul 2012 17:10:27 +0000 (19:10 +0200)]
refactor stuff

11 years agocabal: removed mate-common
Bernhard Urban [Thu, 21 Jun 2012 08:20:13 +0000 (10:20 +0200)]
cabal: removed mate-common

it feels still a bit hackish...

11 years agoMakefile: `ghci' and `tags' targets
Bernhard Urban [Wed, 20 Jun 2012 20:22:31 +0000 (22:22 +0200)]
Makefile: `ghci' and `tags' targets

woot

11 years agoadd package jmate
Bernhard Urban [Tue, 19 Jun 2012 20:11:17 +0000 (22:11 +0200)]
add package jmate

avoid name clashes when using GNU classpath. should be useful for debugging
classpath code.
at the end of the day, we should remove `java/' and maybe `jmate/'

11 years agocodegen: throw: force runtime error on execution
Bernhard Urban [Mon, 18 Jun 2012 17:48:54 +0000 (19:48 +0200)]
codegen: throw: force runtime error on execution

11 years agonative: cleaner arraycopy
Bernhard Urban [Mon, 18 Jun 2012 16:56:12 +0000 (18:56 +0200)]
native: cleaner arraycopy

11 years agotypes: remove dirty Ord instance of MethodSignature
Bernhard Urban [Tue, 19 Jun 2012 19:02:23 +0000 (21:02 +0200)]
types: remove dirty Ord instance of MethodSignature

we moved that finally to hs-java-0.3.3

11 years agotraps: don't delete entry after consuming it
Bernhard Urban [Mon, 18 Jun 2012 16:39:17 +0000 (18:39 +0200)]
traps: don't delete entry after consuming it

see the source code comment. would be nice to enable deletion again

11 years agocodegen: typestuff for compiling classpath files
Bernhard Urban [Mon, 18 Jun 2012 16:33:26 +0000 (18:33 +0200)]
codegen: typestuff for compiling classpath files

11 years agocodegen: again, a bug regarding BB ordering
Bernhard Urban [Sat, 16 Jun 2012 21:21:57 +0000 (23:21 +0200)]
codegen: again, a bug regarding BB ordering

11 years agocodegen: shift insn
Bernhard Urban [Sat, 16 Jun 2012 20:15:02 +0000 (22:15 +0200)]
codegen: shift insn

11 years agonative: add VMSystem.arraycopy
Bernhard Urban [Sat, 16 Jun 2012 17:39:48 +0000 (19:39 +0200)]
native: add VMSystem.arraycopy