Java VM Questions

2018-08-28 Thread mr rupplin
Can I ask you guys a quick question.  Does the VM development team plan on 
implementing any pure pass by reference.  Also I think we would like security 
and RMI integration going forward with the VM directly.  No way to hook memory 
allocation seems like a miss.

Let me know with some feedback.

Thanks.

Max R.

Get Outlook for Android



Re: JVM Interpreter

2018-08-26 Thread mr rupplin
Thanks you guys.  I will try not to run junk into channel and you guys promise 
to stay well run.  Ok.

Get Outlook for Android<https://aka.ms/ghei36>


From: Kim Barrett 
Sent: Saturday, August 25, 2018 11:47:41 PM
To: mr rupplin
Cc: core-libs-dev@openjdk.java.net
Subject: Re: JVM Interpreter

> On Aug 25, 2018, at 2:39 PM, mr rupplin  wrote:
>
> I am presuming the JVM interpreter is defined/implemented in the the hotspot 
> module since this is a JVM implementation.

This is probably more of a hotspot-dev or hotspot-runtime-dev kind of question, 
rather than core-libs.

> I cannot seem to find *any* instruction in it that gets called by a simple 
> "./java -ea Class" call.  We are stumped.
>
>
> For instance there are methods for local set and reference:
>
>
> void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int 
> offset) {
>
>*((address *)[Interpreter::expr_index_at(-offset)]) = value;
> }
>
> void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int 
> offset) {
>
>  *((oop *)[Interpreter::expr_index_at(-offset)]) = value;
> }
>
> These (and similar in same file) are not being called at all during the JVM 
> interpreter phase (simple java program as reference).  My program creates an 
> object and calls a test method with a single object as reference.
>
> What could be the hang up?  No printf statement seems to work.

I think BytecodeInterpreter is part of CppInterpreter, which I think
is only used by Zero platforms, with the TemplateInterpreter used by
all other platforms.  So unless you are running on a platform that
uses Zero, or specifically built for Zero, I think BytecodeInterpreter
won't be used (and might not even be compiled in?).

> Thanks.
>
> Max Rupplin
>
> Software Engineer




JVM Interpreter

2018-08-25 Thread mr rupplin
I am presuming the JVM interpreter is defined/implemented in the the hotspot 
module since this is a JVM implementation.


I cannot seem to find *any* instruction in it that gets called by a simple 
"./java -ea Class" call.  We are stumped.


For instance there are methods for local set and reference:


void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int 
offset) {

*((address *)[Interpreter::expr_index_at(-offset)]) = value;
}

void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int 
offset) {

  *((oop *)[Interpreter::expr_index_at(-offset)]) = value;
}

These (and similar in same file) are not being called at all during the JVM 
interpreter phase (simple java program as reference).  My program creates an 
object and calls a test method with a single object as reference.

What could be the hang up?  No printf statement seems to work.

Thanks.

Max Rupplin

Software Engineer




Interpreter Function Handler

2018-08-23 Thread mr rupplin
jdk9/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp


Where does Java handle pass by value?  Where can I see that implementation?


Great. Thank you.



Javac Compiler

2018-08-23 Thread mr rupplin
com.sun.tools.javac.main.Main


com.sun.tools.javac.main.Main compiler =
new com.sun.tools.javac.main.Main("javac");
return compiler.compile(args).exitCode;

I see this down in jdk.compiler.   The com.sun.tools.javac.main folder doesn't 
exist.



Re: JVMInit function call - where is it located the source?

2018-08-21 Thread mr rupplin
Ok, David.  Great, you did it.


From: David Holmes 
Sent: Tuesday, August 21, 2018 9:38:06 PM
To: mr rupplin; core-libs-dev@openjdk.java.net; Andrew Haley
Subject: Re: JVMInit function call - where is it located the source?

On 22/08/2018 11:02 AM, mr rupplin wrote:
> Quickly, where do we look?  I can't seem to find where the "javac" command is 
> called in the C interface.

javac is just the name of a executable launcher that is built.

See make/launcher/Launcher-jdk.compiler.gmk

> Where is the java code that runs the parser/compiler?  Ok, thanks gotta run 
> ably.

src/jdk.compiler/share/classes/com/sun/tools/javac

David

