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

GC Compiler changes #682

Merged
merged 3 commits into from Apr 29, 2017
Merged

Conversation

LukasKellenberger
Copy link
Contributor

  • Adds a pass that injects global variables needed by the garbage collector
    • array of modules __modules
    • size of the array __modules_size
    • id of the ObjectArray class __object_array_id
  • Adds a new field to the Runtime type information which represents the ref map of a class' fields. In the form of an array of offsets terminated by -1.

Copy link
Member

@densh densh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass.


/**
* Created by lukaskellenberger on 08.03.17.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We strongly discourage authorship comments in the code as they quickly get out of date.

}

val moduleArrayName = Global.Top("__modules")
val moduleArraySizeName = Global.Top("__modules_size")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two above should go the GCExternals companion.

/**
* Created by lukaskellenberger on 08.03.17.
*/
class GCexternals(top: Top) extends Inject {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCExternals.

val modules = defns.filter {
case _: Defn.Module => true
case _ => false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defns.filter(_.isIntanceOf[Defn.Module])

def genObjectArrayId(): Defn.Var = {
val objectArray =
top.nodes(Global.Top("scala.scalanative.runtime.ObjectArray"))
val objectArrayIdName = Global.Top("__object_array_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line above should go the companion of GCExternals.

@densh
Copy link
Member

densh commented Apr 29, 2017

LGTM!

@densh densh merged commit 1cbceb3 into scala-native:master Apr 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants