Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Dinduks/Mireille
base: 96d1842cc1
...
head fork: Dinduks/Mireille
compare: 8f548c77e1
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
7 build.sbt
@@ -1 +1,8 @@
scalaVersion := "2.10.0"
+
+libraryDependencies ++= Seq(
+ "org.specs2" %% "specs2" % "1.14" % "test"
+)
+
+resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
+ "releases" at "http://oss.sonatype.org/content/repositories/releases")
View
40 resources/notes.md
@@ -98,4 +98,42 @@ A list of type descriptors that describe the parameter types and the return type
* `void m(int i, float f)` -> `(IF)V`
* `int m(Object o)` -> `(Ljava/lang/Object;)I`
* `int[] m(int i, String s)` -> `(ILjava/lang/String;)[I`
-* `Object m(int[] i)` -> `([I)Ljava/lang/Object;`
+* `Object m(int[] i)` -> `([I)Ljava/lang/Object;`
+
+# Methods
+## The JVM's execution model
+* Executed inside threads
+* Each threads has its own execution stack, which is made of frames
+* Each frame respresents a method invocation
+* When a method is called
+ * New frame is pushed on the current thread's execution stack
+ * When the methods returns (or throws an exception)
+ * The frame is popped from the execution stack
+ * The execution continues in the calling method (whose stack is now on top of the stack)
+* Each frame contains two parts
+ * The local variables part: Contains variables that can be accessed by their index, in random order
+ * The operand stack: a stack of values that are used as operands by bytecode instructions
+
+## Bytecode instructions
+### Made of
+* An opcode that identifies the instruction
+ * Unsigned byte value: the bytecode name
+ * Identified by a mnemonic symbol
+ * *Example:* the opcode value `0` stands for `NOP`, which is the instruction that does nothing.
+* A fixed number of arguments
+ * Arguments are static values given after the opcode
+ * Must not be confused by instruction operands: these are know only at run time, which arguments values are statically known and stored in the compiled code.
+
+### Can be divided in two categories
+* A small set of instructions designed to transfer values form the local variables to the operand stack, and vice versa
+* The other instruction act only on the operand stack; for instance, they pop values from the stack, compute a result based on these values, and push it back on the stack
+
+### Instructions
+* `xLOAD` instructions
+ * Read a local variable and push its value on the operand stack.
+ * Take as arguments the index of the local variable that musy be read.
+ * `ILOAD` for `boolean`, `byte`, `char`, `short` and `int`.
+ * `LLOAD` and `DLOAD` use two slots.
+ * `ALOAD`: used to load any non primitive value, i.e. object and array references
+* `xSTORE`: pop a values from the operand stack and store it in a local variable.
+* Instructions are typed
View
19 src/test/scala/com/dindane/mireille/SampleSpec.scala
@@ -0,0 +1,19 @@
+package test.scala.com.dindane.mireille.SampleSpec
+
+import org.specs2.mutable._
+
+class SampleSpec extends Specification {
+
+ "The 'Hello world' string" should {
+ "contain 11 characters" in {
+ "Hello world" must have size(11)
+ }
+ "start with 'Hello'" in {
+ "Hello world" must startWith("Hello")
+ }
+ "end with 'world'" in {
+ "Hello world" must endWith("world")
+ }
+ }
+
+}

No commit comments for this range

Something went wrong with that request. Please try again.