>
> /mr
>
> ____________
> From: mr rupplin 
> Sent: Tuesday, August 21, 2018 6:37:30 PM
> To: core-libs-dev@openjdk.java.net; Andrew Haley
> Subject: Re: JVMInit function call - where is it located the source?
>
> Thanks.
>
> Get Outlook for Android<https://aka.ms/ghei36>
>
> 
> From: Andrew Haley 
> Sent: Tuesday, August 21, 2018 12:32:20 PM
> To: mr rupplin; core-libs-dev@openjdk.java.net
> Subject: Re: JVMInit function call - where is it located the source?
>
> On 08/21/2018 05:21 PM, mr rupplin wrote:
>> Inside java.c there is a JLI_Launch which purports to be the launching or 
>> entry point for the JVM.  The last line shows:
>>
>>
>> return JVMInit(, threadStackSize, argc, argv, mode, what, ret);
>>
>>
>> This is given apparently as a function call that will return an int.  
>> However the include file java.h shows no source for this function.
>
>>   Where is it located?
>
> Couldn't you just look?
>
> src/java.base/unix/native/libjli/java_md_solinux.c:79
>
>> And finally where is the javac.c source file? I'm sure it's been here and 
>> now its lost. - ok
>
> It's part of the Java launcher, jexec.c. The easiest way to discover
> this stuff is to run javac in a real C++ debugger.
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>


Re: JVMInit function call - where is it located the source?

2018-08-21 Thread mr rupplin
Quickly, where do we look?  I can't seem to find where the "javac" command is 
called in the C interface.


Where is the java code that runs the parser/compiler?  Ok, thanks gotta run 
ably.


/mr

____
From: mr rupplin 
Sent: Tuesday, August 21, 2018 6:37:30 PM
To: core-libs-dev@openjdk.java.net; Andrew Haley
Subject: Re: JVMInit function call - where is it located the source?

Thanks.

Get Outlook for Android<https://aka.ms/ghei36>


From: Andrew Haley 
Sent: Tuesday, August 21, 2018 12:32:20 PM
To: mr rupplin; core-libs-dev@openjdk.java.net
Subject: Re: JVMInit function call - where is it located the source?

On 08/21/2018 05:21 PM, mr rupplin wrote:
> Inside java.c there is a JLI_Launch which purports to be the launching or 
> entry point for the JVM.  The last line shows:
>
>
> return JVMInit(, threadStackSize, argc, argv, mode, what, ret);
>
>
> This is given apparently as a function call that will return an int.  However 
> the include file java.h shows no source for this function.

>  Where is it located?

Couldn't you just look?

src/java.base/unix/native/libjli/java_md_solinux.c:79

> And finally where is the javac.c source file? I'm sure it's been here and now 
> its lost. - ok

It's part of the Java launcher, jexec.c. The easiest way to discover
this stuff is to run javac in a real C++ debugger.

--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


Re: JVMInit function call - where is it located the source?

2018-08-21 Thread mr rupplin
Thanks.

Get Outlook for Android<https://aka.ms/ghei36>


From: Andrew Haley 
Sent: Tuesday, August 21, 2018 12:32:20 PM
To: mr rupplin; core-libs-dev@openjdk.java.net
Subject: Re: JVMInit function call - where is it located the source?

On 08/21/2018 05:21 PM, mr rupplin wrote:
> Inside java.c there is a JLI_Launch which purports to be the launching or 
> entry point for the JVM.  The last line shows:
>
>
> return JVMInit(, threadStackSize, argc, argv, mode, what, ret);
>
>
> This is given apparently as a function call that will return an int.  However 
> the include file java.h shows no source for this function.

>  Where is it located?

Couldn't you just look?

src/java.base/unix/native/libjli/java_md_solinux.c:79

> And finally where is the javac.c source file? I'm sure it's been here and now 
> its lost. - ok

It's part of the Java launcher, jexec.c. The easiest way to discover
this stuff is to run javac in a real C++ debugger.

--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


JVMInit function call - where is it located the source?

2018-08-21 Thread mr rupplin
Inside java.c there is a JLI_Launch which purports to be the launching or entry 
point for the JVM.  The last line shows:


return JVMInit(, threadStackSize, argc, argv, mode, what, ret);


This is given apparently as a function call that will return an int.  However 
the include file java.h shows no source for this function.  Where is it located?


--


And finally where is the javac.c source file? I'm sure it's been here and now 
its lost. - ok


max



Moderator Responsibilities

2018-08-17 Thread mr rupplin
Hello.


I have been contacted by someone who has stated that there are complaints that 
we ask the channel about debug questions.  I have 12+ years in Software and a 
Masters Degree in Computer Science.


