X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcodeGen%2FStgCmmForeign.hs;h=83c430143edc8ae692300cefca590d5e83acbc23;hb=5db0076d34263fae4f431b51b871ef55a6ebb2a7;hp=64d0203957090c7020aff9e16297bce9569e67ba;hpb=0c84eb9d40b4fab76cc4d72913f9ead409cdbd47;p=ghc-hetmet.git diff --git a/compiler/codeGen/StgCmmForeign.hs b/compiler/codeGen/StgCmmForeign.hs index 64d0203..83c4301 100644 --- a/compiler/codeGen/StgCmmForeign.hs +++ b/compiler/codeGen/StgCmmForeign.hs @@ -56,10 +56,17 @@ cgForeignCall results result_hints (CCall (CCallSpec target cconv safety)) stg_a = do { cmm_args <- getFCallArgs stg_args ; let ((call_args, arg_hints), cmm_target) = case target of - StaticTarget lbl -> - (unzip cmm_args, - CmmLit (CmmLabel (mkForeignLabel lbl (call_size cmm_args) False IsFunction))) - DynamicTarget -> case cmm_args of + StaticTarget lbl mPkgId + -> let labelSource + = case mPkgId of + Nothing -> ForeignLabelInThisPackage + Just pkgId -> ForeignLabelInPackage pkgId + size = call_size cmm_args + in ( unzip cmm_args + , CmmLit (CmmLabel + (mkForeignLabel lbl size labelSource IsFunction))) + + DynamicTarget -> case cmm_args of (fn,_):rest -> (unzip rest, fn) [] -> panic "cgForeignCall []" fc = ForeignConvention cconv arg_hints result_hints @@ -81,9 +88,6 @@ cgForeignCall results result_hints (CCall (CCallSpec target cconv safety)) stg_a -- ToDo: this might not be correct for 64-bit API arg_size (arg, _) = max (widthInBytes $ typeWidth $ cmmExprType arg) wORD_SIZE -cgForeignCall _ _ (DNCall _) _ - = panic "cgForeignCall: DNCall" - emitCCall :: [(CmmFormal,ForeignHint)] -> CmmExpr -> [(CmmActual,ForeignHint)] @@ -99,9 +103,9 @@ emitCCall hinted_results fn hinted_args fc = ForeignConvention CCallConv arg_hints result_hints -emitPrimCall :: CmmFormal -> CallishMachOp -> CmmActuals -> FCode () +emitPrimCall :: CmmFormals -> CallishMachOp -> CmmActuals -> FCode () emitPrimCall res op args - = emitForeignCall PlayRisky [res] (PrimTarget op) args NoC_SRT CmmMayReturn + = emitForeignCall PlayRisky res (PrimTarget op) args NoC_SRT CmmMayReturn -- alternative entry point, used by CmmParse emitForeignCall @@ -123,7 +127,7 @@ emitForeignCall safety results target args _srt _ret | otherwise = do updfr_off <- getUpdFrameOff temp_target <- load_target_into_temp target - emit $ mkSafeCall temp_target results args updfr_off + emit $ mkSafeCall temp_target results args updfr_off (playInterruptible safety) {-