Advanced Software Technologies for Post-Peta Scale Computing by Mitsuhisa Sato

Advanced Software Technologies for Post-Peta Scale Computing by Mitsuhisa Sato

Author:Mitsuhisa Sato
Language: eng
Format: epub
ISBN: 9789811319242
Publisher: Springer Singapore


Then line 5 and 6 in Listing 8.3 can be replaced with the following single call:

 mapmap(f, pos1, pos2);

Defining a convenience method such as mapmap is not possible if map is a macro function.

8.3 Bytespresso

To show our idea of deep reification, we implemented a Java library that provides deep reification in Java [2]. Our Java library named Bytespresso extracts an AST by bytecode decompilation. It needs to launch the Java virtual machine with the option jdk.internal.lambda.dumpProxyClasses. This option generates the bytecode of a dynamically generated lambda expression. For deep reification, Bytespresso reads the bytecode of a given lambda expression and decompiles it to construct an AST. It does not need source code; it only needs Java bytecode.

To support the implementation of an embedded DSL by deep reification, Bytespresso also provides a translator from ASTs to C or CUDA code. The code generated by the translation is normally compiled by an external C (or CUDA) compiler and executed in a separate process from the Java virtual machine. The generated code and the host Java code communicate with each other through a socket for portability.

Delimiting AST acquisition by deep reification, Bytespresso provides the @Native annotation. When a method has this annotation, the AST of the method body is not extracted by deep reification. The ASTs for the methods invoked by that method are not extracted either. Although a @Native method is translated into a C function by Bytespresso, the body of that C function is the argument to @Native. The following method is an example of @Native method:

 @Native( "struct timeval time; gettimeofday(&time, NULL); "

  + "return time.tv_sec * 1000000 + time.tv_usec;")

 public static long time() {

  return System.nanoTime() / 1000;

 }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.