There will be no more kid games. If you are asked, please answer fully and 
promptly.  Debugging a long compile stack can be complicated.


Also, if recurring questions become irksome make a JDK wiki on github.  This is 
the least we can expect.


That is all.


Thank you for your understanding.


Max R.


(Sr. Software Fellow)


Compile Error

2018-08-16 Thread mr rupplin
Spot what's the issue here:

Compiling 4 files for BUILD_JIGSAW_TOOLS
Error occurred during initialization of VM
java.lang.NullPointerException
at jdk.internal.misc.VM.saveAndRemoveProperties(java.base/VM.java:176)
at java.lang.System.initPhase1(java.base/System.java:802)

>>

make/Main.gmk:356: recipe for target 'exploded-image-optimize' failed


Removing the Barrier

2018-08-15 Thread mr rupplin
Can you explain how to remove the requirement for comments in the OpenJDK build 
in the Java source files?  It's really killing my schedule to have to reinsert 
comments by hand.

Thanks.

Max R.

Software Developer


OpenJDK 9 - Make (no deprecations flag setting)

2018-08-14 Thread mr rupplin
Where in Makefile do we add this - to suppress deprecation warnings - to our 
personal builds.

Thanks.

MR


Makefile Suppress Deprecation Warnings

2018-08-12 Thread mr rupplin
Where in the Makefile would we add this to silence to deprecated warnings from 
GCC compiler?

-Wno-deprecated

Who thought this would be fine?  To run this seem falty.  ok


Re: JVMTI lib location

2018-08-12 Thread mr rupplin
Where are the source codes for the following methods:


 err = (*jvmti)->GetMethodDeclaringClass(jvmti, frames[i].method, 
_class);

 err = (*jvmti)->GetClassSignature(jvmti, declaring_class, , 
NULL);

Thanks,

Max

From: David Holmes 
Sent: Sunday, August 12, 2018 7:07 PM
To: mr rupplin; core-libs-dev@openjdk.java.net; serviceability-dev
Subject: Re: JVMTI lib location

Hi Max,

On 11/08/2018 6:41 AM, mr rupplin wrote:
> Trying to write a quick agent for the JVM.  The jvmti.h file is found quickly 
> but I do not know what to link it with.  Can you guys help?

JVM TI is a serviceability-dev topic, though that's really about
developing JVM TI not using it. There are numerous tutorials/blog pages
on using JVM TI e.g. [1]. IIUC the JVM TI agent library is dynamically
loaded into the JVM and thus dynamically linked with the JVM TI runtime
- so you don't have to link your library with anything to access JVM TI.

David

[1] http://www.oracle.com/technetwork/articles/javase/index-140680.html

> Thanks.
>
> Max r.
>


Command 'make jdk' no longer runs ; request a quick look

2018-08-12 Thread mr rupplin
Building target 'jdk' in configuration 'linux-x86_64-normal-server-release'
Creating ct.sym classes
Compiling 11 properties into resource bundles for java.logging
Compiling 2 files for BUILD_BREAKITERATOR_BASE
Compiling 2 files for BUILD_BREAKITERATOR_LD
Exception in thread "main" java.lang.AssertionError
at com.sun.tools.javac.util.Assert.error(Assert.java:155)
at com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
at com.sun.tools.javac.comp.Modules.allModules(Modules.java:1193)
at 
com.sun.tools.javac.comp.Modules.getObservableModule(Modules.java:1388)
at 
com.sun.tools.javac.model.JavacElements.getModuleElement(JavacElements.java:136)
at 
com.sun.tools.javac.model.JavacElements.getModuleElement(JavacElements.java:84)
at 
build.tools.symbolgenerator.TransitiveDependencies.main(TransitiveDependencies.java:81)
make[3]: *** 
[/media/mearvk/SSD/OpenJDKs/SecureJVM/jdk9/build/linux-x86_64-normal-server-release/support/symbols/ct.sym-files/_the.symbols]
 Error 1
Gendata-jdk.compiler.gmk:64: recipe for target 
'/media/mearvk/SSD/OpenJDKs/SecureJVM/jdk9/build/linux-x86_64-normal-server-release/support/symbols/ct.sym-files/_the.symbols'
 failed
make[2]: *** [jdk.compiler-gendata] Error 2
make/Main.gmk:150: recipe for target 'jdk.compiler-gendata' failed

Here I'm stumped; we've not touched the make files and it still gives this 
dump.  We've stopped for a while and are picking back up shortly.  Can we clear 
this like right now? -- thanks


C files and their Mapping(s)

2018-08-11 Thread mr rupplin
Hello.

Thanks for taking time.  We had a quick question about the Java to C mappings 
in the JDK.  For instance the System.java has a corresponding System.c and even 
a System.o.

We find these without too much problem.  However many of the "core" packages 
(corba, nashorn, jaxp, jaxws) do not have a corresponding C source folder.

If we were to make changes to System.java we would, for example, also make 
changes to System.c.  It is quickly clear then that we would need a mechanism 
for altering the remaining java classes.  Since these do not have a C file what 
do we then alter?  How would we rewrite a method, add one, etc.?

-- -- -- --

Thank you,

Max


JVMTI lib location

2018-08-10 Thread mr rupplin
Trying to write a quick agent for the JVM.  The jvmti.h file is found quickly 
but I do not know what to link it with.  Can you guys help?

Thanks.

Max r.


Re: System.java Development Question

2018-08-06 Thread mr rupplin
That is alot of reading.  I will look into it.  We would build some according 
to the frameworks' ability to handle that control area.


Thank you.  I will be in touch.


Max R.


Sr. Software Lead


From: Claes Redestad 
Sent: Monday, August 6, 2018 2:20:38 PM
To: mr rupplin; core-libs-dev@openjdk.java.net
Subject: Re: System.java Development Question


Hi Max,

On 2018-08-06 17:55, mr rupplin wrote:

Clases, Hello.


Firstly thank you for replying.  Of course our goal is to show the strengths in 
the OpenJDK.


Some weeks ago we were working with the ClassFileTransformer as an initial hook 
for a modest databasing proposal.  We found it to be a dead end.


Of course the company has greenlit further work into the area.  We would like 
to point out JDK did not have any way to hook the malloc sequence at the time.

it's great that you're showing an interest in the platform and exploring ways 
to extend/improve it.

It's somewhat coincidental that a lot of work happened in this particular area 
recently.



Please refer us to the technical lay for the Overhead Heap-Profiling reference 
you refer to; Ok.

I thought I already had, but it seems I referred to the initial implementation 
RFE twice. Sorry about that..

The high-level JEP is here: http://openjdk.java.net/jeps/331

It has the high-level overview. From there you can click through to JBS details 
for the JEP, and from there to the implementation.

For historical reference, initial discussion on the proposal here: 
http://mail.openjdk.java.net/pipermail/serviceability-dev/2015-June/017543.html

There were a couple of code reviews done on open lists, but I think this is the 
final round (and thread): 
http://mail.openjdk.java.net/pipermail/serviceability-dev/2018-May/023668.html

On top of the Low-Overhead Heap Profiling JEP mentioned, JFR was also open 
sourced in time for JDK 11. Perhaps it's memory allocation sampling is of 
interest and a workable alternative.

HTH!

/Claes


Core Type Compilation Issues

2018-08-06 Thread mr rupplin
Three problems that I run into when running the 'make jdk' after minor work on 
the System.java class for JNI and custom JDK:

java/lang/memory/GroupListener.java:111: warning: [rawtypes] found raw type: 
Class
Class basetype = null;


-- --


java/lang/memory/GroupListener.java:7: error: package java.rmi does not exist
import java.rmi.Remote;


-- --


java/lang/memory/GroupListener.java:13: warning: [exports] class Group in 
module java.base is not accessible to clients that require this module
public final ArrayList groups = new ArrayList();



== ==


Can we get explanations for each of these?  Also the solutions or workarounds.  
OkQ!


Thanks,


Max R.


Software Lead


Re: System.java Development Question

2018-08-06 Thread mr rupplin
Clases, Hello.


Firstly thank you for replying.  Of course our goal is to show the strengths in 
the OpenJDK.


Some weeks ago we were working with the ClassFileTransformer as an initial hook 
for a modest databasing proposal.  We found it to be a dead end.


Of course the company has greenlit further work into the area.  We would like 
to point out JDK did not have any way to hook the malloc sequence at the time.


Please refer us to the technical lay for the Overhead Heap-Profiling reference 
you refer to; Ok.


Thanks,


Max R.


From: Claes Redestad 
Sent: Monday, August 6, 2018 2:12:35 AM
To: core-libs-dev@openjdk.java.net; mea...@outlook.com
Subject: Re: System.java Development Question

On 2018-08-04 14:29, mr rupplin wrote:
> Any help?

