<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged jvm</title>
<link>https://ask.clojure.org/index.php/tag/jvm</link>
<description></description>
<item>
<title>Is RT.longCast() missing an overload for char?</title>
<link>https://ask.clojure.org/index.php/14650/is-rt-longcast-missing-an-overload-for-char</link>
<description>&lt;p&gt;This code resorts to reflection:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(long (char \x))
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;&lt;p&gt;call to static method &lt;code&gt;longCast&lt;/code&gt; on &lt;code&gt;clojure.lang.RT&lt;/code&gt; can't be resolved (argument types: &lt;code&gt;char&lt;/code&gt;).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Casting to &lt;code&gt;int&lt;/code&gt; does not trigger this reflection warning, as &lt;code&gt;RT.intCast(char)&lt;/code&gt; exists.&lt;/p&gt;
&lt;p&gt;It seems to me there should be a &lt;code&gt;RT.longCast(char)&lt;/code&gt; as well?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14650/is-rt-longcast-missing-an-overload-for-char</guid>
<pubDate>Thu, 31 Jul 2025 11:02:56 +0000</pubDate>
</item>
<item>
<title>Is a bytecode file generated after the Clojure code compilation?</title>
<link>https://ask.clojure.org/index.php/13037/bytecode-file-generated-after-the-clojure-code-compilation</link>
<description>&lt;p&gt; I mean, is the generated bytecode directly fed to the JVM, or a .class file is created and the bytecode is saved there? And also, if a file is generated, is it generated for every evaluated expression?&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13037/bytecode-file-generated-after-the-clojure-code-compilation</guid>
<pubDate>Tue, 27 Jun 2023 21:23:34 +0000</pubDate>
</item>
<item>
<title>Type hints getting ignored, reverting to java.lang.Object</title>
<link>https://ask.clojure.org/index.php/10555/type-hints-getting-ignored-reverting-to-java-lang-object</link>
<description>&lt;pre&gt;&lt;code&gt;  (deftype l [^java.util.List x])
  (use '[clojure.reflect :as r])
  (:members (r/reflect (l. `())))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Despite the type-hints of &lt;code&gt;java.util.List&lt;/code&gt;, on reflection x seems to always be an Object&lt;/p&gt;
&lt;p&gt;Have been specifically trying to get an optaplanner example working in 100% clojure &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/joinr/optaplanner-clj/tree/163d326a6433b88ca9811e33d30758ceff42b91f&quot;&gt;https://github.com/joinr/optaplanner-clj/tree/163d326a6433b88ca9811e33d30758ceff42b91f&lt;/a&gt; . The code is evaluating but this error keeps occurring on running &lt;code&gt;(solve (-&amp;gt;problem))&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;ol&gt;
&lt;li&gt;Unhandled java.lang.IllegalStateException    The solutionClass (class optaplanner_clj.data.TimeTable) has a &lt;br&gt;
PlanningEntityCollectionProperty annotated member (public final &lt;br&gt;
java.lang.Object optaplanner_clj.data.TimeTable.lessonList) that does&lt;br&gt;
not    return a Collection or an array.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10555/type-hints-getting-ignored-reverting-to-java-lang-object</guid>
<pubDate>Sun, 02 May 2021 01:56:00 +0000</pubDate>
</item>
<item>
<title>is It possible to implement a label/goto mechanism in clojure</title>
<link>https://ask.clojure.org/index.php/10547/is-it-possible-to-implement-label-goto-mechanism-in-clojure</link>
<description>&lt;p&gt;Apparently the JVM has a &lt;code&gt;label/goto&lt;/code&gt; mechanism.  Would it be possible to add such a capability to the Clojure language?&lt;/p&gt;
&lt;p&gt;I suppose there are two questions which could be addressed 100% independently. &lt;br&gt;
1. whether it is theoretically possible.  i.e., to the JVM instructions really permit such a Clojure primitive at all.  Perhaps I'm mistaken, and it is really not possible.&lt;br&gt;
2. whether the core Clojure maintainers can be convinced of the merits of the request.&lt;/p&gt;
&lt;p&gt;In general &lt;code&gt;goto&lt;/code&gt; is useful in machine generated code, not so much in human written code.&lt;/p&gt;
&lt;p&gt;I have at least three use cases where I'd like to have such a mechanism.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;serialization of deterministic finite automata&lt;/li&gt;
&lt;li&gt;serialization of discrimination nets&lt;/li&gt;
&lt;li&gt;translation of Knuth style algorithms into Clojure from Art of Computer Programming.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I know that lots of people might respond with philosophical arguments about why you shouldn't use goto.   I hope to avoid such a discussion here.&lt;/p&gt;
&lt;p&gt;One possibility which seems reasonable to me would be a Clojure primitive similar to the  &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.lispworks.com/documentation/HyperSpec/Body/m_prog_.htm&quot;&gt;Common Lisp prog&lt;/a&gt; although the ability to bind variables is not really necessary, as it could easily be implemented by the user by using &lt;code&gt;let&lt;/code&gt; with some macrology.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10547/is-it-possible-to-implement-label-goto-mechanism-in-clojure</guid>
<pubDate>Fri, 30 Apr 2021 08:49:38 +0000</pubDate>
</item>
<item>
<title>How to locate a function when debugging?</title>
<link>https://ask.clojure.org/index.php/9234/how-to-locate-a-function-when-debugging</link>
<description>&lt;p&gt;Our server is experiencing memory leaking. As to investigate what  happened, I used &lt;code&gt;jmap&lt;/code&gt; to dump JVM and got the following file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;No dump file specified
 num     #instances         #bytes  class name (module)
-------------------------------------------------------
   1:        904887       79630056  java.lang.reflect.Method (java.base@13.0.2)
   2:        935204       50874608  [Ljava.lang.Object; (java.base@13.0.2)
   3:        889710       47099400  [B (java.base@13.0.2)
   4:         85795       26006880  [C (java.base@13.0.2)
   5:        518846       22286056  [I (java.base@13.0.2)
   6:        781108       18746592  java.lang.String (java.base@13.0.2)
   7:        382891       15315640  java.math.BigInteger (java.base@13.0.2)
   8:        370774       14830960  java.math.BigDecimal (java.base@13.0.2)
   9:        153329       12266320  java.lang.reflect.Constructor (java.base@13.0.2)
...
 152:          1665         146520  java.util.regex.Pattern (java.base@13.0.2)
 153:          3638         145520  com.newrelic.agent.deps.org.objectweb.asm.tree.LdcInsnNode
 154:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48879
 155:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48881
 156:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48883
 157:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48885
 158:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48887
 159:          9043         144688  exchange.api.restful.orders$fn__48874$fn__48892
 160:          9006         144096  java.util.Formatter$Flags (java.base@13.0.2)
 161:          8973         143568  java.util.concurrent.atomic.AtomicBoolean (java.base@13.0.2)
...
 600:           296           7104  java.math.MathContext (java.base@13.0.2)
 601:           221           7072  java.lang.invoke.BoundMethodHandle$Species_L (java.base@13.0.2)
 602:           221           7072  java.lang.invoke.LambdaForm$NamedFunction (java.base@13.0.2)
 603:           438           7008  clojure.core$distinct$step__6413
 604:           291           6984  taoensso.nippy$read_kvs_into$fn__36561
 605:           218           6976  sun.nio.fs.UnixPath (java.base@13.0.2)
 606:           218           6976  taoensso.carmine.protocol.EnqueuedRequest
 607:           173           6920  java.nio.channels.ClosedChannelException (java.base@13.0.2)
 608:           431           6896  clojure.core.async.impl.ioc_macros$return_chan$fn__21752
 609:           287           6888  javax.management.ImmutableDescriptor (java.management@13.0.2)
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So as you might interpret from it, it is an API service. And judging from the number of instances, I decided &lt;code&gt;exchange.api.restful.orders$fn__48874$*&lt;/code&gt; is bad. (Or I am wrong. My colleague suggested redis went wrong.)&lt;/p&gt;
&lt;p&gt;But here then goes the question: which function/api is it? How can I locate it?&lt;/p&gt;
</description>
<category>Namespaces and vars</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9234/how-to-locate-a-function-when-debugging</guid>
<pubDate>Mon, 13 Apr 2020 05:30:06 +0000</pubDate>
</item>
<item>
<title>Can we use AppCDS to speed up app start?</title>
<link>https://ask.clojure.org/index.php/8353/can-we-use-appcds-to-speed-up-app-start</link>
<description>&lt;p&gt;I’ve been reading the Oracle docs about AppCDS and wondered if for the core functions in clojure we could use AppCDS to snapshot them?&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/8/docs/technotes/guides/vm/class-data-sharing.html&quot;&gt;https://docs.oracle.com/javase/8/docs/technotes/guides/vm/class-data-sharing.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Sam &lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8353/can-we-use-appcds-to-speed-up-app-start</guid>
<pubDate>Tue, 06 Aug 2019 19:36:10 +0000</pubDate>
</item>
</channel>
</rss>