mate.git
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

11 years agocodegen: workaround for a emitBB bug
Bernhard Urban [Wed, 13 Jun 2012 22:09:00 +0000 (00:09 +0200)]
codegen: workaround for a emitBB bug

11 years agocodegen: print every jvm instruction as label in disasm output
Bernhard Urban [Wed, 13 Jun 2012 14:37:56 +0000 (16:37 +0200)]
codegen: print every jvm instruction as label in disasm output

11 years agocodegen: some more tests
Bernhard Urban [Tue, 12 Jun 2012 20:08:36 +0000 (22:08 +0200)]
codegen: some more tests

11 years agocodegen: eliminate code duplication
Bernhard Urban [Tue, 12 Jun 2012 19:40:28 +0000 (21:40 +0200)]
codegen: eliminate code duplication

11 years agorefactor: better names for TrapInfo^WTrapCause
Bernhard Urban [Tue, 12 Jun 2012 10:43:22 +0000 (12:43 +0200)]
refactor: better names for TrapInfo^WTrapCause

11 years agoMakefile: let testfiles be a dependency for the tests target
Bernhard Urban [Tue, 12 Jun 2012 10:32:42 +0000 (12:32 +0200)]
Makefile: let testfiles be a dependency for the tests target

- just compile java files needed for executing mate (e.g. java/* stuff)
- also satisify a dependency with a wrong classfile as we test something
  different here (see ClassPath3.*). yes, it's a hack, as our "test framework"
  isn't really mature :-)

11 years agohlint: more fixes
Bernhard Urban [Tue, 12 Jun 2012 10:06:05 +0000 (12:06 +0200)]
hlint: more fixes

not everything fixed though. some ugly things in the codegen hopefully disappears
sometimes (e.g. due to an awesome reg allocator ;))

11 years agoffi: don't use C for obtaining an address of a haskell function
Bernhard Urban [Mon, 11 Jun 2012 19:02:20 +0000 (21:02 +0200)]
ffi: don't use C for obtaining an address of a haskell function

i.e. get rid of dirty FFI hacks.

thanks to simonmar:
http://stackoverflow.com/questions/10967598/get-the-address-of-a-function-without-ffi#comment14326263_10967598

11 years agotools: cabal: update to new harpy version
Bernhard Urban [Thu, 24 May 2012 13:53:57 +0000 (15:53 +0200)]
tools: cabal: update to new harpy version

11 years agocodegen: add instanceof stub
Bernhard Urban [Sun, 20 May 2012 21:29:37 +0000 (23:29 +0200)]
codegen: add instanceof stub

gnuclasspath is going crazy now o_O

11 years agotools: install libs with profile information
Bernhard Urban [Sun, 20 May 2012 20:56:24 +0000 (22:56 +0200)]
tools: install libs with profile information

11 years agotrapmap: delete entry after information is consumed
Bernhard Urban [Sun, 20 May 2012 20:10:36 +0000 (22:10 +0200)]
trapmap: delete entry after information is consumed

11 years agodebug.h: define DBG_ALL
Bernhard Urban [Sun, 20 May 2012 20:04:19 +0000 (22:04 +0200)]
debug.h: define DBG_ALL

11 years agocodegen: extra handling if calldisplacement doesn't fit in 8bit
Bernhard Urban [Sun, 20 May 2012 19:56:49 +0000 (21:56 +0200)]
codegen: extra handling if calldisplacement doesn't fit in 8bit

harpy generates different code for
- call (Disp  (0x33 :: Word32) (eax)
- call (Disp (0x444 :: Word32) (eax))
although if both immediates are declared as Word32, harpy checks
at emmitting if it's able to reduce code size.

hopefully we find a easier way to fix this issue, because this way
just introduces more complexity.

11 years agocodegen/div: clear edx before use div insn
Bernhard Urban [Sun, 20 May 2012 19:55:47 +0000 (21:55 +0200)]
codegen/div: clear edx before use div insn

11 years agocodegen: a few more hacks to get more of classpath running
Bernhard Urban [Sun, 20 May 2012 13:35:31 +0000 (15:35 +0200)]
codegen: a few more hacks to get more of classpath running

11 years agomethodlookup: unique identifier for methods are name+signature
Bernhard Urban [Sun, 20 May 2012 19:50:49 +0000 (21:50 +0200)]
methodlookup: unique identifier for methods are name+signature

in our case always the "first" method with the name was taken
(the signature was ignored)

11 years agoclasspool: staticfields calculation: bugfix
Bernhard Urban [Sun, 20 May 2012 19:49:22 +0000 (21:49 +0200)]
classpool: staticfields calculation: bugfix

span doesn't do what I believed it does (it aborts on first predicate match)

11 years agotests: generics
Bernhard Urban [Sun, 20 May 2012 13:17:23 +0000 (15:17 +0200)]
tests: generics

11 years agotraps: debugging
Bernhard Urban [Sun, 20 May 2012 19:47:05 +0000 (21:47 +0200)]
traps: debugging

11 years agotests: static classes
Bernhard Urban [Sun, 20 May 2012 12:27:26 +0000 (14:27 +0200)]
tests: static classes

11 years agoclasspool: cache class file access
Bernhard Urban [Sun, 20 May 2012 19:42:48 +0000 (21:42 +0200)]
classpool: cache class file access

it was designed for that, so do it... *sigh*
sometimes I'm so dumb

most things are intend stuff

11 years agostring: allocate a real java object for strings
Bernhard Urban [Sun, 20 May 2012 10:32:07 +0000 (12:32 +0200)]
string: allocate a real java object for strings

incl. fieldtable, array, ...

also see:
http://www.javamex.com/tutorials/memory/string_memory_usage.shtml

11 years agodebug: malloc stuff
Bernhard Urban [Sun, 20 May 2012 10:21:57 +0000 (12:21 +0200)]
debug: malloc stuff

11 years agoarray: char array support
Bernhard Urban [Sun, 20 May 2012 19:37:08 +0000 (21:37 +0200)]
array: char array support

11 years agoMakefile: optional call file for testcases
Bernhard Urban [Sun, 20 May 2012 00:00:10 +0000 (02:00 +0200)]
Makefile: optional call file for testcases

in order to easier pass arguments to the JVM for certain testcases,
e.g. classpath stuff

11 years agomain: some kind of argument parsing
Bernhard Urban [Sun, 20 May 2012 00:10:12 +0000 (02:10 +0200)]
main: some kind of argument parsing

o -cp, -classpath and -jar support now from commandline.
  args parsing is a mess, I know. Unfortunately I can't use
  getopt here, because the weird argument syntax of openjdk
  java.
o finally, calls like `./mate tests.Static5' are also possible now
  (before it was `./mate tests/Static5' only)
o new dependency: package split

11 years agoClassPool: JAR and ClassPath support
Bernhard Urban [Sat, 19 May 2012 21:42:49 +0000 (23:42 +0200)]
ClassPool: JAR and ClassPath support

thanks hs-java awesomeness, although the implemented Java.ClassPath
Modell doesn't really fit nicely in our current implementation :/
so it's a bit hackish...

11 years agohs-java: upgrade to 0.3.1
Bernhard Urban [Sat, 19 May 2012 13:56:18 +0000 (15:56 +0200)]
hs-java: upgrade to 0.3.1

0.3 has JAR support, so stay tuned \o/

11 years agofixed bug in mate.cabal '.' should be in include dir not included itself
Harald Steinlechner [Sat, 19 May 2012 10:39:46 +0000 (12:39 +0200)]
fixed bug in mate.cabal '.' should be in include dir not included itself

11 years agoMakefile: delete *_stub.* files
Bernhard Urban [Sat, 19 May 2012 10:31:45 +0000 (12:31 +0200)]
Makefile: delete *_stub.* files

those are generated exporting things with FFI

11 years agomate.cabal switched to our version of harpy (git://wien.tomnetworks.com/harpy.git...
Harald Steinlechner [Sat, 19 May 2012 10:11:03 +0000 (12:11 +0200)]
mate.cabal switched to our version of harpy (git://wien.tomnetworks.com/harpy.git, d654f45c8dbc81f86d680d4562013761b1d2e0ee) and hs-java (git://wien.tomnetworks.com/hs-java.git; c96825da50f655d1732b61a0bc9da857d784a4ec)

11 years agotools: new custom repo for disassembler
Bernhard Urban [Sat, 19 May 2012 10:10:56 +0000 (12:10 +0200)]
tools: new custom repo for disassembler

11 years agotraps: do more things in haskell world
Bernhard Urban [Sat, 19 May 2012 09:52:33 +0000 (11:52 +0200)]
traps: do more things in haskell world

11 years agotools: missed a possible failed case
Bernhard Urban [Fri, 18 May 2012 22:31:08 +0000 (00:31 +0200)]
tools: missed a possible failed case

11 years agofixed mate-common. cabal build should work now
Harald Steinlechner [Fri, 18 May 2012 23:03:11 +0000 (01:03 +0200)]
fixed mate-common. cabal build should work now

11 years agoadded cabal stubs for mate-common and mate;
Harald Steinlechner [Fri, 18 May 2012 22:58:24 +0000 (00:58 +0200)]
added cabal stubs for mate-common and mate;

11 years agoscratch/ffiTest: removed export
Harald Steinlechner [Fri, 18 May 2012 20:00:05 +0000 (22:00 +0200)]
scratch/ffiTest: removed export

11 years agorefactor: use `unsafePerformIO hack' for global var
Bernhard Urban [Fri, 18 May 2012 09:30:33 +0000 (11:30 +0200)]
refactor: use `unsafePerformIO hack' for global var

11 years agorefactor: reduce global var in trap.c to one pointer
Bernhard Urban [Thu, 17 May 2012 22:43:49 +0000 (00:43 +0200)]
refactor: reduce global var in trap.c to one pointer

still not really what we want :/

11 years agoglobalvars: get rid of `trap_map'
Bernhard Urban [Thu, 17 May 2012 21:35:02 +0000 (23:35 +0200)]
globalvars: get rid of `trap_map'

we can do that differently (still ugly though)

11 years agoscratch: sync sketch code for FFI,Signal...
Harald Steinlechner [Thu, 17 May 2012 16:25:49 +0000 (18:25 +0200)]
scratch: sync sketch code for FFI,Signal...

11 years agotools: let `make tests' fail, if there's a failed testcase
Bernhard Urban [Wed, 16 May 2012 22:50:38 +0000 (00:50 +0200)]
tools: let `make tests' fail, if there's a failed testcase