Skip to content

REPL does not read version from fregec.jar? #33

Description

@Ingo60

I just downloaded Frege REPL 1.2.1-SNAPSHOT, and changed the fregei shell script so that it uses frege3.22.525-g704b834.jar.

However, the version displayed is still 424:

ingo@freguntu:/tmp$ frepl  # just alias to fregei
/home/ingo/bin/java
Welcome to Frege 3.22.524-gcc99d7e (Oracle Corporation Java HotSpot(TM) 64-Bit Server VM, 1.8.0_40)

frege> :version
3.22.524-gcc99d7e

frege> 10-2*3
4

But because it outputs the correct result from the expression (instead 24) means that it actually uses the 525 jar.

I think it would be better to report the actual version from frege.Version. For, when we get a bug report, it'll be hard to establish which frege jar is actually used otherwise.

Activity

  1. self-assigned this
    on Aug 15, 2015
  2. mmhelloworld commented on Aug 27, 2015

    @mmhelloworld
    Member

    REPL does read version from frege.Version.version but the problem seems to be that since it is a constant on the Version module, Java compiler is basically inlining the constant value in FregeRepl module. Thus it ends up as a constant in the class file and it doesn't use Version.version at runtime.

    This is clear from the bytecode of FregeRepl module:

    javap -cp "./lib/*" -verbose frege.repl.FregeRepl | less

    And the relevant bit of bytecode:

    169: ldc_w         #323                // String Welcome to Frege
    172: ldc           #204                // String 3.22.524-gcc99d7e
    
    

    The StackOverflow threads, this and this, touch upon this problem and the solution seems to be adding an intern() call on the version string so that the compiler doesn't inline the constant.

  3. mmhelloworld commented on May 24, 2016

    @mmhelloworld
    Member

    @Ingo60 do we have to do anything for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions