Code Monkey home page Code Monkey logo

hawkbeans-skeleton's Introduction

Build Status

Hawkbeans

Hawkbeans is a small (~6K LOC), MIT-licensed JVM written in C and intended for educational purposes. It does not meet the Java specification (not even close), but includes enough functionality for students to become familiar with concepts important to the JVM, viz. byte code interpretation, exceptions, class loading, resolution of symbolic references, exceptions, stack frames, and garbage collection.

Below are a list of features not supported in this JVM:

  • Full exception support: only the basics.
  • Reflection (required for assertions)
  • Floating point math is hardly tested
  • User-defined class loaders
  • Very limited JNI
  • No JIT compilation
  • Wide word (long/double) support is very limited
  • No actual protection is implemented (i.e. private/public etc.)

Hawkbeans uses a simple buddy allocator with power of 2 free lists for heap management. This code was taken from several other OS code bases.

Hawkbeans was developed referencing Oracle's Java Virtual Machine Specification.

Setup

You'll need a JDK 1.8 environment installed to build programs to run with Hawkbeans (i.e. using javac). By default, Hawkbeans will compile with Clang, but will use GCC if Clang isn't available. You'll also want to have libreadline installed. Feel free to use the provided Vagrantfile to get a dev environment up and running (no GUI necessary).

Building

To build the JVM, simply run make. To build the Java libs (required for building test programs) run make jlibs. To build test programs (in testcode/), run make testcode.

Running

Hawkbeans can be run as follows:

$> bin/hawkbeans-clang-debug SomeClass

Be careful about where you put classes. The hardcoded class search paths are in javasrc, in testcode, and in the Hawkbeans top-level directory. If you try to use a class outside these paths, it will fail.

Source Tree

The source is organized into the following directories:

  • jvm: The code for the platform-independent portion of Hawkbeans. Note this organization is not very sane at the moment.
    • arch/x64-linux: The linux specific code, and the only one that currently works.
    • arch/hawknest: A platform directory for the Hawknest emulator. Not working.
  • include: The header files for the code.
  • javasrc: The Java code for the Hawkbeans standard libraries.
  • scripts: Various utility scripts, mostly used when I wrote the code.
  • testcode: A set of simple Java programs to test functionality
  • bin: This is where the build toolchain puts binaries.

Questions/Concerns

Contact Kyle C. Hale [email protected] for questions/comments.

hawkbeans-skeleton's People

Contributors

khale avatar kirtanshetty avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.