Ticket #1365 (new feature request)

Opened 5 years ago

Last modified 4 months ago

-fbyte-code is ignored in a OPTIONS_GHC pragma

Reported by: mnislaih Owned by:
Priority: lowest Milestone: 7.6.1
Component: GHCi Version: 6.6.1
Keywords: Cc: simonmar@…, mnislaih@…, SamB, mjm2002@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Moderate (less than a day)
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by mnislaih) (diff)

When loading a bunch of modules in ghci with -fobject-code, it seems reasonable to be expect that individual GHC_OPTIONS -fbyte-code pragmas will have the effect of loading individual modules via the bytecode backend.

Change History

Changed 5 years ago by mnislaih

  • description modified (diff)

As an aside, I am trying to load ghc itself in ghci.

-fobject-code is very handy for me because it seriously speeds up the load times. However, I want to be able to set breakpoints in individual modules

Changed 5 years ago by mnislaih

For the matter, it looks like -fobject-code in a PRAGMA is being ignored too :(

Changed 5 years ago by simonmar

  • type changed from bug to feature request
  • milestone set to 6.1

This is by design, in fact. GHCi has the restriction that object code cannot be linked to byte-code, so it doesn't make sense to annotate an individual modules with -fbyte-code, because it would force all modules that depend on it to also be loaded with -fbyte-code (and could conflict with other -fobject-code annotations). I think the choice of byte-code/object-code doesn't belong in the source code. But you're right that there ought to be a way to say "I want to load module M as byte code, and whatever depends on it", so I'm changing this to a feature request.

Current workaround is to load the whole of the program with -fobject-code, then switch to -fbyte-code, touch a source file (or remove the object file) and :reload.

Changed 5 years ago by simonmar

  • owner simonmar deleted

Changed 4 years ago by mnislaih

  • cc mnislaih@… added

Changed 4 years ago by SamB

  • version changed from 6.7 to 6.6.1

I'm beginning to find that restriction rather annoying, too. Why can't object code depend on bytecode? In any case, I would prefer that -fbyte-code in a pragma would cause all dependancies to be byte-compiled, rather than doing nothing.

Changed 4 years ago by SamB

  • cc SamB added

Changed 4 years ago by simonmar

  • difficulty changed from Unknown to Moderate (1 day)
  • os changed from MacOS X to Multiple
  • architecture changed from x86 to Multiple

I looked into doing this. It's almost possible without major changes, but there's a sticking point: mutually recursive modules.

The core restriction is that pbject code can only link to other object code. This is because byte-code resides in the heap and may move around and be GC'd, so if we allowed object-code to point to byte-code the GC would have to track pointers from object-code to byte-code, which it doesn't (that would be possible). Also object-code itself currently never gets GC'd, because in order to do that the GC would have to track pointers into object-code, which include info pointers. Info pointers are not currently tracked as GC pointers, so this is hard. In short, it's really hard to lift this restriction - we thought about it at the time we designed GHCi, and concluded that it wasn't worth it.

So the tricky bit about allowing -fbyte-code at the module level is that if it occurs within a mutually-recursive group of modules, it has to apply to the whole group. That makes this a bit more than a local change, so I gave up for now.

Changed 4 years ago by simonmar

  • architecture changed from Multiple to Unknown/Multiple

Changed 4 years ago by simonmar

  • os changed from Multiple to Unknown/Multiple

Changed 4 years ago by morrow

  • cc mjm2002@… added

Changed 3 years ago by igloo

  • milestone changed from 6.10 branch to 6.12 branch

Changed 3 years ago by simonmar

  • difficulty changed from Moderate (1 day) to Moderate (less than a day)

Changed 2 years ago by igloo

  • milestone changed from 6.12 branch to 6.12.3

Changed 2 years ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

Changed 18 months ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

Changed 15 months ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

Changed 8 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1

Changed 4 months ago by igloo

  • priority changed from low to lowest
  • milestone changed from 7.4.1 to 7.6.1
Note: See TracTickets for help on using tickets.