jvm-hotspot

About the dynamic de-optimization of HotSpot

吃可爱长大的小学妹 提交于 2019-12-01 17:15:22
When I reading the book of "Scala in depth", it mentions that HotSpot compiler has several important features, one of them is "Dynamic De-Optimization": It is the ability to determine if an optimization did not , in fact, improve performance and undo that optimization,allowing others to be applied It seems HotSpot will try all kinds of "optimization"s, and choose the best one of them. But I'm not quite understand it. Is the "optimization" here all provided by HotSpot? I mean programmers often try to optimize the code with some skills, will HotSpot handle them? And is there any common

Java optimizations: (Hotspot/Dalvik) Optimization of final method returning a constant?

为君一笑 提交于 2019-12-01 17:10:11
问题 Can anyone tell me if either Hotspot or Dalvik is smart enough to inline calls to a final method returning a constant (static final) int value? Ideally the method call would be replaced by the constant. This might either be at class load time or through JIT. This has implications in the design of some code I'm working on. 回答1: I would think that the answer is "no, optimization will not happen because of absence or presence of the final keyword", at least on the HotSpot VM. But optimization

Can HotSpot optimize away redundant calls to pure methods without inlining them?

孤人 提交于 2019-12-01 17:02:35
问题 Pure methods are those without side effects: their only effect is to return a value which is a function of their arguments. Two calls to the same pure method with the same arguments will return the same value. So, given two calls to a pure method with identical arguments, can HotSpot optimize away the second call, simply re-using the value from the first call? For example: int add(int x, int y) { return x + y; } int addTwice(int x, int y) { return add(x, y) + add(x, y); } If HotSpot doesn't

Can HotSpot optimize away redundant calls to pure methods without inlining them?

£可爱£侵袭症+ 提交于 2019-12-01 16:56:37
Pure methods are those without side effects: their only effect is to return a value which is a function of their arguments. Two calls to the same pure method with the same arguments will return the same value. So, given two calls to a pure method with identical arguments, can HotSpot optimize away the second call, simply re-using the value from the first call? For example: int add(int x, int y) { return x + y; } int addTwice(int x, int y) { return add(x, y) + add(x, y); } If HotSpot doesn't inline add inside addTwice does it understand that add is pure and thus call add only once and double

About the dynamic de-optimization of HotSpot

杀马特。学长 韩版系。学妹 提交于 2019-12-01 16:46:40
问题 When I reading the book of "Scala in depth", it mentions that HotSpot compiler has several important features, one of them is "Dynamic De-Optimization": It is the ability to determine if an optimization did not , in fact, improve performance and undo that optimization,allowing others to be applied It seems HotSpot will try all kinds of "optimization"s, and choose the best one of them. But I'm not quite understand it. Is the "optimization" here all provided by HotSpot? I mean programmers often

Same thread running the same recursive code seems to consume more stack memory in Java 8 compared to Java 7

浪尽此生 提交于 2019-12-01 09:12:23
I am asking a question about "java stack overflow" in the "stackoverflow" site :) A particular thread which makes some recursive function calls for a particular input runs fine in Oracle Java 7 (64 bit) for a configured stack size of 228k (-Xss228k). However, the same thread running the same recursive code for the same input throws a java.lang.StackOverflowError in Oracle Java 8 (64 bit) for the same stack size of 228k. It runs fine in Java 8 if the stack size is increased to 512k (-Xss512k). Any idea why this could happen? Have any changes been made in Java 8 (Hotspot JVM) compared to Java 7

Do javac or Hotspot automatically add 'final' as an optimisation of invariant variables?

断了今生、忘了曾经 提交于 2019-12-01 06:11:05
The consensus seems to be that there is a performance benefit to marking member variables as final because they never need reloading from main memory. My question is, do javac or Hotspot automatically do this for me when it's obvious the variable cannot change. eg will javac make 'x' final in this class below... public class MyClass { private String x; MyClass(String x) { this.x = x; } public String getX() { return x; } } On a secondary point, has anyone produced empirical evidence that marking members as final makes code run faster? Any benefit is surely negligible in any application making

Same thread running the same recursive code seems to consume more stack memory in Java 8 compared to Java 7

倖福魔咒の 提交于 2019-12-01 05:52:32
问题 I am asking a question about "java stack overflow" in the "stackoverflow" site :) A particular thread which makes some recursive function calls for a particular input runs fine in Oracle Java 7 (64 bit) for a configured stack size of 228k (-Xss228k). However, the same thread running the same recursive code for the same input throws a java.lang.StackOverflowError in Oracle Java 8 (64 bit) for the same stack size of 228k. It runs fine in Java 8 if the stack size is increased to 512k (-Xss512k).

bootstrap class path not set in conjunction with -source 1.6

跟風遠走 提交于 2019-12-01 03:40:18
I am upgrading my application from java 1.6 to 1.7. When I try to build using Maven 3.2.1, my build fails with below error msg: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project my-app5: Compilation failure: Compilation failure: [ERROR] could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.6 I am using java 1.7 hotspot and previously I was using 1.6 jrockit. My application is multi module and few modules compile and build as usual, this module failed. I have set java

Do javac or Hotspot automatically add 'final' as an optimisation of invariant variables?

爱⌒轻易说出口 提交于 2019-12-01 03:06:00
问题 The consensus seems to be that there is a performance benefit to marking member variables as final because they never need reloading from main memory. My question is, do javac or Hotspot automatically do this for me when it's obvious the variable cannot change. eg will javac make 'x' final in this class below... public class MyClass { private String x; MyClass(String x) { this.x = x; } public String getX() { return x; } } On a secondary point, has anyone produced empirical evidence that