I think it would help if you described what you're trying to achieve,
rather than the current stumbling block.[0]

Reading between the lines then it seems you're trying to add some kind
of adhoc allocation profiling, so I wonder if you've seen the Low
Overhead Heap-Profiling work that went into jdk/jdk just a few weeks
ago?[1]

If it doesn't fit your use-case - or you really need something like it
applied to JDK 9 - it might still be good advice to study the code and
approach taken there before reverse-engineering the entire OpenJDK
source code... :-)

/Claes

[0] https://en.wikipedia.org/wiki/XY_problem
[1] Initial implementation:
http://hg.openjdk.java.net/jdk/jdk/rev/e2a7f431f65c
Impl RFE: https://bugs.openjdk.java.net/browse/JDK-8203394
JEP: https://bugs.openjdk.java.net/browse/JDK-8203394

(See the JEP for follow-up bug fixes you'd need to consider if you'd
ever attempt to backport this)


Re: System.java Development Question

2018-08-04 Thread mr rupplin
Any help?


From: mr rupplin 
Sent: Friday, August 3, 2018 9:42:26 AM
To: Alan Bateman; core-libs-dev@openjdk.java.net
Subject: Re: System.java Development Question

This is an OpenJDK 9 build.  Can you explain?  I'm very interested in getting 
all the details understood.  Hey thanks!

MR

From: Alan Bateman 
Sent: Friday, August 3, 2018 9:38 AM
To: mr rupplin; core-libs-dev@openjdk.java.net
Subject: Re: System.java Development Question

On 03/08/2018 06:22, mr rupplin wrote:
> :
>
>
> We get the following after running a trivial Java program:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
> at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
> at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
> at Hope.(Hope.java:19)
> at Hope.main(Hope.java:11)
>
>
> -- --
>
> Can we skip right to it?  What is the issue here?
>
Which JDK build is this? I can't tell if it has the map files used by
the linker (mapfile-vers in the case of libjava) or not. The map files
don't exist in the main line but they may exist if you are working on a
patch for a previous release.

-Alan


Re: System.java Development Question

2018-08-03 Thread mr rupplin
This is an OpenJDK 9 build.  Can you explain?  I'm very interested in getting 
all the details understood.  Hey thanks!

MR

From: Alan Bateman 
Sent: Friday, August 3, 2018 9:38 AM
To: mr rupplin; core-libs-dev@openjdk.java.net
Subject: Re: System.java Development Question

On 03/08/2018 06:22, mr rupplin wrote:
> :
>
>
> We get the following after running a trivial Java program:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
> at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
> at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
> at Hope.(Hope.java:19)
> at Hope.main(Hope.java:11)
>
>
> -- --
>
> Can we skip right to it?  What is the issue here?
>
Which JDK build is this? I can't tell if it has the map files used by
the linker (mapfile-vers in the case of libjava) or not. The map files
don't exist in the main line but they may exist if you are working on a
patch for a previous release.

-Alan


System.java Development Question

2018-08-03 Thread mr rupplin
Hello.

I'm not sure if there's a minor typo but I cannot find the error in it.  Can 
you guys look? In System.c we have:


JNIEXPORT void JNICALL
Java_java_lang_System_setMemoryAllocationListener0(JNIEnv *env, jclass cla, 
jobject listener)
{
jfieldID fid =   
(*env)->GetStaticFieldID(env,cla,"memoryAllocationListener","Ljava/lang/memory/MemoryAllocationListener;");

if (fid == 0)
return;

(*env)->SetStaticObjectField(env,cla,fid,listener);
}

-- -- -- -- --

And in System.java we have:

public static final MemoryAllocationListener memoryAllocationListener = 
null;


...

public static void setMemoryAllocationListener(MemoryAllocationListener 
memoryAllocationListener) {
checkMalloc();
setMemoryAllocationListener0(memoryAllocationListener);
}


...


//SecureJVM private
private static native void 
setMemoryAllocationListener0(MemoryAllocationListener memoryAllocationListener);


-- -- -- -- --


We get the following after running a trivial Java program:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
java.lang.System.setMemoryAllocationListener0(Ljava/lang/memory/MemoryAllocationListener;)V
at java.base/java.lang.System.setMemoryAllocationListener0(Native Method)
at java.base/java.lang.System.setMemoryAllocationListener(System.java:261)
at Hope.(Hope.java:19)
at Hope.main(Hope.java:11)


-- --

Can we skip right to it?  What is the issue here?

Thanks.

Max R.