Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/specs/java_JVM.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% !TEX root = ./java_JVM.tex
\input source_header.tex
\input java_header.tex
\usepackage{titlesec}

\setcounter{secnumdepth}{4}
Expand Down Expand Up @@ -38,10 +38,10 @@

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\docheader{Java}{Source}{}{Martin Henz, Yap Hock Chuan Roland, Chuan Hao Chang}
\docheader{2024}{Java}{JVM}{Martin Henz, Yap Hock Chuan Roland, Chuan Hao Chang}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\input source_intro.tex
\input java_intro.tex

This JVM follows the Java SE8 Edition \href{https://docs.oracle.com/javase/specs/jvms/se8/html/index.html}{JVM Specification}.

Expand Down
154 changes: 0 additions & 154 deletions docs/specs/source_header.tex

This file was deleted.

8 changes: 0 additions & 8 deletions docs/specs/source_intro.tex

This file was deleted.

6 changes: 2 additions & 4 deletions src/jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ export const functions = {
A build script has been provided to create a module of the Java standard library as a hashmap of base64 strings.

```sh
node dist/jvm/utils/build.js /path/to/classfile/directory
npx tsx src/jvm/utils/build path/to/classfiles
```

It has been configured to only include modules with package name starting with `java`, `sun/misc`, `modules`.

You can then import the strings using `import(java-slang/dist/jvm/utils/classfiles)`.
Java packages are deployed as a submodule of the Source Academy modules repository ([link](https://github.com/source-academy/java-packages)).
159 changes: 0 additions & 159 deletions src/jvm/specification.md

This file was deleted.

10 changes: 10 additions & 0 deletions src/jvm/stdlib/java/lang/System.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ const functions = {
'identityHashCode(Ljava/lang/Object;)I': (thread: Thread) => {
logger.warn('System.identityHashCode(Ljava/lang/Object;)I not implemented')
thread.returnStackFrame(0)
},

/**
* Returns the current time in nanoseconds.
* Accuracy is only in millis since browsers do not support hrtime.
* @param thread
*/
'nanoTime()J': (thread: Thread) => {
const time = BigInt(Date.now()) * BigInt(1000000)
thread.returnStackFrame64(time)
}
}

Expand Down