Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In GenJVM, addStaticInit forgets to add local vars #4738

Closed
scabug opened this issue Jun 26, 2011 · 3 comments
Closed

In GenJVM, addStaticInit forgets to add local vars #4738

scabug opened this issue Jun 26, 2011 · 3 comments
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jun 26, 2011

In GenJVM, one of the differences between genMethod and addStaticInit is that the latter doesn't add local vars. This is no problem with the current compilation pipeline (because no such vars show up). I'm applying an AST lowering that stores intermediate results in temp vars (to accomodate an MSIL restriction, "Attempt to enter try-block with non-empty stack") and with that static class initializers do get local temp vars.

The following additions in addStaticInit seems to do the trick, not sure what to do about legacyEmitBootstrapMethodInstall.

      mopt match {
       	case Some(m) =>

           computeLocalVarsIndex(m)   // <----- ADDED

           if (clasz.bootstrapClass.isDefined) legacyEmitBootstrapMethodInstall(clinit)

           assert(m.params.isEmpty)   
           for (local <- m.locals) { // <----- ADDED
             if (settings.debug.value)
               log("add local var: " + local)
             clinitMethod.addNewLocalVariable(javaType(local.kind), javaName(local.sym))
           }
 
@scabug
Copy link
Author

scabug commented Jun 26, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4738?orig=1
Reporter: @magarciaEPFL
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Jul 12, 2011

@paulp said:
It looks like this would be easy enough to do, assigning to meeting for endorsement or rejection.

@SethTisue
Copy link
Member

closing for staleness, but maybe @lrytz would like to take a quick look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants