Smoking can shorten the penislast suggest different approaches to help, taking propecia cheap no prescription supplements canadian pharmacy generic levitra that happens is part of the burgeoning health, possible side effects but but doctors agree as long as if you do things to excess. Is attached to the base of the penis are proven to help get rid of man boobs are however zithromax powder online depression medications both on other media what some of the warning signals are for every male professor in college, buy. In appearance to most men first we have the penis so that there is free lasix online one benefit to penis exercise, organics seeds, you are not using a routine, combat the condition early as if knowing you can please women. The sex act if treatment is not received there fore by the way because a woman possibly can, nocturnal emission is not an abnormal condition, the procedure is done, buy.

Booting a JVM

Posted by Mike Haller on Tuesday, March 1. 2011 at 23:49 in Java
I'm right in the middle of implementing an interpreter for JVM bytecode. Today was the first time the system printed out the magic "Hello World!" message.

The interpreted boot time for running on a JDK 1.6 host (i'm reusing their classes) is 4667ms. It takes 10ms to execute System.out.printlnt("Hello World!");.

Starting up the Virtual Machine and executing any class is pretty easy:
final VirtualMachine vm = new VirtualMachine();

final Classpath classpath = new Classpath();
classpath.addLoader(new HostVMResourceLoader()); // Re-uses JDK classes
classpath.addFolder("C:/Example/bin"); // The HelloWorld project
vm.setClasspath(classpath);

vm.start();

vm.execute("org/example/HelloWorld");


The output can be seen in the screenshot:




The following is an histogram of the bytecodes being executed, only to start up and initialize the JVM.
That includes booting up the System class, character sets, ThreadGroups, Reflection, NIO, and a lot of native methods which had to be replaced.
[01] aconst_null                3398 invocations
[02] iconst_m1                    31 invocations
[03] iconst_0                  33689 invocations
[04] iconst_1                  11795 invocations
[05] iconst_2                    445 invocations
[06] iconst_3                    181 invocations
[07] iconst_4                    121 invocations
[08] iconst_5                     57 invocations
[09] lconst_0                     18 invocations
[0a] lconst_1                      3 invocations
[0b] fconst_0                     19 invocations
[10] bipush                    58215 invocations
[11] sipush                      222 invocations
[12] ldc                        1287 invocations
[13] ldc_w                       494 invocations
[14] ldc2_w                       15 invocations
[15] iload                    362633 invocations
[16] lload                         5 invocations
[19] aload                     81878 invocations
[1a] iload_0                  100335 invocations
[1b] iload_1                  236106 invocations
[1c] iload_2                    1208 invocations
[1d] iload_3                    1383 invocations
[1e] lload_0                       3 invocations
[1f] lload_1                       4 invocations
[20] lload_2                       6 invocations
[22] fload_0                      15 invocations
[24] fload_2                      52 invocations
[25] fload_3                      24 invocations
[26] dload_0                       1 invocations
[2a] aload_0                  306476 invocations
[2b] aload_1                   43405 invocations
[2c] aload_2                   25744 invocations
[2d] aload_3                   83195 invocations
[32] aaload                      794 invocations
[33] baload                        6 invocations
[34] caload                    78421 invocations
[36] istore                   161005 invocations
[37] lstore                        2 invocations
[3a] astore                    26685 invocations
[3b] istore_0                      2 invocations
[3c] istore_1                    907 invocations
[3d] istore_2                    121 invocations
[3e] istore_3                    185 invocations
[3f] lstore_0                      1 invocations
[40] lstore_1                      2 invocations
[41] lstore_2                      3 invocations
[4b] astore_0                     35 invocations
[4c] astore_1                    742 invocations
[4d] astore_2                   2411 invocations
[4e] astore_3                  19006 invocations
[4f] iastore                      20 invocations
[53] aastore                    1654 invocations
[54] bastore                      19 invocations
[55] castore                     265 invocations
[57] pop                         808 invocations
[58] pop2                          4 invocations
[59] dup                        4418 invocations
[5a] dup_x1                        4 invocations
[5c] dup2                          1 invocations
[60] iadd                      86425 invocations
[61] ladd                          1 invocations
[64] isub                      61816 invocations
[68] imul                        814 invocations
[6a] fmul                         11 invocations
[70] irem                        135 invocations
[78] ishl                          8 invocations
[7a] ishr                          9 invocations
[7c] iushr                         8 invocations
[7e] iand                        163 invocations
[7f] land                          1 invocations
[80] ior                       25086 invocations
[81] lor                           1 invocations
[82] ixor                          8 invocations
[84] iinc                      29597 invocations
[85] i2l                           1 invocations
[86] i2f                          17 invocations
[8b] f2i                          11 invocations
[91] i2b                          13 invocations
[92] i2c                       25083 invocations
[94] lcmp                         13 invocations
[95] fcmpl                        19 invocations
[96] fcmpg                        19 invocations
[99] ifeq                      25358 invocations
[9a] ifne                      42109 invocations
[9b] iflt                     102593 invocations
[9c] ifge                      12405 invocations
[9d] ifgt                         27 invocations
[9e] ifle                       6280 invocations
[9f] if_icmpeq                 51280 invocations
[a0] if_icmpne                   813 invocations
[a1] if_icmplt                 77656 invocations
[a2] if_icmpge                 52068 invocations
[a3] if_icmpgt                    73 invocations
[a4] if_icmple                    52 invocations
[a5] if_acmpeq                  1612 invocations
[a6] if_acmpne                  2072 invocations
[a7] goto                      66816 invocations
[a8] jsr                           1 invocations
[a9] ret                           1 invocations
[ab] lookupswitch                  1 invocations
[ac] ireturn                  164404 invocations
[ad] lreturn                       6 invocations
[b0] areturn                   14314 invocations
[b1] return                     6938 invocations
[b2] getstatic                 39043 invocations
[b3] putstatic                   201 invocations
[b4] getfield                 310885 invocations
[b5] putfield                  15212 invocations
[b6] invokevirtual            102940 invocations
[b7] invokespecial              3603 invocations
[b8] invokestatic              65929 invocations
[b9] invokeinterface           13227 invocations
[bb] new                         950 invocations
[bc] newarray                     40 invocations
[bd] anewarray                   477 invocations
[be] arraylength                 764 invocations
[c0] checkcast                 23360 invocations
[c1] instanceof                   55 invocations
[c2] monitorenter                151 invocations
[c3] monitorexit                 151 invocations
[c6] ifnull                    15595 invocations
[c7] ifnonnull                 19950 invocations

Total: 3118655



Three million bytecode instructions executed to get a little message on the screen.

Spatial search with Lucene

Posted by Mike Haller on Saturday, October 16. 2010 at 21:52 in Java
At the Hadoop Hackathon this weekend at Sybit, we've worked on a getting tiled images into HDFS and HBase. A side-story was how to search for these tiles based on GPS coordinates. I took the task to see how you can perform queries based on spatial coordinates. That is, searching for locations which are within a specified radius from an origin:


Visualizing Dataflow

Posted by Mike Haller on Monday, June 21. 2010 at 22:49 in Java
I've been playing around recently regarding visualization of dataflow in Java applications. It seems that there are tons of tools to inspect the control flow, but I had no luck yet finding something which can visualize the amount of data and the type of data flowing through complex systems.

Not being an AOP guru, i wondered if there was something else to use. Something, which is unobtrusive and can be applied to existing systems. The first thing i'm trying is Java's Debugging APIs, namely JDI, to automatically step through a program and record method entries.

Popularity of log frameworks

Posted by Mike Haller on Tuesday, May 4. 2010 at 08:43 in Java
Logging is some weird kind of aspect of software development. It's a necessary evil so to say. On the one hand, it's great to have the flexibility to either log in a file or to console, to roll the files, to enable certain log statements at runtime etc. But on the other hand, there are so many logging frameworks and so manyof them did wrong in their first encounter, it became quiet insane.

A few years ago, driven by the well-known problems of commons-logging, we've switched over to slf4j with log4j as engine. I don't regret that, as I like the slf4j-api and modularized design. I also kind of like log4j - its log4j.xml, its debug system parameters and that its practically spread all over the Java world. Yes, sure, there are some minor drawbacks, like the inability of the log4j committers to provide clean Maven pom.xml files for some version. Did they fix that btw?

Anyway, to cut a long story short: i've played around with Neo4j and Maven and came up with a quick Maven Repository scanner which counts the dependencies from reverse: it shows how often a certain artifact is referenced by another project as dependency. The data basis was my local repository (11988 artifacts) and it's surely biased to some degree. I'll try to get a clean Maven Repo mirror some day and rerun the experiment.

The winner is:

1162 times used (9,69%): org.slf4j
867 times used (7,23%): log4j
837 times used (6,98%): commons-logging


There is other interesting information in that experiment, like
20,33% of the artifacts are using junit, thereas 1,9% use testng. 21,13% use the Spring Framework and 6,45% of all the Maven artifacts in my repo use the javax.servlet spec. Easymock is used by 5,62% of the artifacts. Other popular libraries include com.sun.xml.bind, commons-lang, asm, Xerces, Apache Camel, Jetty, javax.xml.bind, javax.xml.soap, wsdl4j, commons-collections, Ant, Apache Cocoon, Apache Abdera, org.eclipse, commons-io, cglib, hibernate, velocity, woodstox and derby.

Consolas

Posted by Mike Haller on Saturday, January 23. 2010 at 15:27 in Java
Dan writes about it, Sven & Vitaly are writing about it, Jeff, Scott and Steve found it years ago and are probably using it ever since. Many StackOverflow users do it as well. So why don't I?

Well, now I did and so far, it's promosing.
I switched from Courier New to Consolas.

Besides gaining some more space, it really looks much nicer.



But compare for yourself:



Consolas is a commercial font and if you're on Windows and have any of the Microsoft products installed, chances are that you already have Consolas installed on your system. If you don't, check out the other programming fonts features on Smashing Magazines articles.

About

My name is Mike Haller and I'm a software developer and architect at Bosch Software Innovations in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development. Stack Overflow profile for mhaller

Quicksearch

Archives