Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/GhcPlugins/Extras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ module GhcPlugins.Extras
, module GhcPlugins.Extras
, module GHC.Core.TyCo.Rep
, module GHC.Types.ForeignStubs
, module GHC.Cmm.CLabel
) where

import Control.Monad.Writer
import Data.Data (Data)
import Data.Maybe (mapMaybe)
import GHC.Cmm.CLabel (mkInitializerStubLabel)
import GHC.Core.FamInstEnv
import GHC.Core.Reduction (Reduction(..))
import GHC.Core.TyCo.Rep
Expand Down
29 changes: 15 additions & 14 deletions src/Language/Java/Inline/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import Prelude hiding ((<>))
--
-- Finally, it calls the java compiler to produce the bytecode and
-- arranges to have it inserted in the bytecode table in constructor functions
-- (cConstructors).
-- (cConstructor).

plugin :: Plugin
plugin = defaultPlugin
Expand Down Expand Up @@ -82,15 +82,15 @@ plugin = defaultPlugin
dcs <- buildJava guts qqOccs jimports
>>= maybeDumpJava args
>>= buildBytecode args
dflags <- getDynFlags
let cstub =
cConstructor
dflags
(mg_module guts)
(text bctable_header $$ dotClasses dcs)
return guts
{ mg_binds = binds
, mg_foreign = appendStubC (mg_foreign guts) $
CStub
( text bctable_header
$$ dotClasses dcs
$$ cConstructors
)
[] []
, mg_foreign = appendStubC (mg_foreign guts) cstub
}

-- The contents of bctable.h
Expand Down Expand Up @@ -460,9 +460,10 @@ dotClasses dcs = vcat $

-- | Produces the constructor function which inserts the static structures
-- generated by 'dotClasses' into the bytecode table.
cConstructors :: SDoc
cConstructors = vcat
[ text "static void hs_inline_java_init(void) __attribute__((constructor));"
, text "static void hs_inline_java_init(void)"
, text "{ inline_java_bctable = inline_java_new_pack(inline_java_bctable, dcs, dc_count); }"
]
cConstructor :: DynFlags -> Module -> SDoc -> CStub
cConstructor dflags this_mod decls =
initializerCStub
(targetPlatform dflags)
(mkInitializerStubLabel this_mod "inline_java_bctable")
decls
(text "{ inline_java_bctable = inline_java_new_pack(inline_java_bctable, dcs, dc_count); }")